environment

How do I launch a java process that has the standard bash shell environment?

有些话、适合烂在心里 提交于 2019-12-01 11:50:39
I've tried looking into process builder, but I'm not sure how to source the bash environment into the process. For example I'm using the following to launch my process: Process p = new ProcessBuilder(args).start(); InputStream is = p.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); And I'd like my standard shell environment (from /etc/profile, .bashrc, etc.) sourced to the process. Sorry if I'm not using the right terms - still learning java. Thanks in advance for any help! You need to set up a shell invocation with

Global Assignment, Parallelism, and foreach

╄→гoц情女王★ 提交于 2019-12-01 11:46:54
I have just finished running a long running analysis (24+ hours) on multiple sets of data. Since I'm lazy and didnt want to deal with multiple R sessions and pulling the results together afterwards, I ran them in parallel using foreach . The analysis returns an environment full of the results (and intermediate objects), so I attempted to assign the results to global environments, only to find that this didn't work. Here's some code to illustrate: library(doMC) library(foreach) registerDoMC(3) bigAnalysis <- function(matr) { results <- new.env() results$num1 <- 1 results$m <- matrix(1:9, 3, 3)

Global Assignment, Parallelism, and foreach

落爺英雄遲暮 提交于 2019-12-01 09:42:01
问题 I have just finished running a long running analysis (24+ hours) on multiple sets of data. Since I'm lazy and didnt want to deal with multiple R sessions and pulling the results together afterwards, I ran them in parallel using foreach . The analysis returns an environment full of the results (and intermediate objects), so I attempted to assign the results to global environments, only to find that this didn't work. Here's some code to illustrate: library(doMC) library(foreach) registerDoMC(3)

When/how/where is parent.frame in a default argument interpreted?

点点圈 提交于 2019-12-01 08:03:09
Truth be told, I'm just being lazy here, but perhaps someone could someday profit from the answer being here. Say I define a function like: fn<-function(envir=parent.frame()) { #do something with envir } My question is: what might I expect to be the content of envir? Context: I had a rather long function f1 that contained a call to parent.frame. Now, I want to extract part of that function (containing the parent.frame call) into a new helper function f2 (which will then be called by f1), and I want to be sure that f1 does the same as it did before. Default arguments are evaluated within the

When/how/where is parent.frame in a default argument interpreted?

主宰稳场 提交于 2019-12-01 06:21:58
问题 Truth be told, I'm just being lazy here, but perhaps someone could someday profit from the answer being here. Say I define a function like: fn<-function(envir=parent.frame()) { #do something with envir } My question is: what might I expect to be the content of envir? Context: I had a rather long function f1 that contained a call to parent.frame. Now, I want to extract part of that function (containing the parent.frame call) into a new helper function f2 (which will then be called by f1), and

How do I import environment settings into my Perl program?

吃可爱长大的小学妹 提交于 2019-11-30 23:28:18
I have a script whose content simply exports a variable in linux. export LD_LIBRARY_PATH=.... I want to run this script in my Perl script so whoever is running my Perl script will have their LD_LIBRARY_PATH set. Can i just do this in the beginning of my Perl script: #!/usr/bin/perl -w system(". /myfolder1/myfolder2/myScript.sh"); #!/bin/sh . /myfolder1/myfolder2/myScript.sh exec perl -wxS "$0" "$@" #!/usr/bin/perl -w # .. the rest of your script as normal When you run this, it will first be executed by /bin/sh , which is capable of loading myScript.sh into the local environment. sh then exec s

VS2013: “VSP2340: Environment variables were not properly set” even when running from IDE

这一生的挚爱 提交于 2019-11-30 20:30:16
I am profiling a C# program from Visual Studio 2013. I go to Analyze -> Performance and Diagnostics to start the wizard. It gives me a choice of profiling method. If I choose the default, CPU sampling, then profiling works and I can see the results. However if I choose the third option, .NET memory allocation, then after my application has finished I see empty results and this error in the Visual Studio output window: VSP2340: Environment variables were not properly set during profiling run and managed symbols may not resolve. Please use vsperfclrenv before profiling All the documentation I've

How do I import environment settings into my Perl program?

这一生的挚爱 提交于 2019-11-30 17:43:46
问题 I have a script whose content simply exports a variable in linux. export LD_LIBRARY_PATH=.... I want to run this script in my Perl script so whoever is running my Perl script will have their LD_LIBRARY_PATH set. Can i just do this in the beginning of my Perl script: #!/usr/bin/perl -w system(". /myfolder1/myfolder2/myScript.sh"); 回答1: #!/bin/sh . /myfolder1/myfolder2/myScript.sh exec perl -wxS "$0" "$@" #!/usr/bin/perl -w # .. the rest of your script as normal When you run this, it will first

Run a command line with custom environment

旧巷老猫 提交于 2019-11-30 17:42:51
In Ruby, I want to be able to: run a command line (via shell) capture both stdout and stderr (preferably as single stream) without using >2&1 (which fails for some commands here) run with additional enviornment variables (without modifying the environment of the ruby program itself) I learned that Open3 allows me to do 1 and 2. cmd = 'a_prog --arg ... --arg2 ...' Open3.popen3("#{cmd}") { |i,o,e| output = o.read() error = e.read() # FIXME: don't want to *separate out* stderr like this repr = "$ #{cmd}\n#{output}" } I also learned that popen allows you to pass an environment but not when

Python deployment and /usr/bin/env portability

本秂侑毒 提交于 2019-11-30 17:38:47
At the beginning of all my executable Python scripts I put the shebang line: #!/usr/bin/env python I'm running these scripts on a system where env python yields a Python 2.2 environment. My scripts quickly fail because I have a manual check for a compatible Python version: if sys.version_info < (2, 4): raise ImportError("Cannot run with Python version < 2.4") I don't want to have to change the shebang line on every executable file, if it's possible; however, I don't have administrative access to the machine to change the result of env python and I don't want to force a particular version, as