reference

Pointers or references for dynamically allocated members that always exist?

I have a class CContainer that has some members CMemberX, CMemberY, which are independent of each other and other CClientA, CClientB classes that use CContainer. #include "MemberX.h" #include "MemberY.h" class CContainer { public: CMemberX & GetX() const { return m_x; } CMemberY & GetY() const { return m_y; } private: CMem...

PHP function to return a reference a variable

I'm trying to write a function that will return a reference to a PDO object. The reason for wanting a reference is if, for some reason, the PDO object gets called twice in one page load, it will just return the same object rather than initializing a new one. This isn't silly, is it? :/ function &getPDO() { var $pdo; if (!$pdo) ...

Recreate webservice

HI, My job was to create a webservice which acted as another webservice we have, so the client doesn't notice the difference. I created my entire webservice and it works fine as I use it and the outputs all are the same. The thing is, I created a clientapplication where I use the old webservice and if I change the url of the webreferenc...

Reassign parent variable in included Dwoo template

Hello ! I have a Dwoo template - in example base.html and there is an array $data. {assign '' 'globalVar'} {* $globalVar empty right now *} {foreach $data element} {include '_partial.html'} {/foreach} ... <b>{$globalVar}</b> And here is _partial.html <p> {$element.someText} </p> {assign "$globalVar $element.someVar" 'gl...

Eclipse Library Reference Out of Date in Project

I am using Eclipse Ganymede. I have a project open and call a static method of a class in another project, which the current one references. I close the current project, open the referenced library's project, change the method return type, and rebuild its jar. (It's set to build automatically, but I tried explicitly rebuilding all any...

load a DLL reference from a different folder?

I have a .NET console app that references a DLL. It runs fine if the DLL is in the same folder as the EXE but I would like to put the DLL in a different folder. How can I do that? ...

Why would I return a hash or a hash reference Perl?

Hi I was wondering what the most effective way of accomplishing the below would be. ( i know they accomplish the same thing but was wondering how most people would do this between the three, and WHY ) a.pl my %hash = build_hash(); # do stuff with hash using $hash{$key} sub build_hash { # build some hash my %hash = (); my @...

How to Copy an Object in PHP?

I have a simple 'dimensions' class containing a width/height property and a constructor to set them. I have a function (to re-size dimensions) that takes two dimensions objects -- one to be re-sized, and one containing the max size. It should reduce the dimensions in the first parameter such that they 'fit into' the second parameter. T...

Asp + code behind: reference missing ?

I'm currently working on a project I've just received that is asp.net + vb. I have to add a gridview in one part of the page, but it simply won't let me set the datasource <%@ Page Language="VB" MasterPageFile="~/Common/Common.master" title=whatever" %> <%@ Register TagPrefix="uct" TagName="SubmenuControl" Src="whatever.ascx" %> this ...

How to access session in MVC 1.0

In an MVC 1.0 C# app, what's the different between the following: HttpContext.Current.Session["MyValue"] = "ItsValue"; and Session["MyValue"] = "ItsValue"; ...

Memory management with dictionaries / possible misinterpretation by GCC?

Hi, Somewhere on my code I need to create several windows from a main window, each functioning with a specific configuration but all instances of the same controller object. I also need to keep a list of open windows, so whenever I open a window I store its instance in a dictionary and when the window is closed I send a notification to...

sending back a vector from a function

Hi, How to translate properly the following Java code to C++? Vector v; v = getLargeVector(); ... Vector getLargeVector() { Vector v2 = new Vector(); // fill v2 return v2; } So here v is a reference. The function creates a new Vector object and returns a reference to it. Nice and clean. However, let's see the following C...

Can Pointer to reference and Pointer to the actual variable be treated as same?

I recently saw the below code ( simplified version given below) in my code base and got this doubt: class B; class A { public: A():m_A("testA"){} B& getB() { return m_B; } B* getBPtr() //== > written to explain the problem clearly { return &m_B; } private: B m_B; }; class B { pub...

c/c++ passing argument by pointer / argument by reference stackframelayout?

hi! foo1(int* val){(*val)++;} foo2(int &val){val++;} will the compiler create in both cases the same code? will it simply write a pointer into the parameterpart of foo's stackframe? or will in the second case the callers' and foos' stackframes somehow overlap such that the callers' local variable takes the same memory on the stack as...

Error adding reference to System.ServiceModel.Web.dll in VS 2010 Beta 2 with .NET Framework on Win 7 x64

Hi, I am creating a project that requires the System.ServiceModel.Web.dll. I have added a reference by right-clicking the reference "folder" in the project explorer. A search of the system shows System.ServiceModel.Web.dll in different directories: Program Files(x86), x64, GAC, etc. It doesn't seem to matter which one I pick, as I al...

are arrays in php passed by value or by reference?

When an array is passed as an argument to a method or function is it passed by reference? What about doing this: $a = $array(1,2,3); $b = $a Is $b a reference to $a? ...

Pass by reference problem with PHP 5.3.1

Ok, this is a weird problem, so please bear with me as I explain. We upgraded our dev servers from PHP 5.2.5 to 5.3.1. Loading up our code after the switch, we start getting errors like: Warning: Parameter 2 to mysqli_stmt::bind_param() expected to be a reference, value given in /home/spot/trunk/system/core/Database.class.php on line ...

how-to pass the reference of the current instance in C#

e.g. something like ( ref this ) which does not work ... E.g. this fails: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace CopyOfThis { class Program { static void Main(string[] args) { View objView = new View(); objView.Boo(); o...

Self teaching resources for Jquery

Hi I'm a php developer looking to learn jquery, with no Javascript experience. Ideally, I would like a beginners self teaching guide in a book, that I can use as a reference. Any suggestions? ...

References in C

Possible Duplicate: Passing pointer argument by reference under C? Are reference variables a C++ concept? Are they available in C? If available in C, why is my code giving a compilation error? #include <stdio.h> #include <stdlib.h> int main() { int a = 10; int b = 20; int &c = a; int &d = b; return 0; } Output: ba...