Search Results

Search found 38284 results on 1532 pages for 'object reference'.

Page 16/1532 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • Remove PostSharp reference after build?

    - by Simon
    Is is possible to get postsharp to remove references to the postsharp assemblies during a build? I have an exe i needs to have a very small footprint. I want to use some of the compile time weaving of postsharp but dont want to have to deploy PostSharp.dll with the exe.

    Read the article

  • Passing objects by reference or not in C#

    - by Piku
    Suppose I have a class like this: public class ThingManager { List<SomeClass> ItemList; public void AddToList (SomeClass Item) { ItemList.Add(Item); } public void ProcessListItems() { // go through list one item at a time, get item from list, // modify item according to class' purpose } } Assume "SomeClass" is a fairly large class containing methods and members that are quite complex (List<s and arrays, for example) and that there may be a large quantity of them, so not copying vast amounts of data around the program is important. Should the "AddToList" method have "ref" in it or not? And why? It's like trying to learn pointers in C all over again ;-) (which is probably why I am getting confused, I'm trying to relate these to pointers. In C it'd be "SomeClass *Item" and a list of "SomeClass *" variables)

    Read the article

  • Basic class returns onject reference instead of Array

    - by php-b-grader
    I have very basic class: class Customer { protected $id; protected $customer; public function __construct($customer_id) { $this->id = $customer_id; return $this->set_customer(); } protected function set_customer() { $query = mysql_query("SELECT * FROM customer WHERE id = '$this->id'"); $this->customer = mysql_fetch_row($query); return $this->customer; } } $customer = new Customer($order->customer->id); print_r($customer); This is not doing what I want it to but I understand why... $customer returns a reference to the Customer Object... But what I want is the MySQL row array from the mysql_fetch_row() call... What am I missing?

    Read the article

  • How to reduce redundant code when adding new c++0x rvalue reference operator overloads

    - by Inverse
    I am adding new operator overloads to take advantage of c++0x rvalue references, and I feel like I'm producing a lot of redundant code. I have a class, tree, that holds a tree of algebraic operations on double values. Here is an example use case: tree x = 1.23; tree y = 8.19; tree z = (x + y)/67.31 - 3.15*y; ... std::cout << z; // prints "(1.23 + 8.19)/67.31 - 3.15*8.19" For each binary operation (like plus), each side can be either an lvalue tree, rvalue tree, or double. This results in 8 overloads for each binary operation: // core rvalue overloads for plus: tree operator +(const tree& a, const tree& b); tree operator +(const tree& a, tree&& b); tree operator +(tree&& a, const tree& b); tree operator +(tree&& a, tree&& b); // cast and forward cases: tree operator +(const tree& a, double b) { return a + tree(b); } tree operator +(double a, const tree& b) { return tree(a) + b; } tree operator +(tree&& a, double b) { return std::move(a) + tree(b); } tree operator +(double a, tree&& b) { return tree(a) + std::move(b); } // 8 more overloads for minus // 8 more overloads for multiply // 8 more overloads for divide // etc which also has to be repeated in a way for each binary operation (minus, multiply, divide, etc). As you can see, there are really only 4 functions I actually need to write; the other 4 can cast and forward to the core cases. Do you have any suggestions for reducing the size of this code? PS: The class is actually more complex than just a tree of doubles. Reducing copies does dramatically improve performance of my project. So, the rvalue overloads are worthwhile for me, even with the extra code. I have a suspicion that there might be a way to template away the "cast and forward" cases above, but I can't seem to think of anything.

    Read the article

  • Boost singleton and undefined reference

    - by Ockonal
    Hello, I globally use singleton pattern in my project. To make it easier - boost::singleton. Current project uses Ogre3d library for rendering. Here is some class: class GraphicSystem : public singleton<GraphicSystem> { private: Ogre::RenderWindow *mWindow; public: Ogre::RenderWindow *getWindow() const { return mWindow; } }; In GraphicSystem constructor I fill the mWindow value: mWindow = mRoot->createRenderWindow(...); I cheked it, everything makes normally. So, now I have to use handler for the window in input system (to get window handle). Somewhere else in another class: Ogre::RenderWindow *temp = GraphicSystem::get_mutable_instance().getWindow(); GraphicSystem::get_mutable_instance().getWindow()->getCustomAttribute("WINDOW", &mWindowHandle); temp is 0x00, and there is segfault at last line (getting custon attribute). I can't understand, why does singleton returns undefined pointer for the window. All another singleton-based classes work well.

    Read the article

  • JNA Passing Structure By Reference Help

    - by tyeh26
    Hi all, I'm trying to use JNA to talk over a USB device plugged into the computer. Using Java and a .dll that was provided to me. I am having trouble with the Write function: C code: typedef struct { unsigned int id; unsigned int timestamp; unsigned char flags; unsigned char len; unsigned char data[16]; } CANMsg; CAN_STATUS canplus_Write( CANHANDLE handle, //long CANMsg *msg ); Java Equivalent: public class CANMsg extends Structure{ public int id = 0; public int timestamp = 0; public byte flags = 0; public byte len = 8; public byte data[] = new byte[16]; } int canplus_Write(NativeLong handle, CANMsg msg); I have confirmed that I can open and close the device. The close requires the NativeLong handle, so i am assuming that the CANMsg msg is the issue here. I have also confirmed that the device works when tested with C only code. I have read the the JNA documentation thoroughly... I think. Any pointers. Thanks all.

    Read the article

  • What should happen when a reference is deleted?

    - by Apeksha
    I have a vb.net 3.5 application which references a dll (abc.dll, also in .net 3.5) This dll is accessed by the application from time to time. If at anytime during execution, if I delete the dll, I expect the application to throw an error the next time it tries to use a class from the dll. But, this is not the behaviour I see. If I delete the dll before startup, the application throws an error at startup. But not when the dll is deleted after startup. Is this the standard behaviour, or am I doing something wrong? Can I get the app to throw an error if the dll is not found when it tries to use its classes? Thanks in advance.

    Read the article

  • How to pass function reference into arguments

    - by Ockonal
    Hi, I'm using boost::function for making function-references: typedef boost::function<void (SomeClass &handle)> Ref; someFunc(Ref &pointer) {/*...*/} void Foo(SomeClass &handle) {/*...*/} What is the best way to pass Foo into the someFunc? I tried something like: someFunc(Ref(Foo));

    Read the article

  • Real world examples of Ecmascript functions returning a Reference?

    - by Bergi
    Read the EcmaScript specification, section 8.7 The Reference Specification Type: The Reference type is used to explain the behaviour of such operators as delete, typeof, and the assignment operators. […] A Reference is a resolved name binding. Function calls are permitted to return references. This possibility is admitted purely for the sake of host objects. No built-in ECMAScript function defined by this specification returns a reference and there is no provision for a user-defined function to return a reference. Those last two sentences impressed me. With this, you could do things like coolHostFn() = value (valid syntax, btw). So my question is: Are there any EcmaScript implementations that define host function objects which result in Reference values?

    Read the article

  • Basic class returns object reference instead of Array

    - by php-b-grader
    I have very basic class: class Customer { protected $id; protected $customer; public function __construct($customer_id) { $this->id = $customer_id; return $this->set_customer(); } protected function set_customer() { $query = mysql_query("SELECT * FROM customer WHERE id = '$this->id'"); $this->customer = mysql_fetch_row($query); return $this->customer; } } $customer = new Customer($order->customer->id); print_r($customer); This is not doing what I want it to but I understand why... $customer returns a reference to the Customer Object... What I want is the MySQL row array from the mysql_fetch_row() - How do I return the array? What am I missing?

    Read the article

  • C++ reference variables

    - by avd
    I have these two functions (with Point2D & LineVector (has 2 Point2D member variables) classes and SQUARE macro predefined) inline float distance(const Point2D &p1,const Point2D &p2) { return sqrt(SQUARE(p2.getX()-p1.getX())+SQUARE(p2.getY()-p1.getY())); } inline float maxDistance(const LineVector &lv1,const LineVector &lv2) { return max(distance(lv1.p1,lv2.p2),distance(lv1.p2,lv2.p1)); } but it gives compilation error in maxDistance() function (line 238) saying: /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/stl_iterator_base_types.h: In instantiation of `std::iterator_traits<Point2D>': quadrilateral.cpp:238: instantiated from here /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/stl_iterator_base_types.h:129: error: no type named `iterator_category' in `class Point2D' /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/stl_iterator_base_types.h:130: error: no type named `value_type' in `class Point2D ' /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/stl_iterator_base_types.h:131: error: no type named `difference_type' in `class Point2D' /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/stl_iterator_base_types.h:132: error: no type named `pointer' in `class Point2D' /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/stl_iterator_base_types.h:133: error: no type named `reference' in `class Point2D' Please suggest what is the error?

    Read the article

  • a design to avoid circular reference in this scenario

    - by BDotA
    Here is our dependency tree: BigApp - Child Apps - Libraries ALL of our components are HEAVILY using one of the Libraries as above ( LibA). But it has a ‘few’ public methods that require classes from ‘higher-level’ assemblies and we want to avoid CIRCULAR references. What do you propose as a good design for this?

    Read the article

  • How to make a copy of a char and not a reference in C++

    - by Phenom
    If I declare a function like this: string hash (char* key) then any change I make to key will also change it's value when the function exits, correct? I want to make a copy of it in the function so that I can safely change it without changing the original value. I tried this, but it doesn't work. string temp = key; How can it be done?

    Read the article

  • Deriving an HTMLElement Object from jQuery Object

    - by Jasconius
    I'm doing a fairly exhaustive series of DOM manipulations where a few elements (specifically form elements) have some events. I am dynamically creating (actually cloning from a source element) several boxes and assigning a change() event to them. The change event executes, and within the context of the event, "this" is the HTML Element Object. What I need to do at this point however is determine a contact for this HTML Element Object. I have these objects stored already as jQuery entities in assorted arrays, but obviously [HTMLElement Object] != [Object Object] And the trick is that I cannot cast $(this) and make a valid comparison since that would create a new object and the pointer would be different. So... I've been banging my head against this for a while. In the past I've been able to circumvent this problem by doing an innerHTML comparison, but in this case the objects I am comparing are 100% identical, just there's lots of them. Therefore I need a solid comparison. This would be easy if I could somehow derive the HTMLElement object from my originating jQuery object. Thoughts, other ideas? Help. :(

    Read the article

  • Convert JSON flattened for forms back to an object

    - by George Jempty
    I am required (please therefore no nit-picking the requirement, I've already nit-picked it, and this is the req) to convert certain form fields that have "object nesting" embedded in the field names, back to the object(s) themselves. Below are some typical form field names: phones_0_patientPhoneTypeId phones_0_phone phones_1_patientPhoneTypeId phones_1_phone The form fields above were derived from an object such as the one toward the bottom (see "Data"), and that is the format of the object I need to reassemble. It can be assumed that any form field with a name that contains the underscore _ character needs to undergo this conversion. Also that the segment of the form field between underscores, if numeric, signifies a Javascript array, otherwise an object. I found it easy to devise a (somewhat naive) implementation for the "flattening" of the original object for use by the form, but am struggling going in the other direction; below the object/data below I'm pasting my current attempt. One problem (perhaps the only one?) with it is that it does not currently properly account for array indexes, but this might be tricky because the object will subsequently be encoded as JSON, which will not account for sparse arrays. So if "phones_1" exists, but "phones_0" does not, I would nevertheless like to ensure that a slot exists for phones[0] even if that value is null. Implementations that tweak what I have begun, or are entirely different, encouraged. If interested let me know if you'd like to see my code for the "flattening" part that is working. Thanks in advance Data: var obj = { phones: [{ "patientPhoneTypeId": 4, "phone": "8005551212" }, { "patientPhoneTypeId": 2, "phone": "8885551212" }]}; Code to date: var unflattened = {}; for (var prop in values) { if (prop.indexOf('_') > -1) { var lastUnderbarPos = prop.lastIndexOf('_'); var nestedProp = prop.substr(lastUnderbarPos + 1); var nesting = prop.substr(0, lastUnderbarPos).split("_"); var nestedRef, isArray, isObject; for (var i=0, n=nesting.length; i<n; i++) { if (i===0) { nestedRef = unflattened; } if (i < (n-1)) { // not last if (/^\d+$/.test(nesting[i+1])) { isArray = true; isObject = false; } else { isArray = true; isObject = false; } var currProp = nesting[i]; if (!nestedRef[currProp]) { if (isArray) { nestedRef[currProp] = []; } else if (isObject) { nestedRef[currProp] = {}; } } nestedRef = nestedRef[currProp]; } else { nestedRef[nestedProp] = values[prop]; } } }

    Read the article

  • Using an object in an if statement... (Android)

    - by James Rattray
    I have an object variable Object test = Spinner.getSelectedItem(); -It gets the selected item from the Spinner (called spinner) and names the item 'test' I want to do an if statement related to that object e.g: 'if (test = "hello") { //do something }' But it appears not to work.... Can someone give me some help? -Do I have to use a different if? or convert the object to string etc.? Thanks alot... James

    Read the article

  • Scala passing type parameters to object

    - by Shahzad Mian
    In Scala v 2.7.7 I have a file with class Something[T] extends Other { } object Something extends OtherConstructor[Something] { } This throws the error: class Something takes type parameters object Something extends OtherConstructor[Something] { However, I can't do this object Something[T] extends OtherConstructor[Something[T]] { } It throws an error: error: ';' expected but '[' found. Is it possible to send type parameters to object? Or should I change and simply use Otherconstructor

    Read the article

  • Code Contracts Vs. Object Initializers (.net 4.0)

    - by Mystagogue
    At face value, it would seem that object initializers present a problem for .net 4.0 "code contracts", where normally the invariant should be established by the time the object constructor is finished. Presumably, however, object-initializers require properties to be set after construction is complete. My question is if the invariants of "code contracts" are able to handle object initializers, "as if" the properties were set before the constructor completes? That would be very nice indeed!!

    Read the article

  • Check if an object is defined in html

    - by Manikanta
    In HTML, I have an object tag as follows: <OBJECT ID="objectid" CLASSID="some-class-id" CODEBASE="some-codebase"> I have written a function in JavaScript to access this object. I checked the null value as follows: if(objectid==null){-----} i want to check if the object is undefined or is empty. Do we have any functions to check so?

    Read the article

  • Nant COM Reference [migrated]

    - by user29286
    I'm trying to find the Nant syntax for including a COM reference. The current Nant script with the normal dll reference looks like .. <references> <include name="${external-lib}/System.Interop.AppName.dll" /> The COM reference in the .csproj file looks like this ... <COMReference Include="System.Interop.AppName"> <Guid>{00020813-0000-0000-C000-000000000046}</Guid> <VersionMajor>1</VersionMajor> <VersionMinor>7</VersionMinor> <Lcid>0</Lcid> <WrapperTool>primary</WrapperTool> <Isolated>False</Isolated> </COMReference> What syntax should I use in Nant to swap to the COM reference to do the build ?

    Read the article

  • printable PHP manual - 'all but the Function Reference section'

    - by JW01
    My Motivation I find it easier to learn things by reading 'offline'. I'd like to lean back and read the narrative part of a paper version of the official php manual. My Scuppered Plan My plan was to download the manual, print all but the Function Reference section and then read it. I have downloaded the "Single HTML file" version of the manual from the php.net download page. (That version did not contain any images, so I patched-in the ones from the Many HTML files version with no problem.) My plan was to open that "Single HTML file" in an HTML editor, delete the Function Reference section then print it out. Unfortunately, although I have tried three different editors, I have not been able to successfully load-up that massive html file to be able to edit it. Its about (~40MB). I started to look into the phpdoc framework with a view to rendering my own html docs from the source...but that's a steep learning curve for a newby..and is a last resort. I would use a file splitter, but they tend to split files crudely with no regard for html/xml/xhtml sematics. So the question is... Does anyone know know where you can download the php manual in a version that is a kind of half-way house between the 'Single HTML file' and the 'Many HTML files'? Ideally with the docs split into 3 parts: File 1 - stuff before the function reference File 2 - function reference File 3 - stuff after the function reference Or Can you suggest any editors/tools will enable me to split up this file myself?

    Read the article

  • So what *did* Alan Kay really mean by the term "object-oriented"?

    - by Charlie Flowers
    Reportedly, Alan Kay is the inventor of the term "object oriented". And he is often quoted as having said that what we call OO today is not what he meant. For example, I just found this on Google: I made up the term 'object-oriented', and I can tell you I didn't have C++ in mind -- Alan Kay, OOPSLA '97 I vaguely remember hearing something pretty insightful about what he did mean. Something along the lines of "message passing". Do you know what he meant? Can you fill in more details of what he meant and how it differs from today's common OO? Please share some references if you have any. Thanks.

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >