environment

How can find all functions and bounded symbols in an “environment”

三世轮回 提交于 2019-12-11 02:19:23
问题 I am using a softer who has a build-in scheme interpreter. I know the "environment" name is (the-environment). How can I find all the functions and symbols in the environment ? (define p (open-output-file "d:/test.txt")) (display (the-environment) p) can this will display all the functions ? Thanks in advance. Joe 回答1: As Eli Barzilay pointed out, whether or not you can reflectively find all the names bound in an environment depends on which implementation of Scheme you are using. I infer

ddply run in a function looks in the environment outside the function?

☆樱花仙子☆ 提交于 2019-12-11 01:37:39
问题 I'm trying to write a function to do some often repeated analysis, and one part of this is to count the number of groups and number of members within each group, so ddply to the rescue !, however, my code has a problem.... Here is some example data > dput(BGBottles) structure(list(Machine = structure(c(1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L), .Label = c("1", "2", "3", "4"), class = "factor"), weight = c(14.23, 14.96, 14.85, 16.46, 16.74, 15.94, 14.98, 14.88, 14.87, 15.94, 16.07, 14.91

Execute bash script that defines environment variables using Python

穿精又带淫゛_ 提交于 2019-12-11 01:35:19
问题 I'm using the next code to execute a bash script that defines a lot of environment variables: #!/usr/bin/python # -*- coding: utf-8 -*- import subprocess # Code used to get the value of variable before the call to my script command = "echo $MYDIR" ps = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) my_dir = ps.communicate()[0] print "my_dir", my_dir subprocess.Popen(["/bin/sh", "/home/user/env_file"]) # Code used to get the value of established

How to let Cakephp 3 choose database connection by Apache environment variable

家住魔仙堡 提交于 2019-12-11 01:26:07
问题 I'm working with cakephp v3 and want to install the application in two different environments, one for development and one for production use. Both installations should consist of exactly the same files (and file contents), so I could use 'git' or 'svn' to easily deploy the application. If both environments are hosted on the same machine, I need different database settings (so that the development env uses its own 'testing' DB). I thought of configuring two 'Datasources' in app.php , the

How can I properly import the environment from running a subcommand in Perl?

我们两清 提交于 2019-12-11 01:07:57
问题 In importing the environment from a subcommand, I want to add all environment variables exported from a bash script to a hash. When program gets run, it will set up some variables and export them. I'd like to save those variables in the Perl script for later. However I don't want to take the bash functions defined in the subcommand. Currently, I have a block like: foreach (`program; env`) { next if /^\(\)/; my ($a, $b) = split("=", $_); if( /^(\w+)=(.*)$/ ) { $hash{$1} = $2; } } Is there a

How can I read the liblist from within an ILE-Program? (preferably RPG or CL)

我的未来我决定 提交于 2019-12-10 21:20:48
问题 We control on what objects our programs on the as400 work, by running them with different liblists. But some operations cannot be directly controlled by this. Therefore, my program needs to read the liblist and decide on some of the libraries in it, how to act. I could not find any api to read the liblist entries from within a program. What I would expect, is some kind of api that lets me iterate through the liblist entries by priority or gives me an array with them in the order given by the

Conda environment is discoverable but not activateable (when activate is a bash alias)

喜你入骨 提交于 2019-12-10 17:10:30
问题 Conda version 4.2.9, from the anaconda3 4.2.0 installation for RedHat 4.4.7-1. [user@machine]$ conda info --envs # conda environments: # molr-py3 /home/user/anaconda3/envs/molr-py3 root * /home/user/anaconda3 [user@machine]$ source activate molr-py3 CondaEnvironmentNotFoundError: Could not find environment: molr-py3 . You can list all discoverable environments with `conda info --envs`. I'm not even sure what debugging steps to take in this case. I've verified that conda comes from the right

Detaching and re-attaching “tools:rstudio”

谁都会走 提交于 2019-12-10 16:49:36
问题 a.k.a playing with fire... The following does not work: rstd.obj <- as.environment("tools:rstudio") detach("tools:rstudio") attach(rstd.obj, name="tools:rstudio") Well, it seems to work, but then all sorts of weird errors start popping up. The problem is that very annoyingly (though I'm sure for a very good reason) attach makes a copy of the environment and attaches that, instead of attaching the environment directly: rstd.obj # <environment: 0x000000000930edd0> # attr(,"name") # [1] "tools

how to compare environment for equality in R

可紊 提交于 2019-12-10 12:43:40
问题 I would like to check if the current environment is the global environment in R. However, direct comparison doesn't seem to work with evironments. What is the best way to do this? #doesn't work sys.frame() == .GlobalEnv 回答1: Matthew Plourde's solution: > identical(sys.frame(),.GlobalEnv) [1] TRUE You can also check names, though this might be less reliable: > environmentName(sys.frame())=="R_GlobalEnv" [1] TRUE 来源: https://stackoverflow.com/questions/14491523/how-to-compare-environment-for

Ruby, Unicorn, and environment variables

青春壹個敷衍的年華 提交于 2019-12-10 12:37:28
问题 While playing with Heroku, I found their approach of using environment variables for server-local configuration brilliant. Now, while setting up an application server of my own, I find myself wondering how hard that would be to replicate. I'm deploying a sinatra application, riding Unicorn and Nginx. I know nginx doesn't like to play with the environment, so that one's out. I can probably put the vars somewhere in the unicorn config file, but since that's under version control with the rest