我有一个备份系统,它创建以Unix时间戳命名的目录,然后使用硬链接系统(rsync中的--link-dest)创建增量备份,因此通常第一个备份非常大,然后后续备份就像分数一样大.
这是我当前备份的输出:
root@athos:/media/awesomeness_drive# du -sh lantea_home/*
31G lantea_home/1384197192
17M lantea_home/1384205953
17M lantea_home/1384205979
17M lantea_home/1384206056
17M lantea_home/1384206195
17M lantea_home/1384207349
3.1G lantea_home/1384207678
14M lantea_home/1384208111
14M lantea_home/1384208128
16M lantea_home/1384232401
15G lantea_home/1384275601
43M lantea_home/1384318801
Run Code Online (Sandbox Code Playgroud)
一切似乎都是正确的,但是,例如最后一个目录,lantea_home/1384318801:
root@athos:/media/awesomeness_drive# du -sh lantea_home/1384318801/
28G lantea_home/1384318801/
Run Code Online (Sandbox Code Playgroud)
我一直都是这种行为,为什么第二个du命令会将目录视为28G?
注 - 输出与-P和-L标志保持一致.
Docker提供了一个交互式stats命令,docker stats [cid]它提供了有关CPU使用情况的最新信息,如下所示:
CONTAINER CPU % MEM USAGE/LIMIT MEM % NET I/O
36e8a65d 0.03% 4.086 MiB/7.798 GiB 0.05% 281.3 MiB/288.3 MiB
Run Code Online (Sandbox Code Playgroud)
我试图以可消化的格式将CPU使用率作为百分比来进行一些分析.
我已经看到/ sys/fs中的统计信息似乎提供了与Docker Remote API类似的值,它给了我这个JSON blob:
{
"cpu_usage": {
"usage_in_usermode": 345230000000,
"total_usage": 430576697133,
"percpu_usage": [
112999686856,
106377031910,
113291361597,
97908616770
],
"usage_in_kernelmode": 80670000000
},
"system_cpu_usage": 440576670000000,
"throttling_data": {
"throttled_time": 0,
"periods": 0,
"throttled_periods": 0
}
}
Run Code Online (Sandbox Code Playgroud)
但我不确定如何从中获得精确的CPU使用率百分比.
有任何想法吗?
我有一个特定的Vagrantfile用于lucid32盒子,安装一些非常标准的包(PHP/MySQL/Apache),做一些特定的端口转发等等,我设置它,从git签出一个项目并更改一些服务器配置,我想要将此框打包给团队中的其他开发人员使用,所以我使用命令:
vagrant package boxname --output test.box --vagrantfile Vagrantfile
Run Code Online (Sandbox Code Playgroud)
我得到一个test.box文件,它在包装中注明它正在添加我的特定Vagrantfile,然后我运行:
vagrant box add boxname test.box
Run Code Online (Sandbox Code Playgroud)
它出现在vagrant box list当我创建一些测试目录,也就好了,现在vagrant init boxname接着vagrant up
,然后将其规定,凡与来自结账和一切文件框中,但确实没有设置正确的端口转发,实际上是在不使用我的Vagrantfile我打包了它,但在该目录中生成了一个新的默认值.
我在〜/ .vagrant.d/boxes/boxname中注意到它有默认的Vagrantfile,以及我打包的那个包含/ _Vagrantfile
有什么方法可以让我的特定Vagrantfile成为我生成的那个vagrant init boxname?
所以这基本上是一种保证,就哈希/腌制而言,我正在进行整个注册/登录过程.
我有一个用户表,其中包含字段密码,盐,令牌(显然还有其他但这是最重要的).注册后,它会生成一个随机盐和一个随机令牌,并在密码字段中输入:
hash("sha256", $theirpostpassword.$randomgeneratedsalt);
Run Code Online (Sandbox Code Playgroud)
随机生成的salt和令牌存储在表中该用户行的各自字段中.
因此,在登录时,我只使用他们指定的用户名从用户行中选择salt.然后我做一个计数查询,查看有多少行的帖子密码与他们的特定盐连接,然后我将它们登录.很确定我有那个部分.
现在我想在每个页面上验证他们的登录我会在每个页面上运行一个函数来检查他们的cookie,看看id-username-token的格式是否与数据库中的行匹配.这意味着每次登录都会使用这些凭据设置cookie.
现在,我能想到的唯一能让它变得更好的是每次有效登录都会更改令牌吗?
感谢有识之士.
我正在使用json.el和furl.el从toggl.com的API获取时间条目 - 不幸的是我不认为它将响应分成多个列表:
JSON响应(数据中的两个条目):
{"data":[{"id":50439783,"description":"bar","billable":false,"start":"2012-10-20T18:07:00Z","stop":"2012-10-20T22:39:00Z","duration":16320,"workspace":{"id":172049,"name":"Dan's workspace"},"tag_names":[],"ignore_start_and_stop":false,"updated_at":"2012-10-20T22:40:26Z","user_id":231062},{"id":50440682,"description":"Test Time Entry","billable":false,"start":"2012-10-20T23:40:16Z","stop":"2012-10-20T23:50:16Z","duration":600,"workspace":{"id":172049,"name":"Dan's workspace"},"tag_names":[],"ignore_start_and_stop":false,"updated_at":"2012-10-20T23:51:32Z","user_id":231062}],"related_data_updated_at":"2012-10-19T00:00:00Z"}
Run Code Online (Sandbox Code Playgroud)
json-read-from-string响应:
(related_data_updated_at . 2012-10-19T00:00:00Z)
(data . [((user_id . 231062) (updated_at . 2012-10-20T22:40:26Z) (ignore_start_and_stop . :json-false) (tag_names . []) (workspace ... ...) (duration . 16320) (stop . 20\
12-10-20T22:39:00Z) (start . 2012-10-20T18:07:00Z) (billable . :json-false) (description . bar) (id . 50439783)) ((user_id . 231062) (updated_at . 2012-10-20T23:51:32Z) \
(ignore_start_and_stop . :json-false) (tag_names . []) (workspace ... ...) (duration . 600) (stop . 2012-10-20T23:50:16Z) (start . 2012-10-20T23:40:16Z) (billable . :jso\
n-false) (description . …Run Code Online (Sandbox Code Playgroud) 我已经注意到我的代码中(with-current-buffer ....一再重复相同的趋势所以我决定根据宏定义定义一个宏with-current-buffer- 这是我到目前为止:
(defmacro with-assembla-buffer(asm-buffer-name heading-str &rest body)
"Create buffer with name of ASM-BUFFER-NAME, or uses it if exists,
preps it with readonly/erase/heading - executes `body' - then puts
readonly back on, goes to beginning of buffer, and switches to it."
(with-current-buffer (get-buffer-create asm-buffer-name)
(assembla-mode)
(toggle-read-only -1)
(erase-buffer)
(insert (format "-- %s --------------------" heading-str))
(newline)
`(progn ,@body)
(toggle-read-only 1)
(goto-char (point-min))
(switch-to-buffer (current-buffer))))
Run Code Online (Sandbox Code Playgroud)
它的主体永远不会被执行,但是当它被切换到defun而不是defmacro完全可行时.所以除了为什么身体永远不会被执行之外,我的另一个问题是 - 作为一个宏而不是一个定义会更有意义吗?
好吧,我有一堆具有相同ID"mashupButton"的图像,但是我的印象是,如果我使用"this"创建一个jQuery click函数,而不是"#mashupButton"它只会执行该函数点击图片.这适用于我,但仅适用于页面上具有该ID的第一张图片,并且在我完成一次之后,它不再有效.
文件准备好后:
$("#mashupButton").click(function()
{
$(this).effect("drop", {direction:"up"}, 1000);
});
Run Code Online (Sandbox Code Playgroud)
标签就像:
<a href="#" onClick="differentFunction"><img src="imagename.png" id="mashupButton"></a>
Run Code Online (Sandbox Code Playgroud)
所以要澄清一下:我已经说了10张带有ID mashupButton的图像 - 我点击时会对该特定图像执行jQuery效果.但是它只适用于这些图像的第一个,即使它们都包含相同的ID.我是否需要为每个人提供唯一的ID,或者可以通过这种方式实现?
我希望这段代码产生4个地址,每个节点2个地址,因此,有2个相同的地址,然后另一组2个相同的地址:
type node struct {
identifier string
parent *node
children []*node
root int
}
func visitNodes(root *node) {
for i := 0; i < len(root.children); i++ {
fmt.Printf("Visiting node %s\n", &root.children[i])
printNodeAddress(root.children[i])
}
}
func printNodeAddress(node *node) {
fmt.Println(&node)
}
func main() {
root := new(node)
node1 := new(node)
node2 := new(node)
root.children = append(root.children, node1)
root.children = append(root.children, node2)
visitNodes(root)
}
Run Code Online (Sandbox Code Playgroud)
生产:
Visiting node %!s(**main.node=0x10500170)
0x10500180
Visiting node %!s(**main.node=0x10500174)
0x10500190
Run Code Online (Sandbox Code Playgroud)
虽然我希望它能产生这样的东西:
Visiting node %!s(**main.node=0x10500170)
0x10500170
Visiting node …Run Code Online (Sandbox Code Playgroud) Simply put, how do you find out if the 'the' is present in the following string: 'Well lately THEre seems to be much confusion between how to use THEy're, THEre, and THEir, I don't see what THE big deal is?'
The needle capitalized for exaggeration, just trying to figure out how to return the word the is found in the string, but if the string were filled with theres, they'res, and theirs, it wouldn't find it.
Thanks
在分析了我的问题后,我想我可能需要在SQL中使用"union"运算符,但我不确定.任何我在codeigniter中链接我的查询来提出这个查询:
SELECT *
FROM (`deals`)
WHERE `category` = 'books'
AND `host` = 'amazon'
OR `host` = 'zappos'
OR `host` = 'newegg'
ORDER BY `time` desc
Run Code Online (Sandbox Code Playgroud)
因此,它会选择不属于类别书籍但来自这些主机的内容.所以我希望能够让它只返回书中的结果,并拥有这三者中的任何一个.我更喜欢使用数据库查询而不是之后手动过滤.我正在使用带有innoDB表的MySQL.谢谢
我正在Django中创建一个简单的项目,以进一步了解它和Python,基本上只是存储书签和标签,两者都有视图,并且将有3个模型:
Tag
Bookmark
Bookmark_Tag(关系)
我在django文档中阅读了"Projects vs Apps"面板,但我仍然不确定如何进行布局,现在它只在一个书签应用程序中,如果有一个单独的书签应用程序和一个单独的应用程序的标签,如果是这样,关系的模型在哪里生活?
谢谢!