arguments

batch parameters: everything after %1

Duplicate: Is there a way to indicate the last n parameters in a batch file? how to get batch file parameters from Nth position on? Clarification: I knew of the looping approach - this worked even before Command Extensions; I was hoping for something fun and undocumented like %~*1 or whatever - just like those documented at http://w...

JQuery pass more parameters into callback

Hi all, Is there a way to pass more data into a callback function in Jquery? I have two functionsm and I want the callback to the $.post, for example, to pass in both the resulting data of the AJAX call, as well as a few custom arguments function clicked() { var myDiv = $("#my-div"); // ERROR: Says data not defined $.post("someurl.php...

AS3 ... (rest) parameter

Hello, I've tested the following code: function aa(...aArgs):void { trace("aa:", aArgs.length); bb(aArgs); } function bb(...bArgs):void { trace("bb:", bArgs.length); } aa(); //calling aa without any arguments. The output is: aa: 0 //this is expected. bb: 1 //this is not! When I pass empty arguments (aArgs) to bb functi...

AS3 arguments

Why do you think the code below does not work? What would you change/add to make it work? Any help is appreciated.. function TraceIt(message:String, num:int) { trace(message, num); } function aa(f:Function, ...args):void { bb(f, args); } aa(TraceIt, "test", 1); var func:Function = null; var argum:Array = null; function bb(...

Redirecting passed arguments to a windows batch file

I would like to call a jar file from a windows batch file. One requirement is to be able to pass all the batch file arguments as-is to the jar file invocation. For example, Required Command line: foo.bat --flag1=x --flag2=y --flag3=z The batch file foo.bat should invoke foo.jar like follows: java -jar foo.jar --flag1=x --flag2=y --flag...

Is it possible to dynamically populate a CFC with arguments?

The following code errors: <cfdbinfo datasource="#Application.DSN#" name="getCols" type="columns" table="#this.tableName#"> <cftry> <cfquery name="getColumnDetails" dbtype="query"> SELECT COLUMN_NAME,TYPE_NAME FROM getCols WHERE IS_PRIMARYKEY = 'NO' </cfquery> <cfcatch> <cfset this.ErrorState = true> <cfthrow m...

Sending Multiple Items to MVC Controller via jQuery.Ajax

If youa are serializing a form using something like jQuery, it will often map the JSON keys and values to the properties of a object on the Controller Action you are posting to. So: jQuery: function PostForm() { $.ajax({ url: "/Home/TestMVC", type: "POST", dataType: "application/JSON", data: $('#for...

Why can't typed optional arguments have a default of Null?

In ActionScript 3, when you declare an optional argument by giving it a default value, the value null cannot be used on typed arguments. function Action(Param:int=null){ // 1184: Incompatible default value of type Null where int is expected. } function Action(Param:int=0){ // No compiler errors } Any workarounds for this, or g...

Javascript : accessing function arguments generically

Here is what I have : var log = function(arg1, arg2){ console.log("inside :" + arg1 + " / " + arg2); }; var wrap = function(fn){ return function(args){ console.log("before :"); fn(args); console.log("after :"); } }; var fn = new wrap(log); fn(1,2); It is wrong, because I'd like to get in the console : b...

JavaScript: Get Argument Value and NAME of Passed Variable

What I want to do is get the NAME of a variable passed to a function and the VALUE of that variable and only have to pass in one variable to the function. So: var x = "anything"; function showName() { } showName(x); or showName("x"); Which will return: "x = anything". Right now, I have to do: showName("x", x); in order to ge...

What is the explicit difference between the fortran intents (in,out,inout)?

Hey. After searching for a while in books, here on stackoverflow and on the general web, I have found that it is difficult to find a straightforward explanation to the real differences between the fortran argument intents. The way I have understood it, is this: `intent(in)` -- The actual argument is copied to the dummy argument at ent...

calling Java soap webservice with rails -wrong number of arguments

Hey guys, I am trying to call a java soap webservice within my ruby on rails app. Therefor I use the following code: email = "[email protected]" pw = "legendary" XSD::Charset.encoding = 'UTF8' wsdlfile = "http://134.60.60.40:8080/FuturecanteenWebservice/DatabaseWSService?wsdl" driver = SOAP::WSDLDriverFactory.new(wsdlfile).cr...

Why are the arguments to atan2 Y,X rather than X,Y?

In C the atan2 function has the following signature: double atan2( double y, double x ); Other languages do this as well. This is the only function I know of that takes its arguments in Y,X order rather than X,Y order, and it screws me up regularly because when I think coordinates, I think (X,Y). Does anyone know why atan2's argumen...

getopt does not parse optional arguments to parameters

In C, getopt_long does not parse the optional arguments to command line parameters parameters. When I run the program, the optional argument is not recognized like the example run below. $ ./respond --praise John Kudos to John $ ./respond --blame John You suck ! $ ./respond --blame You suck ! Here is the test code. #include <stdio.h...

Pass an unary predicate to a function in C++

I need a function which stablishes for my class a policy for displaying items. e.g: SetDisplayPolicy(BOOLEAN_PRED_T f) This is assuming BOOLEAN_PRED_T is a function-pointer to some boolean predicate type like: typedef bool (*BOOLEAN_PRED_T) (int); I'm interested only on e.g: display something when the passed predicate is TRUE, do n...

Return values with reference arguments or by structure

In what situtations is it best to use reference arguments to return values? Sub Example(byref value as integer) value = 3 End Sub In what situations is it best to return the value (perhaps in a structure for more complex types)? Function Example() as integer return 3 End Function ...

Is there a standard way to list expected command line arguments?

I don't mean a man page or equivalent. You know how, when you start command line applications with insufficient or invalid command line arguments, they often output a one-liner showing the command line arguments they expected, then quit. Is there a standard way to write this one-liner? (i.e. Which command line arguments are required, w...

passing arguments as separate parameters in js

In javascript if I have some function I can use the arguments object to look at how many parameters were passed in. Is there a way to call a second function and pass those arguments as if they are just normal separate parameters? something like this: function f() { g(arguments); } function g(a, b, c) { alert(a+b+c); } So in this cas...

Why does a quoted string match bool method signature before a std::string?

Given the following methods: // Method 1 void add(const std::string& header, bool replace); //Method 2 void add(const std::string& name, const std::string& value); It would appear that the following code will end up calling method 1 instead of method 2: something.add("Hello", "World"); I ended up creating another method that looks...

Best way of making an argument optional for a C# webmethod

What is the best way of supporting optional data passed to a C# function? I have web service function in .Net which defines 5 arguments: [WebMethod] public string UploadFile( string wsURL , byte[] incomingArray , string FileName , string RecordTypeName , MetaData[] metaDataArray) The code of this ...