arguments

C++ Function arguments validation (pointer vs. reference arguments)

Possible Duplicate: When pass-by-pointer is preferred to pass-by-reference in C++? Hello everyone, What do you consider a better programming practice: passing objects as pointers or references to functions. What do you do for input validation? Thanks. ...

Simple python oo issue

Hello, Have a look a this simple example. I don't quite understand why o1 prints "Hello Alex" twice. I would think that because of the default self.a is always reset to the empty list. Could someone explain to me what's the rationale here? Thank you so much. class A(object): def __init__(self, a=[]): self.a = a o =...

Workaround for basic syntax not being parsed.

I want to have a class property that allow for an expression to take place on the right side of the equals sign. All versions of PHP choke on the following code, but it is written in this way to allow for easier extendibility in the future. /* Example SDK Class */ class SDK { /* Runtime Option Flags */ // Strings # 0: Makes...

How read method signature?

From method name I would like know its signature i.e. def myMethod(firt, second, third='something'): pass from myMethod name is possible have samenthig like that myMethod(firt, second, third='something') ...

drupal views block arguments

I currently have a view (Drupal 6 using Views2) that properly aggregates a custom content type (videos) and filters them for a page display. When I create a block display, it previews the results in live preview just great, but when i go to the page expecting to see the block it doesn't appear. I'm fairly certain the argument I'm attem...

How to pass a variable as an argument to a command with quotes in powershell

Hi there, My powershell script takes the following parameter: Param($BackedUpFilePath) The value that is getting passed into my script is: "\123.123.123.123\Backups\Website.7z" I have another variable which is the location I want to extract the file: $WebsiteDeploymentFolder = "C:\example" I am trying to extract the archive with t...

Call function in function arguments

I have a function, we'll call it funcA that returns an object. I want to pass that object to funcB. Can I do this? funcB(funcA()); so that funcA() is called first and the results are passed to funcB()? ...

JS function returning another function

I want to understand about variables, that has been used in returning function. This is example code Prototype = {} Prototype.F = { bind: function() { var args = arguments, __method = args.shift(), object = args.shift(); return function() { return __method.apply(object, args.concat(arguments)); } } } func...

echo that shell-escapes arguments

Is there a command that not just echos it's argument but also escapes them if needed (e.g. if a argument contains white space or a special character)? I'd need it in some shell magic where instead of executing a command in one script I echo the command. This output gets piped to a python script that finally executes the commands in a mo...

How does the C compiler implement functions with Variable numbers of arguments?

Hi Everybody, I attended a technical interview a few days ago, and I was asked How does the C compiler implments function with Variable number of arguments? How does it pass the on the stack? Does anyone know or can explian that? Thanks, Dan ...

unix - how to deal with too many args for cat

I have a bunch of files in a directory, each with one line of text. I want to cat all of these files together (all the one liners) into a single, large file. However, when I use cat there are too many arguments. How can I get around this? ...

Merge decorator function as class

Need to create a class that will do all things as the "merge" function. In class i will change, process and add new arguments. def merge(*arg, **kwarg): # get decorator args & kwargs def func(f): def tmp(*args, **kwargs): # get function args & kwargs kwargs.update(kwarg) # merge two dictionaries r...

Flash Builder 4 - using relative paths with the -output (-o) compiler argument

I'm trying to use a relative path in the -output compiler argument, here's what I've tried (with and without quotes): -o="./deploy/file.swf" -o="/./deploy/file.swf" -o="./file.swf" -o="/./file.swf" -o="file.swf" -o="file.swf" None of these attempts yields a new file, it's as if they are ignored. The deploy directory is in the roo...

How do I get a Type[] with arguments from a MethodCallExpression?

I'm reflecting over a class (in a unit test of said class) to make sure its members have all the required attributes. To do so, I've constructed a couple of helpers, that take an Expression as an argument. I do some checks for it, and take slightly different actions depending on what type of Expression it is, but it's basically the same....

Pass elements of a list as arguments to a function in python

I'm building a simple interpreter in python and I'm having trouble handling differing numbers of arguments to my functions. My current method is to get a list of the commands/arguments as follows. args = str(raw_input('>> ')).split() com = args.pop(0) Then to execute com, I check to see if it is in my dictionary of command-> code mapp...

default values for variable argument list in Python

Is it possible to set a default value for a variable argument list in Python 3? Something like: def do_it(*args=(2, 5, 21)): pass I wonder that a variable argument list is of type tuple but no tuple is accepted here. ...

Detect if parameter passed is an array? Javascript.

Hello all, I have a simple question: How do I detect if a parameter passed to my javascript function is an array? I don't believe that I can test: if (typeof paramThatCouldBeArray == 'array') So is it possible? How would I do it? Thanks in advance. ...

Accessing variable from ARGV

I'm writing a cPanel postwwwact script, if you're not familiar with the script its run after a new account is created. it relies on the user account variable being passed to the script which i then use for various things (creating databases etc). However, I can't seem to find the right way to access the variable i want. I'm not that good...

PHP function to find out the number of parameters passed into function?

Hi all, Is there a PHP function to find the number of parameters to be received/passed to a particular function? ...

Constructing a function call in C

Given that I have a pointer to a function (provided by dlsym() for example) and a linked list of typed arguments, how can I construct a C function call with those arguments? Example: struct param { enum type { INT32, INT64, STRING, BOOL } type; union { int i32; long long i64; char *str; bool b; } value; struct param *next; };...