V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  mrkschan  ›  全部回复第 2 页 / 共 3 页
回复总数  57
1  2  3  
@ratazzi http://is.gd/Gd3yDY mongodb official documentation (english version) ... 不知道要不要跳牆看 (我在牆外的世界)
@iiduce Within the *same* mongodb process... I believe the BSON ObjectId is unique across all collections.

Note: On a single machine, you can have a master mongodb process and a slave mongodb process. Thus, I have to focus the phrase - *same* mongodb process. Anyway, with this master-slave topology, write operations only occur in master mongodb process and, as a result, the ObjectIds are unique.
@iiduce 你已提過了...

ObjectID = 32bit timestamp + md5(hostname) + process-id + sequence-no. (Full definition is quoted at bottom of this post)

在不同電腦內, process-id 跟 sequence-no 跟 timestamp 是有機會一樣的

跟據 wikipedia (http://is.gd/yZBK2B) md5 hash 不是 collision resistance.

即是說, 是有機會出現 md5(hostname_A) == md5(hostname_B).

所以, ObjectId 一定不是全宇宙唯一.

----

BSON ObjectID Specification (http://is.gd/XcorBb)

A BSON ObjectID is a 12-byte value consisting of a 4-byte timestamp (seconds since epoch), a 3-byte machine id, a 2-byte process id, and a 3-byte counter. Note that the timestamp and counter fields must be stored big endian unlike the rest of BSON. This is because they are compared byte-by-byte and we want to ensure a mostly increasing order. Here's the schema:

0 1 2 3 4 5 6 7 8 9 10 11
time machine pid inc
Here is a breakdown of the sections:

TimeStamp

This is a unix style timestamp. It is a signed int representing the number of seconds before or after January 1st 1970 (UTC).
Machine

This is the first three bytes of the (md5) hash of the machine host name, or of the mac/network address, or the virtual machine id.
Pid

This is 2 bytes of the process id (or thread id) of the process generating the object id.
Increment

This is an ever incrementing value, or a random number if a counter can't be used in the language/runtime.
2011-05-26 23:51:46 +08:00
回复了 mrkschan 创建的主题 互联网 國內有沒有一個像 getsatisfaction.com 的服務?
@xiaojay thx
2011-05-26 20:40:39 +08:00
回复了 ihacku 创建的主题 问与答 编译出来的文章可以用Public Domain协议么
@zhuang "原文的东西,只要是翻译来的,就申请授权,保留别人版权" 完全認同. 至於何為"编译", 我沒有認識, 只知道跟翻译不一樣
2011-05-26 18:55:44 +08:00
回复了 ihacku 创建的主题 问与答 编译出来的文章可以用Public Domain协议么
@zhuang 编译跟翻译, 应该是不一样的动词吧...
2011-05-26 18:51:27 +08:00
回复了 leben 创建的主题 程序员 在ruby和python之间纠结,求指点。
@chloerei 我不是在 Ruby 跟 Python 之間"纠结"的人 -.- 只是路過這論題, 發表一下較客觀的論點 (e.g. funded dev) -.- 個人不喜歡 "xx 比 xx 自由" 那類"理"據
2011-05-26 18:34:56 +08:00
回复了 leben 创建的主题 程序员 在ruby和python之间纠结,求指点。
@chloerei 但我又不覺得 Ruby / Python, 那個是 "领先别人" 走.
Firefox 採用了 short iteration 的開發方向 ... version number 跳快了, 但好的 feature 不用 user 久等 ... 有什麼問題 -.-?
2011-05-26 17:43:09 +08:00
回复了 leben 创建的主题 程序员 在ruby和python之间纠结,求指点。
@chloerei 換句話說, 你不認同小弟的論點: 較多 $ support 的 technology, 是一個 safe bet?
2011-05-26 14:35:33 +08:00
回复了 leben 创建的主题 程序员 在ruby和python之间纠结,求指点。
@ssword 另外, 我覺得看別人的論點跟理據, 覺得收穫不少哦
2011-05-26 14:29:39 +08:00
回复了 leben 创建的主题 程序员 在ruby和python之间纠结,求指点。
@ssword alexa 是訪問流量 ... GFW 保護了 python.org 嗎?
2011-05-26 14:16:05 +08:00
回复了 leben 创建的主题 程序员 在ruby和python之间纠结,求指点。
如果要對比 Python 跟 Ruby 的 web adoption, 相信 Ruby 佔優呢 ... e.g. Django is inspired by RoR; Trac is superseded by RedMine.
2011-05-26 14:13:59 +08:00
回复了 leben 创建的主题 程序员 在ruby和python之间纠结,求指点。
@huiyubird 點進來 url 是 #reply81 ... 應該會自動拉最底的
2011-05-26 14:10:19 +08:00
回复了 leben 创建的主题 程序员 在ruby和python之间纠结,求指点。
如果看看 Alexa 上的 "Audience" stats, 看來日本人很喜歡來自日本的Ruby. 而中國的 訪問量占有率 卻是差不多.

http://www.alexa.com/siteinfo/ruby-lang.org
http://www.alexa.com/siteinfo/python.org
2011-05-26 14:05:21 +08:00
回复了 leben 创建的主题 程序员 在ruby和python之间纠结,求指点。
@ssword 味道重是肯定的, 是不是沒营养呢? 如果可以從不同人的論點看同一件事, 這沒得益嗎?
2011-05-26 13:55:16 +08:00
回复了 leben 创建的主题 程序员 在ruby和python之间纠结,求指点。
如果看看 Python 2011 May 的 Stats (http://pypi.python.org/webstats/usage_201105.html#TOPCTRYS) ... 來自中國的訪問量, 排16哦
2011-05-26 13:52:15 +08:00
回复了 leben 创建的主题 程序员 在ruby和python之间纠结,求指点。
其實我不是很熟悉 Ruby 那一面的發展, 它有沒有像 Python (http://python.org/psf/) 一樣, 有一個 Foundation 支持 ?
2011-05-26 13:48:28 +08:00
回复了 leben 创建的主题 程序员 在ruby和python之间纠结,求指点。
@real_newbie 哦, 是我看錯了..

剛剛我找了一下 http://rubygems.org/stats.html and http://pypi.python.org/webstats/

這兩個 stats 頁可能會有一些啟示
2011-05-26 13:38:40 +08:00
回复了 leben 创建的主题 程序员 在ruby和python之间纠结,求指点。
@real_newbie 我看 ruby 的是 http://rubygems.org/gems

'''
Displaying gems 1 - 30 of 1615 in total
'''
1  2  3  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2294 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 22ms · UTC 15:37 · PVG 23:37 · LAX 08:37 · JFK 11:37
Developed with CodeLauncher
♥ Do have faith in what you're doing.