reference

After passing a reference to an method, any mods using that reference are not visible outside the method - Ruby?

I am passing the reference of name to *mod_name*, I modify the referenced object from within the method but the change is not visible outside of the method, if I am referring to the same object from all locations how come the value is different depending on where I reference it? name = "Jason" puts name.object_id #19827274 def mo...

Reference to array not working as expected in PHP

hi guys, I am confused from the result of the following code: I can't get my expected result: $arrX = array('a'=>array('val'=>10),'b'=>array('val'=>20), 'c'=>array('val'=>30)); foreach( $arrX as &$DataRow ) { $DataRow['val'] = $DataRow['val'] + 20; } foreach( $arrX as $DataRow ) { echo '<br />val: '.$DataRow['val'].'<br/>'; } ...

Reference problem when returning an object from array in PHP

I've a reference problem; the example should be more descriptive than me :P I have a class that has an array of objects and retrieve them through a key (string), like an associative array: class Collection { public $elements; function __construct() { $this->elements = array(); } public function get_element($...

C# / Silverlight: SL classlibrary referenced in "normal" C# - application, must Silverlight be installed?

So, I want to share TONS of code between Silverlight and "normal" applications. Starting with utility functions and all that up to my hand coded framework (MVC, DI, etc...)... Here is my question: Imagine I have put all this stuff into a SL - Classlibrary, lets call it "AmazingLibrary" and I reference it in a NORMAL (say, WPF) project ...

Store return value of function in reference C++

Is it valid to store the return value of an object in a reference? class A { ... }; A myFunction() { A myObject; return myObject; } //myObject goes out of scope here void mySecondFunction() { A& mySecondObject = myFunction(); } Is it possible to do this in order to avoid copying myObject to mySecondObject? myObject is not...

Is there a definitive list of uri patterns for use in android apps made by google?

Apart from http://developer.android.com/guide/appendix/g-app-intents.html (which is quite good but fairly limited in the number of apps/uri's it covers) I've been unable to find a decent reference source for looking up URI's to use when integrating with google apps. I'm currently working on triggering the "add new contact" UI, and have ...

How can I create a collection of references in C#

Ok I am having a cross language hiccup. In C# with it's great collections like List and I have: a Map class with properties of: List<byte[]> Images; List<Tile> Tiles; a Tile Class of: byte[] ImageData; int X; int Y; Now I want to add an image to the Map class and have the ImageData property of the Tile Classes to ...

References for better performance of newer JSF specifications

Dear fellows, I'm looking for a reference to cite, which states that JSF 1.2 performs better than JSF 1.1. Or JSF 2.0 over JSF 1.2 respectively. I'm quite sure that I've read something like this before but can't find it anymore. Maybe you can help. Or is this mischief and there are no official statements regarding the performance? ...

Equivalent of http://www.cplusplus.com/ for C# .net

Hi Folks I've read through a lot of the "Learn C# .Net" questions just to see if this question was answered already (directly or indirectly). I program mostly in C++ so I find the website http://www.cplusplus.com/ invaluable and there's rarely a day when it is not open in my browser! However, I'm just wondering is there an C# .Net e...

Referencing text input fields in CKEditor dialogs

Hi, I've been playing around with this for a couple of weeks now with no success... In a CKEditor dialog, text input fields are renamed with a unique number - e.g. id: 'txtUrl' will become something like id='27_textinput'. How do I reference this? // I feel it should be something like: var myfield = CKEDITOR.instances.myElement.docum...

Does a simple delphi form app needs any libraries or dependencies to deploy?

I need to code a simple form application and I want to make it easy to deploy (without installing libraries or dependencies), I don't want to use visual studio cpp or csharp because clr apps compile with .net frameworks and I have no much experience with mfc and dialogs. So I was wondering which libraries does a simple delphi vcl forms ...

On reference_wrapper and callable objects

Given the following callable object: struct callable : public std::unary_function <void, void> { void operator()() const { std::cout << "hello world" << std::endl; } }; a std::tr1::reference_wrapper<> calls through it: callable obj; std::tr1::ref(obj)(); Instead, when the operator() accepts an argument: s...

Java Properties and References -- I'm not getting what I expect.

I'm a little embarrassed to ask this as I ought to know better, but here's what I've got. I have an object "Pitcher" with an int property of "runsAllowed". I have an object Batter that has a property of "responsiblePitcher". I have an object Team that has a property "pitcher". When the batter reaches base: Batter.responsiblePitcher = ...

iPhone xcode - Best way to control audio from several view controllers

Hi, I am pretty new to iPhone programming. I have a navBar with three views. I need to control audio from all of the views. I only want one audio stream to play at a time. I was thinking that it would be smart to let my AppDelegate have an instance of my audioplaying class and let the three other views use that instance to control th...

Custom string class (C++)

Hey guys. I'm trying to write my own C++ String class for educational and need purposes. The first thing is that I don't know that much about operators and that's why I want to learn them. I started writing my class but when I run it it blocks the program but does not do any crash. Take a look at the following code please before reading ...

Python: How do I create a reference to a reference?

Hi, I am traditionally a Perl and C++ programmer, so apologies in advance if I am misunderstanding something trivial about Python! I would like to create a reference to a reference. Huh? Ok. All objects in Python are actually references to the real object. So, how do I create a reference to this reference? Why do I need/want this? ...

Copy Paste vs. Reference

My question is in regard to referencing open source frameworks. There are many of them for many different purposes. I personally leverage several of them in a single project. For example: Unity CAL/Prism ValidationAspects EnterpriseLibrary Logging EnterpriseLibrary Exception Handling EnterpriseLibrary Caching Caliburn All of these fr...

Problem passing a reference as a named parameter to a variadic function

I'm having problems in Visual Studio 2003 with the following: void foo(const char*& str, ...) { va_list args; va_start(args, str); const char* foo; while((foo = va_arg(args, const char*)) != NULL) { printf("%s\n", foo); } } When I call it: const char* one = "one"; foo(one, "two", "three", NULL); I get: ...

Object still linked (referenced) after selecting it out of list?

Hey guys, I was wondering, and i'm not really sure, but help me out here. If you have a List items, and there's one object you need to change a property of it. Say myClass has a string property "status". I'm searching my list with a for-loop and i get my object so i do myClass item = items[i]; if i want to change the "status" prope...

How to pass a reference to a string in JavaScript?

Maybe a closure is my solution? Not exactly sure how to pull it off though. The code is set up like so: var globalVar = ''; var globalVar2 = ''; function func() { if (condition) func2(globalVar) else func2(globalVar2) } In func2() I cache some HTML in a main container into the appropriate global variable that I pa...