parameter-passing

Can't pass a script block as a parameter to powershell.exe via -Command

不羁岁月 提交于 2019-12-04 19:39:54
I'm trying this $Global:commandBlock={ Start-Transcript -path $projectFolder\gruntLog.txt; grunt $argList; Stop-Transcript } $cmdProc=start-process powershell -ArgumentList ('-command `$Global:commandBlock') -WorkingDirectory $fwd -PassThru -NoNewWindow:$NoNewWindow And keep getting $commandBlock : The term '$Global:commandBlock' is not recognized as the name of a cmdlet, function, script file, or operable program. My guess was it has to do with scope. But making variable global didn't help. Adding -args $commandBlock like that: -ArgumentList ('-command `$Global:commandBlock -args "

Passing arguments into multiple match_fun functions in R fuzzyjoin::fuzzy_join

ぐ巨炮叔叔 提交于 2019-12-04 18:14:46
I was answering these two questions and got an adequate solution, but I had trouble passing arguments using fuzzy_join into the match_fun that I extracted from fuzzyjoin::stringdist_join . In this case, I'm using a mix of multiple match_fun's, including this customized match_fun_stringdist and also == and <= for exact and criteria matching. The error message I'm getting is: # Error in mf(rep(u_x, n_y), rep(u_y, each = n_x), ...): object 'ignore_case' not found # Data: library(data.table, quietly = TRUE) Address1 <- c("786, GALI NO 5, XYZ","rambo, 45, strret 4, atlast, pqr","23/4, 23RD FLOOR,

Pass Array .jsp to .jsp

时间秒杀一切 提交于 2019-12-04 18:11:09
I am wondering how to pass an array or a list from one .jsp page to another. I want to then take the values from this array and assign them to a javascript array. I think I have the source jsp page configured correctly, but was wondering how to get the values in the second .jsp page. This is my source .jsp file: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Firstjsp</title> </head> <body> <Form Method = "Post" Action = "Mapper.jsp"> <% String locations[] = {"Loan 1", "33.890542", "151.274856", "Address 1","true", "-35404.34"}; for (int i =0; i

bash: passing paths with spaces as parameters?

ぐ巨炮叔叔 提交于 2019-12-04 16:20:22
问题 I have a bash script that recieves a set of files from the user. These files are sometimes under directories with spaces in their names. Unfortunately unlike this question all the filenames are passed via the command line interface. Let's assume the paths are correctly quoted as they are passed in by the user, so spaces (save for quoted spaces) are delimiters between paths. How would I forward these parameters to a subroutine within my bash script in a way that preserves the quoted spaces?

In Bash, is there a way to expand variables twice in double quotes?

拥有回忆 提交于 2019-12-04 14:54:33
For debugging my scripts, I would like to add the internal variables $FUNCNAME and $LINENO at the beginning of each of my outputs, so I know what function and line number the output occurs on. foo(){ local bar="something" echo "$FUNCNAME $LINENO: I just set bar to $bar" } But since there will be many debugging outputs, it would be cleaner if I could do something like the following: foo(){ local trace='$FUNCNAME $LINENO' local bar="something" echo "$trace: I just set bar to $bar" } But the above literally outputs: "$FUNCNAME $LINENO: I just set bar to something" I think it does this because

Pass a variable number of bash command line arguments to a MATLAB function

不打扰是莪最后的温柔 提交于 2019-12-04 14:26:19
Arguments that are passed to a bash script can be passed on to a MATLAB function in the following way: #!/bin/bash matlab -nodesktop -nosplash -nodisplay -r "my_function('$1','$2')" But how to do this if I do not know the number of arguments to pass a priori? So I want to do something like this: #!/bin/bash matlab -nodesktop -nosplash -nodisplay -r "my_function('$1',...,'$N')" where I do not know what number N equals to a priori. I figure that you could create a string with a for loop containing '$1',...,'$N' and pass the entire string to the above command. But isn't there a more succinct

Correct usage of `for_each_arg` - too much forwarding?

瘦欲@ 提交于 2019-12-04 13:16:10
I'm really happy to have discovered for_each_arg(...) , which makes dealing with argument packs much easier. template<class F, class...Ts> F for_each_arg(F f, Ts&&...a) { return (void)initializer_list<int>{(ref(f)((Ts&&)a),0)...}, f; } I'm, however, confused on its correct usage. There are many arguments that need to be perfectly forwarded, but am I performing any unnecessary forwarding? Reading the code becomes harder with excessive fowarding. struct UselessContainer { // Expects a perfectly-forwarded item to emplace template<typename T> void add(T&&) { } }; // Creates an `UselessContainer`

How to inspect the types of a function's parameters?

不羁的心 提交于 2019-12-04 09:56:46
I have an application where I'm building a function, marshal_and_apply , which calls some other function (or functor), f with some arguments. marshal_and_apply 's job is to apply some special marshaling for the arguments depending on the type of f 's parameters. If one of f 's parameters is of a special type, marshal_me<T> , then marshal_and_apply will marshal the parameter through some specially allocated storage before passing it to f . In order to perform the allocation, the storage requirements of all the parameters must be known to marshal_and_apply before any can be marshaled. Some

How to pass needed parameters to script in Powershell ISE?

二次信任 提交于 2019-12-04 08:46:24
问题 See Title. I specified needed parameters in the head of a script: param ($G_ARCHIVE = $(throw "Need file to upload!"), $G_LOGFILE = $(throw "Need logfile!")) When I want to debug the script with Powershell ISE: how can I fill these parameters? 回答1: Use the command pane. Open the script file in the ISE editor, set the breakpoints (F9). Then in the command pane type a command invoking this script with required parameters. I do not think there is another (built-in) way of doing this in ISE. 回答2:

How to pass objects from one page to another page in JSF without writing a converter

痴心易碎 提交于 2019-12-04 08:39:33
first of all sorry for my english. I have two pages in JSF2, one to list Passengers and another one to create/update passengers. I have also two @ViewScoped beans, one with the list of passengers and one for hold in pageB the selected passenger. I see the ways to pass the passenger through viewParam or @ManagedProperty but i don´t want to write a converter. What i want to know if there is a way to pass the object from pageA to pageB without passing the id of the passenger and write a converter or without passing the id and then go to the DB to retrieve the passenger. What i do and works is the