arguments

named and default arguments

In PHP, I have to pass the arguments in the same order as the arguments are in the constructor. Now, in Python, take listbox = Listbox(root, yscrollcommand=scrollbar.set) for example. If I had passed yscrollcommand=scrollbar.set as the third argument and yscrollcommand was the second argument in the constructor, would I still be abl...

Drupal 6 absolute wildcards in _menu(), is it possible ?

is it possible to handle all wildcards in _menu() by module. I know about specific wildcards like display/page/% but that won't work for paths display/page/3/andOrderBy/Name what If I want to handle unpredicted ammount of parameters like display/page/3/12/45_2/candy/yellow/bmw/turbo I want to have one display/* _menu() path to hand...

jQuery plugin scope of settings passed in

I feel like this must have been asked, but I'm unable to find it through my searches. Here's a complete example of the issue that's confusing me: <html><head> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"&gt;&lt;/script&gt; <script type="text/javascript"> (function($){ $.fn.test...

Too many input arguments in MATLAB

When I run the following code: xdata2 = [1 3 4 5]; ydata2 = [3 9 76 73]; params = [0.1 0.5 0.0 -0.5 0.2 0.8]; y = svenssontest2(xdata2,ydata2,params,0.636,1.9632); I get the error message "Too many input arguments", but the number of input arguments is correct. Here's the code for the function svenssontest2: function [alpha L1 L2] = ...

What do our customers have from migrating from .Net 2.0 to .Net 3.5?

Hi SOers, I found very much about the benefits of using a newer .Net version for programmers (LINQ, WPF etc.) but I didn't find anything about the benefits for our customers. So, I'm thinking about migrating our application (WinForms, C#, .Net2.0) from .Net2.0 to .Net3.5 and I need answers to the question: "What are the benefits for ou...

What are good arguments to convince management to upgrade to Delphi 2009 / 2010?

We have a medium-to-large size application. One version runs on Delphi 6 and another one on Delphi 2006. One argument would be support for Unicode. We need that to cater to Customers around the world. Other things I have read about are: better IDE (stability, speed), better Help and some cool additions to the language (e.g.: generics...

What arguments does the sizeof operator take in C?

[Original title referred to 'sizeof function'.] I tried these and they all worked: char *p; printf("Size of *p is %d\n",sizeof(*p)); //result =1 printf("Size of p is %d\n",sizeof( p)); //result =4 printf("Size of p is %d\n",sizeof( //result =4 I wonder why the first printf is 1, the 2nd and 3rd is 4? So what arguments can size...

PHP function with unlimited number of parameters

How do I write a function that can accept unlimited number of parameters? What am trying to do is create a function within a class that wraps the following: $stmt->bind_param('sssd', $code, $language, $official, $percent); ...

Is there an easier way of passing a group of variables as an array

What I'm trying to do is to write a dedicated method for my StreamWriter instance, rather than make use of it at random points in the program. This localises the places where the class is called, as there are some bugs with the current way it's done. Here is what I have at the moment: public static void Write(string[] stringsToWrite) {...

Apache Ant command line arguments without double quotes - is it possible?

Today I had to add a task to an Apache Ant file. The command line should have been something like myprogram --param1 --param2 path\somefile 2> path\logfile The problem with this was that if I used something like the following for this <exec executable="$(myprogram)" <arg value="--param1"> <arg value="--param2"> <arg path="$(som...

Passing variable argument list to sprintf()

I would like to write a function that (amongst other things) accepts a variable number of arguments and then passes them to sprintf(). For example: <?php function some_func($var) { // ... $s = sprintf($var, ...arguments that were passed...); // ... } some_func("blah %d blah", $number); ?> How do I do this in PHP? ...

PHP Class arguments in functions

Hi, I'm having trouble using an argument from my class in one of that class's functions. I have a class called company: class company { var $name; function __construct($name) { echo $name; } function name() { echo $name; } } $comp = new company('TheNameOfSomething'); $comp->name(); When I instantiate...

How to write a JS function that accepts and "forwards" variable number of parameters?

How do I write a Javascript function that accepts a variable number of parameters, and forwards all of those parameters to other anonymous functions? For example, consider the scenario of a method that fires an event: function fireStartedEvent(a,b,c,d,e,f,g,...) { for(var i = 0; i < startedListeners.length; i++) { started...

Checking arguments in numerical python code

I find myself writing the same argument checking code all the time for number-crunching: def myfun(a, b): if a < 0: raise ValueError('a cannot be < 0 (was a=%s)' % a) # more if.. raise exception stuff here ... return a + b Is there a better way? I was told not to use 'assert' for these things (though I don't see th...

How do I make the params keyword usage similar to writing to the Console

In relation to my last question (http://stackoverflow.com/questions/1588135/is-there-an-easier-way-of-passing-a-group-of-variables-as-an-array) I was trying to pass string variables to a method to write to a stream, rather than doing the writing in each individual method. The use of the params keyword is obviously a solution, however b...

Java passing command line arguments to methods

I'm writing a program, which takes two words as command line arguments, does something to them, and prints out the result. I'm writing a class to handle this, and my question is: what is the best way to pass two words given as command line arguments between methods in a class? Why can't I use the usual "this.variable = " in the construct...

VB - How do I test if optional arguments are supplied or not?

How do I test if optional arguments are supplied or not? -- in VB6 / VBA Function func (Optional ByRef arg As Variant = Nothing) If arg Is Nothing Then <----- run-time error 424 "object required" MsgBox "NOT SENT" End If End Function ...

Difference between arguments/parameters in C#

What is the difference between an argument & a parameter in C#? Are they the same thing? ...

Forwarding command line arguments to a process in Python

I'm using a crude IDE (Microchip MPLAB) with C30 toolchain on Windows XP. The C compiler has a very noisy output that I'm unable to control, and it's very hard to spot actual warnings and errors in output window. I want to write a python script that would receive arguments for compiler, call the compiler with same arguments, filter resu...

Reference a method parameter in javadoc

Is there a way to reference one of the method parameters from the method documentation body? Something like: /** * When {@paramref a} is null, we rely on b for the discombobulation. * * @param a this is one of the parameters * @param b another param */ void foo(String a, int b) {...} ...