argument-passing

Postgres integer arrays as parameters?

柔情痞子 提交于 2019-11-28 17:29:44
I understand that in Postgres pure, you can pass an integer array into a function but that this isn't supported in the .NET data provider Npgsql. I currently have a DbCommand into which I load a call to a stored proc, add in a parameter and execute scalar to get back an Id to populate an object with. This now needs to take n integers as arguments. These are used to create child records linking the newly created record by it's id to the integer arguments. Ideally I'd rather not have to make multiple ExecuteNonQuery calls on my DbCommand for each of the integers, so I'm about to build a csv

How to pass arguments to functions by the click of button in PyQt?

徘徊边缘 提交于 2019-11-28 17:13:25
问题 I want to pass the arguments to a function when I click the button. What should I add to this line button.connect(button, QtCore.SIGNAL('clicked()'), calluser(name)) so it will pass the value to the function: def calluser(name): print name def Qbutton(): button = QtGui.QPushButton("button",widget) name = "user" button.setGeometry(100,100, 60, 35) button.connect(button, QtCore.SIGNAL('clicked()'), calluser(name)) One more thing, buttons will be generated using for loop; so name value will vary

Passing variables from main form to input form

我与影子孤独终老i 提交于 2019-11-28 12:55:45
问题 I have a simple question. I have a main form, and then a startup form from where I can select a new 3D model to generate. When selecting a new 3D model from the startup form, I want to check first whether the previous model I worked on has been saved or not. I simply want to pass a boolean value from the main form to the startup form using a delegate, but I can't seem to access the main form or any of its variables. I thought it would be as simple as saying: <code>frmMain myForm = new frmMain

Parsing/passing command line arguments to a bash script - what is the difference between “$@” and “$*”?

依然范特西╮ 提交于 2019-11-28 10:12:18
I am using a bash script to call and execute a .jar file from any location without having to constantly enter its explicit path. The .jar requires additional variable parameters to be specified at execution, and as these can be anything, they cannot be hard coded into the script. There are 3 variables in total, the first specifies 1 of 2 actions that the .jar is to make, the second specifies a target file to enact this action on and the third specifies the name of a file that the action is to create. The script I am currently using is: #!/bin/bash java -jar "C:\path\to\file.jar" "$1" "$2" "$3"

Using command-line argument for passing files to a program

会有一股神秘感。 提交于 2019-11-28 09:24:49
How can I receive a file as a command-line argument? Just the path of the file is passed, inside your program use the Java File class to handle it This takes the first parameter as the file path: import java.io.File; public class SomeProgram { public static void main(String[] args) { if(args.length > 0) { File file = new File(args[0]); // Work with your 'file' object here } } } in Java, the main method receives an array of String as argument, as you probably have noticed. you can give another name to the parameter args , but this is the most used one. the array args contains the values of what

pass parameters to php with shell

痞子三分冷 提交于 2019-11-28 07:32:44
问题 my question is probably easy to answer. i want to execute my php file with shell and pass parameters to it via shell example php test.php parameter1 parameter2 is there a way to do that except using GET ? thanks 回答1: Yes you can do it like that but you should reference the arguments from the $_SERVER['argv'] array. $_SERVER['argc'] will tell you how many args were received, should you want to use that as a first layer of validation to make sure a required number of args were input. To

Argument conversion: (normal) pointer to void pointer, cast needed?

大城市里の小女人 提交于 2019-11-28 03:56:29
问题 When assigning to or from a void -pointer no cast is needed (C99 §6.3.2.2 sub 1 / §6.5.16.1 sub 1). Is this also true when passing a (for example int -)pointer to a function that expects a void -pointer? For example: void foo(void * p){ // Do something } int main(){ int i = 12; foo(&i); // int * to void *: no cast needed? } When I compile this with GCC (4.8.1, MinGW-32) I get neither errors nor warnings (with -Wall & -pedantic ). In contrast in this answer it is suggested that a cast is

How to pass a function and its arguments through a wrapper function in R? Similar to *args and *kwargs in python

本秂侑毒 提交于 2019-11-28 03:46:31
问题 I want to write a wrapper function in R. I should take a function and its arguments. Do something, and then call the function with the supplied arguments. I know how to do it in python, but I search for an implementation in R. In python I would write: def wrapper(func, *args, **kwargs): #do something here return func(*args, **kwargs) 回答1: wrapper <- function(func, ...) { func(...) } 来源: https://stackoverflow.com/questions/8165837/how-to-pass-a-function-and-its-arguments-through-a-wrapper

passing parameters to bash when executing a script fetched by curl

荒凉一梦 提交于 2019-11-28 03:02:14
I know how to execute remote bash script, via these syntaxes: curl http://foo.com/script.sh | bash or bash < <( curl http://foo.com/script.sh ) which give the same result. But what if I need to pass arguments to the bash script ? It's possible when the script is saved locally: ./script.sh argument1 argument2 I tried several possibilities like this one, without success: bash < <( curl http://foo.com/script.sh ) argument1 argument2 try curl http://foo.com/script.sh | bash -s arg1 arg2 bash manual says: If the -s option is present, or if no arguments remain after option processing, then commands

Why do argument lists in certain Cocoa methods end with a nil?

好久不见. 提交于 2019-11-28 01:57:15
Why do argument list in some methods end with nil ? I have noticed this particularly in the collection classes, for example NSSet : mySet = [NSSet setWithObjects:someData, aValue, aString, nil]; and NSArray : NSArray *objects = [NSArray arrayWithObjects:@"value1", @"value2", @"value3", nil]; It has to do with how variable argument lists work ( va_list , seen as ... in the parameters). When the code is trying to extract all of the values in the list, it needs to know when to stop (because it doesn't know how many there are). We denote the end of the list with a special value called a "sentinel"