parameter-passing

How to run a job array in R using the rscript command from the command line? [closed]

雨燕双飞 提交于 2019-11-29 08:56:54
I am wondering how I might be able to run 500 parallel jobs in R using the Rscript function. I currently have an R file that has the header on top: args <- commandArgs(TRUE) B <- as.numeric(args[1]) Num.Cores <- as.numeric(args[2]) Outside of the R file, I wish to pass which of the 500 jobs are to be run, which is specified by B . Also, I would like to control the number of cores/CPUs available to each job, Num.Cores . I am wondering if there is software or guides that can allow this. I currently have a CentOS 7/Linux server and I know one way is to install Slurm. However, it is quite a hassle

Setting Public Property Values on the Command Line

大兔子大兔子 提交于 2019-11-29 08:10:39
Setting Public Property Values on the Command Line of an msi follows the pattern MyInstaller.msi PUBLICPROPERTY="someValue" This works on "Command Prompt" aka cmd.exe and powershell. But MyInstaller.msi PUBLICPROPERTY="" does not work like expected in powershell. I expected that it sets PUBLICPROPERTY to null but it sets PUBLICPROPERTY to the value "CURRENTDIRECTORY="C:\temp\msi\"" (it does work like expected with cmd.exe). Why do powershell and cmd.exe behaviour different, and how can it be fixed? PowerShell, on Windows of necessity, performs re-quoting of your arguments behind the scenes.

In common-lisp, how do I modify part of a list parameter from within a function without changing the original list?

有些话、适合烂在心里 提交于 2019-11-29 07:18:09
I'm trying to pass a list to a function in Lisp, and change the contents of that list within the function without affecting the original list. I've read that Lisp is pass-by-value, and it's true, but there is something else going on that I don't quite understand. For example, this code works as expected: (defun test () (setf original '(a b c)) (modify original) (print original)) (defun modify (n) (setf n '(x y z)) n) If you call (test), it prints (a b c) even though (modify) returns (x y z). However, it doesn't work that way if you try to change just part of the list. I assume this has

Passing parameters in the message header with a REST API

ぐ巨炮叔叔 提交于 2019-11-29 06:39:52
I'm developping a REST API and I need to tranport cryptograms to authenticate the message for each request in a applicative process (MAC encryption from secret keys). I was thinking about putting them in the message header to avoid adding non-data information in the message body which contains the posted/retrieved object (XML or JSON). Is it a best practise ? Can I add as many parameters I want in the header ? I've read that I must prefix them with "x-". The behavior of this parameter is exactly the same than Path or Query params ? I'm using Jersey. Thank you for you help. Yes I believe it is

How to keep already-set GET parameter values on form submission?

╄→尐↘猪︶ㄣ 提交于 2019-11-29 05:28:10
I have a URL : foo.php?name=adam&lName=scott , and in foo.php I have a form which gives me values of rectangleLength & rectangleBreadth with a submit button. When I click this submit button with form action as $_SERVER['REQUEST_URI'] , I get this result URL: foo.php?rectangleLength=10&rectangleBreadth=5 (these values have been filled in by the user). Notice that I am losing my previous values name & lName from the URL. How can I keep them? Also, keep in mind that I have to come back to foo.php and if the user wants to submit the form again then the length and breadth values should change. You

Using an OrderedDict in **kwargs

点点圈 提交于 2019-11-29 05:07:55
问题 Is it possible to pass an OrderedDict instance to a function which uses the **kwargs syntax and retain the ordering? What I'd like to do is : def I_crave_order(**kwargs): for k, v in kwargs.items(): print k, v example = OrderedDict([('first', 1), ('second', 2), ('third', -1)]) I_crave_order(**example) >> first 1 >> second 2 >> third -1 However the actual result is: >> second 2 >> third -1 >> first 1 ie, typical random dict ordering. I have other uses where setting the order explicitly is good

Passing data between asp.net pages

元气小坏坏 提交于 2019-11-29 05:05:30
I'm wondering the opinion of what is the best way to pass a lot of values between MULTIPLE pages. I was thinking of either saving the values to a database, using context.Items[], or Session[]. I'm not sure about what is the best method. I'm passing probably around 40 variables.This will be during a checkout process so they should be persisted through the users lifecycle. The user does not change the values after they are entered the first time. The values would be like Billing Address, First and Last name etc Session is probably the most efficient. However, if the session times out or is lost

Optional parameters in Python functions and their default values [duplicate]

纵饮孤独 提交于 2019-11-29 04:41:53
问题 Possible Duplicate: “Least Astonishment” in Python: The Mutable Default Argument I'm kind of confused about how optional parameters work in Python functions/methods. I have the following code block: >>> def F(a, b=[]): ... b.append(a) ... return b ... >>> F(0) [0] >>> F(1) [0, 1] >>> Why F(1) returns [0, 1] and not [1] ? I mean, what is happening inside ? 回答1: Good doc from PyCon a couple years back - Default parameter values explained. But basically, since lists are mutable objects, and

c++11 optimal parameter passing

别等时光非礼了梦想. 提交于 2019-11-29 04:17:32
Consider these classes: #include <iostream> #include <string> class A { std::string test; public: A (std::string t) : test(std::move(t)) {} A (const A & other) { *this = other; } A (A && other) { *this = std::move(other); } A & operator = (const A & other) { std::cerr<<"copying A"<<std::endl; test = other.test; return *this; } A & operator = (A && other) { std::cerr<<"move A"<<std::endl; test = other.test; return *this; } }; class B { A a; public: B (A && a) : a(std::move(a)) {} B (A const & a) : a(a) {} }; When creating a B , I always have an optimal forward path for A , one move for rvalues

Immutable and pass by value

ぐ巨炮叔叔 提交于 2019-11-29 03:04:38
问题 I have the following code which has a mutable Person class, String and a method to modify the instances of String and Person class Person{ int a = 8; public int getA() { return a; } public void setA(int a) { this.a = a; } @Override public String toString() { return "Person [a=" + a + "]"; } } -- public class TestMutable { public static void main(String[] args) { Person p = new Person(); p.setA(34); String s = "bar"; modifyObject(s, p); //Call to modify objects System.out.println(s); System