arguments

What are the problems/benefits of overloading an argument's type?

Often I write functions whose operation depends depends on the type of some argument. An example would be a function that would help me to insert rows into a mysql database. function insert($table, $columns, $values) { if(is_string($values)) { $values = "('" . $values . "')"; } else if(is_array($values)) { ...

How to pass an argument to event handler? python, tkinter programming

Hi friends., widget.bind('<Button-1>',callback) # binding def callback(self,event) #do something i need to pass an argument to callback() .the argument is a dictionary object. thanks in advance sag ...

volatile variables as argument to function

Having this code: typedef volatile int COUNT; COUNT functionOne( COUNT *number ); int functionTwo( int *number ); I can't get rid of some warnings.. I get this warning 1 at functionOne prototype [Warning] type qualifiers ignored on function return type and I get this warning 2, wherever I call functionTwo with a COU...

Cannot pass an argument to python with "#!/usr/bin/env python"

I needed to have a directly executable python script, so i started the file with "#!/usr/bin/env python". However, i also need unbuffered output, so i tried "#!/usr/bin/env python -u", but that doesn't work. ("python -u: no such file or directory") I found out that "#/usr/bin/python -u" works, but it doesn't suit my needs because i need...

Compound argument declaration

To make my code more concise, can I do something like int f(int const x, y, z), g(int const x, y, z); to declare functions f and g which each take three int const arguments? Edit: Perhaps here is a better example: int f(int const a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z); How would that not be m...

How can I call (not define) a function with a variable number of arguments in C?

Is there any way to make this code shorter? long call_f(int argc, long *argv) { switch (argc) { case 0: return f(); break; case 1: return f(argv[0]); break; case 2: return f(argv[0], argv[1]); break; case 3: return f(argv[0], argv[1], argv[2]); break; case 4: re...

How can i pass command line arguments to a standalone MATLAB executable running on linux/unix?

How can i pass command line arguments to a standalone MATLAB executable running on Linux/UNIX? I need to compile my MATLAB script as a standalone file that can be run on a machine without matlab present. It needs to be able to work in a way similar to C's argv[], where you do the following: COMMAND LINE: myfile argument1.txt argument2...

Create view in Drupal with a taxonomy argument that displays values for hierarchies

Hi there, I'm trying to get my view to work correctly using a taxonomy argument. My taxonomy has a hierarchy so if I supply the main taxonomy term (which has various sub-terms), I want it to show results for the main term plus all the sub-terms. However, at the moment it is only supplying results for the main term and excludes it's sub-...

Plus (+) in MVC Argument causes 404 on IIS 7.0

I have an MVC route that is giving me hell on a staging server running IIS. I am running Visual Studio 2010's development server locally. Here is a sample URL that actually works on my dev box: Root/CPUBoards/Full+Size Results Server Error404 - File or directory not found. The resource you are looking for might have been removed, had...

How do I convert passed flags/arguments to my Perl program without parsing them myself?

Hi, I would like to pass a perl program a set of arguments and flags, e.g. my_script.pl --flag1 --arg1=value --flag2 … Is there a way to quickly convert all of these into some standard structure (hash) instead of parsing? Thanks, Dave ...

PHP: Get method's arguments?

In php I can check all available methods for an object like so: $methods = get_class_methods($object); But how can I see wich arguments have to be sent to these methods? Is there a function for this? ...

Function/method argument validation standards.

I was just inquiring about standard practices of argument validation syntax. I'm working with PHP as of currently, but anything that's considered a platform/language agnostic solution would be great. As of currently, I'm aware of two pretty common syntax. For example (my preference): function foo($a, $b, $c){ if(!$a){ throw new Exc...

Python 3 argument (semi)not UTF-8 when passed from Windows batch.cmd

When I invoke a Python 3 script from a Windows batch.cmd, a UTF-8 arg is not passed as "UTF-8", but as a series of bytes, each of which are interpreted by Python as individual UTF-8 chars. How can I convert the Python 3 arg string to its intended UTF-8 state? The calling .cmd and the called .py are shown below. PS. As I mention in a ...

Flex 4, compile a class package for runtime class instantiation.

Hi, I'm looking for a way to ensure classes are compiled for dynamic run time instantiation using getDefinitionByName() in Flex4. I've looked at using the -include-libraries compiler argument but I would rather not have to pre-compile my classes in an swc. There appears to be another compiler argument -includes, but whenever I try thi...

Pass arguments from array in php to constructor

Normally, if I want to pass arguments from $myarray to $somefunction I can do this in php using call_user_func_array($somefunction, $myarray); However this does not work when the function one wishes to call is the constructor for an object. For fairly obvious reasons it does not work to do: $myobj = new call_user_func_array($classna...

what contents should be filled in PDT eclipse?

at "debug configurations" -> 'php script' -> 'new_config', on the right "PHP script arguments",what arguments should i fill in? for example: < ?php $tmp = $_GET['arg']; // is here the argument will be replaced ? echo $tmp; ?> i have no idea how to debug a URL with parameters. ...

No such file or directory in Pydev

I have a file in my project directory that I want to run a script on: myproject\file1 The script is in myproject\src\script. When I go to run configurations -> arguments tab and put file1, I get an: IOError: No such file or directory: 'file1' What am I doing wrong? ...

arguments problem help

i have created a win32 window it work fine but im tryin to get command argument using lpcmdline. it works fine but when i try to compare it to string it to does work here is the comparing code TCHAR checking[]=_T("hello"); if(args==checking) // args equals lpcmdline like this LPTSTR args=lpcmdline { TCHAR greeting[]=_T("heys"); } e...

passing integer arguments when using execve

Hello I am a beginner at programming using system calls in C. I am trying to use the execve call in one of my programs. I have to pass an integer as an argument to the program that is being invoked through execve. However, reading on the internet and seeing sample code, I can see that we can pass only strings as arguments. So, I tried c...

Using the argparse output to call functions.

Currently my code looks like this. It allows me to parse multiple parameters my program script gets. Is there a different way that is closer to 'best practices'? I haven't seen code actually using the output of argparse, only how to set it up. def useArguments(): x = 0 while x <= 5: if x == 0: ...