我正在使用vagrant + chef-solo + barkshelf插件.在我的Vagrantfile中我有这个:
chef.json = {
"postgresql" => {
"password" => {
"postgres" => "password"
}
},
"database" => {
"create" => ["chembl_18"]
},
"build_essential" => {
"compiletime" => true
}
}
Run Code Online (Sandbox Code Playgroud)
如果我在这里添加更多配置,我的Vagrantile将很快变得凌乱.我试图改变这一点,所以我创建了databags/postgresql/json_attribs.json包含以下内容的文件:
{
"postgresql": {
"password": {
"postgres": "iloverandompasswordsbutthiswilldo"
}
}
}
Run Code Online (Sandbox Code Playgroud)
和我的Vagrantfile中修改的内容:
chef.json = {
:postgresql => ["json_attribs"],
"database" => {
"create" => ["chembl_18"]
},
...
}
Run Code Online (Sandbox Code Playgroud)
但它不起作用,我得到:
==> default: 58>> default['postgresql']['dir'] = "/etc/postgresql/#{node['postgresql']['version']}/main"
...
==> default: [2014-05-14T12:36:51+00:00] ERROR: Running exception handlers
==> default: …Run Code Online (Sandbox Code Playgroud) 我有这些数据:
data = pd.DataFrame().from_dict([r for r in response])
print data
_id total
0 213 1
1 194 3
2 205 156
...
Run Code Online (Sandbox Code Playgroud)
现在,如果我打电话:
data.hist()
Run Code Online (Sandbox Code Playgroud)
我会得到两个单独的直方图,每列一个.这不是我想要的.我想要的是使用这两列制作的单个直方图,其中一列被解释为值,另一列被解释为该值的出现次数.我该怎么做才能生成这样的直方图?
我试过了:
data.hist(column="_id", by="total")
Run Code Online (Sandbox Code Playgroud)
但这会生成更多(空)直方图和错误消息.
我想在带有Vista和Visual Studio 2010的ma PC上安装boost库.
首先从官方网站下载升级1.42并解压缩到c:\ boost_1_42_0然后我调用了bootstrap.bat但是我得到了一些错误:
c:\boost_1_42_0>bootstrap.bat Building Boost.Jam build engine Failed to build Boost.Jam build engine. Please consult bjam.log for furter diagnostics. You can try to obtain a prebuilt binary from http://sf.net/project/showfiles.php?group_id=7586&package_id=72941 Also, you can file an issue at http://svn.boost.org Please attach bjam.log in that case.
在bjam.log中我发现:
Setting environment for using Microsoft Visual Studio 2010 x86 tools. ERROR: Cannot determine the location of the VS Common Tools folder. ### ### Using 'vc10' toolset. ### c:\boost_1_42_0\tools\jam\src>if exist bootstrap …
我尝试了解 Shibboleth 身份验证的工作原理。用户必须提供什么才能进行身份验证?是登录名和密码吗?如果是这样,这是唯一的选择吗?如何为新用户创建新的登录名/密码?如果某些用户在其组织内已经拥有一些登录名/密码怎么办?我在哪里可以阅读一些涵盖使用 Shibboleth 进行身份验证的实际方面的“高级”教程?
我刚刚写了这个函数:
def _apply(mols, fn, *args, **kwargs):
return [fn(m, *args, **kwargs) for m in mols if m ]
Run Code Online (Sandbox Code Playgroud)
我开始思考:
map?据我所知,map无法将参数传递给函数,另一方面,它可能会以某种方式进行优化,并且使用一些部分绑定或 lambda 我可以使用map. 这会有好处吗?
python algorithm functional-programming list-comprehension function
我有一个元素列表:[ 3, 3, 6, 6, 6, 5, 5, 8 ]需要按元素的频率对其进行排序才能得到这个:[ 6, 6, 6, 3, 3, 5, 5, 8 ]几个元素具有相同的频率按值排序.你能找到比这更短的路吗?
import collections
from operator import itemgetter, attrgetter
def freq_sort(arr):
counter=collections.Counter(arr)
com = sorted(counter.most_common(), key=itemgetter(1,0), reverse=True)
com = map(lambda x: [x[0]] * x[1], com)
return [item for sublist in com for item in sublist]
Run Code Online (Sandbox Code Playgroud) python ×3
algorithm ×2
berkshelf ×1
boost ×1
c++ ×1
chef-infra ×1
chef-solo ×1
function ×1
histogram ×1
pandas ×1
plot ×1
shibboleth ×1
sorting ×1
vagrant ×1
vagrantfile ×1