07 2013 档案
摘要:普通计时可以clock()精确计时:windows:QueryPerformanceCounter() linux:clock_gettime()用法:google参考:http://blog.csdn.net/pirate_code/article/details/5670055http://blog.chinaunix.net/uid-25909722-id-2827364.html
阅读全文
摘要:python有一个python模块--hash_ring,即python中的一致性hash,使用起来也挺简单。可以参考下官方例子:https://pypi.python.org/pypi/hash_ring/ 1 Basic example of usage (for managing memcached instances): 2 3 memcache_servers = ['192.168.0.246:11212', 4 '192.168.0.247:11212', 5 '192.168.0.249:1121...
阅读全文
摘要:调试程序发现起了一个子线程后,主线程上的sleep不生效了,看到这才明白...— Function: unsigned intsleep(unsigned int seconds)Thesleepfunction waits forsecondsor until a signal is delivered, whichever happens first.Ifsleepfunction returns because the requested interval is over, it returns a value of zero. If it returns because of deli
阅读全文
摘要:1 #baidu_hotword.py 2 #get baidu hotword in news.baidu.com 3 import urllib2 4 import os 5 import re 6 7 def getHtml(url): 8 page = urllib2.urlopen(url) 9 html = page.read()10 page.close()11 return html12 13 def getHotWord(html):14 reg = ''15 hotwords = re.compile(reg).finda...
阅读全文
浙公网安备 33010602011771号