FAQ Database Discussion Community


c# - Reading commandline args with their associated values

c#,command-line,console-application,args,command-line-parsing
Was just wondering whether there is a way to read in commandlines in a console app with values. I can read in commandlines easily enough but can't seem to find any info about obtaining values from a commandline. For example(args): aTest = 5; bTest = 13; Would there be a...

Trouble with variable scope with args Ruby script

ruby,args
I am having a problem with variable scope when reading args into global variables in Ruby. I get this error when I run the following script. not sure what I am doing wrong; any ideas? $ ./parse_args_example.rb --config=./config/tests.yml --type=Mag --envs=['warm','humid'] ARGV => Creating new instance of FlashLight... ./parse_args_example.rb:45:in `<main>': undefined...

String args[] as an input for a method java

java,eclipse,args
I have this code and I am wondering what String args[] means here and how it can be used as an input I read many online comments but still confused about this thanks static int parse_commandline(String args[]) { // TODO range check if (args.length == 0) { System.err.println("No options are...

Pass Function To Main Method Args Cmd Prompt

c#,function,args
i am trying to pass a add or subtract function to main method args. in cmd if i run the program with 1 it should display the AddFunction and if i press it with 2 it should display the minusFunction. this is what i have done so far im a...

Netbeans input parameters

java,netbeans,args
I'm new to java development in Netbeans and I'm having issue supplying input parameters in Netbeans. If I build project and run the jar using cmd, everything works fine but I don't know how to supply parameters in IDE. Here is the mimimum exemple for testing: public class NetbeansRunParams {...

Use main args with SpingBoot & velocity

java,spring,velocity,args
I am making a program and I need to read from main args but I don't know how to proceed. my code public class Application { public static void main(String[] args) throws Exception { SpringApplication.run(Application.class, args); } } controller @Controller public class SampleControler { @Autowired private Checker checker; @RequestMapping("/monitoring") String...

How to check the end of args array?

java,arrays,scala,args
I am writing a parser program in Scala that should read input using "args" and pars it. It doesn't matter I use: while(!args.isEmpty){ if (Files.exists(Paths.get(args(j)))){ Statement=Statement.concat(inputXml) Statement=Statement.concat(" ") println(j) } else{ Statement=Statement.concat(args(j)) Statement=Statement.concat(" ") println(j) } j=j+1 } or while(args.length !=0) { if (Files.exists(Paths.get(args(j)))){ Statement=Statement.concat(inputXml) Statement=Statement.concat(" ") println(j) } else{...

Flask submit data outside of form input fields

python,forms,input,flask,args
I'm working with Flask, and I am trying to submit some data that is not in input fields, to be added to the database. jinja code with the form(s) looks like this: {% for item in items %} <tr> <form id="adauga_{{ item.stoc_id }}" action="{{ url_for('adauga') }}" method="POST"> <td>{{ item.stoc_id }}</td>...

Some informations of how handle the main() args in Java [duplicate]

java,intellij-idea,main,args
This question already has an answer here: How to make IntelliJ prompt me for command line arguments 1 answer I have to develop a command line Java application in which the main() method accept 2 String parameters named respetivelly partitaIVA and nomePDF. So, as starting point, I created this...

Manage multiple following positional argument with argparse

python,command-line-arguments,argparse,args
I'm using this lib for parsing arguments in python : https://docs.python.org/2/library/argparse.html So far I have this: prog arg1 [-s arg2 [arg2 ...]] [-m arg3 [arg3 ...]] And I want this: prog arg1 -s arg2 [arg2 ...] -m arg3 [arg3 ...] Here is my python code: parser = argparse.ArgumentParser() parser.add_argument('path', type=str,...

Removing infinity values of a function using exception handling, *args, and **kwargs

python-2.7,exception-handling,args,kwargs,gradient-descent
I'm currently working through the book Data Science from Scratch by Joel Grus, and I've run across a function that I don't really understand: def safe(f): def safe_f(*args, **kwargs): try: return f(*args, **kwargs) except: return float('inf') return safe_f The safe function is called within a Gradient Descent algorithm to remove...

using xargs bash command with spaces is possible?

unix,args
Here is my current command which i use: xargs -n 1 -P 250 php b <targets It is possible to using this command like that: xargs -n 1 -P 250 php b <targets [SOMETHINGELE] I mean the machine to execute like that: php b %target% %something else value% ...

Print Size of args[] array - out of bounds exception error

java,indexoutofboundsexception,args
I understand why an outofbounds error is thrown, but not why it is in this case. In the course text book, some exercises include writing code to "print out its' command line argument" and "add its two command line arguements" The two codes I've written are: public class AddToCommandLine {...

Java Date Format in “args”

java,date-format,simpledateformat,args
So, I'm using JD-GUI to decompile some Java class files which doesn't have any documentation. This Java Application is running on a Windows Server and running via taskscheduler with a cmd file (I don't know exactly what, intern here). If some one who worked with an args command can help...

arbitrary number of *args or ** kwargs in str.format() in Python

python,python-3.x,string-formatting,args,kwargs
I'm making a socket client and need to define a function which sends the following kind of message to server: sometext,[name_1],[name_2],...,[name_n]. Actually the message is more complex, but for the sake of an example I simplified it. Where: ... - represents the rest of the names (comma delimited) between name_2...

More Pythonic way to turn any number of different lists or tuples into one list [duplicate]

python,list,args
This question already has an answer here: Making a flat list out of list of lists in Python [duplicate] 8 answers I am trying to write a function to take in any number of different lists or tuples as arguments and return one big list. def addify(*args): big_list =...

Calling function with unknown number of parameters

python,args
I am trying to create a set of functions in python that will all do a similar operation on a set of inputs. All of the functions have one input parameter fixed and half of them also need a second parameter. For the sake of simplicity, below is a toy...