references

C++ Storing references to values in std::map

Am I right in assuming that adding/removing elements to an std::map does not effect the other elements (ie cause them to be relocated in memory) and so that the following is safe: I looked at various sites with info on the container but only found out about the cases where iterators are invalidated, which I already know... std::map<std...

A product release changes its library name, how to be compatible with old and new?

We have a product that uses a Reference from a 3rd party supplier. With the release of their new product they have renamed this Reference to a new name. What we want to do is have the one version of our application compiled so that it can run against both the old and new names of the library. There is basically no change, only 1 metho...

How to I pass a checkbox value by reference with CLI?

I have a GUI app written in C++/CLI which has a load of configurable options. I have some overloaded functions which grab values from my data source and I'd like to connect my options to those values. So here's a couple of data retrievers: bool GetConfigSingle(long paramToGet, String^% str, char* debug, long debugLength); bool GetConfi...

What's the best Perl practice for returning hashes from functions?

I am mulling over a best practice for passing hash references for return data to/from functions. On the one hand it seems intuitive to pass only input values to a function and have only return output variables. However in Perl, passing hashes can only be done by reference so it is a bit messy and would seem more of an opportunity to ...

How do I create and access a Perl hash with scalar keys whose values are arrays?

In Perl 5.10, how do I create and access a hash with scalar keys whose values are arrays? #Doing this does not work properly. %someHash= ("0xfff" => ('Blue', 'Red', 'Yellow')); @arr = @fileContents{"0xfff"}; print @arr; When I print the array, the only thing that prints is "ARRAY('randmemAddr')". When I do a foreach loop on @arr, only...

C++ / CLI Precompiled Headers: How do they work?

I'm trying to write a mixed-mode DLL, let's call it 'Client', to replace some unmanaged classes with their managed equivalents. Everything works fine on my personal machine, but when I check the source code in, our build machine won't build the project. It doesn't recognize the Managed classes I'm using from another DLL, called 'Core.' ...

How can I have references between two classes in Objective-C?

I'm developing an iPhone app, and I'm kinda new to Objective-C and also the class.h and class.m structure. Now, I have two classes that both need to have a variable of the other one's type. But it just seems impossible. If in class1.m (or class2.m) I include class1.h, and then class2.h, I can't declare class2 variables in class1.h, if ...

If I need to retrieve an object from a custom model binder should the binder interact with the service layer, the repository layer, or ...? Asp.Net MVC

If I have a class similar to this: public class Person { public string firstName { get; set; } public string lastName { get; set; } public Pet myPet { get; set; } } When I create a custom model binder, the Post from my form will not be sending in a Pet, it would send in data like this: firstName: "myFirstName" lastName: "m...

understanding String^ in C++ .Net

I remember seeing somewhere there "^" operator is used as a pointer operator in Managed C++ code. Hence "^" should be equivalent to "*" operator right?? Assuming my understanding is right, when I started understanding .Net and coded a few example programs, I came across some code like this: String ^username; //my understanding is you ...

I can't seem to call my web service from C# Forms app

I have a web site which has a simple web service. I can call the web service successfully from javascript on the page. I need to be able to call the same web service from a C# forms application. The web service code is very simple: [WebService(Namespace = "http://myurl.com/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)...

How to reference one XML document from a second XML document

In relational databases, the use of primary keys and foreign keys are commonly used to link records across different tables. I'm wondering if I can do the same sort of thing with XML documents. That is, I would like one XML document to contain an element whose value 'points to' the 'primary key' or something similar (maybe the root nod...

Why arrays of references are illegal?

The following code does not compile. int a=1,b=2,c=3; typedef const int intlink arr[] = {a,b,c,8}; What C++ standard says about it? Is this compiler error? P.S. I know I could declare class that contains reference and use it in array, but I really want to know why the code above doesn't compile. Edit: The following code is...

What is a good way to think about C++ references?

I've been programming C, mainly in an embedded environment, for years now and have a perfectly good mental model of pointers - I don't have to explicitly think about how to use them, am 100% comfortable with pointer arithmetic, arrays of pointers, pointers-to-pointers etc. I've written very little C++ and really don't have a good way o...

External references not working

I am having problems with external references not working when the source is closed. I am using a vlookup to pull data from the source file, and when the source is open the references work. I have tried including the location along with the file name in the formula but it still is not working. Please help :) ...

Tutorials/References/HowTos to learn Glade GTK+ with Ruby?

Hello all, I am trying to design some simple GUIs with Glade to use with Ruby. I am not having so much luck finding tutorials/references on how to actually interface glade with Ruby however. I have found maybe 1 or 2 hello world tutorials that show how to use a button to change a title of a window but is there a reference that tells me ...

How does a C++ reference look, memory-wise?

Given: int i = 42; int j = 43; int k = 44; By looking at the variables addresses we know that each one takes up 4 bytes (on most platforms). However, considering: int i = 42; int& j = i; int k = 44; We will see that variable i indeed takes 4 bytes, but j takes none and k takes again 4 bytes on the stack. What is happening here? I...

Reading the list of References from csproj files

Does anyone know of a way to programmatically read the list of References in a VS2008 csproj file? MSBuild does not appear to support this functionality. I'm trying to read the nodes by loading the csproj file into an XmlDocument but, the XPath search does not return any nodes. I'm using the following code: System.Xml.XmlDocument pro...

Serializing an object but none of its references c#

Hi, I have a situation where I need to serialize an object but don't want to serialize any of its references. This is because I don't know in advance which dlls the object might be referencing and therefore can't ensure that they are serializable objects. This has arisen from needing to serialise plugins to preserve their state. Am I r...

In Java is there a performance difference between referencing a field through getter versus through a variable?

Is there any differences between doing Field field = something.getSomethingElse().getField(); if (field == 0) { //do something } somelist.add(field); versus if (something.getSomethingElse().getField() == 0) { //do something } somelist.add(something.getSomethingElse().getField()); Do references to the field through getters i...

Why can't this reference be resolved?

I updated my Sharp-Architecture libraries to the newest version and all of a sudden I'm getting unable to resolve errors - specifically with NHibernate Validators. I am not quite sure why though, here is what my test assembly looks like in reflector: But the NHibernate.Validator library with the exact same version number/public key...