reference

"An assembly with the same simple name has already been imported" error without duplicate reference

I'm getting the following error: error CS1704: An assembly with the same simple name 'Interop.xxx.dll, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null has already been imported. Try removing one of the references or sign them to enable side-by-side. Everything I've seen says that I am referencing two assemblies with the same nam...

PHP: Values returned by ref from functions seems to get copied on multiple assignments

When a value being returned from a function by ref is assigned to multiple variables, assignments after the first one seems to copy the value. The code I used to test it is: root@kelso:/tmp# php -r 'function &bar() {static $x; if (NULL === $x) {$x=range(1,99999);}; return $x;}; var_dump(memory_get_usage()); bar(); var_dump(memory_get_...

Problem with QMap return as reference ?

Greetings all, I have a code snippet as follows : class AppCtx { private: QMap<QString,IRzPlugin*> pluginsMap; public : void addPlugin(IRzPlugin *plugin) { pluginsMap.insert(plugin->getPluginUID(),plugin); } QMap<QString,IRzPlugin*> & getPlugins() { return pluginsMap; } } In my client code I access the QMap as follows....

const reference must be initialized in constructor base/member initializer list

I am trying to block access to the default constructor of a class I am writing. The constructor I want others to use requires a const reference to another object. I have made the default constructor private to prevent others from using it. I am getting a compiler error for the default constructor because the const reference member var...

Java Recursion, calling it with Objects - How To Copy The Objects?

The old value/reference things. Im getting ConcurrentModificationException for this adaptation of the Bron-Kerbosch. public int[] bk(ArrayList<Integer> R, ArrayList<Integer> P, ArrayList<Integer> X) { int count[] = new int[n]; int u=0, c = 0; ArrayList<Integer> tempPX = new ArrayList<Integer>(); ArrayList<Integer> new...

Which reference should I take to an exam?

Hello everyone! I have an upcoming exam on Programming using C++ and we can take consultation material. I have decided to take a reference as well as some code examples, etc. Which reference should I take? Here's what I have available at the college's library: The C++ standard library : a tutorial and reference STL tutorial and refe...

Java pass by value -- can you explain this?

I read this excellent article and it make sense: Java is strictly pass by value; when an object is a parameter, the object's reference is passed by value. However, I'm totally confused as to why the following snippet could possibly work. Foo has a String member variable a which is immutable and needs to be burned in every time. The fi...

A terse introduction to Qt?

Is there a terse introduction to GUI programming with Qt, meant for programmers with a decade's worth of experience (but who don't have any exposure to Qt). I am looking for something that gets one started quickly, and covers all the advanced stuff (including best-practices and patterns). Was looking for something like this book - Advanc...

Peculiar Behaviour with PHP (5.3), static inheritance and references.

I'm writing a library in PHP 5.3, the bulk of which is a class with several static properties that is extended from by subclasses to allow zero-conf for child classes. Anyway, here's a sample to illustrate the peculiarity I have found: <?php class A { protected static $a; public static function out() { var_dump(static::$a); } ...

How to make two directory-entries refer always to the same float-value

Consider this: >>> foo = {} >>> foo[1] = 1.0 >>> foo[2] = foo[1] >>> foo {1: 0.0, 2: 0.0} >>> foo[1] += 1.0 {1: 1.0, 2: 0.0} This is what happens. However, what I want would be that the last line reads: {1: 1.0, 2: 1.0} Meaning that both refer to the same value, even when that value changes. I know that the above works the way it ...

How to pass a reference into and out of a class

I would like to pass the reference of a variable into a class, use it and then get it out later. Something like this: // Create the comment Screen string newCommentText = ""; commentsScreen = new CommentEntry(this, ref newCommentText); commentScreen.ShowDialog(); ... _dataLayer.SaveOffComment(newCommentText); And then in the comme...

Database Book to help me prove when I should hardcode a table vs. use a database

I am looking for a book or other undeniably authoritative source that gives reasons when you should choose a database vs. when you should choose other storage methods, most notably, a hardcoded table of values in a program. The rest of this message is just supporting info. Below are some unofficial lists of reasons to use one or the ...

Failed to getResource() utf file from package in Android

Hi, I have a custom java library which getResource() from an UTF-8 encoded text file in the package. keyWordPairs = new Hashtable<String, Vector<String>>(); try { File pinYinDatabase = new File(this.getClass().getClassLoader().getResource("myCustomLibrary/NewPinYin.utf").getFile()); BufferedReader br = new BufferedReader(new Fi...

C++: References as constructor arguments, help...

Hi, I have a base class(Base) whose constructor takes a reference as argument. In my derived class its constructor, I call the superclass-constructor and of course I need to pass a reference as argument. But I have to obtain that argument from a method of which the return type is by value... I will give a short example: class Base { p...

Referencing a class that may exist in one of two assemblies

I am currently working on a data harvester for a project. The way it works is it basically calls another program which collects the data, and that program returns a data structure containing a collection of queue information. The harvester then serializes out the data. The program that actually collects the data is maintained by another ...

C++ catching dangling reference

hello Suppose the following piece of code struct S { S(int & value): value_(value) {} int & value_; }; S function() { int value = 0; return S(value); // implicitly returning reference to local value } compiler does not produce warning (-Wall), this error can be hard to catch. What tools are out there to help catch...

flex cheatsheet for lifecyle methods and overrideable UIComponent functions

HI, O.K, not technically a programming question but it's still relevent for this forum I think. I'm wondering if theres any cheat sheets around for flex? Ideally I'm really looking for some comrehensive list of lifecycle events and functions such as creationComplete, preinitilize etc. Also It would be really cool to get a comprehensiv...

Sharing a reference between objects

I want to have multiple objects share a reference through a private field, such that any of the objects can assign to the field, and the updated field will be seen by other objects sharing that reference. What I was originally hoping to do was this: class SomeObject { private ref DataObject _data; public SomeObject(ref DataObjec...

Cannot Convert ref double[] to ref object

It seems like I'm on here asking a question just about every day now. I'm not sure if that's a good thing or a bad thing... Today's "Flavor-Of-The-WTF" involves my complete and utter cluelessness when using a function from a NI Measurement Studio object. As with most of my previous questions, this is in regards to an internship project ...

Why do I need to reference this assembly, even though its not being used

Hey everyone, I've got an architecture like the following: Data (Class Library that handles our Entity Framework stuff) Components (Middle tier class library that references Data library) WebOffice (Web Application that references Components library, but NOT Data library) Now, I have the following snippet of code (this lives inside ...