Search Results

Search found 3518 results on 141 pages for 'arguments'.

Page 2/141 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Pass arguments when using the File protocol

    - by Ando
    I found this question being asked on several places on the internet (including the File protocol MSDN page) but no clear answer. So, if I am calling my application like this: file://c:\myapp.exe is there any way to pass it some command line arguments, like /nospashscreen=true Things I've tried: file://c:\myapp.exe?/nospashscreen=true - launches the app, but with no command line arguments :( Thanks in advance.

    Read the article

  • How to iterate over function arguments

    - by Jack
    I have a Python function accepting several string arguments def foo(a, b, c): and concatenating them in a string. I want to iterate over all function arguments to check they are not None. How it can be done? Is there a quick way to convert None to ""? Thanks.

    Read the article

  • Mac OS X: Getting detailed process information (specifically its launch arguments) for arbitrary run

    - by Jasarien
    I am trying to detect when particular applications are launched. Currently I am using NSWorkspace, registering for the "did launch application" notification. I also use the runningApplications method to get apps that are currently running when my app starts. For most apps, the name of the app bundle is enough. I have a plist of "known apps" that I cross check with the name of that passed in the notification. This works fine until you come across an app that acts as a proxy for launching another application using command line arguments. Example: The newly released Portal on the Mac doesn't have a dedicated app bundle. Steam can create a shortcut, which serves as nothing more than to launch the hl2_osx app with the -game argument and portal as it's parameter. Since more Source based games are heading to the Mac, I imagine they'll use the same method to launch, effectively running the hl2_osx app with the -game argument. Is there a nice way to get a list of the arguments (and their parameters) using a Cocoa API? NSProcessInfo comes close, offering an `-arguments' method, but only provides information for its own process... NSRunningApplication offers the ability to get information about arbitrary apps using a PID, but no command line args... Is there anything that fills the gap between the two? I'm trying not to go down the route of spawning an NSTask to run ps -p [pid] and parsing the output... I'd prefer something more high level.

    Read the article

  • Processing command-line arguments in prefix notation in Python

    - by ejm
    I'm trying to parse a command-line in Python which looks like the following: $ ./command -o option1 arg1 -o option2 arg2 arg3 In other words, the command takes an unlimited number of arguments, and each argument may optionally be preceded with an -o option, which relates specifically to that argument. I think this is called a "prefix notation". In the Bourne shell I would do something like the following: while test -n "$1" do if test "$1" = '-o' then option="$2" shift 2 fi # Work with $1 (the argument) and $option (the option) # ... shift done Looking around at the Bash tutorials, etc. this seems to be the accepted idiom, so I'm guessing Bash is optimized to work with command-line arguments this way. Trying to implement this pattern in Python, my first guess was to use pop(), as this is basically a stack operation. But I'm guessing this won't work as well on Python because the list of arguments in sys.argv is in the wrong order and would have to be processed like a queue (i.e. pop from the left). I've read that lists are not optimized for use as queues in Python. So, my ideas are: convert argv to a collections.deque and use popleft(), reverse argv using reverse() and use pop(), or maybe just work with the int list indices themselves. Does anyone know of a better way to do this, otherwise which of my ideas would be best-practise in Python?

    Read the article

  • Variadic functions and arguments assignment in C/C++

    - by Rizo
    I was wondering if in C/C++ language it is possible to pass arguments to function in key-value form. For example in python you can do: def some_function(arg0 = "default_value", arg1): # (...) value1 = "passed_value" some_function(arg1 = value1) So the alternative code in C could look like this: void some_function(char *arg0 = "default_value", char *arg1) { ; } int main() { char *value1 = "passed_value"; some_function(arg1 = value1); return(0); } So the arguments to use in some_function would be: arg0 = "default_value" arg1 = "passed_value" Any ideas?

    Read the article

  • Haskell: reading multiple command line arguments

    - by Survot
    Hi all, Okay, so I am making a program in Haskell that needs to change certain words based on two command line arguments. I have made the replace function and everything works great, but I am stumped getting it to work with command line arguments. Here is the main code: (replace function not included) main = do text <- getContents (command1:command2:_) <- getArgs putStrLn (replace (read command1) (read command2) text) So for intstance in the terminal I want to be able to type something like: "--- cat textfile.txt | ./replace oldword newword" I know this code is close since I have seen others do it this way. O_o Thanks for any help

    Read the article

  • Ruby Methods: return an usage string when insufficient arguments are given

    - by Shyam
    Hi, After creating a serious bunch of classes, with initialize methods, loading them in IRb requires to look back at the code. However, I think it should be easy enough to return a usage message, instead of: ArgumentError: wrong number of arguments (0 for 9) So I prefer to return a string with the human readable arguments, by example using "puts" or just a return of a string. Now I have seen the rescue keyword inside begin-end code, but I wonder how I could catch the ArgumentError when the initialize method is called. Thank you for your answers, feedback and comments!

    Read the article

  • Passing arguments to Shared Function - C

    - by SpyrosR
    I have used dlopen to load an object and dlsym to get a function pointer to a shared object function. Everything works fine. I have tested it calling then the shared function which (for now) only prints and it works-prints fine in the main program calling it. Now I want to pass two arguments to this function. An int and a char * .Can anyone help me understand how can I pass arguments to a shared function? I have searched in the web but I cannot understand how it works.

    Read the article

  • Overload Resolution and Optional Arguments in C# 4

    - by Dale McCoy
    I am working with some code that has seven overloads of a function TraceWrite: void TraceWrite(string Application, LogLevelENUM LogLevel, string Message, string Data = ""); void TraceWrite(string Application, LogLevelENUM LogLevel, string Message, bool LogToFileOnly, string Data = ""); void TraceWrite(string Application, LogLevelENUM LogLevel, string Message, string PieceID, string Data = ""); void TraceWrite(string Application, LogLevelENUM LogLevel, string Message, LogWindowCommandENUM LogWindowCommand, string Data = ""); void TraceWrite(string Application, LogLevelENUM LogLevel, string Message, bool UserMessage, int UserMessagePercent, string Data = ""); void TraceWrite(string Application, LogLevelENUM LogLevel, string Message, string PieceID, LogWindowCommandENUM LogWindowCommand, string Data = ""); void TraceWrite(string Application, LogLevelENUM LogLevel, string Message, LogWindowCommandENUM LogWindowCommand, bool UserMessage, int UserMessagePercent, string Data = ""); (All public static, namespacing noise elided above and throughout.) So, with that background: 1) Elsewhere, I call TraceWrite with four arguments: string, LogLevelENUM, string, bool, and I get the following errors: error CS1502: The best overloaded method match for 'TraceWrite(string, LogLevelENUM, string, string)' has some invalid arguments error CS1503: Argument '4': cannot convert from 'bool' to 'string' Why doesn't this call resolve to the second overload? (TraceWrite(string, LogLevelENUM, string, bool, string = "")) 2) If I were to call TraceWrite with string, LogLevelENUM, string, string, which overload would be called? The first or the third? And why?

    Read the article

  • Library for parsing arguments GNU-style?

    - by Delan Azabani
    I've noticed the basic 'style' of most GNU core applications whereby arguments are: --longoption --longoption=value or --longoption value -abcdefg (multiple options) -iuwww-data (option i, u = www-data) They follow the above style. I want to avoid writing an argument parser if there's a library that does this using the above style. Is there one you know of?

    Read the article

  • Reconstruction of java command line arguments

    - by notnoop
    Is there a way to reconstruct the command line arguments passed to Java within a Java program, including the JVM options and classpath option? I have a Java program that needs to restart the JVM and manipulate its bootclasspath (i.e. trying to override some system classes). I use the libc system method to invoke the new JVM. I'm open for better approaches, but Java agents isn't an option.

    Read the article

  • Multiple GET arguments

    - by AJ Ravindiran
    Hello, I've been working with PHP lately, and I came across something I couldn't solve. So basically, I have a form: <form method="get"> <fieldset class="display-options" style="float: left"> Search by name or ip: <input type="text" name="key" value="" />&nbsp; <input type="submit" class="button2" value="Search" /> </fieldset> </form> The problem is, I currently already have a argument: http://example.com/logs.php?type=admin&page=1 How would i pass the given form argument with the already existing arguments? Like so: http://example.com/logs.php?type=admin&page=1&key=name Thanks in advance, AJ.

    Read the article

  • C++ overloading operator comma for variadic arguments

    - by uray
    is it possible to construct variadic arguments for function by overloading operator comma of the argument? i want to see an example how to do so.., maybe something like this: template <typename T> class ArgList { public: ArgList(const T& a); ArgList<T>& operator,(const T& a,const T& b); } //declaration void myFunction(ArgList<int> list); //in use: myFunction(1,2,3,4); //or maybe: myFunction(ArgList<int>(1),2,3,4);

    Read the article

  • Passing multiple arguments to a UNIX shell script

    - by Waffles
    I have the following (bash) shell script, that I would ideally use to kill multiple processes by name. #!/bin/bash kill `ps -A | grep $* | awk '{ print $1 }'` However, while this script works is one argument is passed: end chrome (the name of the script is end) it does not work if more than one argument is passed: $end chrome firefox grep: firefox: No such file or directory What is going on here? I thought the $* passes multiple arguments to the shell script in sequence. I'm not mistyping anything in my input - and I the programs I want to kill (chrome and firefox) are open. Any help is appreciated.

    Read the article

  • TypeError: Python thinks that I passed a function 2 arguments but I only passed it 1

    - by slhck
    I work on something in Seattle Repy which is a restricted subset of Python. Anyway, I wanted to implement my own Queue that derives from a list: class Queue(list): job_count = 0 def __init__(self): list.__init__(self) def appendleft(item): item.creation_time = getruntime() item.current_count = self.job_count self.insert(0, item) def pop(): item = self.pop() item.pop_time = getruntime() return item Now I call this in my main server, where I use my own Job class to pass Jobs to the Queue: mycontext['queue'] = Queue() # ... job = Job(str(ip), message) mycontext['queue'].appendleft(job) The last line raises the following exception: Exception (with type 'exceptions.TypeError'): appendleft() takes exactly 1 argument (2 given) I'm relatively new to Python, so could anyone explain to me why it would think that I gave appendleft() two arguments when there obviously was only one?

    Read the article

  • Passing arguments and values form HTML to jQuery (events)

    - by Jaroslav Moravec
    What is the practice to pass arguments from HTML to jQuery events function. For example getting id of row from db: <tr class="jq_killMe" id="thisItemId-id"> ... </tr> and jQuery: $(".jq_killMe").click(function () { var tmp = $(this).attr('id).split("-"); var id = tmp[0] // ... } What's the best practise, if I want to pass more than one argument? Is it better not to use jQuery? For example: <tr onclick="killMe('id')"> ... </tr> I didn't find the answer on my question, I will be glad even for links. Thanks.

    Read the article

  • Default Arguments in Matlab

    - by Scott
    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 get: ??? Error: File: wave.m Line: 1 Column: 37 The expression to the left of the equals sign is not a valid target for an assignment. Thanks!

    Read the article

  • c++: truth assignment warning with arguments?

    - by John
    I use the following to work with arguments in my programs, but it seems to just hand me a warning (just a warning): "warning: suggest parentheses around assignment used as truth value" The beginning of the code is as follows: enum{OPT_DISP_H = 0x2, OPT_DISP_W = 0x1}; int main(int argc, char *argv[]) { int opt = 0x00; char c; while((++argv)[0] && argv[0][0]=='-'){ while(c =* ++argv[0]) switch(c){ case 'h': opt |= OPT_DISP_H; break; //etc.. The while(c =* ++argv[0]) part being where the warning persists. The code works fine, but what does this warning mean opposed to what is used? I think the code is c = *++argv[0], using the pointer. So why does the single = work and what is really recommended to be used?

    Read the article

  • How does R treat positional arguments

    - by inspectorG4dget
    I'm a python guy and very new to R (so far, all I've done is copy-paste code and screen-shot the resulting, graph). I would now like to actually learn the language so that I can draw useful plots (right now, I am trying to plot this). In attempting my first plot, I came across this function call: sets_options("universe", seq(from = 0, to = 25, by = 0.1)) Now, I would like to know if I can achieve the same result by calling sets_options("universe", seq(0, 25, 0.1)) The help page for seq doesn't speak to this specifically (or I'm not reading it correctly), so I was hoping someone could shed some light on how R handles positional arguments I tried calling the function that way in R and it worked (no syntax errors, etc), but I don't know how to test the output of that function, so I'm forced to ask here

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >