parameter-passing

Using references in PHP.

I ask this question because i learned that in programming and designing, you must have a good reason for decisions. I am php learner and i am at a crossroad here, i am using simple incrementation to try to get what im asking across. I am certainly not here to start a debate about the pros/cons of referencing, but when it comes to php, ...

Passing value from :locals to link_remote_to

In my edit.haml file, I have =render :partial => 'old_question_tags', :locals => {:current_question => @question.id}. I'd like to pass the value in :current_question to a link_to_remote call in _old_question_tags.haml: #{link_to_remote image_tag('red-x.png', {:alt => "Remove #{t.name} tag"}), :url => {:action => 'remove_old_tag_from_q...

How can I easily pass all the variables from a template to a partial in Symfony with output escaping on?

It there an easy way to pass all the variables a template file has access to onto a partial when I have output escaping on? I tend to create a template file, then refactor things into a partial at some point and it would seem that there would be an easy way to just pass all the same variables from the template to the partial and be done...

Return an Oracle Associative Array from a function

Does anybody know if it is possible to return an associative array as the result of an Oracle function, if so do you have any examples? I have an Oracle package which contains an associative array declaration as defined below: TYPE EVENTPARAM IS TABLE OF NUMBER INDEX BY BINARY_INTEGER; This is then used in a stored procedure ...

Passing expression as a parameter in Call by reference

All, When we are passing an expression as a parameter, how does the evaluation occur? Here is a small example. This is just a pseudocode kind of example: f (x,y) { y = y+1; x = x+y; } main() { a = 2; b = 2; f(a+b, a) print a; } When accessing variable x in f, does it access the address of the temp variable which c...

Confusion in C++

I'm very new to C++ and I'm currently learning it. I got a few questions.. What is the differences between void DoSomething(const Foo& foo) and void DoSomething(Foo foo)? If we don't specify & then the instance of Foo will be passed by value ( not reference ). It will be the same as having const + & in argument except no checking at co...

Passing a struct with multiple entries in c++

I am trying to pass a coordinate, which is defined as struct with 2 integer parameters (the struct is called coord) the following way: UpdateB({0,0}); where the input argument is of type coord (i.e. in the above statement I am trying to pass a coordinate 0,0). UpdateB is some function. I am getting an error, any ideas what the probl...

How to pass object/template as parameter in Javascript/jQuery

I'm attempting my first forray into jQuery. I'm trying to acheive the following, though I'm not sure of the terminology so will try to explain with an example using a kind of C#/pseudocode syntax. Say I want an (anonymous) object as parameter, looking something like: elemParameter { elemId, arg1, optionalArg2 } and I wan...

When does a param that is passed by reference get updated?

Suppose I have a method like this: public void MyCoolMethod(ref bool scannerEnabled) { try { CallDangerousMethod(); } catch (FormatException exp) { try { //Disable scanner before validation. scannerEnabled = false; if (exp.Message == "FormatException") ...

Altering passed parameters in Java (call by ref,value)

Hi, I actually thought that I had a good idea of how passing values in Java actually work, since that was part of the SCJP cert which I have passed. That was until today, when I at work discovered a method like this: public void toCommand(Stringbuffer buf) { buf.append("blablabla"); } Then the caller of that method used the functi...

Does php5 function parameters pass as ponter or as copies?

Hi, Does php function parameters pass as ponter to object or as copy of object? Its very clear in C++ but in php5 I don't know. Example: <?php $dom=new MyDocumentHTMLDom(); myFun($dom); ?> parameter $dom pass as pointer or as copy? Thanks ...

Microsoft Reporting Services 2008- Multi-Value Parameter- New Page

I am creating a report where the parameter selection = customer_name and the report is one page and has 5 tablix relating to the customer. What my team would like is to be able to select more than one customer at a time to save time; however they want a separate page per customer_name. Can this be done with multi-value parameter and if s...

C++ - Optional arguments by reference

Hello all, I have an exam on C++ coming up, and I'm solving a few ones from past years. I have this question in one of them: A function calculates the volume of a prysm. Arguments passed are height, depth and width. Arguments and return value are doubles Depth is optional and should default to 10. Hypothesis 1: All para...

Integral promotion when passing and returning argument by reference?

Hi! I'm reading something about overload resolution and I found something that bothers me...In the following code: int const& MaxValue(int const& a, int const& b) { return a > b ? a : b; } void SomeFunction() { short aShort1 = 3; short aShort2 = 1; int const & r2 = MaxValue(aShort1, aShort2); // integral promotion ...

cakephp validation losing parameters

CONTROLLER class ImagesController extends AppController { var $name = 'Images'; var $uses = array('Image','Person'); var $helpers = array('Html', 'Form'); function add($idp = 0, $mac = 0) { if (!empty($this->data) && is_uploaded_file($this->data['Image']['File']['tmp_name']))...

How do I get the source element in the AjaxOptions OnComplete function with MVC Ajax.BeginForm

As the title, I need something along the lines of... using (Ajax.BeginForm("MyAction", new AjaxOptions { OnComplete = "function() { mySucessFunction(this); }" })) <script> function mySucessFunction(srcElem) { alert(srcElem.id); } </script> An...

How to pass the parameters from a user-defined to delegate method in objective C (iPhone)

Hi, everyone I want to ask about the passing parameter in objective C on iPhone simulator. Is it possible to pass an parameter (e.g. NSArray) to the delegate method? I wrote a program, when the user press a button, it will call a function called 'pressLoginButton' (user-defined). After complete the function, I have to pass an NSArray ...

Automatic Evaluation Strategy Selection in C++

Consider the following function template: template<typename T> void Foo(T) { // ... } Pass-by-value semantics make sense if T happens to be an integral type, or at least a type that's cheap to copy. Using pass-by-[const]-reference semantics, on the other hand, makes more sense if T happens to be an expensive type to copy. Let's ass...

WCF: How to pass a variable number of parameters to a WebGet enabled service

We're trying to pass a variable number of key-value-pairs to our service by using the WebGetAttribute and the UriTemplate to expose a REST interface. What we want to do: [WebGet(UriTemplate="/Query/Select?{query}"] Response Query(string query); At client-side we want to specify some keys several times, e.g.: hllp://localhost/MyService...

Hyperlink Navigationuri with parameter wpf

Hi All, I want to set navigateURI to the dynamically created hyperlink. I am using the following code but it is not navigation to the page if i pass parameter. showing the following error. Code: Hyperlink hlProduct = new Hyperlink(new InlineUIContainer(img)); hlProduct.NavigateUri = new Uri("Player.xaml?id=109", UriKind.Relative...