argument-passing

How can I pass command-line arguments via file association in Vista 64?

╄→гoц情女王★ 提交于 2019-12-04 13:03:58
问题 How can one pass command line arguments via file association in Vista 64? I recently built a PC running Vista Ultimate 64-bit. I noticed several of the Perl scripts I transferred failed due to command-line arguments not being passed. As a simple test, I wrote the following (foo.pl): #!/usr/bin/perl -w use strict; my $num_args = $#ARGV + 1; print "${num_args} arguments read\n"; print "$^X\n" # to see what was being used Running "foo.pl 1 2 3" undesirably yielded: 0 arguments read C:\strawberry

C++ member function pointer with different arguments - or is this bad anyway?

我怕爱的太早我们不能终老 提交于 2019-12-04 12:04:57
Even though I fear that you will tell me that this topic was covered several time, I dare to ask it, since I was not able to generate a solution. Probably I was just looking for the wrong thing... Assume that I have a function which receives a "mode" from some external function. Depending on the mode, the function will call different member functions of the same object. This works well for me with member function without any argument, but I did not find out how to extend it to members with arguments. In the real world application, the arguments are not int/float but a more complex classes and

How to Use an Environment Variable as an Environment Variable Name

余生颓废 提交于 2019-12-04 11:25:09
In my pursuit of a solution to another environment-variable/batch-file related problem, I have once again come across a problem I have visited before (but cannot for the life of me remember how, or even if I solved it). Say you have two BAT files (or one batch file and the command line). How can one pass an environment variable name to the other so that it can read the variable? The following example does not work: A.BAT: @call b.bat path B.BAT: @echo %%1% > A.BAT > %1 > B.BAT path > %1 It is easy enough to pass the environment variable name, but the callee cannot seem to use it. (I don’t

How can I pass <arguments> to IRB if I don't specify <programfile>?

自古美人都是妖i 提交于 2019-12-04 09:21:49
问题 Since: irb --help Usage: irb.rb [options] [programfile] [arguments] I know I can pass arguments to ARGV if I include a programfile eg: irb test.rb A B C where test.irb is simply "p ARGV" produces: ["a", "b", "c"] Making programfile be con in DOS... I can do following irb con A B C con(main):001:0> ARGV produces: ARGV => ["A", "B", "C"] but this is system dependent and has the side effect of echoing input :-( What i really like is something like irb -- a b c BTW: I know I can set ARGV inside

Remove last argument from argument list of shell script (bash)

南楼画角 提交于 2019-12-04 07:58:28
问题 This question concerns a bash script that is run in automator osx. I am using automator actions to get and filter a bunch of file references from the finder. Then I append to that list the name of the parent folder, also via an automator action. Automator then feeds these arguments to an action called "run shell script". I am not sure exactly how automator invokes the script but the argument list looks like this when echoed with: echo "$@" /Volumes/G-Raid/Online/WAV_TEST/Testbok 50/01/01000

What are the differences between parameter definitions as (type& name), and (type* name)?

别说谁变了你拦得住时间么 提交于 2019-12-04 07:31:11
A very basic question, but still, it would be good to hear from C++ gurus out there. There are two rather similar ways to declare by-reference parameters in C++. 1) Using "asterisk": void DoOne(std::wstring* iData); 2) Using "ampersand": void DoTwo(std::wstring& iData); What are implications of each method? Are there any gotcha's in any case? Bonus #1: What would be a formal way to call method in #1 and #2? Are they both called "by-reference"? Bonus #2: std::wstring is used deliberately. What would be implications towards standard library classes in each case? #1 uses a pointer parameter (

Using callNextMethod() within accessor function in R

混江龙づ霸主 提交于 2019-12-04 06:54:53
This is related to the following post Problems passing arguments with callNextMethod() in R I am writing accessors for two S4 classes, 'foo' and 'bar'. 'bar' inherits from foo and is extended only by a few slots. Instead of writing a full accessor function for objects of class 'bar' I want to pass the arguments to callNextMethod() when accessing a slot that is inherited by 'foo'. My code looks like this: foo <- setClass("foo", representation(x = "numeric", y = "numeric")) bar <- setClass("bar", representation(distance = "numeric"), contains = "foo") setMethod("[", "bar", function(x, i, j, drop

How to pass arguments (not command line arguments) to functions within batch scripts

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-04 05:03:00
I'm writing a batch file for automating the creation of typical folder structures for products that we sell. I would like to be able to call my batch file with 2 optional arguments; the name of the supplier and a file for creating lots of folders at once. If no supplier is supplied the script asks via standard input who the supplier is. If no file is supplied the script asks for the name of the folder you wish to create. If a file is passed as an argument I would like the script to read the file line by line and create a folder for each line, named after the contents of that line. Here is the

Process.Start - Pass html code to exe as argument

时光怂恿深爱的人放手 提交于 2019-12-04 03:32:23
问题 I am using the code below to start a executable file from a windows service and I need to pass html code (stored in a variable) as an argument. I am escaping with double quotes but this is not working. What do I need to do in order to pass this correctly? Thanks in advance for any guidance that is offered. Inside the service: Process.Start(@"E:\Program Files\MyApp.exe", dr["rec"].ToString() + " \"" + subject + "\" \"" + htmlVar); and then within MyApp.exe: static void Main(string[] args) {

PHP: Pass anonymous function as argument

為{幸葍}努か 提交于 2019-12-04 00:53:19
Is it possible to pass an anonymous function as an argument, and have it execute immediately, thus passing the function's return value? function myFunction(Array $data){ print_r($data); } myFunction(function(){ $data = array( 'fruit' => 'apple', 'vegetable' => 'broccoli', 'other' => 'canned soup'); return $data; }); This throws an error due to the Array type-hint, complaining of an object being passed. Alright, if I remove the type-hint, it of course spits out Closure Object , rather than the results I want. I understand that I am technically passing an object instance of Closure to myFunction