2005年12月8日

摘要: Table 11.5. Erase/Replace Algorithm name Description Functions replace/erase_first Replace/Erase the first occurrence of a string in the input replace_first() replace_first_copy() ireplace_f... 阅读全文
posted @ 2005-12-08 23:53 吴尔平 阅读(1917) 评论(0) 推荐(0) 编辑

2005年11月29日

摘要: Table 11.4. Find algorithms Algorithm name Description Functions find_first Find the first occurrence of a string in the input find_first() ifind_first() find_last Find the last occurrenc... 阅读全文
posted @ 2005-11-29 11:00 吴尔平 阅读(2242) 评论(0) 推荐(0) 编辑

2005年11月22日

摘要: Table 11.3. Predicates Algorithm name Description Functions starts_with Check if a string is a prefix of the other one starts_with()istarts_with() ends_with Check if a string is a suffix ... 阅读全文
posted @ 2005-11-22 23:09 吴尔平 阅读(1682) 评论(0) 推荐(0) 编辑

2005年11月21日

摘要: Boost String Algorithms Library 是很有用的一个库,它让C++程序员不用一次又一次的为了字符串的处理制造一些小小的轮子。《浅尝boost之String algorithms library》里我主要介绍了它的Split ,因为这个功能很出彩,其它则一带而过。不过,当多次向朋友推荐这个库后,反馈得到的信息让我觉得详细列出其每一个函数的使用,作为一个程序员... 阅读全文
posted @ 2005-11-21 22:56 吴尔平 阅读(1885) 评论(0) 推荐(0) 编辑

2005年11月19日

摘要: bencoding是BT用来说明与组织数据的格式。BitTorrent-4.1.6\BitTorrent\bencode.py是算法的实现。bencoding相当简单,不过我还是写了一个UnitTest来验证我的理解。 1 import unittest 2 from BitTorrent.bencode import * 3 4 class testBencodeFun(unitte... 阅读全文
posted @ 2005-11-19 02:11 吴尔平 阅读(2410) 评论(0) 推荐(0) 编辑

2005年11月16日

摘要: 还没到最后日期,作者撑不住了。peer review 果然是恐怖的事情 Hi all, today I got the following message from John Torjo: Due to the feedback I got, I would like you to declare the library as rejected. In the ... 阅读全文
posted @ 2005-11-16 16:38 吴尔平 阅读(1180) 评论(0) 推荐(0) 编辑

2005年11月13日

摘要: 很早就希望boost中能有一个log库,昨天看到了这个,高兴了一下 ^_^ news://news.gmane.org/gmane.comp.lib.boost.user Subject: [Review] The review of the Boost.Logging library starts November 7th Hi all, today s... 阅读全文
posted @ 2005-11-13 12:17 吴尔平 阅读(3342) 评论(2) 推荐(0) 编辑

2005年10月29日

摘要: 首先,要明白不是所有的socket服务都需要高性能。如果要求高性能,使用IOCP或EPoll模式用C/C++来完成,直接用API写,用ACE的proactor封装来完成是比较恰当的行为。但当性能不是主要问题时,用Python来写socket服务,并享受高的开发效率将是一件快乐的事。下面,是用python完成的一个每thread/connect的一个echo服务。 经常的,在写一... 阅读全文
posted @ 2005-10-29 23:25 吴尔平 阅读(29332) 评论(3) 推荐(0) 编辑

2005年10月25日

摘要: # tinyp2p.py 1.0 (documentation at http://freedom-to-tinker.com/tinyp2p.html) import sys, os, SimpleXMLRPCServer, xmlrpclib, re, hmac # (C) 2004, E.W. Felten ar,pw,res = (sys.argv,lambda u:hmac.new(sy... 阅读全文
posted @ 2005-10-25 10:35 吴尔平 阅读(4086) 评论(1) 推荐(0) 编辑

2005年9月21日

摘要: 我在一个项目中用python做业务逻辑部分的代码,但速度不够理想,记录业务逻辑各段代码的用时情况并分析瓶颈就成了必须的工作。于是动手写了下面的ElapsedTime.PY,帮助解决问题。 import sysimport timeclass ElapsedTime: def __init__(self, scope = ""): self.scope_name ... 阅读全文
posted @ 2005-09-21 18:31 吴尔平 阅读(1112) 评论(0) 推荐(0) 编辑