<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5796527</id><updated>2024-09-19T21:28:57.558+08:00</updated><category term="唠叨"/><category term="python"/><category term="google"/><category term="android"/><category term="django"/><category term="linux"/><category term="perl"/><category term="GFW"/><category term="apache"/><category term="debian"/><category term="funny"/><category term="ldap"/><category term="setup"/><category term="shell"/><category term="subversion"/><category term="ubuntu"/><category term="web"/><title type='text'>举头望明月</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://xieyanbo.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default'/><link rel='alternate' type='text/html' href='http://xieyanbo.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default?start-index=26&amp;max-results=25'/><author><name>xyb</name><uri>http://www.blogger.com/profile/11574809298508868859</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>116</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5796527.post-6061808750401745315</id><published>2010-10-27T06:54:00.004+08:00</published><updated>2010-10-27T07:15:47.909+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="google"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><title type='text'>导出Google Apps里所有的用户组和组员</title><content type='html'>&lt;a href=&quot;http://www.google.com/apps/&quot;&gt;Google Apps&lt;/a&gt;的管理功能很不错，但用户组多了不好管理，时常要拿出来晒晒，调整一下结构。这就经常需要把所有组和组员列出来，幸亏Google提供了&lt;a href=&quot;http://code.google.com/googleapps/domain/gdata_provisioning_api_v2.0_reference_python.html#Retrieve_Member_Example&quot;&gt;API&lt;/a&gt;，懒人的办法就是用脚本搞定。下面是python示例，输出比较简单。知道了如何做，你可以自己改成输出csv或者任何其他格式，都会容易。多说无益，上代码。&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;#!/usr/bin/env python&lt;br /&gt;# Author: xieyanbo@gmail.com&lt;br /&gt;# dump_google_apps_mail_groups.py&lt;br /&gt;# export mail groups and group members from Google Apps service&lt;br /&gt;&lt;br /&gt;import gdata.apps.groups.service&lt;br /&gt;&lt;br /&gt;def print_all_members(email, domain, password):&lt;br /&gt;    group_service = gdata.apps.groups.service.GroupsService(email=email,&lt;br /&gt;            domain=domain, password=password)&lt;br /&gt;    group_service.ProgrammaticLogin()&lt;br /&gt;&lt;br /&gt;    def print_members(group_id):&lt;br /&gt;        for user in group_service.RetrieveAllMembers(group_id):&lt;br /&gt;            print user[&#39;memberId&#39;]&lt;br /&gt;&lt;br /&gt;    def shrink(str, max=20):&lt;br /&gt;        if not str:&lt;br /&gt;            return &#39;&#39;&lt;br /&gt;        str = str.replace(&#39;\n&#39;, &#39; &#39;).strip().decode(&#39;utf8&#39;)&lt;br /&gt;        if len(str) &gt; max:&lt;br /&gt;            short = str[:max-3] + &#39;...&#39;&lt;br /&gt;        else:&lt;br /&gt;            short = str&lt;br /&gt;        return str.encode(&#39;utf8&#39;)&lt;br /&gt;&lt;br /&gt;    def print_groups(groups):&lt;br /&gt;        for group in groups:&lt;br /&gt;            gid = group[&#39;groupId&#39;]&lt;br /&gt;            print &#39;%s, %s, %s&#39; % (gid, group[&#39;groupName&#39;],&lt;br /&gt;                    shrink(group[&#39;description&#39;]))&lt;br /&gt;            print &#39;=&#39;*60&lt;br /&gt;            print_members(gid)&lt;br /&gt;            print&lt;br /&gt;&lt;br /&gt;    groups = group_service.RetrieveAllGroups()&lt;br /&gt;    print_groups(groups)&lt;br /&gt;&lt;br /&gt;def main():&lt;br /&gt;    from optparse import OptionParser&lt;br /&gt;    parser = OptionParser()&lt;br /&gt;&lt;br /&gt;    parser.add_option(&#39;-e&#39;, &#39;--email&#39;)&lt;br /&gt;    parser.add_option(&#39;-d&#39;, &#39;--domain&#39;)&lt;br /&gt;    parser.add_option(&#39;-p&#39;, &#39;--password&#39;)&lt;br /&gt;    options, args = parser.parse_args()&lt;br /&gt;&lt;br /&gt;    if not options.email:&lt;br /&gt;        parser.error(&#39;need email address to login&#39;)&lt;br /&gt;    if not options.domain:&lt;br /&gt;        parser.error(&#39;need domain to login&#39;)&lt;br /&gt;    if not options.password:&lt;br /&gt;        import getpass&lt;br /&gt;        password = getpass.getpass(&#39;Password: &#39;)&lt;br /&gt;    else:&lt;br /&gt;        password = options.password or login&lt;br /&gt;    print_all_members(options.email, options.domain, password)&lt;br /&gt;&lt;br /&gt;if __name__ == &#39;__main__&#39;:&lt;br /&gt;    main()&lt;/pre&gt;&lt;/blockquote&gt;</content><link rel='replies' type='application/atom+xml' href='http://xieyanbo.blogspot.com/feeds/6061808750401745315/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5796527/6061808750401745315' title='1 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/6061808750401745315'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/6061808750401745315'/><link rel='alternate' type='text/html' href='http://xieyanbo.blogspot.com/2010/10/google-apps.html' title='导出Google Apps里所有的用户组和组员'/><author><name>xyb</name><uri>http://www.blogger.com/profile/11574809298508868859</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5796527.post-5649779985046809519</id><published>2010-07-07T11:31:00.004+08:00</published><updated>2010-07-07T12:17:24.086+08:00</updated><title type='text'>在Gentoo里调试新软件包</title><content type='html'>最近又开始研究web测试的技术，迷上了西门子开发的&lt;a href=&quot;http://code.google.com/p/robotframework/&quot;&gt;robot framework&lt;/a&gt;。不过服务器用的Gentoo上还没有这东西，只好自力更生。所以先记录一下给Gentoo添加新软件包的过程，下次也好照抄，以后再说robot framework有多好。&lt;br /&gt;&lt;br /&gt;Gentoo的包管理器叫做Portage，描述文件叫Portfile。现在的portage很讲究目录结构，就是Gentoo里的PORTDIR structure，所谓category。robot framework是用python开发的，照例是在dev-python下的某个目录中。没想到的是，现在ebuild对目录的检查很严格，即使在调试时安装本地的portfile也要遵循该结构：&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;mkdir -p dev-python/robotframework&lt;br /&gt;mv robotframework-2.5.ebuild dev-python/robotframework/&lt;br /&gt;cd dev-python/robotframework&lt;/code&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;然后利用底层的ebuild包管理命令，对本地包生成数字摘要、测试安装和部署：&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;sudo ebuild robotframework-2.5.ebuild digest&lt;br /&gt;sudo ebuild robotframework-2.5.ebuild install&lt;br /&gt;sudo ebuild robotframework-2.5.ebuild qmerge&lt;/code&gt;&lt;/blockquote&gt;&lt;br /&gt;digest是最近新增加的指令？有这个命令省事多了，调试起来很happy。&lt;br /&gt;&lt;br /&gt;调试过程需要反复修改，得删除已经用qmerge安装到系统目录中的文件，以及portfile的缓存：&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;sudo emerge -C robotframework-2.5&lt;br /&gt;sudo rm -rf /var/tmp/portage/dev-python/robotframework-2.5/&lt;/code&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;把dev-python/robotframework和dev-python/robotframework-seleniumlibrary向Gentoo提交了，不知道审核要多久。&lt;br /&gt;&lt;br /&gt;完。</content><link rel='replies' type='application/atom+xml' href='http://xieyanbo.blogspot.com/feeds/5649779985046809519/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5796527/5649779985046809519' title='2 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/5649779985046809519'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/5649779985046809519'/><link rel='alternate' type='text/html' href='http://xieyanbo.blogspot.com/2010/07/gentoo.html' title='在Gentoo里调试新软件包'/><author><name>xyb</name><uri>http://www.blogger.com/profile/11574809298508868859</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5796527.post-3106459884594212167</id><published>2009-04-26T16:11:00.005+08:00</published><updated>2009-04-26T16:56:08.508+08:00</updated><title type='text'>请，给点提示吧，bitten</title><content type='html'>一直在用&lt;a href=&quot;http://bitten.edgewall.org/&quot;&gt;bitten&lt;/a&gt;做集成测试，效果挺好，现在天天离不了它。不过最近被它搞的很郁闷，因为bitten-slave吐出一行神秘的错误信息：&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;[DEBUG   ] Sending POST request to &#39;https://mytrac.com/build/5632/steps/&#39;&lt;br /&gt;[WARNING ] Server returned error 403: Forbidden&lt;br /&gt;[ERROR   ] HTTP Error 403: Forbidden&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;起因是因为最近升级了bitten，顺便想把以前的单个进程拆成多个，加快一下bitten的执行速度。人家说，一个和尚有水吃，两个和尚抬水吃，三个和尚没水吃，没想到软件也是这样。两个slave一块跑起来，就有了问题：有时这个出错，有时那个出错，提示都是神秘的403。观察了一下，出现错误的时候，都是某slave A先执行，B稍后也开始执行，然后A再次向服务器POST数据就会出错。猜测可能用户之间有冲突，试过了几种方式，使用各自独立的用户名，在不同目录执行，在不同机器执行，但问题依旧。今天费了些力气，把bitten的代码跟踪了半天，发现程序调用了这个&lt;a href=&quot;http://bitten.edgewall.org/browser/trunk/bitten/queue.py?rev=629#L260&quot;&gt;函数&lt;/a&gt;：&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;    def reset_orphaned_builds(self):&lt;br /&gt;       &quot;&quot;&quot;Reset all in-progress builds to ``PENDING`` state if they&#39;ve been&lt;br /&gt;       running so long that the configured timeout has been reached.&lt;br /&gt;    &lt;br /&gt;       This is used to cleanup after slaves that have unexpectedly cancelled&lt;br /&gt;       a build without notifying the master, or are for some other reason not&lt;br /&gt;       reporting back status updates.&lt;br /&gt;       &quot;&quot;&quot;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;幸亏代码里有注释，这才恍然大悟，原来是timeout参数在作怪。进入trac管理界面，把timeout从10秒调高到500秒，总算解决了问题。&lt;br /&gt;&lt;br /&gt;实际上，在bitten描述&lt;a href=&quot;http://bitten.edgewall.org/wiki/MasterSlaveProtocolHttp#CancellingBuilds&quot;&gt;客户端协议&lt;/a&gt;的文档中，已经指出了这一问题：&lt;br /&gt;&lt;blockquote&gt;To handle the case of build slaves going away at some point between having created a build and completing the build, the build master should have a configurable timeout. All in-progress builds would be checked against this timeout; if there has been no activity on the build for an amount of time exceeding the timeout, the master should cancel the build, resetting it the PENDING state. If a slave later does decide to come back to life and post results, it would get 404 (Not Found) or 409 (Conflict) errors, and should cancel the build on its side, too. &lt;/blockquote&gt;&lt;br /&gt;但由于未明的原因，bitten的实现用403代替了404、409，并且没有给出进一步的提示信息。要是bitten-slave能打印一条附加信息，告诉我403的原因可能跟timeout设置有关系，那该多好呀。&lt;br /&gt;&lt;br /&gt;这个故事告诉我们，别嫌提示信息废话太多，能多写一点是一点，不定什么时候它就会节省自己和别人的若干时间。折腾了三天以后，我现在太喜欢话唠的软件啦。</content><link rel='replies' type='application/atom+xml' href='http://xieyanbo.blogspot.com/feeds/3106459884594212167/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5796527/3106459884594212167' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/3106459884594212167'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/3106459884594212167'/><link rel='alternate' type='text/html' href='http://xieyanbo.blogspot.com/2009/04/bitten.html' title='请，给点提示吧，bitten'/><author><name>xyb</name><uri>http://www.blogger.com/profile/11574809298508868859</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5796527.post-5505354893951349967</id><published>2007-11-30T18:45:00.000+08:00</published><updated>2007-11-30T19:00:34.050+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="django"/><title type='text'>用于django中的缓存decorator</title><content type='html'>myproject/&lt;a href=&quot;http://www.djangosnippets.org/snippets/492/&quot;&gt;decorators.py&lt;/a&gt;代码：&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;from django.core.cache import cache&lt;br /&gt;&lt;br /&gt;def cached(cache_key=&#39;&#39;, timeout_seconds=1800):&lt;br /&gt;    def _cached(func):&lt;br /&gt;        def do_cache(*args, **kws):&lt;br /&gt;            if isinstance(cache_key, str):&lt;br /&gt;                key = cache_key % locals()&lt;br /&gt;            elif callable(cache_key):&lt;br /&gt;                key = cache_key(*args, **kws)&lt;br /&gt;            data = cache.get(key)&lt;br /&gt;            if data: return data&lt;br /&gt;            data = func(*args, **kws)&lt;br /&gt;            cache.set(key, data, timeout_seconds)&lt;br /&gt;            return data&lt;br /&gt;        return do_cache&lt;br /&gt;    return _cached&lt;/pre&gt;&lt;/blockquote&gt;只能用于静态数据的缓存，如果需要对connection.cursor等对象进行缓存，那需要函数本身做更多的处理，不是这个decorator要解决的问题。&lt;br /&gt;&lt;br /&gt;使用范例1，简单的cache key：&lt;blockquote&gt;&lt;pre&gt;from myproject.decorators import cached&lt;br /&gt;&lt;br /&gt;class MenuItem(models.Model):&lt;br /&gt;    @classmethod&lt;br /&gt;    @cached(&#39;menu_root&#39;)&lt;br /&gt;    def get_root(self):&lt;br /&gt;        return MenuItem.objects.get(pk=1)&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;使用范例2，cache key需要根据调用参数来决定：&lt;blockquote&gt;&lt;pre&gt;@cached(lambda u: &#39;user_privileges_%s&#39; % u.username, 3600)&lt;br /&gt;def get_user_privileges(user):&lt;br /&gt;    #...&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;使用范例3，需要只对直接调用者做缓存，递归的调用不需要，那么把要递归函数独立出来：&lt;blockquote&gt;&lt;pre&gt;class MenuItem(models.Model):&lt;br /&gt;    @cached(lambda s,u: &#39;user_menu_%s_%s&#39; % (u.username, s.id), 3600)&lt;br /&gt;    def permit_menu_items(self, user):&lt;br /&gt;        return self._permit_menu_items(user)&lt;br /&gt;&lt;br /&gt;    def _permit_menu_items(self, user):&lt;br /&gt;        items = []&lt;br /&gt;        for mi in self.children():&lt;br /&gt;            items += [n for n in mi._permit_menu_items(user)]&lt;br /&gt;        return items&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;使用范例4，返回结果中部分需要做缓存的，首先把要缓存的部分extract出来，然后对其应用缓存机制：&lt;blockquote&gt;&lt;pre&gt;class Report:&lt;br /&gt;    def get_summary(self, day, path=&#39;&#39;, sort=&#39;path&#39;, type=&#39;daily&#39;):&lt;br /&gt;        data = self._get_summary(day, path, type)&lt;br /&gt;        # sort ...&lt;br /&gt;        return data&lt;br /&gt;&lt;br /&gt;    @cached(lambda s,d,p,t:&#39;summary_%s_%s_%s&#39;%(d,p,t), 3600*24)&lt;br /&gt;    def _get_summary(self, day, path=&#39;&#39;, type=&#39;daily&#39;):&lt;br /&gt;        #...&lt;/pre&gt;&lt;/blockquote&gt;</content><link rel='replies' type='application/atom+xml' href='http://xieyanbo.blogspot.com/feeds/5505354893951349967/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5796527/5505354893951349967' title='1 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/5505354893951349967'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/5505354893951349967'/><link rel='alternate' type='text/html' href='http://xieyanbo.blogspot.com/2007/11/djangodecorator.html' title='用于django中的缓存decorator'/><author><name>xyb</name><uri>http://www.blogger.com/profile/11574809298508868859</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5796527.post-3228840773814474773</id><published>2007-11-16T00:06:00.000+08:00</published><updated>2007-11-16T00:16:36.583+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="android"/><category scheme="http://www.blogger.com/atom/ns#" term="google"/><title type='text'>人们研究android的热情高涨</title><content type='html'>短短一天时间，又有很多新情况发生。&lt;br /&gt;&lt;br /&gt;首先，有人测试了汉字的显示，发现可以支持。我也在模拟器里试了一下，确实很容易。系统内带了&lt;a href=&quot;http://www.sda-asia.com/sda/features/psecom,id,1638,nodeid,1,_language,Singapore.html&quot;&gt;几种字体&lt;/a&gt;，其中有一款支持CJK字符。&lt;br /&gt;&lt;br /&gt;其次，有人&lt;a href=&quot;http://groups.google.com/group/android-developers/browse_thread/thread/dffafba924e3a2e6&quot;&gt;成功编译&lt;/a&gt;了c版本的&lt;a href=&quot;http://benno.id.au/blog/2007/11/13/android-native-apps&quot;&gt;hello world&lt;/a&gt;，并执行成功。使用的是arm的编译器。而且还编译了&lt;a href=&quot;http://benno.id.au/blog/2007/11/14/android-busybox&quot;&gt;全功能的busybox&lt;/a&gt;，可以安装到模拟器的系统中。&lt;br /&gt;&lt;br /&gt;另外，已经&lt;a href=&quot;http://www.burtonini.com/blog/computers/poky-android-2007-11-13-18-00&lt;br /&gt;&quot;&gt;有人&lt;/a&gt;成功编译linux放入android模拟器中运行。&lt;br /&gt;&lt;br /&gt;邮件列表里很多人都在打听、讨论能不能用C/C++/Python/Ruby之类的语言代替java来开发。今天去&lt;a href=&quot;http://www.jython.org/&quot;&gt;jython&lt;/a&gt;的项目主页看了看，惊奇的发现项目复苏了，jython 2.2已经正式发布。期待高手把jython打包集成进android吧。</content><link rel='replies' type='application/atom+xml' href='http://xieyanbo.blogspot.com/feeds/3228840773814474773/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5796527/3228840773814474773' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/3228840773814474773'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/3228840773814474773'/><link rel='alternate' type='text/html' href='http://xieyanbo.blogspot.com/2007/11/android_16.html' title='人们研究android的热情高涨'/><author><name>xyb</name><uri>http://www.blogger.com/profile/11574809298508868859</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5796527.post-510679324921740823</id><published>2007-11-15T23:46:00.000+08:00</published><updated>2007-11-16T00:20:00.872+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="django"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><category scheme="http://www.blogger.com/atom/ns#" term="web"/><title type='text'>Django+Cheetah</title><content type='html'>最近在用&lt;a href=&quot;http://www.djangoproject.com/&quot;&gt;Django&lt;/a&gt;做东西，考虑到现在的流行程度，用Django在稳定性、bug修正速度、参考资料等方面很有优势。但它的模板系统很被一些人诟病，很多用python开发者第一次使用Django都会对它发点牢骚。Python语言的魅力之一就是它的开发，甚至对象实例在运行中都可以随时被改变。但Django因为一些考虑，人为的限制了模板系统的功能，不允许它过于强大。作为一种设计思想，增加限制可以简化问题的复杂程度、提高效率和代码安全性等等，好处不少。但我们是Python程序员，不受拘束、流畅而连贯的书写代码是我们的一贯风格（或说是追求目标），反正我可不愿被当孩子一样限制不许做这、不许做那。用最快的速度，写出糟糕但是能运行的代码，也是程序员应该争取的一个权利--有了可以跑的代码，才能有生存的机会，才能有后续的优化。所以我要寻找一种Django模板的替换方案。&lt;br /&gt;&lt;br /&gt;从编写者的舒适角度来看，zpt等类似php的语法写起来感觉都恩罗唆，逻辑之外要码的累赘字符太多了，不够爽快。类似&lt;a href=&quot;http://webpy.org/&quot;&gt;webpy&lt;/a&gt;、&lt;a href=&quot;http://www.cheetahtemplate.org/&quot;&gt;Cheetah&lt;/a&gt;的模板用起来更简单，而且有着类似python的语法风格，个人比较喜欢。据测试，Cheetah的速度也非常快，历史又很悠久，社区活跃，使用起来基本没有后顾之忧。所以我选择Cheetah。参考了&lt;a href=&quot;http://www.eflorenzano.com/blog/cheetah-and-django/&quot; title=&quot;Cheetah and Django&quot;&gt;Eric Florenzano的文章&lt;/a&gt;，在Django中使用Cheetah非常简单。首先要在settings.py中配置模板目录：&lt;blockquote&gt;&lt;code&gt;TEMPLATE_DIRS = (&lt;br /&gt;    &#39;/path/to/myproject/templates&#39;,&lt;br /&gt;)&lt;/code&gt;&lt;/blockquote&gt;&lt;br /&gt;然后编写一个使用Cheetah模板的render_to_response函数，用来代替Django自带的：&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;import os.path&lt;br /&gt;from Cheetah.Template import Template&lt;br /&gt;from django.conf import settings&lt;br /&gt;from django.http import HttpResponse&lt;br /&gt;&lt;br /&gt;def render_to_response(template_name, context=None, **kwargs):&lt;br /&gt;    for template_dir in settings.TEMPLATE_DIRS:&lt;br /&gt;        path = os.path.join(template_dir, template_name)&lt;br /&gt;        if os.path.exists(path):&lt;br /&gt;            template = Template(file = path, searchList = (context,))&lt;br /&gt;            return HttpResponse(unicode(str(template), &#39;utf-8&#39;), **kwargs)&lt;br /&gt;    raise ValueError, &#39;Could not find template for %s&#39; % template_name&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;我是把上面这段代码放在myproject/shortcuts.py文件中。使用起来是这样子：&lt;blockquote&gt;&lt;pre&gt;from myproject.shortcuts import render_to_response&lt;br /&gt;def index(request):&lt;br /&gt;    return render_to_response(&#39;index.tmpl&#39;, {&#39;title&#39;: &#39;index&#39;)&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;</content><link rel='replies' type='application/atom+xml' href='http://xieyanbo.blogspot.com/feeds/510679324921740823/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5796527/510679324921740823' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/510679324921740823'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/510679324921740823'/><link rel='alternate' type='text/html' href='http://xieyanbo.blogspot.com/2007/11/djangocheetah.html' title='Django+Cheetah'/><author><name>xyb</name><uri>http://www.blogger.com/profile/11574809298508868859</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5796527.post-3689205124532435438</id><published>2007-11-15T23:31:00.000+08:00</published><updated>2007-11-16T00:18:47.684+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><category scheme="http://www.blogger.com/atom/ns#" term="setup"/><title type='text'>Dell 640m的双显示器配置</title><content type='html'>参考了一下Ubuntu论坛里&lt;a href=&quot;http://ubuntuforums.org/showthread.php?t=358265&quot; title=&quot;Dual Monitors on Dell 640m laptop&quot;&gt;一个帖子&lt;/a&gt;，配置好了双显示器，也算是把多出来的一个显示器利用上了。这里是xorg.conf的后半部分：&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;Section &quot;Device&quot;&lt;br /&gt;  BoardName    &quot;945 GM&quot;&lt;br /&gt;  BusID        &quot;0:2:0&quot;&lt;br /&gt;  Driver       &quot;i810&quot;&lt;br /&gt;  Identifier   &quot;Device[1]&quot;&lt;br /&gt;  Option       &quot;MonitorLayout&quot; &quot;CRT,LFP&quot;&lt;br /&gt;  Screen       1&lt;br /&gt;  VendorName   &quot;Intel&quot;&lt;br /&gt;EndSection&lt;br /&gt;&lt;br /&gt;Section &quot;Device&quot;&lt;br /&gt;  BoardName    &quot;945 GM&quot;&lt;br /&gt;  BusID        &quot;0:2:0&quot;&lt;br /&gt;  Driver       &quot;i810&quot;&lt;br /&gt;  Identifier   &quot;Device[0]&quot;&lt;br /&gt;  Screen       0&lt;br /&gt;  VendorName   &quot;Intel&quot;&lt;br /&gt;EndSection&lt;br /&gt;&lt;br /&gt;Section &quot;Monitor&quot;&lt;br /&gt;  DisplaySize  340 270&lt;br /&gt;  Identifier   &quot;Monitor[0]&quot;&lt;br /&gt;  ModelName    &quot;DELL 1708FP&quot;&lt;br /&gt;  VendorName   &quot;DELL&quot;&lt;br /&gt;  Option       &quot;DPMS&quot;&lt;br /&gt;  HorizSync    31-80&lt;br /&gt;  VertRefresh  56-75&lt;br /&gt;EndSection&lt;br /&gt;&lt;br /&gt;Section &quot;Monitor&quot;&lt;br /&gt;  DisplaySize  305 230&lt;br /&gt;  Identifier   &quot;Monitor[1]&quot;&lt;br /&gt;  ModelName    &quot;DELL 1280X800 LAPTOP&quot;&lt;br /&gt;  VendorName   &quot;DELL&quot;&lt;br /&gt;  Option       &quot;DPMS&quot;&lt;br /&gt;  HorizSync    30-67&lt;br /&gt;  VertRefresh  30-60&lt;br /&gt;EndSection&lt;br /&gt;&lt;br /&gt;Section &quot;Screen&quot;&lt;br /&gt;  Device       &quot;Device[0]&quot;&lt;br /&gt;  Identifier   &quot;Screen[0]&quot;&lt;br /&gt;  Monitor      &quot;Monitor[0]&quot;&lt;br /&gt;  DefaultDepth 24&lt;br /&gt;  SubSection &quot;Display&quot;&lt;br /&gt;    Modes      &quot;1280x1024&quot; &quot;1152x864&quot; &quot;1024x768&quot; &quot;800x600&quot; &quot;720x400&quot; &quot;640x480&quot;&lt;br /&gt;  EndSubSection&lt;br /&gt;EndSection&lt;br /&gt;&lt;br /&gt;Section &quot;Screen&quot;&lt;br /&gt;  Device       &quot;Device[1]&quot;&lt;br /&gt;  Identifier   &quot;Screen[1]&quot;&lt;br /&gt;  Monitor      &quot;Monitor[1]&quot;&lt;br /&gt;  DefaultDepth 24&lt;br /&gt;  SubSection &quot;Display&quot;&lt;br /&gt;    Modes      &quot;1280x800&quot; &quot;1024x768&quot; &quot;800x600&quot; &quot;640x480&quot;&lt;br /&gt;  EndSubSection&lt;br /&gt;EndSection&lt;br /&gt;&lt;br /&gt;Section &quot;ServerLayout&quot;&lt;br /&gt;  Identifier   &quot;Default Layout&quot;&lt;br /&gt;  InputDevice  &quot;Generic Keyboard&quot;&lt;br /&gt;  InputDevice  &quot;Configured Mouse&quot;&lt;br /&gt;  Option       &quot;Clone&quot;    &quot;off&quot;&lt;br /&gt;  Option       &quot;Xinerama&quot; &quot;on&quot;&lt;br /&gt;  Screen       &quot;Screen[1]&quot; leftof &quot;Screen[0]&quot;&lt;br /&gt;  Screen       &quot;Screen[0]&quot;&lt;br /&gt;  InputDevice  &quot;Synaptics Touchpad&quot;&lt;br /&gt;  InputDevice  &quot;stylus&quot; &quot;SendCoreEvents&quot;&lt;br /&gt;  InputDevice  &quot;cursor&quot; &quot;SendCoreEvents&quot;&lt;br /&gt;  InputDevice  &quot;eraser&quot; &quot;SendCoreEvents&quot;&lt;br /&gt;EndSection&lt;br /&gt;&lt;br /&gt;Section &quot;DRI&quot;&lt;br /&gt;  Mode 0666&lt;br /&gt;EndSection&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;Xinerama模式非常好用，笔记本屏幕的和外接的DELL LCD显示器都可以打到最大分辨率；如果按ctrl_alt_&quot;num +&quot;或者ctrl_alt_&quot;num 1&quot;，还可以即时切换鼠标指针所在屏幕的分辨率，在外接投影仪时很方便。让我很纳闷的是，配置里“Screen &quot;Screen[0]&quot;”这一句必须写在screen[1]的后面，不知道是什么原因。</content><link rel='replies' type='application/atom+xml' href='http://xieyanbo.blogspot.com/feeds/3689205124532435438/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5796527/3689205124532435438' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/3689205124532435438'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/3689205124532435438'/><link rel='alternate' type='text/html' href='http://xieyanbo.blogspot.com/2007/11/dell-640m.html' title='Dell 640m的双显示器配置'/><author><name>xyb</name><uri>http://www.blogger.com/profile/11574809298508868859</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5796527.post-2307555650768267787</id><published>2007-11-14T23:38:00.000+08:00</published><updated>2007-11-16T00:17:04.321+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="android"/><category scheme="http://www.blogger.com/atom/ns#" term="google"/><title type='text'>android真是热火朝天呀</title><content type='html'>才一天，&lt;a href=&quot;http://code.google.com/android/&quot;&gt;android&lt;/a&gt;的&lt;a href=&quot;http://groups.google.com/group/android-developers/&quot;&gt;google group&lt;/a&gt;里就600多主题了。可惜blogsearch.google.com里还现在搜不到任何andriod主题的blog文章，但我已经四处看到不少文章了。我也&lt;a href=&quot;http://code.google.com/android/download.html&quot;&gt;下载&lt;/a&gt;了一个sdk，用起来很不错。模拟器是基于qemu的，速度很快。不过浏览豆瓣会有文字重叠或者被压缩成条的问题，跟豆瓣的css和 layout table有很大关系，看来要改善在手机的webkit浏览器上的效果，豆瓣还要做很多努力。&lt;br /&gt;&lt;br /&gt;google groups里有人在问，&lt;a href=&quot;http://groups.google.com/group/android-developers/browse_thread/thread/90ed8c51e1547516&quot;&gt;能不能用python语言来做开发&lt;/a&gt;。但从架构来看，官方会提供的应该只有java。所以有人建议用jython来做，一样能访问所有的api，这个主意倒是不错，但jython项目现在还活跃吗？用五六年前的python语法和类库来开发程序，还是让我死了好啦。&lt;br /&gt;&lt;br /&gt;不知道有没有提供像XIM之类的输入法api，但是既然和中国电信、日本docomo这些公司合作，应该会有人在做CJK的输入法吧？可是对他们的开发出来东西的质量表示怀疑，各个智能手机平台上好用的中文输入法大多是个人开发的，这个功能需要好的用户体验才能，这些大公司往往欠缺的就是替用户着想的能力或说是动力。</content><link rel='replies' type='application/atom+xml' href='http://xieyanbo.blogspot.com/feeds/2307555650768267787/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5796527/2307555650768267787' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/2307555650768267787'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/2307555650768267787'/><link rel='alternate' type='text/html' href='http://xieyanbo.blogspot.com/2007/11/android.html' title='android真是热火朝天呀'/><author><name>xyb</name><uri>http://www.blogger.com/profile/11574809298508868859</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5796527.post-2882462259194201661</id><published>2007-10-28T16:03:00.000+08:00</published><updated>2007-10-28T16:17:35.389+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="perl"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><title type='text'>让程序只能启动一份</title><content type='html'>有时写的程序因为资源等等原因，应该只启动一份。利用指定的文件锁，可以实现这样的功能。&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;import os&lt;br /&gt;import fcntl&lt;br /&gt;import errno&lt;br /&gt;&lt;br /&gt;def lock_file(filename):&lt;br /&gt;    fd = os.open(filename, os.O_CREAT | os.O_WRONLY, 0666)&lt;br /&gt;    try:&lt;br /&gt;        fcntl.lockf(fd, fcntl.LOCK_EX | fcntl.LOCK_NB)&lt;br /&gt;        return True&lt;br /&gt;    except IOError, e:&lt;br /&gt;        if e.errno in (errno.EACCES, errno.EAGAIN):&lt;br /&gt;            return False&lt;br /&gt;&lt;br /&gt;if not lock_file(&#39;/tmp/test.lock&#39;):&lt;br /&gt;  print &quot;another instance is running&quot;lock_file(&#39;/tmp/test.lock&#39;)&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;再附上一份perl的代码：&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;use Fcntl qw(:flock);&lt;br /&gt;&lt;br /&gt;  my $lockdir = &#39;lock&#39;;&lt;br /&gt;  if (!-d $lockdir) {&lt;br /&gt;      mkdir $lockdir, 0755;&lt;br /&gt;      my $status=$!;&lt;br /&gt;      die &quot;Failed to create $lockdir: $status\n&quot; if (!-d $lockdir);&lt;br /&gt;  }&lt;br /&gt;  my $lockfile=&quot;$lockdir/test.pid&quot;;&lt;br /&gt;  if (!open(PID, &quot;&gt;$lockfile&quot;)) {&lt;br /&gt;    die &quot;can not open pid file\n&quot;;&lt;br /&gt;  }&lt;br /&gt;  unless (flock(PID, LOCK_EX|LOCK_NB)) {&lt;br /&gt;    die &quot;can not lock pid file\n&quot;;&lt;br /&gt;  }&lt;br /&gt;  print &quot;locked\n&quot;;&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;顺便再抱怨两句，perl5补丁摞补丁的语法很怪异，异常处理机制竟然要用if...unless，类的写法也搞得跟写dll一样。不得不说，perl的语法离现代语言太远了。一个优美的语言可以提高开发效率，期待一下perl6最终出来的样子。</content><link rel='replies' type='application/atom+xml' href='http://xieyanbo.blogspot.com/feeds/2882462259194201661/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5796527/2882462259194201661' title='1 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/2882462259194201661'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/2882462259194201661'/><link rel='alternate' type='text/html' href='http://xieyanbo.blogspot.com/2007/10/blog-post_28.html' title='让程序只能启动一份'/><author><name>xyb</name><uri>http://www.blogger.com/profile/11574809298508868859</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5796527.post-528766157013824458</id><published>2007-10-28T14:15:00.000+08:00</published><updated>2007-10-28T16:18:27.932+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="perl"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><title type='text'>在python和perl程序中启用logging记录日志</title><content type='html'>写一些脚本程序的时候，合理的记录日志是必不可少的，尽量不往stdout乱打印信息为好，这时python的logging模块很用用处。不过调试时为了方便，还是希望日志也打印到stdout一份，这样出现什么问题一目了然；否则就只有再开个terminal，用tail -f my.log来检查了。&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;import logging&lt;br /&gt;&lt;br /&gt;def _init_logging(logfile, debug=False):&lt;br /&gt;    if debug:&lt;br /&gt;        level = logging.DEBUG&lt;br /&gt;    else:&lt;br /&gt;        level = logging.INFO&lt;br /&gt;    logging.basicConfig(level=level, format=&#39;%(asctime)s %(message)s&#39;,&lt;br /&gt;            datefmt=&#39;%Y-%m-%d %H:%M:%S&#39;, filename=logfile, filemode=&#39;w&#39;)&lt;br /&gt;    if debug:&lt;br /&gt;        console = logging.StreamHandler()&lt;br /&gt;        console.setLevel(logging.DEBUG)&lt;br /&gt;        formatter = logging.Formatter(&#39;%(asctime)s %(levelname)-8s %(message)s&#39;)&lt;br /&gt;        console.setFormatter(formatter)&lt;br /&gt;        logging.getLogger(&#39;&#39;).addHandler(console)&lt;br /&gt;&lt;br /&gt;if __name__ == &quot;__main__&quot;:&lt;br /&gt;    import os&lt;br /&gt;    debug = os.environ.get(&#39;DEBUG&#39;) and True or False&lt;br /&gt;    _init_logging(&#39;my.log&#39;, debug=debug)&lt;br /&gt;    logging.info(&#39;start&#39;)&lt;br /&gt;&lt;br /&gt;    logging.info(&#39;end&#39;)&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;这样程序就会知道检查环境变量DEBUG，往合适的地方打印信息了。调试程序时执行方法：&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;$ DEBUG=1 ./my.py&lt;br /&gt;2007-10-22 17:30:59,917 INFO     start&lt;br /&gt;2007-10-22 17:31:02,027 INFO     end&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;最近还写了一些perl代码，和上面差不多功能的perl代码也贴出来：&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;use strict;&lt;br /&gt;use Log::Log4perl qw(:easy);&lt;br /&gt;&lt;br /&gt;my $log_file = &quot;/tmp/my.log&quot;;&lt;br /&gt;&lt;br /&gt;if (exists $ENV{DEBUG} &amp;&amp; $ENV{DEBUG}) {&lt;br /&gt;  Log::Log4perl-&gt;easy_init(&lt;br /&gt;    {file  =&gt; &quot;&gt;&gt; &quot; . log_file, level =&gt; $DEBUG},&lt;br /&gt;    {file  =&gt; &quot;STDOUT&quot;, level =&gt; $DEBUG},&lt;br /&gt;  );&lt;br /&gt;} else {&lt;br /&gt;  Log::Log4perl-&gt;easy_init(&lt;br /&gt;    {file  =&gt; &quot;&gt;&gt; &quot; . $log_file, level =&gt; $DEBUG},&lt;br /&gt;  );&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;INFO(&quot;start...&quot;);&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;这里用到log4perl模块，需要提前安装：&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;&lt;br /&gt;sudo perl -MCPAN -e&#39;install Log::Log4perl&#39;&lt;br /&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br /&gt;虽然适应了一段时间，但perl满眼$@%这些助记符，还是很阻碍阅读和思维连贯，不习惯。</content><link rel='replies' type='application/atom+xml' href='http://xieyanbo.blogspot.com/feeds/528766157013824458/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5796527/528766157013824458' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/528766157013824458'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/528766157013824458'/><link rel='alternate' type='text/html' href='http://xieyanbo.blogspot.com/2007/10/pythonperllogging.html' title='在python和perl程序中启用logging记录日志'/><author><name>xyb</name><uri>http://www.blogger.com/profile/11574809298508868859</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5796527.post-1872860619837464400</id><published>2007-10-11T02:35:00.000+08:00</published><updated>2007-10-11T03:07:34.375+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="唠叨"/><title type='text'>睡觉还是思考，这是个问题</title><content type='html'>晚上回家，意外发现被防盗门挡在了屋外。防盗门不防小偷，倒防主人，真是奇怪。叫来开锁公司，师傅跟铁门叫了一个多小时的劲，最终还是无功而返，我们一起被楼上吵得忍无可忍的邻居给轰走了。无奈之下，只有回办公室委屈一夜了，真是郁闷。&lt;br /&gt;&lt;br /&gt;以前熬夜的时候，要么整晚不睡，要么是办公室有沙发，可以当成临时的床。现在的办公室没沙发这个设备，经过一番调研，决定用三个椅子拼在一起。按从电视看到的经验，这应该是办公室临时床铺的经典模式，不少人应该都这么干过，不过睡到上面的感觉可是只有自己心知肚明了。中间的椅子正好硌着腰眼，肩膀也只能有半个放到椅子面上，感觉别提多难受了。可就在这时，明明已经累的够呛，眼皮都酸的不想抬起来了，脑袋里的思想倒活跃起来了，平常做沙发上闭目沉思都没这时候想法多。可见现今哲学家变少是有道理的，只有睡硬板床的人各种稀奇古怪的想法才能层出不穷，有了席梦思睡的谁还瞎琢磨事呀，早呼呼大睡了。就在辗转反侧--俗称“烙饼”--之际，已经把手机里&lt;a href=&quot;http://en.wikipedia.org/wiki/Getting_Things_Done&quot; title=&quot;Get Things Done&quot;&gt;GTD&lt;/a&gt;软件里的事情又review了一遍，这次效率真高，很高兴；但是又发现严重拖延的事情非常多，继续郁闷...下半年其实过得不好，事实证明计划不如变化，现在离梦想中的幸福生活似乎更加遥远了...烙饼到第九圈，还是睡不着。人生苦短，可竟然还得睡觉。据说达芬奇天天打盹，加起来每天只睡两三个小时，看他能研究那么多领域也就不足为奇了。我不求达到奇人的地步，只要让我今晚少睡几个小时，明天照样能精神起来就好了。&lt;br /&gt;&lt;br /&gt;这个故事告诉我们，家里床铺不好的人有可能得腰锥疾病，也有可能成为一代大家，切记切记。</content><link rel='replies' type='application/atom+xml' href='http://xieyanbo.blogspot.com/feeds/1872860619837464400/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5796527/1872860619837464400' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/1872860619837464400'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/1872860619837464400'/><link rel='alternate' type='text/html' href='http://xieyanbo.blogspot.com/2007/10/blog-post.html' title='睡觉还是思考，这是个问题'/><author><name>xyb</name><uri>http://www.blogger.com/profile/11574809298508868859</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5796527.post-2163489813337194603</id><published>2007-08-28T19:27:00.000+08:00</published><updated>2007-08-28T19:35:03.661+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="funny"/><title type='text'>怪序字符？</title><content type='html'>最近人们流行贴怪序字符，想必用Linux的人不会大惊小怪。其实大家贴的这就是三个unicode的字符：\u202d\u202e\u0489，前两个叫做控制字符LRO和RLO，也就是“从左到右覆盖”和“从右到左覆盖”。这些控制字符是给阿拉伯语等特殊书写顺序的语言准备的，没有什么稀奇。所有用Linux系统的人都可以在gedit等编辑区的右键菜单中任意添加这些控制字符，以方便阿拉伯语、希伯来语等书写，以及它们同其他语言的混合录入。</content><link rel='replies' type='application/atom+xml' href='http://xieyanbo.blogspot.com/feeds/2163489813337194603/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5796527/2163489813337194603' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/2163489813337194603'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/2163489813337194603'/><link rel='alternate' type='text/html' href='http://xieyanbo.blogspot.com/2007/08/blog-post_28.html' title='怪序字符？'/><author><name>xyb</name><uri>http://www.blogger.com/profile/11574809298508868859</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5796527.post-4227941321140511085</id><published>2007-08-27T10:41:00.000+08:00</published><updated>2007-08-27T10:56:29.252+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="debian"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><category scheme="http://www.blogger.com/atom/ns#" term="shell"/><title type='text'>原来还有个脚本叫ssh-copy-id</title><content type='html'>才发现openssh-client里有个脚本叫做ssh-copy-id，看了看openssh官方&lt;a href=&quot;http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/&quot;&gt;CVSweb&lt;/a&gt;中的代码，也没有找到，它从那里冒出来的？根据Debian包里的ChangeLog记录，1999年这个脚本就被加进去了，奇怪一直都没注意到它。原来都用这个脚本来把自己的ssh公钥发布到服务器上：&lt;blockquote&gt;&lt;code&gt;#!/bin/sh&lt;br /&gt;ssh &quot;$target&quot; &#39;test -d .ssh || mkdir -m 0700 .ssh ; cat &gt;&gt; .ssh/authorized_keys &amp;&amp; chmod 0600 .ssh/*&#39; &lt; ~/.ssh/id_rsa.pub&lt;br /&gt;&lt;/code&gt;&lt;/blockquote&gt;现在可以舍弃了，据说&lt;a href=&quot;http://www.chiark.greenend.org.uk/ucgi/~cjwatson/cvsweb/openssh/contrib/ssh-copy-id?rev=1.6;content-type=text%2Fplain&quot;&gt;ssh-copy-id&lt;/a&gt;兼容性更好。</content><link rel='replies' type='application/atom+xml' href='http://xieyanbo.blogspot.com/feeds/4227941321140511085/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5796527/4227941321140511085' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/4227941321140511085'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/4227941321140511085'/><link rel='alternate' type='text/html' href='http://xieyanbo.blogspot.com/2007/08/ssh-copy-id.html' title='原来还有个脚本叫ssh-copy-id'/><author><name>xyb</name><uri>http://www.blogger.com/profile/11574809298508868859</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5796527.post-1346574741403650748</id><published>2007-08-20T00:32:00.000+08:00</published><updated>2007-08-20T00:39:34.104+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="唠叨"/><title type='text'>无线上网中</title><content type='html'>终于可以在家里无线上网啦，可惜最近某人老是不上网，心情也受了影响，高兴不起来。&lt;br /&gt;&lt;br /&gt;最近需要赶着还债的事情还真不少，有的忙了。&lt;br /&gt;&lt;br /&gt;睡觉。</content><link rel='replies' type='application/atom+xml' href='http://xieyanbo.blogspot.com/feeds/1346574741403650748/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5796527/1346574741403650748' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/1346574741403650748'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/1346574741403650748'/><link rel='alternate' type='text/html' href='http://xieyanbo.blogspot.com/2007/08/blog-post_20.html' title='无线上网中'/><author><name>xyb</name><uri>http://www.blogger.com/profile/11574809298508868859</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5796527.post-4680548711318517428</id><published>2007-08-19T11:18:00.000+08:00</published><updated>2007-08-19T11:24:33.648+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="唠叨"/><title type='text'>广而告之：诈骗信一封</title><content type='html'>发到我的gmail邮箱里来了，诈骗、传销、垃圾邮件，都被占全了。第一次收到以创业为诱饵的中文诈骗信，广而告之一下。不知道网上有没有向公安机关举报的地址呢？&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;&lt;br /&gt;from:  Oafkow &lt;lqwd@ccicards.com&gt;&lt;br /&gt;to:  xiexiege@163.com  &lt;br /&gt;date:  Aug 18, 2007 8:34 PM  &lt;br /&gt;subject:  m创业邀请函  &lt;br /&gt;&lt;br /&gt;亲爱的朋友：&lt;br /&gt;您好！&lt;br /&gt;     关于“筹集创业资金互助”活动的通告&lt;br /&gt;&lt;br /&gt;     请静下心把这封信仔细看完，然后马上行动！！！&lt;br /&gt;&lt;br /&gt;各位辛勤创业的同仁：&lt;br /&gt;&lt;br /&gt;   我们没有钱，所以我们要挣钱，所以我们要创业，但是创业的艰难在于启动资金筹措问题上，而互助却是中华民族的传&lt;br /&gt;&lt;br /&gt;统美德。这项由创业同仁们自发组织的互助活动的目的是要帮助所有自愿加入该互助活动的朋友完成心愿,筹集创业资金，达&lt;br /&gt;&lt;br /&gt;到创业的目的。只要你参与,并严格按规则操作,你必将得到丰厚的资助。你不但自己可以得到几十万、上百万的资金,也支持&lt;br /&gt;&lt;br /&gt;了其他的创业者.如果说创业是人生的转折点,那么有幸参加这次互助活动就是我们的一个人生转折点.然而毕竟多数的创业者&lt;br /&gt;&lt;br /&gt;收不到这封信,而为之遗憾!所以，当你得到无数创业人的资助时,别忘了还有更多和我们一样正在为创业而痛苦的朋友！给他&lt;br /&gt;&lt;br /&gt;一封信，助他度过难关。其实创业的艰难在于启动资金筹措问题上，而互助却是中华民族的传统美德，所以我认为很有必要&lt;br /&gt;&lt;br /&gt;参与。&lt;br /&gt;&lt;br /&gt; 一、创业资金筹措的方法：&lt;br /&gt;&lt;br /&gt;就是依据《二八法则》,使10元变成100万元 ！如果你花10元钱买彩票，得头等大奖的概率是千万分之一，而你只要汇出十块&lt;br /&gt;&lt;br /&gt;钱，有百分之百的把握得到１００万回报。这个活动的可行性在于它严格遵守《二八法则》。世上有很多奇妙的事，《二八&lt;br /&gt;&lt;br /&gt;法则》就是其中之一：社会上８０％的财富在２０％的人手里，２０％的财富在８０％的人手里。只要花费１０块钱，然后&lt;br /&gt;&lt;br /&gt;发200个Ｅ－ｍａｉｌ，你就可以验证《二八法则》的灵运，同时将得到１００万的收入。　&lt;br /&gt;&lt;br /&gt; 二、“筹集创业资金联谊互助”活动的原理:&lt;br /&gt;&lt;br /&gt;本活动采用著名的“倍增扩散法”，这种方法没有永远的第一和穷尽.这种方法是每个人都有平等的机会从第四位升到第一&lt;br /&gt;&lt;br /&gt;位,只要参加活动,就可以100％获得可观效益,这并不像彩票一样只有千万分之一的运气,而是收到信并积极响应者都必然得到&lt;br /&gt;&lt;br /&gt;巨额回报。每人按规则向100人(或更多的创业者)发出联谊信,按20％的反馈率算,用“倍增扩散法“计算一下,可想而知其效&lt;br /&gt;&lt;br /&gt;果。&lt;br /&gt;&lt;br /&gt; 三、互助联谊排序表：&lt;br /&gt;&lt;br /&gt;1号 中国工商银行 卡号： 95588 04000 15516 1751 康国平&lt;br /&gt;&lt;br /&gt;2号 中国农业银行 卡号： 62284 80120 07038 3514 魏  芬&lt;br /&gt;&lt;br /&gt;3号 中国工商银行 卡号:  95588 04000 16530 4243 陈  瑜&lt;br /&gt;&lt;br /&gt;4号 中国招商银行 卡号： 6225  8800  0122  7850 王志华&lt;br /&gt;&lt;br /&gt;表中四位创业者的编号为1号、2号、3号、4号,你收到信后,以最短的时间给1号寄去10元(寄钱的时间越长,扩散就越慢,你升&lt;br /&gt;&lt;br /&gt;级到1号的时间也越晚.世间之事有时也是很微妙的，诚实的人也有诚实的回报，别因小失大哦！)然后将编号为1的创业者删&lt;br /&gt;&lt;br /&gt;掉(此时1号已经被资助完毕),请你将2、3、4号的创业人依次递进,成为1、2、3,再把你的姓名和卡号,加在4号的位置上(注意&lt;br /&gt;&lt;br /&gt;你一定要在资助完1号才可以将你的卡号加上去),你就成了第4号,排好后把些信分别发给200位或尽量更多各地创业人,当这&lt;br /&gt;&lt;br /&gt;200位再发出信时，你就是200X200=40000封信中的3号了，依次类推，当你变成1号时，扩散人数可想而知,对你的回报是惊人&lt;br /&gt;&lt;br /&gt;的.而且你寄出仅仅10元的投入,且是寄给1号的创业人。你就会开始得到朋友们资助的创业资金了！当然发出的信越多效果就&lt;br /&gt;&lt;br /&gt;越佳，建议你多坚持发信一段时间！前面的劳动都是你应该做的，也是在为你增加资助的人数，所以不要跳级，这样只会让&lt;br /&gt;&lt;br /&gt;你得到的资助变少几百倍！&lt;br /&gt;&lt;br /&gt;以下是对倍增扩散法的图例说明(注意,本图以每位创业者发两封邮件为例)&lt;br /&gt;                               ☆（你－创业者１）&lt;br /&gt;                                           ↓&lt;br /&gt;↓&lt;br /&gt; ↓￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣↓&lt;br /&gt;                  ★                                            ★------４级&lt;br /&gt;                  ↓　　　　　　　　　　　　　　　　　　　　　　↓&lt;br /&gt;↓￣￣￣￣￣￣ ￣￣￣↓　　　　　　　　　　　↓￣￣￣￣￣￣￣￣￣￣↓&lt;br /&gt;★　　　　　         ★　　　　　　　　　　　★　　　　　　　      ★-----３级&lt;br /&gt;↓　　　　　　　　　 ↓　　　　　　　　　　　↓　　　　　　　　　　↓&lt;br /&gt;  ↓￣￣￣￣↓　　　　↓￣￣￣￣￣↓　　　　　↓￣￣￣￣￣↓　　　  ↓￣￣￣￣￣↓&lt;br /&gt;  ★　　    ★        ★　　      ★　        ★          ★        ★          ★-----２级&lt;br /&gt;  ↓　　　　↓　　　　↓　　　　　↓　　　　　↓　　　　　↓　　　  ↓　　　　　↓&lt;br /&gt;↓￣￣↓　↓￣￣↓　↓￣￣↓　　↓￣￣↓　　↓￣￣↓　　↓￣￣↓　↓￣￣↓　  ↓￣￣↓&lt;br /&gt;★　　★　★　　★　★　　★　　★　　★　　★　　★　　★　　★　★　　★　  ★　　★------１级&lt;br /&gt;&lt;br /&gt;  收到你发出的信件的人是处于４级的创业者－－２人（这时你的银行卡号是排在４号位）&lt;br /&gt;&lt;br /&gt;  当４级的创业者将信件发出时收件人是３级的创业者－－４人（这时你的银行卡号是排在３号位）&lt;br /&gt;&lt;br /&gt;  当３级的创业者将信件发出时收件人是２级的创业者－－８人（这时你的银行卡号是排在２号位）&lt;br /&gt;&lt;br /&gt;  当２级的创业者将信件发出时收件人是１级的创业者－－１６人（这时你的银行卡号是排在１号位）&lt;br /&gt;&lt;br /&gt;  若以每位创业者发100封邮件的话当你的银行卡号排在１号位时就有100X100X100X100=100000000人收到邮件&lt;br /&gt;&lt;br /&gt; 四、注意:&lt;br /&gt;&lt;br /&gt;在你给1号创业人打钱后,,请按原格式递进,消除1号,将其余号按顺序递进,增加你为4号,重新把互助联谊信修改一下,尽快发,&lt;br /&gt;&lt;br /&gt;务必认真校对清楚,众人拾柴火焰高,如在你处中断,实在太可惜.本来我们都是公布创业者的地址和姓名，但应广大创业者的&lt;br /&gt;&lt;br /&gt;要求，我们把创业者的名字和地址做自愿处理，愿意公布的也可以，不愿意的也可以匿名从事。对一些主动返回信息的资助&lt;br /&gt;&lt;br /&gt;者作报道：到目前为止，收到较多创业资金的有:&lt;br /&gt;&lt;br /&gt;重庆市石桥铺达飞苑南华街423号赵东林(邮编:400039 电话:023-61613581)，他发了235份邮件，收到资助款72万元；南京市&lt;br /&gt;&lt;br /&gt;珠江路373号-5A韦良栋(邮编:210018  电话:025-86871956)发出联谊信220封，三个月后收到120万元；天津大港中学李万祥&lt;br /&gt;&lt;br /&gt;(邮编:300270)发了330份邮件，两个月收到100余万元；湖南长沙市东区政协委员刘振时(邮编:410011)发出220封联谊信，三&lt;br /&gt;&lt;br /&gt;个月收到130万元。&lt;br /&gt;&lt;br /&gt; 五、来信选登:&lt;br /&gt;&lt;br /&gt;我是山东筑港工程公司一名工程师,业余时间搞了摩托车防松气门等十余项发明并申请专利,始终无法成功转让,自己仅靠工资&lt;br /&gt;&lt;br /&gt;收入,无起步资金,连专利年费都交不起,可幸运的是今年一月我收到了一位创业者发来的“互助联谊信“,当时我未在乎,后我&lt;br /&gt;&lt;br /&gt;认真阅读,分析了一下它的原理,认为可行,不就10块钱?况且又是互助,我就按信中要求的操作规律,给1号寄了10元,我把排序&lt;br /&gt;&lt;br /&gt;表重新排好,发了100份,约两个月后,真让我高兴,我陆续收到各地创业者来的资助.打过来的资助，现已累计了180万元,我并&lt;br /&gt;&lt;br /&gt;未花费多少精力,竟然得到如些丰厚回报,我谨向支持我的创业者同仁和组委会表示我的诚挚的感谢!(山东省筑港工程总公司&lt;br /&gt;&lt;br /&gt;段兴 通信地址:表惠路8号 邮编: 265032)我是一名政协委员,我怀着万分感动的心情给你们写信,表达我对创业互助联谊活动&lt;br /&gt;&lt;br /&gt;的感谢!因我喜爱搞发明,1983年我发明的“新型无钥匙保险锁“,1990年获得湖南省新技术博览会一等奖,但我平时的工资仅&lt;br /&gt;&lt;br /&gt;500多元,家中还欠了不少债,当我收到“互助联谊信“后,觉得有道理,怀着试试的心情发出了 120份互助联谊信,大概过了两&lt;br /&gt;&lt;br /&gt;个月,仅三个月我的卡里就收到全国各地创业人资助款160万元,我好兴奋!我不仅还清了所有债务,还用这笔资金办了一个企&lt;br /&gt;&lt;br /&gt;业-长沙市龙江超级保险柜有限公司,我未想到我仅汇出10元,得到如此回报,互助的力量无穷!说心里话,我还后悔发的太少&lt;br /&gt;&lt;br /&gt;了…...(通信地址:湖南长沙市东区政协转刘振时 邮编:410011)&lt;br /&gt;&lt;br /&gt;   也许有人不会相信，但自然法则造就的事实。顺便提醒一下，当你收到了超过１千元的时候，请给收到信时排序表上的4&lt;br /&gt;&lt;br /&gt;人各寄上20元，因为他们是你生命中的贵人，是值得你感恩的。&lt;br /&gt;&lt;br /&gt;致&lt;br /&gt;礼！&lt;br /&gt;                                             182007&lt;/code&gt;&lt;/blockquote&gt;&lt;br /&gt;邮件信头：&lt;blockquote&gt;&lt;code&gt;&lt;br /&gt;Received: by 10.114.196.20 with SMTP id t20cs632823waf;&lt;br /&gt;        Sat, 18 Aug 2007 05:34:16 -0700 (PDT)&lt;br /&gt;Received: by 10.35.110.13 with SMTP id n13mr4677532pym.1187440455920;&lt;br /&gt;        Sat, 18 Aug 2007 05:34:15 -0700 (PDT)&lt;br /&gt;Return-Path: &lt;lqwd@ccicards.com&gt;&lt;br /&gt;Received: from ccicards.com ([206.173.124.181])&lt;br /&gt;        by mx.google.com with ESMTP id e1si1799104nzd.2007.08.18.05.34.15;&lt;br /&gt;        Sat, 18 Aug 2007 05:34:15 -0700 (PDT)&lt;br /&gt;Received-SPF: neutral (google.com: 206.173.124.181 is neither permitted nor denied by best guess record for domain of lqwd@ccicards.com) client-ip=206.173.124.181;&lt;br /&gt;Authentication-Results: mx.google.com; spf=neutral (google.com: 206.173.124.181 is neither permitted nor denied by best guess record for domain of lqwd@ccicards.com) smtp.mail=lqwd@ccicards.com&lt;br /&gt;Received: from 8017A300191F4BE [116.24.119.199] by ccicards.com with ESMTP&lt;br /&gt;  (SMTPD-9.04) id A7311730; Sat, 18 Aug 2007 07:33:53 -0500&lt;br /&gt;Message-Id: &lt;200708180733380.SM12488@8017A300191F4BE&gt;&lt;br /&gt;From: &quot;Oafkow&quot; &lt;lqwd@ccicards.com&gt;&lt;br /&gt;Subject: =?GB2312?B?bbS00rXR+8fruq8=?=&lt;br /&gt;To: xiexiege@163.com&lt;br /&gt;Content-Type: text/plain&lt;br /&gt;MIME-Version: 1.0&lt;br /&gt;Content-Transfer-Encoding: base64&lt;br /&gt;Date: Sat, 18 Aug 2007 20:34:00 +0800&lt;br /&gt;&lt;/code&gt;&lt;/blockquote&gt;</content><link rel='replies' type='application/atom+xml' href='http://xieyanbo.blogspot.com/feeds/4680548711318517428/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5796527/4680548711318517428' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/4680548711318517428'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/4680548711318517428'/><link rel='alternate' type='text/html' href='http://xieyanbo.blogspot.com/2007/08/blog-post_19.html' title='广而告之：诈骗信一封'/><author><name>xyb</name><uri>http://www.blogger.com/profile/11574809298508868859</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5796527.post-4610365621351180315</id><published>2007-08-03T19:50:00.000+08:00</published><updated>2007-08-03T20:13:54.573+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="GFW"/><title type='text'>强烈推荐OpenDNS</title><content type='html'>今天收到 &lt;a href=&quot;http://www.opbyte.it/grsync/&quot; title=&quot;Grsync is a GUI (Graphical User Interface) for rsync, the commandline directory synchronization tool.&quot;&gt;grsync&lt;/a&gt; 作者给翻译人员的一封信，要求大家都去一个专为这个项目建立的 &lt;a href=&quot;http://opbyte.freeforums.org/&quot;&gt;forum&lt;/a&gt; 上。直接点击地址，打不开。莫非是域名还没生效？dig了一下，发现二级域名和顶级域名都找不到，好像不对吧，从web archive上&lt;a href=&quot;http://web.archive.org/web/*/http://freeforums.org/&quot;&gt;看&lt;/a&gt;，人家的网站2003年就有了。新装的机器上一直都没设置使用 &lt;a href=&quot;http://www.opendns.com/&quot; title=&quot;OpenDNS provides a safer, faster and smarter DNS service that is free, with no software to install.&quot;&gt;OpenDNS&lt;/a&gt; 呢，修改 /etc/resolv.conf，加入两行：&lt;blockquote&gt;&lt;code&gt;nameserver 208.67.222.222&lt;br /&gt;nameserver 208.67.220.220&lt;/code&gt;&lt;/blockquote&gt;再试，果然，是因为“有人”把这个域名给河蟹了。接下来又撞上了一堵墙，这次只能用 &lt;a href=&quot;http://tor.eff.org/&quot; title=&quot;Tor 是一个工具集，帮助各类组织和个人增强互联网上活动的安全。&quot;&gt;Tor&lt;/a&gt; 翻墙了。&lt;br /&gt;&lt;br /&gt;被这样搞掉的网站有多少？实在不好统计。总之学个教训，Tor好用，但还要记得DNS安全，别让人把你劫持了。DNS直接返回无效算是容易发现的，有人要是有目的的域名劫持，后果就可怕了，所以还是提前防备一下的好。虽然咱不干犯法的事，但谁知道呢，现在遍地的条条框框，你能保证不会有一天被它给框进去？&lt;br /&gt;&lt;br /&gt;p.s. 预测一下，什么时候 OpenDNS 会流行起来？什么时候它也会被河蟹掉？被河蟹也可以算是一种另类的受欢迎指数吧 -__-</content><link rel='replies' type='application/atom+xml' href='http://xieyanbo.blogspot.com/feeds/4610365621351180315/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5796527/4610365621351180315' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/4610365621351180315'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/4610365621351180315'/><link rel='alternate' type='text/html' href='http://xieyanbo.blogspot.com/2007/08/opendns.html' title='强烈推荐OpenDNS'/><author><name>xyb</name><uri>http://www.blogger.com/profile/11574809298508868859</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5796527.post-582021160134398992</id><published>2007-08-02T20:51:00.000+08:00</published><updated>2007-08-02T21:25:13.924+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="唠叨"/><title type='text'>“GPS技术在气象学中的应用”</title><content type='html'>昨天被大雨所困，想起了F1赛事精准的天气预报和GPS。今天上网查了一下，&lt;a href=&quot;http://news.xinhuanet.com/newscenter/2002-08/03/content_509068.htm&quot; title=&quot;上海GPS气象服务网启动 准确预报半小时内天气&quot;&gt;GPS早就被气象部门用来采集数据&lt;/a&gt;了，&lt;a href=&quot;http://www.unistrong.com/productline/News/page.aspx?articleid=1061&quot; title=&quot;GPS技术在气象学中的应用&quot;&gt;GPS技术在气象学中的应用&lt;/a&gt;还真少。不过，这些家伙搞的都是观测系统，什么时候有公司能根据个人GPS提供的方位为我们实时传送气象预报呢？我记得有些手机是有GPS配件的，等过两年GPS变成了手机的标配，再在手机上加几个温度湿度气压之类的传感器，手机就变成全能的气象终端啦，既可以给观测系统提供实时的数据，又可以接收精度很高的个人化天气预报。看起来国外已经有人在做这事了，有&lt;a href=&quot;http://www.spectrum.ieee.org/apr06/comments/1362&quot; title=&quot;A BETTER WEATHER FORECAST&quot;&gt;气象专家的研究&lt;/a&gt;，也有&lt;a href=&quot;http://www.lbszone.com/content/view/1507/2/&quot; title=&quot;XM to Introduce First Personal Weather Tracking System, Demonstrate In-Car Video and More at CES&quot;&gt;商业公司的系统&lt;/a&gt;；国内不知道是不是因为卫星系统国有，没有人冒风险去研究这种偏门的项目，好像没有这方面的消息。人家已经快要开始搞产品商业化时，我们这边的新闻还是某地又建了几个“高科技”的GPS气象采集基站，各部门领导很有面子云云。难道是我们又输在起跑线上了？</content><link rel='replies' type='application/atom+xml' href='http://xieyanbo.blogspot.com/feeds/582021160134398992/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5796527/582021160134398992' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/582021160134398992'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/582021160134398992'/><link rel='alternate' type='text/html' href='http://xieyanbo.blogspot.com/2007/08/gps.html' title='“GPS技术在气象学中的应用”'/><author><name>xyb</name><uri>http://www.blogger.com/profile/11574809298508868859</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5796527.post-3433620631795870000</id><published>2007-08-01T20:38:00.000+08:00</published><updated>2007-08-01T20:52:09.100+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="唠叨"/><title type='text'>果真是天有不测风云</title><content type='html'>早晨看到阳光灿烂，赶紧把昨天洗完晾在房间里的衣服挂到外面的晾衣绳上。晚上下班了，忽然听到外面淅沥哗啦，又开始下雨啦！怎么昨天的暴雨还没下够？今年北京的雨水可是下足了。上网看看北京今天的天气预报，也是说晴转多云，就没提到会下雨这回事。话说天有不测风云，果然不错。前几天看F1德国站的比赛，那两场雨预报的，准确的让人瞠目结舌。不过特定地点、特定时间的预报会比大范围的预报容易做一些吧，什么时候通过GPS就能实时接收这么准确的气象预报就好啦，呵呵。顶着早晨的大太阳，我可没想到晚上会被大雨困在办公室：可怜，完全没想到要带雨伞 :(&lt;br /&gt;&lt;br /&gt;多等一会，雨停了后回家再把衣服洗一遍吧....</content><link rel='replies' type='application/atom+xml' href='http://xieyanbo.blogspot.com/feeds/3433620631795870000/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5796527/3433620631795870000' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/3433620631795870000'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/3433620631795870000'/><link rel='alternate' type='text/html' href='http://xieyanbo.blogspot.com/2007/08/blog-post.html' title='果真是天有不测风云'/><author><name>xyb</name><uri>http://www.blogger.com/profile/11574809298508868859</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5796527.post-8453667706297902461</id><published>2007-07-29T16:51:00.000+08:00</published><updated>2007-07-29T17:13:54.946+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="唠叨"/><title type='text'>收拾心情，继续似水流年中的流水帐</title><content type='html'>我写blog是因为时常有跟别人分享点什么东西的冲动，写出来也许能跟人产生共鸣；或是指望帮人解决碰到的同样问题，自己心里也能有些窃喜。不过自打GFW愈演愈烈，访问国外blog的人全都会撞上一堵墙，偏巧我又只信任国外的blog服务...本来就拙于写字，如此有中国特色的blog体验更是让人心里烦躁，blog也就慢慢荒废了。&lt;br /&gt;&lt;br /&gt;不过今年的见闻让我又有所领悟，当撞墙已经成为常态，练就翻墙绝顶轻功的人岂不是会越来越多？也许有一天世界又会大同，blog在墙里还是墙外还有什么分别。干脆抛开这些烦人的事情，哪怕铜墙铁壁终于铸成，起码墙外的人还能知道墙里的人曾经有这样的生活。</content><link rel='replies' type='application/atom+xml' href='http://xieyanbo.blogspot.com/feeds/8453667706297902461/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5796527/8453667706297902461' title='2 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/8453667706297902461'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/8453667706297902461'/><link rel='alternate' type='text/html' href='http://xieyanbo.blogspot.com/2007/07/blog-post.html' title='收拾心情，继续似水流年中的流水帐'/><author><name>xyb</name><uri>http://www.blogger.com/profile/11574809298508868859</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5796527.post-4240705993832194930</id><published>2007-07-28T16:40:00.000+08:00</published><updated>2007-08-01T12:00:25.571+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="apache"/><category scheme="http://www.blogger.com/atom/ns#" term="ldap"/><category scheme="http://www.blogger.com/atom/ns#" term="subversion"/><category scheme="http://www.blogger.com/atom/ns#" term="ubuntu"/><title type='text'>在Ubuntu上安装用Windows目录服务做认证的Subversion服务</title><content type='html'>最近需要架设一台svn服务器，在Ubuntu Feisty(7.04)上安装了一下，非常容易。网上有很多相关资料，不过我需要让用户使用Windows的目录服务(Active Directory)来认证身份，参照了这篇&lt;a href=&quot;http://www.itguyonline.com/blog/2007/05/02/ldap-authentication-for-subversion-on-ubuntu-feisty/&quot; title=&quot;LDAP Authentication for Subversion on Ubuntu Feisty lesen&quot;&gt;LDAP Authentication for Subversion on Ubuntu Feisty&lt;/a&gt;文章，在这里做个文档备份：&lt;blockquote&gt;&lt;code&gt;# sudo apt-get install libapache2-svn subversion subversion-tools&lt;br /&gt;# cd /etc/apache2/mods-enabled&lt;br /&gt;# sudo ln -s /etc/apache2/mods-available/dav_svn.load&lt;br /&gt;&lt;b&gt;# sudo ln -s /etc/apache2/mods-available/ldap.load&lt;/b&gt;&lt;br /&gt;&lt;b&gt;# sudo ln -s /etc/apache2/mods-available/authnz_ldap.load&lt;/b&gt;&lt;br /&gt;# sudo /etc/init.d/apache2 restart# cd /etc/apache2/mods-enabled&lt;br /&gt;# sudo touch dav_svn.conf&lt;br /&gt;# sudo vi dav_svn.conf&lt;/code&gt;&lt;/blockquote&gt;其中加粗的两个命令是启用ldap相关的apache模块，这是参考的文章中没有提到的，否则会出现：“&lt;code&gt;Unknown Authn provider: ldap&lt;/code&gt;”的错误提示。&lt;br /&gt;&lt;br /&gt;dav_svn.conf文件，指明svn仓库在那里，如何认证用户身份：&lt;br /&gt;&lt;blockquote style=&quot;font-family: courier new;&quot;&gt;&lt;br /&gt;&amp;lt;Location /svn/&amp;gt;&lt;br /&gt;DAV svn&lt;br /&gt;SVNParentPath /home/svn&lt;br /&gt;AuthType Basic&lt;br /&gt;AuthName &quot;Subversion Repository&quot;&lt;br /&gt;AuthBasicProvider ldap&lt;br /&gt;AuthLDAPBindDN &quot;cn=readuser,ou=dep,dc=mydomain,dc=com&quot;&lt;br /&gt;AuthLDAPBindPassword &quot;password&quot;&lt;br /&gt;AuthLDAPURL &quot;ldap://adserver:3268/ou=dep,dc=mydomain,dc=com?sAMAccountName?sub?(objectClass=user)&quot;&lt;br /&gt;AuthzLDAPAuthoritative Off&lt;br /&gt;Require valid-user&lt;br /&gt;SVNListParentPath on&lt;br /&gt;AuthzSVNAccessFile /home/svn/authz.conf&lt;br /&gt;&amp;lt;/Location&amp;gt;&lt;br /&gt;&lt;/blockquote&gt;authz.conf文件，定义用户的组和访问不同项目仓库的权限：&lt;br /&gt;&lt;blockquote&gt;&lt;code&gt;[groups]&lt;br /&gt;svnadmin = xieyanbo&lt;br /&gt;erpadmin = user1&lt;br /&gt;&lt;br /&gt;[/]&lt;br /&gt;* =&lt;br /&gt;@svnadmin = rw&lt;br /&gt;&lt;br /&gt;[sandbox:/]&lt;br /&gt;* = rw&lt;br /&gt;&lt;br /&gt;[repos1:/]&lt;br /&gt;@erpadmin = rw&lt;br /&gt;&lt;/code&gt;&lt;/blockquote&gt;为了创建项目方便，写了一个脚本&lt;span style=&quot;font-family:courier new;&quot;&gt;add_project.sh&lt;/span&gt;做一些琐碎的事情，比如目录权限、配置文件的修改等：&lt;br /&gt;&lt;blockquote style=&quot;font-family: courier new;&quot;&gt;&lt;code&gt;#!/bin/bash&lt;br /&gt;&lt;br /&gt;project_name=&quot;$1&quot;&lt;br /&gt;&lt;br /&gt;if [ x&quot;$project_name&quot; = &quot;x&quot; ]; then&lt;br /&gt;echo &quot;$0 PROJECT_NAME&quot;&lt;br /&gt;exit 1&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;sudo mkdir /home/svn/&quot;$project_name&quot;&lt;br /&gt;sudo svnadmin create /home/svn/&quot;$project_name&quot;&lt;br /&gt;sudo chown -R www-data:www-data /home/svn/&quot;$project_name&quot;&lt;br /&gt;sudo chmod -R go-rwxs /home/svn/&quot;$project_name&quot;&lt;br /&gt;sudo sh -c &quot;echo &#39;auth-access = write&#39; &gt;&gt; /home/svn/$project_name/conf/svnserve.conf&quot;&lt;br /&gt;sudo sh -c &quot;echo &#39;[&#39;$project_name&#39;:/]&#39; &gt;&gt; /home/svn/authz.conf&quot;&lt;br /&gt;sudo sh -c &quot;echo &gt;&gt; /home/svn/authz.conf&quot;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;补充，增加SSL支持&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;参考《&lt;a href=&quot;http://wiki.freaks-unidos.net/Apache2%20SSL%20and%20Subversion%20in%20Debian&quot; title=&quot;Apache2 SSL and Subversion in Debian&quot;&gt;Apache2 SSL and Subversion in Debian&lt;/a&gt;》，给服务添加SSL支持。助记如下：&lt;br /&gt;&lt;blockquote style=&quot;font-family: courier new;&quot;&gt;&lt;code&gt;sudo apt-get install openssl&lt;br /&gt;sudo mkdir /etc/apache2/ssl&lt;br /&gt;export RANDFILE=/dev/random&lt;br /&gt;sudo openssl req $@ -new -x509 -days 365 -nodes \&lt;br /&gt;    -out /etc/apache2/ssl/apache.pem \&lt;br /&gt;    -keyout /etc/apache2/ssl/apache.pem&lt;br /&gt;sudo chmod 600 /etc/apache2/ssl/apache.pem&lt;br /&gt;cd /etc/apache2/sites-available/&lt;br /&gt;sudo cp default ssl&lt;br /&gt;sudo a2ensite ssl&lt;br /&gt;sudo a2enmod ssl&lt;br /&gt;sudo vi /etc/apache2/ports.conf # add Listen 443&lt;br /&gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;br /&gt;其实生成证书用apache的命令&lt;code&gt;apache2-ssl-certificate&lt;/code&gt;很方便，但Ubuntu从Debian继承的一个&lt;a href=&quot;https://launchpad.net/ubuntu/+source/apache2/+bug/77675&quot; title=&quot;apache2-ssl-certificate has gone missing since feisty&quot;&gt;bug&lt;/a&gt;把它给搞丢了，可惜...下面是ssl的apache配置文件/etc/apache2/sites-available/ssl的内容：&lt;br /&gt;&lt;blockquote style=&quot;font-family: courier new;&quot;&gt;&lt;code&gt;&amp;lt;VirtualHost *:443&amp;gt;&lt;br /&gt;  SSLEngine On&lt;br /&gt;  SSLCertificateFile /etc/apache2/ssl/apache.pem&lt;br /&gt;  Include /etc/apache2/mods-enabled/dav_svn.conf&lt;br /&gt;&amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;h3&gt;2007-08-01再补充，&lt;code&gt;SVNListParentPath on&lt;/code&gt;的bug临时应对方案&lt;/h3&gt;&lt;br /&gt;参考&lt;a href=&quot;http://subversion.tigris.org/issues/show_bug.cgi?id=2753&quot; title=&quot;SVNListParentPath feature doesn&#39;t work when svn authz is used.&quot;&gt;svn bug #2753&lt;/a&gt;，在使用 authz 的情况下，&lt;code&gt;SVNListParentPath on&lt;/code&gt;这个设置会失效，apache总是报告权限错误。避免这种情况的临时方案：把&lt;code&gt;&amp;lt;Location /svn&amp;gt;&lt;/code&gt;改成&lt;code&gt;&amp;lt;Location /svn/&amp;gt;&lt;/code&gt;，路径的最后面增加一个斜线。还真是个古怪的bug呀。</content><link rel='replies' type='application/atom+xml' href='http://xieyanbo.blogspot.com/feeds/4240705993832194930/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5796527/4240705993832194930' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/4240705993832194930'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/4240705993832194930'/><link rel='alternate' type='text/html' href='http://xieyanbo.blogspot.com/2007/07/ubuntuwindowssubversion.html' title='在Ubuntu上安装用Windows目录服务做认证的Subversion服务'/><author><name>xyb</name><uri>http://www.blogger.com/profile/11574809298508868859</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5796527.post-115444622647297912</id><published>2006-08-01T23:26:00.000+08:00</published><updated>2006-08-01T23:30:26.473+08:00</updated><title type='text'>pkblogs，救星</title><content type='html'>最近借助&lt;a href=&quot;http://www.pkblogs.com/&quot;&gt;pkblogs&lt;/a&gt;看了不少blogspot上的文章，真是广大受压迫人民的救星呀。托pkblogs的福，这个blog也能再利用一下了：&lt;br/&gt;&lt;br /&gt;&lt;a href=&quot;http://www.pkblogs.com/xieyanbo&quot;&gt;http://www.pkblogs.com/xieyanbo&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://xieyanbo.blogspot.com/feeds/115444622647297912/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5796527/115444622647297912' title='2 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/115444622647297912'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/115444622647297912'/><link rel='alternate' type='text/html' href='http://xieyanbo.blogspot.com/2006/08/pkblogs.html' title='pkblogs，救星'/><author><name>xyb</name><uri>http://www.blogger.com/profile/11574809298508868859</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5796527.post-114127772962174737</id><published>2006-03-02T13:31:00.000+08:00</published><updated>2006-03-02T13:35:29.630+08:00</updated><title type='text'>好的心态比啥都强</title><content type='html'>偶尔读到一段话，有点共鸣：&lt;br /&gt;有句俗语说：“满怀希望的旅途要比到达目的地更快乐。”与之相对的是英国吉普赛诗人W•H•戴维斯(W. H. Davies)的诗句：“终日营营的生活会是怎样，无暇驻足停留凝神欣赏？”</content><link rel='replies' type='application/atom+xml' href='http://xieyanbo.blogspot.com/feeds/114127772962174737/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5796527/114127772962174737' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/114127772962174737'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/114127772962174737'/><link rel='alternate' type='text/html' href='http://xieyanbo.blogspot.com/2006/03/blog-post.html' title='好的心态比啥都强'/><author><name>xyb</name><uri>http://www.blogger.com/profile/11574809298508868859</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5796527.post-113972590424754915</id><published>2006-02-12T14:06:00.000+08:00</published><updated>2007-07-28T17:28:09.074+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="python"/><title type='text'>还是关于python的web开发</title><content type='html'>&lt;p&gt;&lt;a href=&quot;http://www.aminus.org/blogs/index.php&quot;&gt;Peter Hunt&lt;/a&gt;在“&lt;a href=&quot;http://www.aminus.org/blogs/index.php/phunt/2006/01/04/how_python_wins_on_the_web&quot;&gt;How Python wins on the Web&lt;/a&gt;”里说道：“In fact, what I would love more than anything would be a portable mod_wsgi across Apache, LightTPD, and IIS: a module that would let me drop a .egg file into a directory and have it automatically pick up and install the WSGI application from the archive. Once we&#39;ve got this, a standard, portable way of easily installing ANY Python web app, we&#39;ll be getting somewhere.”心有戚戚焉。&lt;/p&gt;&lt;p&gt;一个大一统的Python Web Framework可能对企业用户更有吸引力，但它肯定不能适用于所有应用。对一个语言来说，拥有众多杀手级的应用才是证明它的存在价值的最好方法。最近工作不太顺心，不过倒正好是个机会，有闲暇的功夫补习这两年Web开发的发展。&lt;a href=&quot;http://www.zope.org/DevHome/Zope3&quot;&gt;Zope3&lt;/a&gt;、&lt;a href=&quot;http://www.djangoproject.com/&quot;&gt;Django&lt;/a&gt;的发展都不能忽视；但是要建一个好的网站，需要特别开发和优化的东西大多无法依靠这些框架，可能还反受框架之累；比起完整的解决方案，我更喜欢&lt;a href=&quot;http://www.python.org/peps/pep-0333.html&quot;&gt;WSGI&lt;/a&gt;/Template/ORM这些部分都能各自独立，随心选择不同实现。高内聚，低耦合，这是硬道理呀。&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://xieyanbo.blogspot.com/feeds/113972590424754915/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5796527/113972590424754915' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/113972590424754915'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/113972590424754915'/><link rel='alternate' type='text/html' href='http://xieyanbo.blogspot.com/2006/02/pythonweb.html' title='还是关于python的web开发'/><author><name>xyb</name><uri>http://www.blogger.com/profile/11574809298508868859</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5796527.post-113963738117392763</id><published>2006-02-11T13:42:00.000+08:00</published><updated>2006-02-11T13:56:21.190+08:00</updated><title type='text'>ColorQuiz</title><content type='html'>&lt;!--ColorQuiz.com code--&gt;&lt;br /&gt;&lt;table bgcolor=&quot;white&quot; border=&quot;1&quot; cellpadding=&quot;3&quot; cellspacing=&quot;0&quot;&gt;&lt;br /&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;http://www.colorquiz.com&quot;&gt;&lt;img alt=&quot;ColorQuiz.com&quot; src=&quot;http://www.colorquiz.com/images/colorquizlogosmall2.gif&quot; border=&quot;0&quot; height=&quot;32&quot; width=&quot;120&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;br /&gt;&lt;td&gt;xyb took the free ColorQuiz.com personality test!&lt;p&gt;&lt;i&gt;&quot;Wants interesting and exciting things to happen. A...&quot;&lt;/i&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;a href=&quot;http://www.colorquiz.com/cgi-bin/results.cgi?do=print_blog&amp;picked1=3,5,0,6,2,1,4,7,2&amp;amp;picked2=5,4,3,2,6,1,0,7,3&amp;sex=Male&amp;amp;blog_name=xyb&quot;&gt;Click here&lt;/a&gt; to read the rest of the results.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;Free personality analysis from &lt;b&gt;ColorQuiz.com&lt;/b&gt;.&lt;br /&gt;Generated on Fri Feb 10 21:38:41 2006.&lt;h3&gt;Your Existing Situation&lt;/h3&gt;&lt;ul&gt;Active, but feels that insufficient progress or reward is being made for the effort exerted.&lt;/ul&gt;&lt;br /&gt;&lt;h3&gt;Your Stress Sources&lt;/h3&gt;&lt;ul&gt;Wishes to be independent, unhampered, and free from any limitation or restriction, other than those which he imposes of himself or by his own choice and decision.&lt;/ul&gt;&lt;br /&gt;&lt;h3&gt;Your Restrained Characteristics&lt;/h3&gt;&lt;ul&gt;Willing to participate and to allow himself to become involved, but tries to fend off conflict and disturbance in order to reduce tension.&lt;p&gt;Remains emotionally unattached even when involved in a close relationship.&lt;/p&gt;&lt;p&gt;Feels that he cannot do much about his existing problems and difficulties and that he must make the best of things as they are. Able to achieve satisfaction through sexual activity.&lt;/p&gt;&lt;/ul&gt;&lt;br /&gt;&lt;h3&gt;Your Desired Objective&lt;/h3&gt;&lt;ul&gt;Wants interesting and exciting things to happen. Able to make himself well-liked by his obvious interest and by the very openness of his charm. Over-imaginative and given to fantasy or day-dreaming.&lt;/ul&gt;&lt;br /&gt;&lt;h3&gt;Your Actual Problem&lt;/h3&gt;&lt;ul&gt;Seeks to avoid criticism and to prevent restriction of his freedom to act, and to decide for himself by the exercise of great personal charm in his dealings with others.&lt;/ul&gt;&lt;br /&gt;&lt;!--End ColorQuiz.com code--&gt;</content><link rel='replies' type='application/atom+xml' href='http://xieyanbo.blogspot.com/feeds/113963738117392763/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5796527/113963738117392763' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/113963738117392763'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/113963738117392763'/><link rel='alternate' type='text/html' href='http://xieyanbo.blogspot.com/2006/02/colorquiz.html' title='ColorQuiz'/><author><name>xyb</name><uri>http://www.blogger.com/profile/11574809298508868859</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5796527.post-113920277667048344</id><published>2006-02-06T11:54:00.001+08:00</published><updated>2006-02-06T14:17:45.713+08:00</updated><title type='text'>脚本语言的胜利</title><content type='html'>&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;/images/ruby_vs_java_books.jpg&quot;&gt;&lt;img style=&quot;float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px;&quot; src=&quot;/images/ruby_vs_java_books.jpg&quot; border=&quot;0&quot; alt=&quot;Ruby VS. Java Books&quot; /&gt;&lt;/a&gt;碰巧看到“&lt;a href=&quot;http://plog.longwin.com.tw/post/1/309&quot;&gt;&lt;br /&gt;Ruby on Rails将程式设计化繁为简&lt;/a&gt;”，里面的一张&lt;a href=&quot;/images/ruby_vs_java_books.jpg&quot;&gt;照片&lt;/a&gt;很吸引眼球。文章还提到，脚本语言“兼具脚本(scripting)程式语言PHP的速度与易用性，以及Java结构式作法的‘干净和清爽’”，“Ruby on Rails备受瞩目，反映程式设计界兴起一股以脚本程式语言(scripting language)取代Java或微软C#的风潮”。相比于&lt;a href=&quot;http://www.rubyonrails.org&quot;&gt;Ruby on Rails&lt;/a&gt;，&lt;a href=&quot;http://www.python.org&quot;&gt;Python&lt;/a&gt;语言正在开发的Web framework &lt;a href=&quot;http://www.djangoproject.com/&quot;&gt;Django&lt;/a&gt;也吸引了Python界众多领军人物的眼光，第一个正式版的发布已进入倒计时；而&lt;a href=&quot;http://www.artima.com/weblogs/index.jsp?blogger=guido&quot;&gt;Guido&lt;/a&gt;为自己在新公司Google的项目&lt;a href=&quot;http://www.artima.com/weblogs/viewpost.jsp?thread=146149&quot;&gt;公开征集&lt;/a&gt;基于Python的Web framework，更是激起了空前热情的大讨论，网上的妙文不断。有理由相信，2006年将是Python的Web framwrok大发展的一年。而商业公司也在过去的两年里与脚本语言关系越来越密切，微软发布了&lt;a href=&quot;http://www.ironpython.com&quot;&gt;IronPython&lt;/a&gt;，旨在把UNIX开发商吸引到.Net框架中；&lt;a href=&quot;http://www.zdnet.com.cn/developer/code/story/0,3800066897,39376951,00.htm&quot;&gt;CNET的文章&lt;/a&gt;称，“过去曾经被正统的编程人员认为是玩具的脚本语言正在成为企业软件开发世界的一等公民”。&lt;br /&gt;&lt;br /&gt;在这里，我学到的是，在这个竞争激烈、一寸光阴一寸金的年代，开发框架的“易用性”正在成为压倒一切的重要特征；因为易用性给开发、部署、维护方面带来的时间与金钱的节约，是任何投资者都无法忽视的——包括公司的投资者和免费软件程序员。&lt;br /&gt;&lt;br /&gt;不过，企业应用一贯是期望使用的语言提供更成熟和繁复的架构，这本身和脚本语言的哲学有些相背；希望今后的几年脚本语言能给这个领域带来一些清新的风，而不是被“企业级应用”带到沟里去，忘了自己的本分。&lt;br /&gt;&lt;br /&gt;闲话一句，似乎Perl6的开发进度还是&lt;a href=&quot;http://wiki.perlchina.org/main/show/Ask+Tim%3A+When+will+Perl+6+ever+get+done&quot;&gt;不太乐观&lt;/a&gt;，拭目以待吧。</content><link rel='replies' type='application/atom+xml' href='http://xieyanbo.blogspot.com/feeds/113920277667048344/comments/default' title='博文评论'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5796527/113920277667048344' title='0 条评论'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/113920277667048344'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5796527/posts/default/113920277667048344'/><link rel='alternate' type='text/html' href='http://xieyanbo.blogspot.com/2006/02/blog-post.html' title='脚本语言的胜利'/><author><name>xyb</name><uri>http://www.blogger.com/profile/11574809298508868859</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>