parameter-passing

Static keyword in function parameter

I've just found this function definition in some embedded code: float round_float_to_4(static float inputval); I'm familiar with other uses for static (global variables, functions and local variables), but this is the first time I see it as specifier for function parameter. I assume that this forces compiler to use fixed memory locati...

Does a passed final variable in Java stay final on the other side?

I've just come across some code that's confusing me slightly; there are really 2 variations that I'd like to clarify. Example 1: public String getFilepath(){ final File file = new File(this.folder, this.filename); return file.getAbsolutePath(); } What would be the purpose of declaring file "final"? Since Java prim...

What's the way to keep the dictionary parameter order in Python?

def createNode(doc_, **param_): cache = {'p':'property','l':'label','td':'totalDelay','rd':'routeDelay','ld':'logicDelay'} for index in param_: newIndex = cache[index] value = param_[index] print newIndex, '=', value doc = 10 createNode(doc, p='path', l='ifft4k_radix4_noUnolling_core.vi', td='3.0', ld='...

Parameter Passing in Scheme

Hi All, Can anyone help me out understanding the various parameter passing modes in Scheme? I know Scheme implements parameter passing by value. But how about other modes? Is there any good documentation for parameter passing in Scheme? ...

how do php share data without access a DB

I have two pages and I want to pass data to each other. How can I do this without accessing a DB? Sessions? Cookies? someother magical way? If you know how, can you please post sample code? Thanks ...

How to add a "select all" value to a parametrized query in C# and MS SQL

I have the following code: As you can see, i need to pass a parameter to Field2, but i also need that parameter to be ablo to handle the ""all values" option, for example, if i assign "foo" to the parameter, the query will return every record where Field2 = "foo"... but i also want to be able to pass a wildcard, or something to tell tha...

C#: Can parameters be constant?

I'm looking for the C# equivalent of Java's final. Does it exist? Does C# have anything like the following: public Foo(final int bar); In the above example, bar is a read only variable and cannot be changed by Foo(). Is there any way to do this in C#? For instance, maybe I have a long method that will be working with x, y, and z coo...

Passing a variable to the new.html.rb page

I have two MVCs Meeting and Agenda. A meeting can have many agenda items. I am trying to set these two pages up so that I can click a 'Create New Agenda Item' on the show.html.rb meeting page. The idea being that this would redirect the user to the new.html.rb agenda page passing the meeting id, and pre-populating the new.html.rb agend...

Creating a function reference that has value parameters not references

I'm not sure exactly how to describe what I want. I want to define a function with the parameters being a local VALUE not a reference. say I have list of objects I want to create for(i = 0; i < 10; i++){ var div = document.createElement("div"); div.onclick = function(){alert(i);}; document.appendChild(div); } Now I believe in ...

Is there a better way to pass by reference in Perl?

I am doing pass-by-reference like this: use strict; use warnings; sub repl { local *line = \$_[0]; our $line; $line = "new value"; } sub doRepl { my ($replFunc) = @_; my $foo = "old value"; $replFunc->($foo); print $foo; # prints "new value"; } doRepl(\&repl); Is there a cleaner way of doing it? Prototypes ...

CakePHP passing parameters to action

Hi im kinda new in cakephp and having a lot of trouble adjusting.. Here's my biggest problem .. Im trying to pass a parameter to an action, it does load, but when my script goes from the controller to the view, and goes back to the controller again, its gone. CONTROLLER CODE function add($mac = 0) { if(isset($this->params['form'][...

Javascript function programming — receiving elaborate parameters

I'm writing a Javascript function that would manipulate an array written on-the-fly and sent as a parameter. The function is written as follows: function returnJourney(animation,clean){ var properties = {}; // loads of other inane stuff for(i in animation[0]) properties[animation[0][i]] = animation[0].i; // heaps more i...

Ruby - Call method passing values of array as each parameter

I'm currently stuck on this problem. I've hooked into the method_missing function in a class I've made. When a function is called that doesn't exist, I want to call another function I know exists, passing the args array as all of the parameters to the second function. Does anyone know a way to do this? For example, I'd like to do som...

How to pass get-parameter to backing bean in jsf?

I have a get-parameter with name controller. When I try to pass it (with propertyChangeListener) to my backing bean I get null instead of the real value of that parameter: <h:commandButton value="#{msg['mail.send']}" styleClass="mailbutton" action="#{mailSender.sendMail}"> <f:setPropertyActionListener target="#{mailSender.controller...

How to retrieve an url parameter in the Zend Framework ?

Hello guys ! I'am trying to retrieve an parameter passed in a url using the zend framework. But of course, it is not working ! My code looks like this : Generating the url : <?php echo $this->url(array('controller' => 'poll', 'action' => 'showresults', 'poll_id' => $poll['_id']), null, true) ?> Retrieving the "poll_id" parameter in ...

Using a function with reference as a function with pointers?

Today I stumbled over a piece of code that looked horrifying to me. The pieces was chattered in different files, I have tried write the gist of it in a simple test case below. The code base is routinely scanned with FlexeLint on a daily basis, but this construct has been laying in the code since 2004. The thing is that a function implem...

Passing List (Of ChildClass) as parameter to method expecting List (Of ParentClass)?

Hi, I have implemented inheritance for two parent classes called Table and Field. Each parent class has several child classes. In the Table parent class, I created a method that expects parameter List(Of Field). I get an error when trying to pass in parameter List(Of ChildField) to the method that expects a parameter of List(Of Field). ...

Passing an array argument from C# to a C++/CLI method

I know only very little about C++/CLI, but I have a simple problem that needs a solution. I have a C++/CLI class method that takes a byte-array as a parameter. The array is of a pre-determined length, and can be allocated in C# beforehand. The array is supposed to be filled with data by the C++/CLI method. How do I declare the method an...

Passing data between asp.net pages

Hello, I'm wondering the opinion of what is the best way to pass a lot of values between MULTIPLE pages. I was thinking of either saving the values to a database, using context.Items[], or Session[]. I'm not sure about what is the best method. I'm passing probably around 40 variables.This will be during a checkout process so they should...

Adding an keyUp-event to form objects

Hello folks, I've got the issue to add a browser event to some input fields. The challenge I have to face is, that one parameter of my target function is the 'event'-variable and the second one an object. For a better understanding here some codes:The HTML object: <div id="1_dateFieldAdvanced" class="xp set"> <div id="1_dateFieldA...