下面是我的nginx模板.
我正面临一个问题22.我需要安装一个init.d模板.所以我有一个nginx erb模板,我放在/etc/init.d/nginx中.
我甚至尝试将代码置于食谱之上.配方依赖于init.d文件,但它不会被激活,直到它为时已晚,因此我收到此错误:
STDERR: update-rc.d: /etc/init.d/nginx: file does not exist
---- End output of "bash" "/tmp/chef-script20120330-26326-3ologp-0" ----
Ran "bash" "/tmp/chef-script20120330-26326-3ologp-0" returned 1
[Fri, 30 Mar 2012 06:22:15 +0000] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[Fri, 30 Mar 2012 06:22:15 +0000] ERROR: Sleeping for 60 seconds before trying again
Run Code Online (Sandbox Code Playgroud)
在下一次的厨师客户端,事情是有效的,因为这样就形成了模板.
在为nginx注册服务资源之前,如何立即执行模板?一个快速解决方法是我创建一个配方,在nginx之前运行模板来安装模板,但这似乎相当荒谬.
需要在注册服务之前安装此模板.
template "nginx" do
path "/etc/init.d/nginx"
source "nginx.erb"
owner "root"
group "root"
mode "0755"
end
Run Code Online (Sandbox Code Playgroud)
然后注册服务器.
service "nginx" do
supports :restart => true, :start => true, :stop => true, :reload …Run Code Online (Sandbox Code Playgroud) 我错过了什么?我想将字典转储为json字符串.
我正在使用python 2.7
使用此代码:
import json
fu = {'a':'b'}
output = json.dump(fu)
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/gevent-1.0b2-py2.7-linux-x86_64.egg/gevent/greenlet.py", line 328, in run
result = self._run(*self.args, **self.kwargs)
File "/home/ubuntu/workspace/bitmagister-api/mab.py", line 117, in mabLoop
output = json.dump(fu)
TypeError: dump() takes at least 2 arguments (1 given)
<Greenlet at 0x7f4f3d6eec30: mabLoop> failed with TypeError
Run Code Online (Sandbox Code Playgroud) wowee .....如何使用python和pandas的iterrows?如果我进行行迭代,我是否应该无法使用行['COL_NAME']访问col?
这是col名称:
print df
Int64Index: 152 entries, 0 to 151
Data columns:
Date 152 non-null values
Time 152 non-null values
Time Zone 152 non-null values
Currency 152 non-null values
Event 152 non-null values
Importance 152 non-null values
Actual 127 non-null values
Forecast 86 non-null values
Previous 132 non-null values
dtypes: object(9)
for row in df.iterrows():
print row['Date']
Traceback (most recent call last):
File "/home/ubuntu/workspace/calandar.py", line 34, in <module>
print row['Date']
TypeError: tuple indices must be integers, not str
Run Code Online (Sandbox Code Playgroud)
如果我打印1行: …
我正在使用DigiOcean实例和512兆内存,我用kafka得到了以下错误.我不是一个java熟练的开发者.如何调整kafka以利用少量的ram.这是一个开发者.我不想每小时为更大的机器支付更多费用.
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 986513408 bytes for committing reserved memory.
# An error report file with more information is saved as:
# //hs_err_pid6500.log
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000bad30000, 986513408, 0) failed; error='Cannot allocate memory' (errno=12)
Run Code Online (Sandbox Code Playgroud) 我该如何解决这个问题?我想提交,但我得到以下错误.
git push origin monty_svm_dev
To git@github.com: ! [rejected] monty_svm_dev -> monty_svm_dev
(non-fast-forward) error: failed to push some refs to
'git@github.com:/mygit.git' To prevent you from losing history,
non-fast-forward updates were rejected Merge the remote changes before
pushing again. See the 'Note about fast-forwards' section of 'git
push --help' for details. root@li409-202:~/mypath#
Run Code Online (Sandbox Code Playgroud) 在我的代码下面安装vcider.我正在学习厨师,但没有看到任何安装dpkg的东西.我想在脚本中使用版本.以下代码有效.
script "install_vcider" do
interpreter "bash"
user "root"
cwd "/tmp"
code <<-EOH
wget https://my.vcider.com/m/downloads/vcider_2.0.1b_amd64.deb
dpkg -i vcider__amd64.deb
EOH
end
Run Code Online (Sandbox Code Playgroud)
即使使用上面的代码,我可以用#{version}替换2.0.1b吗?属性文件 - >默认[:vcider] [:版本] 2.0.1b
recipe file - > version = node[:vcider][:version]
Run Code Online (Sandbox Code Playgroud) 我必须下载一个git python repo并安装,因为pypi版本没有更新.
通常我会这样做:
pip install mypackage
pip install mypackage[redis]
Run Code Online (Sandbox Code Playgroud)
现在我将repo克隆在以下文件夹中:
的/ opt/mypackage的
那么如何运行安装以下不使用pypi版本而是本地?
pip --flag /opt/mypackage install mypackage
pip --flag /opt/mypackage install mypackage[redis]
Run Code Online (Sandbox Code Playgroud)
有可用的pip标志,我不知道如何完成:
Commands:
install Install packages.
uninstall Uninstall packages.
freeze Output installed packages in requirements format.
list List installed packages.
show Show information about installed packages.
search Search PyPI for packages.
wheel Build wheels from your requirements.
help Show help for commands.
General Options:
-h, --help Show help.
--isolated Run pip in an isolated mode, ignoring environment …Run Code Online (Sandbox Code Playgroud) 我有一个反应形式.在编辑时我想要禁用控件.
以下作品:
this.myForm.controls['analysis_horizon'].disable();
Run Code Online (Sandbox Code Playgroud)
但是,关键的analysis_horizon不再是我的myForm.value哈希.
如何禁用具有被动形式的字段,但将值保留在表单值哈希中?
我试过[禁用] =但我得到以下内容:
It looks like you're using the disabled attribute with a reactive form directive. If you set disabled to true
when you set up this control in your component class, the disabled attribute will actually be set in the DOM for
you. We recommend using this approach to avoid 'changed after checked' errors.
Example:
form = new FormGroup({
first: new FormControl({value: 'Nancy', disabled: true}, Validators.required),
last: new FormControl('Drew', Validators.required)
});
Run Code Online (Sandbox Code Playgroud)
我在编辑时将数据从编辑中加载到表单控件中,但我需要一个字段不允许更改.
我想在ubuntu上安装GRAPHITE.我按照博客中的说明操作.
http://geek.michaelgrace.org/2011/09/how-to-install-graphite-on-ubuntu/
Run Code Online (Sandbox Code Playgroud)
当我到达运行命令的部分时......我得到以下错误.我对如何解决没有任何线索.我正在使用最新版本的Django 1.4.
cd /opt/graphite/webapp/graphite/
sudo python manage.py syncdb
sudo python manage.py syncdb
/opt/graphite/webapp/graphite/thirdparty/pytz/__init__.py:32: UserWarning: Module pytz was already imported from /opt/graphite/webapp/graphite/thirdparty/pytz/__init__.pyc, but /usr/local/lib/python2.7/dist-packages/pytz-2012b-py2.7.egg is being added to sys.path
from pkg_resources import resource_stream
Traceback (most recent call last):
File "manage.py", line 11, in <module>
execute_manager(settings)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 459, in execute_manager
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 196, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 232, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", …Run Code Online (Sandbox Code Playgroud) 为什么会在Angular2和Typescript中发生这种情况?
export class Environment {
constructor(
id: string,
name: string
) { }
}
environments = new Environment('a','b');
app/environments/environment-form.component.ts(16,19): error TS2346: Supplied parameters do not match any signature of call target.
Run Code Online (Sandbox Code Playgroud)
如何初始化数组?
python ×4
angular ×2
chef-infra ×2
apache-kafka ×1
django ×1
git ×1
github ×1
java ×1
json ×1
pandas ×1
python-2.7 ×1
typescript ×1