arguments

How to get all arguments passed to function (vs. optional only $args)

$args returns only optional arguments. How can I get all function parameters? ...

Constructor arguments problem ActionScript 3

Hi, I have a custom class defined in Actionscript and I want to make an instance of it in the main document of Flash application. However, after calling the constructor with one argument, Flash gives me this error: Error #1063: Argument count mismatch on coa.application::MenuItem(). Expected 1, got 0. This is my class: public class M...

Default Arguments in Matlab

Hello. Is it possible to have default arguments in Matlab? For instance, here: function wave(a,b,n,k,T,f,flag,fTrue=inline('0')) I would like to have the true solution be an optional argument to the wave function. If it is possible, can anyone demonstrate the proper way to do this? Currently, I am trying what I posted above and I ...

Powershell Command Processing (Passing in Variables)

I'm creating a Powershell script to deploy some code and part of the process is to call a command-line compression tool called RAR.EXE to back-up some folders. I'm attempting to dynamically build out the parameters and then have powershell call the command with the variables but I'm running into trouble. It isn't working... Run the fo...

Initialisation of keyword args in Python

Why does the following: class A(object): def __init__(self, var=[]): self._var = var print 'var = %s %s' % (var, id(var)) a1 = A() a1._var.append('one') a2 = A() result in: var = [] 182897439952 var = ['one'] 182897439952 I don't understand why it is not using a new instance of a list when using optional keyword arg...

PHP get all arguments as array?

Hey, I was working with a PHP function that takes multiple arguments and formats them. Currently, I'm working with something like this: function foo($a1 = null, $a2 = null, $a3 = null, $a4 = null){ if ($a1 !== null) doSomethingWith($a1, 1); if ($a2 !== null) doSomethingWith($a2, 2); if ($a3 !== null) doSomethingWith($a3, 3)...

how do i pass multiple arguments to a ruby method as an array?

Hi All, I have a method in a rails helper file like this def table_for(collection, *args) options = args.extract_options! ... end and i want to be able to call this method like this args = [:name, :description, :start_date, :end_date] table_for(@things, args) so that I can dynamically pass in the arguments based on a form commit...

C# - Capture incoming Argument Values in KeyValuePair Array

Hi, I am wondering how I can fetch the incoming arguments of my method in an array. Or just retrieve the values of my arguments dynamicly. Meaning, a call like: MyMethod(10, "eleven"); For method: void MyMethod(int Test, str Test2) {} Would resolve in an array like: {{"Test" => 10}, {"Test2", "eleven"}} Would be even better if I cou...

Capture incoming arguments from WebService

Hi, Im wondering how you can capture the arguments of a WebService call dynamicly(for logging). Is there any property that stores the Arguments of the call being made? ...

Correct way to implement C# console application?

What is the correct way to implement and architect a command line tool as a C# console application? Concerns to address include proper parsing of command line variables, and the proper way to output text. While Console.WriteLine() is the most obvious choice for output, what are the circumstances in which one should instead opt to write...

Why is my NSInteger changing from 12345 to -1758050543 when I pass it as an argument in an Obj-C method call?

Here's the code in AlertTableView: - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ NSInteger index = 12345; NSLog(@"AlertTableView: selecting row at index %d", index); [self.caller didSelectRowAtIndex:index withContext:self.context]; } In self.caller: - (void)didSelectRowAtIndex:(NS...

Parse Command Line Arguments

Duplicate of: What parameter parser libraries are there for C++? Option Parsers for c/c++? What is the best way of parsing command-line arguments in C++ if the program is specified to be run like this: prog [-abc] [input [output]] Is there a library in STL to do this? Related: Parsing command line arguments in a unicode C+...

Members vs method arguments access in C++

Can I have a method which takes arguments that are denoted with the same names as the members of the holding class? I tried to use this: class Foo { public: int x, y; void set_values(int x, int y) { x = x; y = y; }; }; ... but it doesn't se...

VBScript - Don't know why my arguments are not used the same way as variables

Hello, I have written a VBScript to enumerate events from the event log on a particular day. The first query select from the NT event log events between todays date and yesterdays date, Set colEvents = objWMIService.ExecQuery _ ("Select * from Win32_NTLogEvent Where TimeWritten >= '" _ & dtmStartDate & "' and TimeWritten ...

How do I make a default value for a parameter to a javascript function

Possible Duplicate: Is there a better way to do optional function parameters in Javascript? I would like a javascript function to have optional arguments which I set a default on, which gets used if the value isn't defined. In ruby you can do it like this: def read_file(file, delete_after = false) # code end Does this work...

What is the difference between _tmain() and main() in C++?

If I run my C++ application with the following main() method everything is OK: int main(int argc, char *argv[]) { cout << "There are " << argc << " arguments:" << endl; // Loop through each argument and print its number and value for (int i=0; i<argc; i++) cout << i << " " << argv[i] << endl; return 0; } I get wha...

C#: How would I execute this command line directly to java.exe ?

I am writing a program that needs to run a java.jar server. I need to run the process directly so I can rewrite the output to a textbox and all-in-all have complete control of it. I tried just doing it through CMD.exe, but that wouldnt work because CMD.exe would just call a new process java.exe and I wouldn't have control of it. I need t...

Inspect the names/values of arguments in the definition/execution of a JavaScript function

I'm looking to do the equivalent of Python's inspect.getargspec() in Javascript. I do know that you can get the arguments list from a Javascript function, but what I'm really looking for is the names of the arguments from the originally defined function. If this is in fact impossible, I'm going to have to 'brute-force' it by getting th...

Mixing Single and Double Quotations in Bash

Alright, I have a script that takes a few arguments, runs data, and then rsyncs the data out to a different server. The problem is that to run the data, I have to take one of the arguments and then run a report using it, which is very bash unfriendly (Ex. [3023.2<>1], [5111.3$]="5", etc). So if I'm going to run the command, I need t...

In PHP, How to Convert an Argument Name into a String

My goal is to echo the argument passed to a function. For example, how can this be done? $contact_name = 'foo'; function do_something($some_argument){ // echo 'contact_name' .... How??? } do_something($contact_name); ...