environment

Verify object existence inside a function in R [duplicate]

牧云@^-^@ 提交于 2019-11-29 11:04:29
This question already has an answer here: How to check if object (variable) is defined in R? 6 answers I want to determine whether an object exists inside a function in R: foo <- function() { y <- "hello" if (exists(y, envir = sys.frame())) print(y) } foo() Error in exists(y, envir = sys.frame()) : invalid first argument I thought adding the envir = sys.frame() would do the trick. Also tried envir = environment() Expected foo() "hello" You should have checked ?exists : Usage: exists(x, where = -1, envir = , frame, mode = "any", inherits = TRUE) Arguments: x: a variable name (given as a

zend framework auto switch production staging test .. etc

别等时光非礼了梦想. 提交于 2019-11-29 09:40:57
问题 What do I change to switch from production to staging.. etc.. and where.. Bootstrap ? Also, Curious if anyone has configured their Zend Framework to automatically switch from production, staging, test.. etc based on Host information.. example.. if (hostname = 'prodServer') ... blah if (hostname = 'testServer') ... blah I'm new to Zend but I typically configure my projects to automatically switch run environments based on the host information. thanks 回答1: Assuming that you are using

Installing Gems without rvm, as root, with explicit version of ruby

坚强是说给别人听的谎言 提交于 2019-11-29 08:57:37
I've decided to get rid of rvm, and I'm having trouble compiling a gem with my new version of ruby 1.9.2. The gem requires 1.9.2, I have it, yet says it can't install without, so the error messages makes no sense. How can I explicitly tell the gem to compile with said version of ruby? Gem::InstallError: linecache19 requires Ruby version >= 1.9.2. An error occured while installing linecache19 (0.5.12), and Bundler cannot continue. Make sure that `gem install linecache19 -v '0.5.12'` succeeds before bundling. apps2 ~/projects/sms/apps2/apps2_admin $ ruby -v ruby 1.9.2p180 (2011-02-18 revision

<RubyGems> How to change gem environment settings?

≯℡__Kan透↙ 提交于 2019-11-29 07:01:57
问题 I installed rbenv and set up ruby and gems. Now if I run gem env then I got the following: RubyGems Environment: - RUBYGEMS VERSION: 2.2.2 - RUBY VERSION: 2.1.0 (2013-12-25 patchlevel 0) [x86_64-darwin13.0] - INSTALLATION DIRECTORY: /Users/myusername/Tools/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0 - RUBY EXECUTABLE: /Users/myusername/Tools/.rbenv/versions/2.1.0/bin/ruby - EXECUTABLE DIRECTORY: /Users/myusername/Tools/.rbenv/versions/2.1.0/bin - SPEC CACHE DIRECTORY: /Users/myusername/.gem

What is my current desktop environment?

孤街浪徒 提交于 2019-11-29 02:28:50
How can I get to know what my desktop environment is using Python? I like the result to be gnome or KDE or else. Tested in Ubuntu 9.10: >>> import os >>> os.environ.get('DESKTOP_SESSION') 'gnome' Edit: As mentioned in comments below, this approach will not work for more some OSes. The other two answers provide workarounds. I use this in one of my projects: def get_desktop_environment(self): #From http://stackoverflow.com/questions/2035657/what-is-my-current-desktop-environment # and http://ubuntuforums.org/showthread.php?t=652320 # and http://ubuntuforums.org/showthread.php?t=652320 # and http

Conda: Creating a virtual environment

 ̄綄美尐妖づ 提交于 2019-11-29 00:56:46
问题 I'm trying to create a virtual environment. I've followed steps from both Conda and Medium. Everything works fine until I need to source the new environment. conda info -e # conda environments: # base * /Users/fwrenn/anaconda3 test_env /Users/fwrenn/anaconda3/envs/test_env source ~/anaconda3/bin/activate test_env _CONDA_ROOT=/Users/fwrenn/anaconda3: Command not found. Badly placed ()'s. I can't figure out the problem. Searching on here has solutions that say adding lines to your bash_profile,

How to pass the -D additional parameter while starting tomcat?

半世苍凉 提交于 2019-11-29 00:45:38
问题 I have a maven project, after running command mvn install all project as well as module compile and copied to local repository successfully. But now I want to run the generated web application in tomcat6. Client provided some parameter for tomcat like -Dapp.username,-Dapp.username, which will be used internally once project will start.ButI do not know how to set these additional parameter in tomcat6. Below is my development environment OS = Windows Tomcat = tomcat 6.0.27 Please help me? 回答1:

Scoping and functions in R 2.11.1 : What's going wrong?

て烟熏妆下的殇ゞ 提交于 2019-11-28 23:27:53
This question comes from a range of other questions that all deal with essentially the same problem. For some strange reason, using a function within another function sometimes fails in the sense that variables defined within the local environment of the first function are not found back in the second function. The classical pattern in pseudo-code : ff <- function(x){ y <- some_value some_function(y) } ff(x) Error in eval(expr, envir, enclos) : object 'y' not found First I thought it had something to do with S4 methods and the scoping in there, but it also happens with other functions. I've

Does php have an equivalent to python's virtualenv or ruby's sandbox?

拈花ヽ惹草 提交于 2019-11-28 20:51:22
问题 I'm used to using python's virtualenv tool to create separate environments that can mimic deployment environments for projects I write. Now, I'm going to be working on a php project and I'm wondering if there's any equivalent to that? Specifically I'm hoping to be able to run one virtualhost on apache with one (older) version of php, while everything else runs on the normal up to date version. My development machine is running ubuntu 11.04, so solutions that work on that platform would be

How can I detect Heroku's environment?

♀尐吖头ヾ 提交于 2019-11-28 20:38:32
问题 I have a Django webapp, and I'd like to check if it's running on the Heroku stack (for conditional enabling of debugging, etc.) Is there any simple way to do this? An environment variable, perhaps? I know I can probably also do it the other way around - that is, have it detect if it's running on a developer machine, but that just doesn't "sound right". 回答1: An ENV var seems to the most obvious way of doing this. Either look for an ENV var that you know exists, or set your own: on_heroku =