自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

  • 博客(7)
  • 收藏
  • 关注

转载 学习tornado -- 异步

why asynchronoustornado是一个异步web framework,说是异步,是因为tornado server与client的网络交互是异步的,底层基于io event loop。但是如果client请求server处理的handler里面有一个阻塞的耗时操作,那么整体的server性能就会下降。 def MainHandler(tornado.web.Re

2013-02-28 20:41:28 1925

转载 传说中最快的python字典排序方法

对简单字典的排序,如d = {'a':2, 'b':23, 'c':5, 'd':17, 'e':1},按key-value排序,官方有一种传说是最快的方法。from operator import itemgettersorted(d.iteritems(), key=itemgetter(1), reverse=True)另附一些排序方法的测试代码:

2013-02-25 09:37:57 632

原创 使用cPickle来序列化、持久化 python对象

>>> import cPickle>>> data=range(10)>>> data[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]>>> cPickle.dump(data,open("/tmp/1.dat","wb")) >>> exit()>>> import cPickle>>> data = cPickle.load(open(

2013-02-20 15:04:23 666

原创 postgresql 加解密

F.20. pgcryptoThe pgcrypto module provides cryptographic functions for PostgreSQL.F.20.1. General hashing functionsF.20.1.1. digest() digest(data text, type text) returns bytea

2013-02-20 14:50:08 3964

原创 Postgresql 时间相减求 秒、分、小时数

select a.*,b.login_name,b.user_name,c.cat_name from sec.t_post_message a,sec.t_user b,sec.t_comm_cfg c where a.user_id=b.id and a.type_id=c.cat_id and inpool='0' and time_type='1' and abs((EXTRACT(EPO

2013-02-18 18:16:27 13798

原创 python postgresql 函数

CREATE or replaceFUNCTION public.test()    RETURNS text AS $$    import socket    return socket.gethostname()$$ LANGUAGEplpythonu; CREATE or replaceFUNCTION public.test(keyword varchar)

2013-02-07 19:35:43 1219

转载 plpython 9.2.2

注意,安装python时,需要--enable-shared安装pg时,需要--with-python如果python,重装报  error while loading shared libraries: libpython2.7则需要 vi /etc/ld.so.conf 添加/usr/local/Python2.7/lib/sbin/ldco

2013-02-07 18:02:56 1724 1

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除