
Python
文章平均质量分 56
zuroc
这个作者很懒,什么都没留下…
展开
-
Fast Asynchronous Python Web Server (Fapws is short)
http://github.com/william-os4y/fapws3/tree/masterThis is a python web server using the wonderfull libev (http://software.schmorp.de/pkg/libev.html) library. Thus this is yet an another asynchronou...原创 2009-08-15 12:12:53 · 141 阅读 · 0 评论 -
lcs.py 最长公共子串算法
[size=large]感觉用来匹配相似文件比最短编辑距离更靠谱,最短编辑应该是用来纠错的http://www.unixuser.org/~euske/python/这个网站还有不少好脚本http://www.unixuser.org/~euske/python/lcs.pyzuroc@frodo ~/dev/douban $ cat lcs.py #!/usr...2009-05-05 15:50:19 · 110 阅读 · 0 评论 -
lrucache.py 最近最少使用算法
lrucache.py 最近最少使用算法2009-05-04 13:22:36网上找的# lrucache.py -- a simple LRU (Least-Recently-Used) cache class# Copyright 2004 Evan Prodromou # Licensed under the Academic Free License 2.1...2009-05-04 13:23:44 · 170 阅读 · 0 评论 -
史上最快 异步消息队列zeromq 简介
[size=large]是的,我喜欢Z开头的东西.http://www.zeromq.org/zeromq是一个基于内存的消息队列是一个有着青春和朝气的项目,可惜网站被和谐了高吞吐,低延时,超乎你的想象.ØMQ is already very fast. We're getting 13.4 microseconds end-to-end latenci...2009-04-30 21:40:20 · 809 阅读 · 0 评论 -
pyulbas -> boost矩阵库的python封装
[size=large]pyulbas 是对 boost ulbas 矩阵库的一个封装,同时可以方便的和numpy进行互操作用法如下import numpyimport pyublasa = pyublas.zeros((5,5), flavor=pyublas.SparseBuildMatrix, dtype=float)#SparseBuildMatri...2008-11-22 16:16:37 · 160 阅读 · 0 评论 -
python代码格式化工具
[size=large]在 pydent 基础上 改造的多了一些自动加空格,我是一个懒人,多一个空格都不高兴打。。。还可以在 vim 一键排版 安装工具后,在.vimrc中加入下面代码,可以实现F12一键排版map :call FormartSrc()"定义FormartSrc()func FormartSrc()exec "w"if &fil...2008-11-21 23:44:03 · 290 阅读 · 0 评论 -
python2.6新特性named tuple
[size=large]named tuple Any tuple subclass whose indexable elements are also accessible using named attributes (for example, time.localtime() returns a tuple-like object where the year is acces...2008-11-14 21:04:09 · 156 阅读 · 0 评论 -
vim python代码自动折叠
[size=x-large]手工做折叠太痛苦了用这个吧:)http://vim.sourceforge.net/scripts/script.php?script_id=515zo 展开zc 收起zn 全部展开zN 全部折叠[/size]2008-11-06 14:15:27 · 1039 阅读 · 0 评论 -
python 网络 相关 资源 (epoll 和 Eventlet )
[size=large]1.epoll 哇哦 , 2.6有epoll了select.epoll([sizehint=-1])(Only supported on Linux 2.5.44 and newer.) Returns an edge pollingobject, which can be used as Edge or Level Triggered interface ...2008-11-02 18:26:28 · 163 阅读 · 0 评论 -
Stackless python 好用之处的一个简单演示:并发抓网页
[size=large]import stacklessimport stacklesssocketstacklesssocket.install()import urllib2def test_urllib2(i): print "urllib2 test", i print urllib2.urlopen("http://www.baidu.com")....2008-11-02 12:01:49 · 282 阅读 · 0 评论 -
sqlalchemy的session与线程备忘
[url]http://www.mail-archive.com/sqlalchemy@googlegroups.com/msg07933.html[/url]an example of a typical Session lifecycle as placed in a web application is here:http://www.sqlalchemy.org/do...2008-04-02 18:04:26 · 347 阅读 · 0 评论 -
python2.6的urlopen支持timeout了
[size=x-large]python2.6的urlopen支持timeout了我喜欢不过什么时候才能发布呢.........________后记urllib2.urlopen(url[, data][, timeout]) Open the URL url, which can be either a string or a Request object.d...2008-04-02 17:42:23 · 481 阅读 · 0 评论 -
借着今天的大好日子,挖一个Pylons教程的坑
附件的有预览写了两小节源代码放在http://shot-news.googlecode.com/svn/trunk这几天看来没空填了不过大家都说了,挖坑不填是美德的:)在线浏览见[url]http://zuroc.go1.icpcn.com/pylons/index.html[/url]...2008-04-01 15:23:28 · 172 阅读 · 0 评论 -
pylons的分页类
原来pylons是有分页类的是放在webhelpers下面 paginate(collection, page=None, per_page=10, item_count=None, query_args=None, **options) ... Example:# Using an SQLAlchemy object with assign_mapper unde...2008-03-29 12:28:52 · 113 阅读 · 0 评论 -
pylons mako 摘录笔记
pylons mako笔记1.在pylons中设置为utf-8编码在pylons工程config/environment.py文件最后,添加tmpl_options['mako.default_filters'] = ['decode.utf8']2.${}中间直接是python代码,显示其返回值this is x: ${x}pyth...2008-03-27 20:48:57 · 175 阅读 · 0 评论 -
抓取科学网新闻
抓取科学网新闻请安装sqlalchemy2008-03-27 06:18:58 · 142 阅读 · 0 评论 -
python排版工具
[size=large][url]http://pypi.python.org/pypi/pythius_zsp_ver/1.4[/url]发布一个我修改的pythius,以前在豆瓣改动的,昨晚又修了几个bug主要改进是a=1 -> a = 1当然按照pep8的原则 不会修改 def a(b=1)要对当前目录小的所有python文件排版就是pyd...2009-10-15 14:22:04 · 1729 阅读 · 0 评论 -
easy_install离线安装
2008/3/9 Bruce Wang :> 假设你要安装 TurboGears, 在有网络的地方> easy_install -zmaxd . TurboGears> 然后将整个目录下的内容copy到目标机器,执行>> easy_install -f . TurboGears> 详细参考 http://docs.turbogears.org/1.0/OfflineIn...2008-03-10 04:27:36 · 1000 阅读 · 0 评论 -
libsvm (python封装) 学习笔记 1
2009-05-19 14:10:38#!/usr/bin/env python#coding:utf-8#不少文本引用自#http://blog.youkuaiyun.com/Felomeng/archive/2009/04/09/4058669.aspx#和其他等等地方from svm import *#一个有3个类的问题labels = [0, 1, 1,...2009-05-19 14:28:01 · 208 阅读 · 0 评论 -
关于"Google限制Python"事件我的看法
[size=medium]本来做一个勤勤恳恳的码农我应该学习佩雷尔曼前辈的作风 --- "佩雷尔曼反复说他已经退出了数学界,不再认为自己是职业数学家了。"不过鉴于Gtalk跳出很多朋友 -- 写PHP的和写Java的 -- 很高兴的告诉我伟大的优快云上出现了一条新闻:[独家]Google将限制Python语言的应用 开发社区热议 http://news.youkuaiyun.com/a/2009...2009-11-17 15:11:37 · 177 阅读 · 0 评论 -
c++的矩阵库getfem with python
[size=large]不知道是封装还是什么的问题,昨天提到的pyulbas显得很慢.我又找来一个c++的矩阵库,看起来不错http://home.gna.org/getfem/不过他的python封装不是很好,首先是只封装了一个运算用的稀疏矩阵,这种矩阵赋值的很慢的,不过好在还可以从文件中读取数据,而且比较快.然后就是csc_val(self)Return t...2008-11-23 14:02:04 · 300 阅读 · 0 评论 -
发一个山寨版python的Orm
[size=large]发一个山寨版的Orm大概用法见[url]http://docs.google.com/Presentation?id=dhc93v8q_4tth7mrr3[/url]具体用法看看源码下载[url]http://code.google.com/p/zspy/downloads/list[/url][/size]...2009-02-24 23:49:24 · 123 阅读 · 0 评论 -
pyrex学习笔记
[size=large]0.easy_install pyrex1.写pyrex文件~/pyrex $ ls__init__.py primes.pyx~/pyrex $ cat primes.pyx #coding:utf-8#一个函数def primes(int kmax): cdef int n, k, i cdef int ...原创 2009-02-24 03:36:49 · 208 阅读 · 0 评论 -
python的一个有趣的细节
[size=large]python3.0一个有趣的细节2009-02-24 01:59:37看文档时看到的# Python v3.0c1 documentation »OptimizationsThe net result of the 3.0 generalizations is that Python 3.0 runs the pystone benchm...原创 2009-02-24 02:00:45 · 156 阅读 · 0 评论 -
python备玩候选者
* 张沈鹏 推荐网址当然要有一个部署的东西 Exscript Scriptin... http://code.google.com/p/exscript/ Exscript is a script and template language for automating network connections over protocols such ...2009-02-24 00:34:19 · 133 阅读 · 0 评论 -
python读取mp3 ID3信息
[size=large]pyid3不好用,常常有不认识的.mutagen不错,不过默认带的easyid3不会读取注释,需要手工hack一下from mutagen.mp3 import MP3import mutagen.id3from mutagen.easyid3 import EasyID3EasyID3.valid_keys["comment"]="COMM::...2009-02-18 16:57:07 · 413 阅读 · 0 评论 -
python奇技淫巧
[size=x-large]http://wiki.python.org/moin/ByteplayDoc-----------------------wget http://byteplay.googlecode.com/svn/trunk/byteplay.py-----------------------from types import FunctionType...2009-07-23 22:27:59 · 202 阅读 · 0 评论 -
又写了一个python的route模块
是的 我很无聊2009-01-14 01:18:09 · 452 阅读 · 0 评论 -
mxTidy - HTML Tidy for Python
[size=large]抓取的html不处理一下很容易破坏页面的布局官网的python封装好像不支持linux,囧另外找了一个mxTidy - HTML Tidy for Python网站[url]http://www.egenix.com/products/python/mxExperimental/mxTidy/[/url]下载[url]...2009-01-05 10:50:02 · 227 阅读 · 0 评论 -
跨平台 获取系统信息的python库 http://support.hyperic.com/disp
[size=large]The Sigar API provides a portable interface for gathering system information such as: * System memory, swap, cpu, load average, uptime, logins * Per-process memory, cpu, creden...2009-06-12 11:49:38 · 179 阅读 · 0 评论 -
写了一个很简单的消息队列
[size=large]更新:加入了 紧急消息 和 热重新加载-------------------------是push的方式,每一个key用 一个线程 来push,持久化的方式是抄的peafowl ,远程调用 用的Pyro.core每一个调用完成才会del key,如果失败 会重试这个key[/size]...2008-12-20 15:20:05 · 334 阅读 · 0 评论 -
Bloom filters in Python
Python语言: 临时自用代码@代码发芽网#coding:utf-8# Bloom filters in Python# Adam Langley # 给CountedBloom加了一个max_count 张沈鹏 # Bloom-Filter算法简介# http://www.googlechinablog.com/2007/07/bloom-filter.html...2008-12-10 11:07:04 · 195 阅读 · 0 评论 -
写了一个Python url分配模块
[size=large]pylons的route写的很绕,很java我狠狠的抄袭并重写了一个现在只有一个文件了(压缩包中另外一个目录是演示)更新:[color=red]原来的有bug,更新版本见第二个附件中的epylon/route.py[/color][/size]...2008-12-07 11:23:21 · 159 阅读 · 0 评论 -
frozenset
[size=large]看Route代码看到一个frozenset,了解了一下http://blog.youkuaiyun.com/sharkw/archive/2007/12/14/1937334.aspx简单的说:换句话说,set 是非线程安全的,frozenset没有这个问题,但是frozen的[/size]...2008-12-06 00:52:49 · 106 阅读 · 0 评论 -
频繁集统计 python 封装
封装的是附件这篇paper的count因为对比发现这个的综合性能比较好xxx@ooo ~/zspal/zfeq/frequent-items/src $ cat Release/pyzlcl.py#coding:utf-8from pyzlcl import Lcl#0.001 是要统计的频率下限lcl = Lcl(0.001)for i in xran...2009-05-29 15:49:11 · 165 阅读 · 0 评论 -
python2.6 文档生成用的工具
[size=large][url]http://sphinx.pocoo.org/[/url]很不错easy_install 之后然后 sphinx-quickstart 然后make[/size]2008-11-30 16:50:55 · 140 阅读 · 0 评论 -
python 神经网络调教程序
[size=large]#from http://pyneurgen.sourceforge.net/tutorial_nn.htmlimport randomimport mathfrom pyneurgen.neuralnet import NeuralNetfrom pyneurgen.nodes import BiasNode, Connectionpo...原创 2008-11-29 23:00:09 · 924 阅读 · 0 评论 -
稀疏矩阵的存储格式 之 CSR/CSC
R是Row,C是Column以csr为演示[img]http://zsp.iteye.com/upload/picture/pic/25643/ade3dc1b-a7d9-3b4b-a5d9-1ac4f617ed01.jpg[/img]I中每一个元素代表一行,其数值代表该行从J中哪个元素开始.J是列号了空间 2*nnz+n(因为I==行数,J==2*nnz),nnz...2008-11-23 19:37:58 · 1091 阅读 · 0 评论 -
python之atexit -- 在退出时进行清理操作
import atexit@atexit.registerdef exit_handle():print "close something"2008-03-09 22:26:56 · 562 阅读 · 0 评论 -
[转载]宇宙学的终结
这是一篇让人悲哀的文章 .................. -- 张沈鹏--------------------------------------------------from 格志 - 一起格物致知 by sukye从大爆炸开始,宇宙一直长大。十年来观测到宇宙正在加速膨胀,除了物质之外,我们还需要黑暗的力量。它就是暗能量,一种未知的能量密度,爱因斯坦的宇...2008-02-26 05:55:27 · 125 阅读 · 0 评论