这里一枚~
这个演算法使用相对的比例。O(N) 计算,O(1) 空间
pairs = {a: 1, b: 2}
def freq(pairs)
total = pairs.values.inject(0) { |sum,n| sum + n }
# pick a number (1..total) inclusive
target = rand(total)+1
pairs.each do |key,weight|
if target <= weight
return key
else
target -= weight
end
end
end
#17 楼 @ichord 看过 http://galleria.io/ 吗?
controller 里 reset_session
@ruby_sky 你可以把简历发给我一份吗?[email protected]
#2 楼 @suffering 给我个 email 吧。我们公司在找 rails 程序员 [email protected]
web is dead. long live the web!
试试用 lsof 找出 socket file
$ ps -A | grep mysql 2024 s002 S 0:49.38 /usr/local/Cellar/mysql/5.5.10/bin/mysqld $ lsof -p 2024 # output omitted # Bingo! mysqld 2024 howard 12u unix 0x08a70870 0t0 /tmp/mysql.sock mysqld 2024 howard 13u REG 14,2 2048 1013034 /usr/local/var/mysql/mysql/host.MYI mysqld 2024 howard 14u REG 14,2 0 1013035 /usr/local/var/mysql/mysql/host.MYD mysqld 2024 howard 15u REG 14,2 2048 1013037 /usr/local/var/mysql/mysql/user.MYI mysqld 2024 howard 16u REG 14,2 736 1013038 /usr/local/var/mysql/mysql/user.MYD mysqld 2024 howard 17u REG 14,2 5120 1013030 /usr/local/var/mysql/mysql/db.MYI mysqld 2024 howard 18u REG 14,2 3080 1013032 /usr/local/var/mysql/mysql/db.MYD
the project i am working on right now has an e-commerce component. I am looking forward to learning about Spree : )
oooo beer :))) I am there~~
我也用 emacs. 可以试试 defunkt 的 textmate mode https://github.com/defunkt/textmate.el
@ichord 其实周末也行,比较有空吧。我们俩可以来写些 javascript 的东西。最近还用蛮多的