tagged [arguments]

Console app arguments, how arguments are passed to Main method

Console app arguments, how arguments are passed to Main method This would be question from c# beginner. When I create console application I get Main method with parameter as array string. I do not und...

26 Jan at 10:35

Pass argument to AsyncCallback function?

Pass argument to AsyncCallback function? I'm learning socket programming and I have the following function: and this is how the callback gets set: The problem is I need to pass another argument to OnD...

8 Feb at 11:46

Parsing Command Line Arguments in C++?

Parsing Command Line Arguments in C++? What is the best way of parsing command-line arguments in C++ if the program is specified to be run like this: Is there some way of doing this built into the sta...

10 Feb at 23:58

Pass a variable to a PHP script running from the command line

Pass a variable to a PHP script running from the command line I have a PHP file that is needed to be run from the command line (via [crontab](https://en.wikipedia.org/wiki/Cron#Overview)). I need to p...

How to expand a list to function arguments in Python

How to expand a list to function arguments in Python Is there syntax that allows you to expand a list into the arguments of a function call? Example: ``` # Trivial example function, not meant to do an...

9 Mar at 10:14

Accessing bash command line args $@ vs $*

Accessing bash command line args $@ vs $* In many SO questions and bash tutorials I see that I can access command line args in bash scripts in two ways: Which results in: What is the difference betwee...

3 Nov at 07:9

How to have multiple conditions for one if statement in python

How to have multiple conditions for one if statement in python So I am writing some code in python 3.1.5 that requires there be more than one condition for something to happen. Example: The problem is...

How do I parse command line arguments in Bash?

How do I parse command line arguments in Bash? Say, I have a script that gets called with this line: or this one: What's the accepted way of parsing this such that in each case (or some combination of...

C# Passing Function as Argument

C# Passing Function as Argument I've written a function in C# that does a numerical differentiation. It looks like this: I would like to be able to pass in any function, as in: ``` public double Diff(...

21 Mar at 23:8

Meaning of "[: too many arguments" error from if [] (square brackets)

Meaning of "[: too many arguments" error from if [] (square brackets) I couldn't find any one simple straightforward resource spelling out the meaning of and fix for the following BASH shell error, so...

8 May at 23:26

Best way to check function arguments?

Best way to check function arguments? I'm looking for an efficient way to check variables of a Python function. For example, I'd like to check arguments type and value. Is there a module for this? Or ...

6 Apr at 01:56

"TypeError: method() takes 1 positional argument but 2 were given" but I only passed one

"TypeError: method() takes 1 positional argument but 2 were given" but I only passed one If I have a class ... ... which I use to create an object ... ... on which I call `method("foo")` like so ... `...

20 Feb at 16:59

How can I find out if an .EXE has Command-Line Options?

How can I find out if an .EXE has Command-Line Options? Suppose you have an .EXE and you want to check if it has Command-Line Options. How can one know if the .EXE has this ability. In my case I know ...

Argument list too long error for rm, cp, mv commands

Argument list too long error for rm, cp, mv commands I have several hundred PDFs under a directory in UNIX. The names of the PDFs are really long (approx. 60 chars). When I try to delete all PDFs toge...

11 Nov at 17:28

How to send argument to class in Quartz.Net

How to send argument to class in Quartz.Net I'm using Quartz.Net (version 2) for running a method in a class every day at 8:00 and 20:00 (IntervalInHours = 12) Everything is OK since I used the same j...

Passing lengthy strings (as an argument) into a console application

Passing lengthy strings (as an argument) into a console application I'm creating a console application in C# to which, at execution, it is passed a bunch of data. Three of them are short strings, such...

How do I call a specific Method from a Python Script in C#?

How do I call a specific Method from a Python Script in C#? I'm wondering if there is a possibility to call a specific Method from a Python script over a C# project. I have no code... but my idea is: ...

Multiple optional parameters calling function

Multiple optional parameters calling function Assume that i have a function like this below It takes 3 parameters and 2 have optional values now i want to call this function like below how possible ? ...

Best way to parse command line arguments in C#?

Best way to parse command line arguments in C#? When building console applications that take parameters, you can use the arguments passed to `Main(string[] args)`. In the past I've simply indexed/loop...

23 May at 11:54

WPF Command Line Arguments, a smart way?

WPF Command Line Arguments, a smart way? I'm looking for a way that I can parse command line arguments into my WPF application with just a way of reading the value of the argument that the user passed...

10 Nov at 10:20

Endless method arguments of the same type

Endless method arguments of the same type I remember that I have red somewhere that you can create a method that takes endless arguments. The problem is that I don't remember how to do it. I remember ...

3 Jan at 20:24

build argument lists containing whitespace

build argument lists containing whitespace In bash one can escape arguments that contain whitespace. This also works for arguments to a command or function: So far so good, but what if I want to manip...

17 Jan at 20:39

find: missing argument to -exec

find: missing argument to -exec I was helped out today with a command, but it doesn't seem to be working. This is the command: The shell returns ``` find: missing argument to `-exec' ``` What I am bas...

19 Jun at 03:59

How do I pass a command line argument while starting up GDB in Linux?

How do I pass a command line argument while starting up GDB in Linux? I have to debug a program that has errors in it as part of my assignment. However, I must first pass command line arguments in ord...

When implementing command line flags, should I prefix with a fowardslash (/) or hyphen (-)?

When implementing command line flags, should I prefix with a fowardslash (/) or hyphen (-)? Are their any conventions (either written or just generally understood) for when to use a (/) or a (-) when ...

Best way to parse command-line parameters?

Best way to parse command-line parameters? What's the best way to parse command-line parameters in Scala? I personally prefer something lightweight that does not require external jar. Related: - [How ...

C# pass additional parameter to an event handler while binding the event at the run time

C# pass additional parameter to an event handler while binding the event at the run time I have a link button which have a regular click event : And I bind this event at the runtime : Now I need the f...

if arguments is equal to this string, define a variable like this string

if arguments is equal to this string, define a variable like this string I am doing some bash script and now I got one variable call `source` and one array called `samples`, like this: as I want to ex...

8 Jul at 06:24

Specify environmental variables as commandline parameter in a debug session of VisualStudio C#

Specify environmental variables as commandline parameter in a debug session of VisualStudio C# I want to use an environment variable as a commandline parameter in a debug session. So Project Propertie...

Default value on generic predicate as argument

Default value on generic predicate as argument First time question for me :) I need some way to define a default predicate using a generic on the format and then use this as a default argument. Someth...

26 Jan at 12:29

Generic methods and optional arguments

Generic methods and optional arguments Is it possible to write similar construction? I want to set, somehow, default value for argument of type T. Additionally, I found

21 Jul at 20:27

Is there a "standard" format for command line/shell help text?

Is there a "standard" format for command line/shell help text? If not, is there a de facto standard? Basically I'm writing a command line help text like so: ``` usage: app_name [options] required_inpu...

Passing command line arguments to argv in jupyter/ipython notebook

Passing command line arguments to argv in jupyter/ipython notebook I'm wondering if it's possible to populate `sys.argv` (or some other structure) with command line arguments in a jupyter/ipython note...

How to run Java program in command prompt

How to run Java program in command prompt I created a Java project to call a Web service. It has one Main java file and another class file. I have used some jar files for HTTP client. In Eclipse it ru...

Import SQL file by command line in Windows 7

Import SQL file by command line in Windows 7 I want to import an SQL file (size > 500MB) into a database. I have wamp on my PC. Phpmyadmin does not work well with this size. I changed all parameters i...

How can I pass a member function where a free function is expected?

How can I pass a member function where a free function is expected? The question is the following: consider this piece of code: ``` #include class aClass { public: void aTest(int a, int b) { p...

TypeError: generatecode() takes 0 positional arguments but 1 was given

TypeError: generatecode() takes 0 positional arguments but 1 was given I have the code below: ``` from tkinter import * class Window(Frame): def __init__(self, master = None): Frame.__init__(sel...

2 Jan at 22:15

mkdir's "-p" option

mkdir's "-p" option So this doesn't seem like a terribly complicated question I have, but it's one I can't find the answer to. I'm confused about what the `-p` option does in Unix. I used it for a lab...

docker build with --build-arg with multiple arguments

docker build with --build-arg with multiple arguments According to the [documentation](https://docs.docker.com/engine/reference/commandline/build/#set-build-time-variables-build-arg), it's possible to...

26 Dec at 06:13

How do I pass a unique_ptr argument to a constructor or a function?

How do I pass a unique_ptr argument to a constructor or a function? I'm new to move semantics in C++11 and I don't know very well how to handle `unique_ptr` parameters in constructors or functions. Co...

13 Nov at 22:44

Execute PowerShell Script from C# with Commandline Arguments

Execute PowerShell Script from C# with Commandline Arguments I need to execute a PowerShell script from within C#. The script needs commandline arguments. This is what I have done so far: ``` Runspace...

What is the difference between _tmain() and main() in C++?

What is the difference between _tmain() and main() in C++? If I run my C++ application with the following main() method everything is OK: ``` int main(int argc, char *argv[]) { cout

21 May at 23:45

Best way to check for null parameters (Guard Clauses)

Best way to check for null parameters (Guard Clauses) For example, you usually don't want parameters in a constructor to be null, so it's very normal to see some thing like Is there any way to check ...

21 Mar at 16:39

How to parse command line output from c#?

How to parse command line output from c#? I want to execute an application(command line application) from the C#... and I want after executing this application and providing the input to it, I want to...

Getting raw (unsplit) command line in .NET

Getting raw (unsplit) command line in .NET In .NET, we can easily access split command line arguments in a string array from the argument of `Main(string[])` or `Environment.GetCommandLineArgs()`. How...

30 May at 18:8

Powershell Execute remote exe with command line arguments on remote computer

Powershell Execute remote exe with command line arguments on remote computer I've searched all over and tried different variations of commands, but I am still not there yet. My goal is to run an exe t...

3 Mar at 18:27

How to handle command-line arguments in PowerShell

How to handle command-line arguments in PowerShell What is the "best" way to handle command-line arguments? It seems like there are several answers on what the "best" way is and as a result I am stuck...

29 Jun at 19:15

NDesk.Options: how to register required parameters correctly?

NDesk.Options: how to register required parameters correctly? I am trying to utilize the `OptionSet` class in the following way: ``` string resultsFileName = null; bool isHelp = false; var p = new O...

Running batch file with arguments from C#

Running batch file with arguments from C# I have a batch file like this I have my C# code as follows: ``` string MyBatchFile = @"C:\Program Files (x86)\MybatchFile.bat"; string _sourcePath = @"C:\Fold...

24 Jan at 10:5

Correct way to implement C# console application?

Correct way to implement C# console application? What is the correct way to implement and architect a command line tool as a C# console application? Concerns to address include proper parsing of comma...

7 May at 19:14