env

rails 3, how use an ENV config vars in a Settings.yml file?

只愿长相守 提交于 2019-11-30 02:40:05
In my settings.yml file I have several config vars, some of which reference ENV[] variables. for example I have ENV['FOOVAR'] equals WIDGET I thought I could reference ENV vars inside <% %> like this: Settings.yml: default: cv1: Foo cv2: <% ENV['FOOVAR'] %> in rails console if I type > ENV['FOOVAR'] => WIDGET but > Settings.cv1 => Foo (works okay) > Settings.cv2 =>nil (doesn't work???) use following:- default: cv1: Foo cv2: <%= ENV['FOOVAR'] %> arpiagar The above solution did not work for me. However, I found the solution on How do I use variables in a YAML file? My .yml file contained

env: python\\r: No such file or directory

折月煮酒 提交于 2019-11-29 20:52:25
My Python script beak contains the following shebang: #!/usr/bin/env python When I run the script $ ./beak , I get env: python\r: No such file or directory I previously pulled this script from a repository. What could be the reason for this? falsetru The script contains CR characters. The shell interprets these CR characters as arguments. Solution: Remove the CR characters from the script using the following script. with open('beak', 'rb+') as f: content = f.read() f.seek(0) f.write(content.replace(b'\r', b'')) f.truncate() Open the file in vim or vi, and administer the following command: :set

How to get environment of a variable in R

我是研究僧i 提交于 2019-11-29 18:11:15
问题 I was wondering if there is anyway to get the environment of a declared variable. Say I already have declared a variable to an environment and want to use that variable's environment to declare a few more variables. Something like getEnv("variable") 回答1: Refer to: http://adv-r.had.co.nz/Environments.html#env-basics library(pryr) x <- 5 where("x") #> <environment: R_GlobalEnv> where("mean") #> <environment: base> The where function is described in the above website. It only finds the first

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

Laravel 5 - env local debug true no errors shown

岁酱吖の 提交于 2019-11-28 20:13:02
I'm trying to enable the debug for my app but it looks like I don't have any feedback. The environment is set to local (in the .env file) and if I run php artisan env I get this Current application environment: local The debug config for my local env is set to true return [ 'debug' => true, Also if I set in my main config file (app.php inside the config folder) the debug = true I still have ho feedback that there is an error in the code. I only have an empty page if there is an error in the code (as for debug = false) What am I missing? I have worked around the issue by chmod -R 777 storage/

Use different PHP version CLI executable for one command

醉酒当歌 提交于 2019-11-28 18:13:07
So I have Gentoo box with three PHP versions installed (nevermind the reasons): /usr/bin/php -> /usr/lib64/php5.4/bin/php /usr/bin/php5.5 -> /usr/lib64/php5.5/bin/php /usr/bin/php5.6 -> /usr/lib64/php5.4/bin/php I want to install Laravel framework using composer: $ composer create-project laravel/laravel --prefer-dist This however throws an error because Laravel requires PHP > 5.5.9 and the default php interpreter is 5.4 . So I issue another command: $ /usr/bin/php5.6 /usr/bin/composer create-project laravel/laravel --prefer-dist This takes me one step further, but then some post-install

Mismatch between sys.executable and sys.version in Python

荒凉一梦 提交于 2019-11-28 12:09:42
There are two Python interpreters installed: [user@localhost ~]$ /usr/bin/python -V && /usr/local/bin/python -V Python 2.4.3 Python 2.7.6 Sudo changes PATH for every command it runs as follows: [user@localhost ~]$ env | grep PATH && sudo env | grep PATH PATH=/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/user/bin PATH=/usr/bin:/bin I run a test script: [user@localhost ~]$ cat what_python.py #!/usr/bin/env python import sys print sys.executable print sys.version [user@localhost ~]$ sudo python what_python.py /usr/bin/python 2.7.6 (default, Feb 27 2014, 17:05:07) [GCC 4.1.2

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

ぐ巨炮叔叔 提交于 2019-11-28 02:19:29
问题 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

How do I find the name of the conda environment in which my code is running?

我是研究僧i 提交于 2019-11-27 21:09:43
问题 I'm looking for a good way to figure out the name of the conda environment I'm in from within running code or an interactive python instance. The use-case is that I am running Jupyter notebooks with both Python 2 and Python 3 kernels from a miniconda install. The default environment is Py3. There is a separate environment for Py2. Inside the a notebook file, I want it to attempt to conda install foo . I'm using subcommand to do this for now, since I can't find a programmatic conda equivalent

run python script directly from command line

孤街醉人 提交于 2019-11-27 12:31:13
#!/usr/bin/env python I put that at the top of a script. I've seen that should make the script runnable from the command line without the need for python programname.py . Unless I'm misunderstanding I should be able to use programname.py as long as I have the above line at the top of the script. Is this correct? It isn't working for me I just get an error indicating that I would have to use python at the beginning of the 'call'. Universal running of Python scripts You can pretty much universally run without the shebang ( #! ) with python myscript.py Or nearly equivalently (it places the