arguments

Making an ANT Macro more reusable

I have a simple macro (simplified version below). At the moment it assumes that there will be a single value for a single argument, however there might be multiple values for that argument. How can I pass in 0+ values for that argument so that the macro is usable in situations where I need to pass in 0+ values for that argument, not just...

Variadic functions and arguments assignment in C/C++

I was wondering if in C/C++ language it is possible to pass arguments to function in key-value form. For example in python you can do: def some_function(arg0 = "default_value", arg1): # (...) value1 = "passed_value" some_function(arg1 = value1) So the alternative code in C could look like this: void some_function(char *arg0 = "d...

C# function normal return value VS out or ref argument

I've got a method in C# that needs to return a very large array (or any other large data structure for that matter). Is there a performance gain in using a ref or out parameter instead of the standard return value? I.E. is there any performance or other gain in using void function(sometype input, ref largearray) over largearray fun...

Same code... but warning!Any ideas?

I've a question for a warning message that i get. For this line,using qsort library function: qsort(catalog, MAX ,sizeof catalog, struct_cmp_by_amount); I get this warning: warning: passing argument 4 of ‘qsort’ makes pointer from integer without a cast EDIT: struct_cmp_by_amount is the following function on the program....

How can I pass two lists to a Perl subroutine?

Is it possible to pass two lists to a sub in Perl, for example: sub Foo { my(@list1,@list2) = @_; } I know I could make @_ two lists, with each sublist being the desired argument, I'm just wondering if there is a cleaner way ...

Passing arguments and values from HTML to jQuery (events)

What is the practice to pass arguments from HTML to jQuery events function. For example getting id of row from db: <tr class="jq_killMe" id="thisItemId-id"> ... </tr> and jQuery: $(".jq_killMe").click(function () { var tmp = $(this).attr('id).split("-"); var id = tmp[0] // ... } What's the best practise, if I want ...

How to capture an output from a function in MATLAB?

I have a simple function function increase(percent, number) low = number - number*percent; end I want to return low so I can use it as an argument for another function mitoGen(asp, arg, increase(0.2, 234), glu) Is there a way to do this? ...

How to iterate over function arguments

I have a Python function accepting several string arguments def foo(a, b, c): and concatenating them in a string. I want to iterate over all function arguments to check they are not None. How it can be done? Is there a quick way to convert None to ""? Thanks. ...

Library for parsing arguments GNU-style?

I've noticed the basic 'style' of most GNU core applications whereby arguments are: --longoption --longoption=value or --longoption value -abcdefg (multiple options) -iuwww-data (option i, u = www-data) They follow the above style. I want to avoid writing an argument parser if there's a library that does this using the above style. I...

How do I pass a variable number of parameters along with a callback function?

I'm using a function to lazy-load the Sizzle selector engine (used by jQuery): var sizzle_loaded; // load the Sizzle script function load_sizzle(module_name) { var script; // load Sizzle script and set up 'onload' and 'onreadystatechange' event // handlers to ensure that external script is loaded before dependent // code is e...

Passing zero arguments as params -- where the behaviour is defined?

C# spec. allows you to call a function void foo(params int[] x) with zero parameters. However, I didn't find in C# Lang. Spec. a word on further behaviour -- will foo get empty array or null reference? I checked also MSDN -- nothing. Where the behaviour is defined? NOTE: I am not asking how VS behaves, I am asking about design of ...

Why no ArgumentEmptyException in .NET ?

I am beginning to think I am doing something wrong. I mean they did place System.String.IsNullOrWhitespace finally but no ArgumentEmptyException class. public FilterItem(string name, IEnumerable<string> extensions) { if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentNullExce...

struct and arguments

I am trying to modularize a function that used to add values to multiple structures in one call. Now I want to do one value addition per call, but I am not sure how to make a less specific argument reference. func ( [?] *val ) { } ...

File::Find and $_ in nested subroutines.

When running the following code, the filenames of all files below C:\Test are printed. Why doesn't it print just Hello (n times, depending on how many files are processed)? Does this imply that I cannot rely on shift to reliably assign to $_? Imagine a coworker implements the wtf function and doesn't know that it's called from a File::...

GCC, functions, and pointer arguments, warning behaviour

I've recently updated to a testing distribution, which is now using GCC 4.4.3. Now I've set everything up, I've returned to coding and have built my project and I get one of these horrible messages: *** glibc detected *** ./boxyseq: free(): invalid pointer: 0x0000000001d873e8 *** I absolutely know what is wrong here, but was rather con...

to call a javascript function periodically

I want to call function with arguement periodically. I tried setTimeout("fnName()",timeinseconds); and it is working. But when I add an arguement it won't work. eg: setTimeout("fnName('arg')",timeinseconds); ...

Drupal - Creating alphabetical pager using views

Hi, Thanks guys. This forum is really helpful. Now I have another question for you. I want to create a alphabetical pager for a view, so that when someone clicks on "A", they will see submissions whose title is starting with alphabet A. I have successfully created alpha pager by following http://tedserbinski.com/tags/drupal/creating-al...

Drupal: How to get views argument into header/footer/empty view

I found this code snippet: <?php $view = views_get_current_view(); $arg0 = $view->args[0]; ?> but i don't know where to begin inserting this php code snippet. ...

c++: truth assignment warning with arguments?

I use the following to work with arguments in my programs, but it seems to just hand me a warning (just a warning): "warning: suggest parentheses around assignment used as truth value" The beginning of the code is as follows: while((++argv)[0] && argv[0][0]=='-'){ while(c =* ++argv[0]) The while(c =* ++argv[0]) part being wh...

Reconstruction of java command line arguments

Is there a way to reconstruct the command line arguments passed to Java within a Java program, including the JVM options and classpath option? I have a Java program that needs to restart the JVM and manipulate its bootclasspath (i.e. trying to override some system classes). I use the libc system method to invoke the new JVM. I'm open ...