代码改变世界

sql 的group by order by having 等等与mongo的对应关系

2014-07-25 15:16 by briller, 413 阅读, 0 推荐, 收藏, 编辑
摘要:http://docs.mongodb.org/manual/reference/sql-aggregation-comparison/unwind解释 拆解数组http://blog.nosqlfan.com/html/3648.html几种方式做grouphttp://blog.csdn.ne... 阅读全文

crontab 里 % 引发的问题

2014-07-25 11:57 by briller, 324 阅读, 0 推荐, 收藏, 编辑
摘要:写个 crontab ,命令是类似这样的/path/to/script `date +%Y-%m-%d`直接运行很正常,但是在 crotnab 里就出错。/bin/sh: -c: line 1: unexpected EOF while looking for matching ``'/bin/sh... 阅读全文

hbase 备忘

2014-07-21 18:36 by briller, 138 阅读, 0 推荐, 收藏, 编辑
摘要:设置好后需要将 hadoop 的core-site.xml hdfs-site.xml放到 hbase的conf文件夹中。启动后可以在backup master机器上启动 /bin/hbase-daemon.sh start master --backup 来启动backup masterslf4... 阅读全文

web 粘贴到vim 的内容格式化

2014-07-21 17:29 by briller, 307 阅读, 0 推荐, 收藏, 编辑
摘要:14.6. How do I format/indent an entire file?You can format/indent an entire file using the gg=G command, where gg - Goto the beginning of the file ... 阅读全文

取某个unixtime x 的当天的开始的unixtime y

2014-07-14 17:59 by briller, 169 阅读, 0 推荐, 收藏, 编辑
摘要:import timeimport datetimep = time.localtime(x)dt = datetime(*p[:3])y = time.mktime(dt.timetuple())顺便附带上星号什么的解释http://blog.csdn.net/qinyilang/article/... 阅读全文

mongo 索引问题

2014-06-24 18:15 by briller, 208 阅读, 0 推荐, 收藏, 编辑
摘要:http://wenku.baidu.com/link?url=WeLb5kFFlWXmsi3jRY8D3cd7wh0QmSQokueslk4Pi1BcSre69TUP6D7gD9OVNNrBBrhZE5HAD6-63YQ59xyHyIbVsFxmWmnnY0wz3Xmfh4S增加了appVersi... 阅读全文

python sb 问题

2014-06-20 10:32 by briller, 302 阅读, 0 推荐, 收藏, 编辑
摘要:PROGRAM_MAX_LENGTH = 60*60*3 #3 hoursskiptimes = 0TOTALTIMES = 0def xxx(): print TOTALTIMES #fine consider it as constant #TOTALTIMES += 1 #N... 阅读全文

scrapy 相关问题

2014-06-18 14:39 by briller, 147 阅读, 0 推荐, 收藏, 编辑
摘要:爬取text 包含某个关键字时zhibo_unicode = unicode("直播","utf-8")sel.xpath('//a[contains(span/text(),"%s")]/@href' % zhibo_unicode) 只能用%s占位符这种类似的方式。 以下方式是不... 阅读全文

Flume sink 相关内容

2014-05-26 18:01 by briller, 842 阅读, 0 推荐, 收藏, 编辑
摘要:SinkRunner.java 开启线程调用相应的Processor(Policy) , 根据 Policy调用process的返回值来决定线程睡眠时间,每次默认延后1s,最大默认为5s。public class SinkRunner implements LifecycleAware { pri... 阅读全文

Flume 的失败选择机器和BACKOFF的机制

2014-05-21 12:47 by briller, 825 阅读, 0 推荐, 收藏, 编辑
摘要:在OrderSelector.java中默认的是round_robin,即轮询。backoff 算法是指数回退,代码如下: public void informFailure(T failedObject) { //If there is no backoff this method is a... 阅读全文