<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet href='http://feed.feedsky.com/styles/feedsky2.xsl' type='text/xsl' ?><!--这是一个由Feedsy提供技术支持的Feed，为了提高读者阅读的体验，以及满足用户美化自己Feed的需要，我们设计了多种精美的Feed模板，提供给大家选择，所有最终呈现出来的样式，皆由用户自愿选择使用，未经许可，任何团体和个人，请不要擅自修改样式或者盗用，这是对于用户选择权的尊重。--><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:fs="http://www.feedsky.com/namespace/feed" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link href="http://feed.feedsky.com/youngking" type="application/rss+xml" rel="self"></atom:link><fs:self_link href="http://feed.feedsky.com/youngking" type="application/rss+xml"></fs:self_link><lastBuildDate>Sat, 12 Dec 2009 15:18:31 GMT</lastBuildDate><title>繁星满天</title><description>位我上者灿烂星空,道德律令如在心中</description><image><url>http://www.feedsky.com/feed/youngking/sc/gif</url><title>繁星满天</title><link>http://blog.xmu.me</link></image><link>http://blog.xmu.me</link><sy:updatePeriod>hourly</sy:updatePeriod><sy:updateFrequency>1</sy:updateFrequency><language>en</language><pubDate>Sat, 12 Dec 2009 15:39:52 GMT</pubDate><item><title>让apt-get支持多线程加速下载</title><link>http://blog.xmu.me/2009/12/12/apt-download-speed-support-multi-threaded/</link><content:encoded>&lt;p&gt;最近切换成了debian lenny,不过每到周末晚上就难以忍受apt-get的龟速，想起曾在使用gentoo和archlinux时看到过的加速emerge和pacman的文章，决定想办法加速下apt-get的下载速度。&lt;/p&gt;

&lt;p&gt;查看了apt-get的手册，决定从 &amp;#8211;print-uris这个参数入手，脚本如下：&lt;/p&gt;

&lt;div class=&quot;codecolorer-container bash default&quot; style=&quot;overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;&quot;&gt;&lt;div class=&quot;bash codecolorer&quot; style=&quot;padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap&quot;&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;#!/bin/bash&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;# filename : multiapt.sh&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;# author &amp;nbsp; : yanckin AT gmail.com&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;# usage &amp;nbsp; &amp;nbsp;: ./multapt.sh $1&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;apt-get&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;--print-uris&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-y&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;install&lt;/span&gt; $1 &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;grep&lt;/span&gt; http &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;awk&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;'{print $1}'&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sed&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;s/'//g&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;xargs&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-l&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; aria2c &lt;span style=&quot;color: #660033;&quot;&gt;-s&lt;/span&gt; 5 &lt;span style=&quot;color: #660033;&quot;&gt;-d&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;var&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;cache&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;apt&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;archives&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt; ; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;sudo&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;apt-get&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;install&lt;/span&gt; $&lt;span style=&quot;color: #000000;&quot;&gt;1&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;其中aria2c是多线程下载工具aria2的执行程序名称，需要先安装。比起wget来支持多线程 ，支持多种协议，甚至包括bt。&lt;/p&gt;

&lt;p&gt;然后给脚本执行可权限:&lt;/p&gt;

&lt;div class=&quot;codecolorer-container bash default&quot; style=&quot;overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;&quot;&gt;&lt;div class=&quot;bash codecolorer&quot; style=&quot;padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;chmod&lt;/span&gt; +x multiapt.sh&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;假如你要安装opera，现在只需:&lt;/p&gt;

&lt;div class=&quot;codecolorer-container bash default&quot; style=&quot;overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;&quot;&gt;&lt;div class=&quot;bash codecolorer&quot; style=&quot;padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap&quot;&gt;&amp;nbsp;.&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;multiapt.sh opera&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;后记:
对于普通网友，可能更多的时候找个更快的源，笔者想出此策实在是因为局域网奇慢无比,p2p,arp泛滥，实属无可奈何。&lt;/p&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/308984744/youngking/feedsky/s.gif?r=http://blog.xmu.me/2009/12/12/apt-download-speed-support-multi-threaded/&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/youngking/308984744/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/youngking/308984744/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;fsflare&quot;&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=b387ee5f79e6b895362e5328474ce1c1&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=b387ee5f79e6b895362e5328474ce1c1&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=9f1722fa07a32527249b24f5f07d4daa&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=9f1722fa07a32527249b24f5f07d4daa&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=6d7d876f1a89538253c7f8108acf2bb9&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=6d7d876f1a89538253c7f8108acf2bb9&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=babc8f076e7da4d7b77e696ca07de9a0&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=babc8f076e7da4d7b77e696ca07de9a0&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=c09f41ac786a9a7328a9784503db8c5b&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=c09f41ac786a9a7328a9784503db8c5b&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;/p&gt;</content:encoded><wfw:commentRss>http://blog.xmu.me/2009/12/12/apt-download-speed-support-multi-threaded/feed/</wfw:commentRss><slash:comments>0</slash:comments><description>最近切换成了debian lenny,不过每到周末晚上就难以忍受apt-get的龟速，想起曾在使用gentoo和archlinux时看到过的加速emerge和pacman的文章，决定想办法加速下apt-get的下载速度。

查看了apt-get的手册，决定从 &amp;#8211;print-uris这个参数入手，脚本如下：

#!/bin/bash
# filename : multiapt.sh
# author &amp;#160; : yanckin AT gmail.com
# usage &amp;#160; &amp;#160;: ./multapt.sh $1
sudo apt-get --print-uris -y install $1 &amp;#124; grep http &amp;#124; awk '{print $1}' &amp;#124; sed &amp;#34;s/'//g&amp;#34; &amp;#124; xargs -l sudo aria2c -s 5 -d /var/cache/apt/archives/ ; sudo apt-get install $1

其中aria2c是多线程下载工具aria2的执行程序名称，需要先安装。比起wget来支持多线程 ，支持多种协议，甚至包括bt。

然后给脚本执行可权限:

&amp;#160;chmod +x multiapt.sh

假如你要安装opera，现在只需:

&amp;#160;./multiapt.sh opera

后记:
对于普通网友，可能更多的时候找个更快的源，笔者想出此策实在是因为局域网奇慢无比,p2p,arp泛滥，实属无可奈何。&lt;img src=&quot;http://www1.feedsky.com/t1/308984744/youngking/feedsky/s.gif?r=http://blog.xmu.me/2009/12/12/apt-download-speed-support-multi-threaded/&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/youngking/308984744/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/youngking/308984744/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;fsflare&quot;&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=b387ee5f79e6b895362e5328474ce1c1&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=b387ee5f79e6b895362e5328474ce1c1&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=9f1722fa07a32527249b24f5f07d4daa&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=9f1722fa07a32527249b24f5f07d4daa&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=6d7d876f1a89538253c7f8108acf2bb9&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=6d7d876f1a89538253c7f8108acf2bb9&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=babc8f076e7da4d7b77e696ca07de9a0&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=babc8f076e7da4d7b77e696ca07de9a0&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=c09f41ac786a9a7328a9784503db8c5b&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=c09f41ac786a9a7328a9784503db8c5b&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;/p&gt;</description><category>linux</category><category>Tech</category><category>apt-get</category><category>debian</category><category>aria2</category><pubDate>Sat, 12 Dec 2009 23:18:31 +0800</pubDate><author>youngking</author><comments>http://blog.xmu.me/2009/12/12/apt-download-speed-support-multi-threaded/#comments</comments><guid isPermaLink="false">http://blog.xmu.me/?p=128</guid><dc:creator>youngking</dc:creator><fs:srclink>http://blog.xmu.me/2009/12/12/apt-download-speed-support-multi-threaded/</fs:srclink><fs:srcfeed>http://blog.xmu.me/feed/</fs:srcfeed><fs:itemid>feedsky/youngking/~7542090/308984744/1324224</fs:itemid></item><item><title>PostgreSQL 安装和配置</title><link>http://blog.xmu.me/2009/11/15/postgresql-installation-configuration/</link><content:encoded>&lt;h1&gt;安装&lt;/h1&gt;

&lt;div class=&quot;codecolorer-container text default&quot; style=&quot;overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;&quot;&gt;&lt;div class=&quot;text codecolorer&quot; style=&quot;padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap&quot;&gt;$ emerge postgresql&lt;/div&gt;&lt;/div&gt;

&lt;h1&gt;配置&lt;/h1&gt;

&lt;div class=&quot;codecolorer-container text default&quot; style=&quot;overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;&quot;&gt;&lt;div class=&quot;text codecolorer&quot; style=&quot;padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap&quot;&gt;$ passwd postgres&lt;br /&gt;
$ emerge --config =postgresql-8.0.4&lt;br /&gt;
$ /etc/init.d/postgresql start&lt;br /&gt;
$ rc-update add postgresql default&lt;/div&gt;&lt;/div&gt;

&lt;h1&gt;使用&lt;/h1&gt;

&lt;p&gt;创建一个数据库：&lt;/p&gt;

&lt;div class=&quot;codecolorer-container text default&quot; style=&quot;overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;&quot;&gt;&lt;div class=&quot;text codecolorer&quot; style=&quot;padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap&quot;&gt;$ createdb -U postgres -W test&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;删除一个数据库:&lt;/p&gt;

&lt;div class=&quot;codecolorer-container text default&quot; style=&quot;overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;&quot;&gt;&lt;div class=&quot;text codecolorer&quot; style=&quot;padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap&quot;&gt;$ dropdb -U postgres -W test&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;创建一个超级用户:&lt;/p&gt;

&lt;div class=&quot;codecolorer-container text default&quot; style=&quot;overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;&quot;&gt;&lt;div class=&quot;text codecolorer&quot; style=&quot;padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap&quot;&gt;createuser -a -d -P -E -U postgres -W testroot&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;其中-a 表示该用户可以添加其他用户. -d 表示该用户可以创建数据库. -P 让你为用户输入一个密码 -E 加密，出于安全目的.&lt;/p&gt;

&lt;p&gt;创建一个标准用户:&lt;/p&gt;

&lt;div class=&quot;codecolorer-container text default&quot; style=&quot;overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;&quot;&gt;&lt;div class=&quot;text codecolorer&quot; style=&quot;padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap&quot;&gt;createuser -A -D -P -E -U testroot -W testuser&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;-A,-D和-a,-d的作用相反，表示用户将被剥夺创建用户和数据库的能力&lt;/p&gt;

&lt;p&gt;创建一个普通用户有权限的数据库MyDB:&lt;/p&gt;

&lt;div class=&quot;codecolorer-container text default&quot; style=&quot;overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;&quot;&gt;&lt;div class=&quot;text codecolorer&quot; style=&quot;padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap&quot;&gt;$ createdb -O testuser -U testroot -W MyDB&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;登陆数据库:&lt;/p&gt;

&lt;div class=&quot;codecolorer-container text default&quot; style=&quot;overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;&quot;&gt;&lt;div class=&quot;text codecolorer&quot; style=&quot;padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap&quot;&gt;psql -U testuser -W MyDB&lt;/div&gt;&lt;/div&gt;

&lt;h1&gt;更多&lt;/h1&gt;

&lt;p&gt;参考&lt;a href=&quot;http://www.postgresql.org/docs/8.4/static/index.html&quot;&gt;官方文档&lt;/a&gt;&lt;/p&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/308984762/youngking/feedsky/s.gif?r=http://blog.xmu.me/2009/11/15/postgresql-installation-configuration/&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/youngking/308984762/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/youngking/308984762/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;fsflare&quot;&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=81afdc01396a976a2856d5327a7095bd&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=81afdc01396a976a2856d5327a7095bd&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=4bbe53cb0cb3fa1c3d26beb913823055&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=4bbe53cb0cb3fa1c3d26beb913823055&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=309d97559e8bef2fabf9ce022f06bbfd&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=309d97559e8bef2fabf9ce022f06bbfd&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=3c80ef683e664499c6891eb77ffe7f00&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=3c80ef683e664499c6891eb77ffe7f00&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=94aedf386e29b45f22084cd9508aaef2&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=94aedf386e29b45f22084cd9508aaef2&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;/p&gt;</content:encoded><wfw:commentRss>http://blog.xmu.me/2009/11/15/postgresql-installation-configuration/feed/</wfw:commentRss><slash:comments>0</slash:comments><description>安装

$ emerge postgresql

配置

$ passwd postgres
$ emerge --config =postgresql-8.0.4
$ /etc/init.d/postgresql start
$ rc-update add postgresql default

使用

创建一个数据库：

$ createdb -U postgres -W test

删除一个数据库:

$ dropdb -U postgres -W test

创建一个超级用户:

createuser -a -d -P -E -U postgres -W testroot

其中-a 表示该用户可以添加其他用户. -d 表示该用户可以创建数据库. -P 让你为用户输入一个密码 -E 加密，出于安全目的.

创建一个标准用户:

createuser -A -D -P -E -U testroot -W testuser

-A,-D和-a,-d的作用相反，表示用户将被剥夺创建用户和数据库的能力

创建一个普通用户有权限的数据库MyDB:

$ createdb -O testuser -U testroot -W MyDB

登陆数据库:

psql -U [...]&lt;img src=&quot;http://www1.feedsky.com/t1/308984762/youngking/feedsky/s.gif?r=http://blog.xmu.me/2009/11/15/postgresql-installation-configuration/&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/youngking/308984762/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/youngking/308984762/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;fsflare&quot;&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=81afdc01396a976a2856d5327a7095bd&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=81afdc01396a976a2856d5327a7095bd&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=4bbe53cb0cb3fa1c3d26beb913823055&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=4bbe53cb0cb3fa1c3d26beb913823055&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=309d97559e8bef2fabf9ce022f06bbfd&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=309d97559e8bef2fabf9ce022f06bbfd&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=3c80ef683e664499c6891eb77ffe7f00&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=3c80ef683e664499c6891eb77ffe7f00&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=94aedf386e29b45f22084cd9508aaef2&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=94aedf386e29b45f22084cd9508aaef2&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;/p&gt;</description><category>Tech</category><category>database</category><category>postgresql</category><pubDate>Sun, 15 Nov 2009 16:42:36 +0800</pubDate><author>youngking</author><comments>http://blog.xmu.me/2009/11/15/postgresql-installation-configuration/#comments</comments><guid isPermaLink="false">http://blog.xmu.me/?p=113</guid><dc:creator>youngking</dc:creator><fs:srclink>http://blog.xmu.me/2009/11/15/postgresql-installation-configuration/</fs:srclink><fs:srcfeed>http://blog.xmu.me/feed/</fs:srcfeed><fs:itemid>feedsky/youngking/~7542090/308984762/1324224</fs:itemid></item><item><title>Zope的没落，Django的崛起</title><link>http://blog.xmu.me/2009/10/31/zope-decline-djangos-rise/</link><content:encoded>&lt;table style=&quot;display: inline;&quot; border=&quot;0&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;padding: 0pt; white-space: nowrap;&quot;&gt;&lt;span style=&quot;color: #4684ee;&quot;&gt;&lt;strong&gt;django python&lt;/strong&gt; &lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;table style=&quot;height: 4px;&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; width=&quot;70&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;display: block;&quot; bgcolor=&quot;#4684ee&quot;&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/td&gt;
&lt;td&gt;&lt;span&gt;1.00&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;

&lt;table style=&quot;display: inline;&quot; border=&quot;0&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;padding: 0pt; white-space: nowrap;&quot;&gt;&lt;span style=&quot;color: #dc3912;&quot;&gt;&lt;strong&gt;zope python&lt;/strong&gt; &lt;/span&gt;&lt;/td&gt;
&lt;td&gt;
&lt;table style=&quot;height: 4px;&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; width=&quot;64&quot;&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style=&quot;display: block;&quot; bgcolor=&quot;#dc3912&quot;&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/td&gt;
&lt;td&gt;&lt;span&gt;0.92&lt;/span&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;

&lt;p&gt;&lt;a href=&quot;http://www.google.com/trends?q=django+python%2Czope+python&amp;amp;ctab=0&amp;amp;geo=all&amp;amp;date=all&amp;amp;sort=0&quot;&gt;&lt;img class=&quot;alignnone&quot; title=&quot;zope vs django&quot; src=&quot;http://www.google.com/trends/viz?q=django+python,zope+python&amp;amp;date=all&amp;amp;geo=all&amp;amp;graph=weekly_img&amp;amp;sort=0&amp;amp;sa=N&quot; alt=&quot;&quot; width=&quot;580&quot; height=&quot;260&quot; /&gt;&lt;/a&gt;
一图胜千言，Zope糟糕的文档，不友好的社区注定了它的没落，虽然Zope有很多优秀的地方，但比起Django在很多地方做的太过复杂了。学习Django的过程中有着过去从Zope身上从来没有得到的愉悦，&lt;a href=&quot;http://stackoverflow.com/questions/1515324/history-of-djangos-popularity/1515370#1515370&quot;&gt;Django为什么会流行&lt;/a&gt;？&lt;/p&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/308984778/youngking/feedsky/s.gif?r=http://blog.xmu.me/2009/10/31/zope-decline-djangos-rise/&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/youngking/308984778/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/youngking/308984778/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;fsflare&quot;&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=6c739bea8d73feee7f7b03f6000e0903&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=6c739bea8d73feee7f7b03f6000e0903&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=9d66d99ec1d516ea8db1f7bacc4c03a5&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=9d66d99ec1d516ea8db1f7bacc4c03a5&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=f9154379c8b627f2141b5181f009463b&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=f9154379c8b627f2141b5181f009463b&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=b616f7f7f167ce4951617b864a687a62&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=b616f7f7f167ce4951617b864a687a62&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=3ebcf1f98acec2e5e3dab77c76774670&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=3ebcf1f98acec2e5e3dab77c76774670&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;/p&gt;</content:encoded><wfw:commentRss>http://blog.xmu.me/2009/10/31/zope-decline-djangos-rise/feed/</wfw:commentRss><slash:comments>0</slash:comments><description>django python 








1.00






zope python 








0.92




一图胜千言，Zope糟糕的文档，不友好的社区注定了它的没落，虽然Zope有很多优秀的地方，但比起Django在很多地方做的太过复杂了。学习Django的过程中有着过去从Zope身上从来没有得到的愉悦，Django为什么会流行？&lt;img src=&quot;http://www1.feedsky.com/t1/308984778/youngking/feedsky/s.gif?r=http://blog.xmu.me/2009/10/31/zope-decline-djangos-rise/&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/youngking/308984778/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/youngking/308984778/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;fsflare&quot;&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=6c739bea8d73feee7f7b03f6000e0903&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=6c739bea8d73feee7f7b03f6000e0903&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=9d66d99ec1d516ea8db1f7bacc4c03a5&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=9d66d99ec1d516ea8db1f7bacc4c03a5&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=f9154379c8b627f2141b5181f009463b&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=f9154379c8b627f2141b5181f009463b&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=b616f7f7f167ce4951617b864a687a62&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=b616f7f7f167ce4951617b864a687a62&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=3ebcf1f98acec2e5e3dab77c76774670&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=3ebcf1f98acec2e5e3dab77c76774670&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;/p&gt;</description><category>Tech</category><category>python</category><category>django</category><category>Zope</category><pubDate>Sat, 31 Oct 2009 01:01:29 +0800</pubDate><author>youngking</author><comments>http://blog.xmu.me/2009/10/31/zope-decline-djangos-rise/#comments</comments><guid isPermaLink="false">http://blog.xmu.me/?p=105</guid><dc:creator>youngking</dc:creator><fs:srclink>http://blog.xmu.me/2009/10/31/zope-decline-djangos-rise/</fs:srclink><fs:srcfeed>http://blog.xmu.me/feed/</fs:srcfeed><fs:itemid>feedsky/youngking/~7542090/308984778/1324224</fs:itemid></item><item><title>[tip]为python增加自动补全和历史记忆功能</title><link>http://blog.xmu.me/2009/10/19/python-tip-python-increase-auto-completion-history-memory/</link><content:encoded>&lt;h1&gt;for linux&lt;/h1&gt;

&lt;p&gt;主目录下新建一个.pythonstartup的文件，内容如下:&lt;/p&gt;

&lt;div class=&quot;codecolorer-container python default&quot; style=&quot;overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;&quot;&gt;&lt;div class=&quot;python codecolorer&quot; style=&quot;padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# python startup file&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #dc143c;&quot;&gt;readline&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #dc143c;&quot;&gt;rlcompleter&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #dc143c;&quot;&gt;atexit&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;import&lt;/span&gt; &lt;span style=&quot;color: #dc143c;&quot;&gt;os&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# tab completion&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #dc143c;&quot;&gt;readline&lt;/span&gt;.&lt;span style=&quot;color: black;&quot;&gt;parse_and_bind&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #483d8b;&quot;&gt;'tab: complete'&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# history file&lt;/span&gt;&lt;br /&gt;
histfile = &lt;span style=&quot;color: #dc143c;&quot;&gt;os&lt;/span&gt;.&lt;span style=&quot;color: black;&quot;&gt;path&lt;/span&gt;.&lt;span style=&quot;color: black;&quot;&gt;join&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #dc143c;&quot;&gt;os&lt;/span&gt;.&lt;span style=&quot;color: black;&quot;&gt;environ&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #483d8b;&quot;&gt;'HOME'&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#93;&lt;/span&gt;, &lt;span style=&quot;color: #483d8b;&quot;&gt;'.pythonhistory'&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;try&lt;/span&gt;:&lt;br /&gt;
&lt;span style=&quot;color: #dc143c;&quot;&gt;readline&lt;/span&gt;.&lt;span style=&quot;color: black;&quot;&gt;read_history_file&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;histfile&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;except&lt;/span&gt; &lt;span style=&quot;color: #008000;&quot;&gt;IOError&lt;/span&gt;:&lt;br /&gt;
&lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;pass&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #dc143c;&quot;&gt;atexit&lt;/span&gt;.&lt;span style=&quot;color: black;&quot;&gt;register&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #dc143c;&quot;&gt;readline&lt;/span&gt;.&lt;span style=&quot;color: black;&quot;&gt;write_history_file&lt;/span&gt;, histfile&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;del&lt;/span&gt; &lt;span style=&quot;color: #dc143c;&quot;&gt;os&lt;/span&gt;, histfile, &lt;span style=&quot;color: #dc143c;&quot;&gt;readline&lt;/span&gt;, &lt;span style=&quot;color: #dc143c;&quot;&gt;rlcompleter&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;如果这时还没生效，可以在.bashrc或者.profile文件中加入&lt;/p&gt;

&lt;div class=&quot;codecolorer-container text default&quot; style=&quot;overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;&quot;&gt;&lt;div class=&quot;text codecolorer&quot; style=&quot;padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap&quot;&gt;export PYTHONSTARTUP= ~/.pythonstartup&lt;/div&gt;&lt;/div&gt;

&lt;h1&gt;for win&lt;/h1&gt;

&lt;p&gt;安装readline,&lt;a href=&quot;http://launchpad.net/pyreadline/1.5/1.5/+download/pyreadline-1.5-win32-setup.exe&quot;&gt;下载地址&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;在任意目录，比如D:&amp;#92;Python2.5下建立一个文件startup.py,内容如下:&lt;/p&gt;

&lt;div class=&quot;codecolorer-container text default&quot; style=&quot;overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;&quot;&gt;&lt;div class=&quot;text codecolorer&quot; style=&quot;padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap&quot;&gt;# python startup file&lt;br /&gt;
import readline&lt;br /&gt;
import rlcompleter&lt;br /&gt;
import atexit&lt;br /&gt;
import os&lt;br /&gt;
# tab completion&lt;br /&gt;
readline.parse_and_bind('tab: complete')&lt;br /&gt;
# history file&lt;br /&gt;
histfile = os.path.join(os.path.dirname(os.environ['PYTHONSTARTUP']), '.pythonhistory')&lt;br /&gt;
try:&lt;br /&gt;
readline.read_history_file(histfile)&lt;br /&gt;
except IOError:&lt;br /&gt;
pass&lt;br /&gt;
atexit.register(readline.write_history_file, histfile)&lt;br /&gt;
del os, histfile, readline, rlcompleter&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;增加环境变量PYTHONSTARTUP，值为刚才那个文件的路径。&lt;/p&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/308984792/youngking/feedsky/s.gif?r=http://blog.xmu.me/2009/10/19/python-tip-python-increase-auto-completion-history-memory/&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/youngking/308984792/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/youngking/308984792/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;fsflare&quot;&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=d2889c24afccb089316ca962f912604e&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=d2889c24afccb089316ca962f912604e&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=84162f9762e81dcdacadccabc7f0d60b&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=84162f9762e81dcdacadccabc7f0d60b&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=679e3e9d379d7d55e1535f27ef506324&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=679e3e9d379d7d55e1535f27ef506324&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=4a12c47ef958071ea8e1d4aeb1000e9d&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=4a12c47ef958071ea8e1d4aeb1000e9d&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=7d28527d2dc2256d9e4e16fb7acc70b5&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=7d28527d2dc2256d9e4e16fb7acc70b5&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;/p&gt;</content:encoded><wfw:commentRss>http://blog.xmu.me/2009/10/19/python-tip-python-increase-auto-completion-history-memory/feed/</wfw:commentRss><slash:comments>0</slash:comments><description>for linux

主目录下新建一个.pythonstartup的文件，内容如下:

# python startup file
import readline
import rlcompleter
import atexit
import os
# tab completion
readline.parse_and_bind&amp;#40;'tab: complete'&amp;#41;
# history file
histfile = os.path.join&amp;#40;os.environ&amp;#91;'HOME'&amp;#93;, '.pythonhistory'&amp;#41;
try:
readline.read_history_file&amp;#40;histfile&amp;#41;
except IOError:
pass
atexit.register&amp;#40;readline.write_history_file, histfile&amp;#41;
del os, histfile, readline, rlcompleter

如果这时还没生效，可以在.bashrc或者.profile文件中加入

export PYTHONSTARTUP= ~/.pythonstartup

for win

安装readline,下载地址

在任意目录，比如D:&amp;#92;Python2.5下建立一个文件startup.py,内容如下:

# python startup file
import readline
import rlcompleter
import atexit
import os
# tab completion
readline.parse_and_bind('tab: complete')
# history file
histfile = os.path.join(os.path.dirname(os.environ['PYTHONSTARTUP']), '.pythonhistory')
try:
readline.read_history_file(histfile)
except IOError:
pass
atexit.register(readline.write_history_file, histfile)
del os, histfile, readline, rlcompleter

增加环境变量PYTHONSTARTUP，值为刚才那个文件的路径。&lt;img src=&quot;http://www1.feedsky.com/t1/308984792/youngking/feedsky/s.gif?r=http://blog.xmu.me/2009/10/19/python-tip-python-increase-auto-completion-history-memory/&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/youngking/308984792/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/youngking/308984792/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;fsflare&quot;&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=d2889c24afccb089316ca962f912604e&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=d2889c24afccb089316ca962f912604e&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=84162f9762e81dcdacadccabc7f0d60b&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=84162f9762e81dcdacadccabc7f0d60b&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=679e3e9d379d7d55e1535f27ef506324&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=679e3e9d379d7d55e1535f27ef506324&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=4a12c47ef958071ea8e1d4aeb1000e9d&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=4a12c47ef958071ea8e1d4aeb1000e9d&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=7d28527d2dc2256d9e4e16fb7acc70b5&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=7d28527d2dc2256d9e4e16fb7acc70b5&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;/p&gt;</description><category>Tech</category><pubDate>Mon, 19 Oct 2009 18:51:50 +0800</pubDate><author>youngking</author><comments>http://blog.xmu.me/2009/10/19/python-tip-python-increase-auto-completion-history-memory/#comments</comments><guid isPermaLink="false">http://blog.xmu.me/?p=96</guid><dc:creator>youngking</dc:creator><fs:srclink>http://blog.xmu.me/2009/10/19/python-tip-python-increase-auto-completion-history-memory/</fs:srclink><fs:srcfeed>http://blog.xmu.me/feed/</fs:srcfeed><fs:itemid>feedsky/youngking/~7542090/308984792/1324224</fs:itemid></item><item><title>再见厦门</title><link>http://blog.xmu.me/2009/09/01/goodbye-amoy/</link><content:encoded>&lt;pre&gt;&lt;code&gt;  厦门真的美的就像风景 离开了一年后再回去 才真的真切的感觉到它     
  以前天天处于其中竟浑然不知觉             

  那些青春的过往   那些不诉的离伤 ...    

  但在这海的面前你可以忘却一切忧伤    那么蓝的天又怎么可以让你不明媚

  一不小心就踏入了人生的另一个殿堂 从此过去一切天高水远      
  只有了一份安定和责任 

  站在二十五岁   过去和未来   一个身后一个眼前
&lt;/code&gt;&lt;/pre&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/308984830/youngking/feedsky/s.gif?r=http://blog.xmu.me/2009/09/01/goodbye-amoy/&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/youngking/308984830/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/youngking/308984830/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;fsflare&quot;&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=d1a99f3f81a7eff2d402b021d71c511f&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=d1a99f3f81a7eff2d402b021d71c511f&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=179cd4e2460189fc15a125a80db5e7f4&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=179cd4e2460189fc15a125a80db5e7f4&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=4670c4e933c6bd09efb141f9ba7bc804&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=4670c4e933c6bd09efb141f9ba7bc804&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=8173f768b6eae858605a4adde67f7574&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=8173f768b6eae858605a4adde67f7574&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=97650dd8b71ac88f0ceb73aad1b3c447&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=97650dd8b71ac88f0ceb73aad1b3c447&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;/p&gt;</content:encoded><wfw:commentRss>http://blog.xmu.me/2009/09/01/goodbye-amoy/feed/</wfw:commentRss><slash:comments>2</slash:comments><description>厦门真的美的就像风景 离开了一年后再回去 才真的真切的感觉到它     
  以前天天处于其中竟浑然不知觉             

  那些青春的过往   那些不诉的离伤 ...    

  但在这海的面前你可以忘却一切忧伤    那么蓝的天又怎么可以让你不明媚

  一不小心就踏入了人生的另一个殿堂 从此过去一切天高水远      
  只有了一份安定和责任 

  站在二十五岁   过去和未来   一个身后一个眼前&lt;img src=&quot;http://www1.feedsky.com/t1/308984830/youngking/feedsky/s.gif?r=http://blog.xmu.me/2009/09/01/goodbye-amoy/&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/youngking/308984830/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/youngking/308984830/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;fsflare&quot;&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=d1a99f3f81a7eff2d402b021d71c511f&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=d1a99f3f81a7eff2d402b021d71c511f&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=179cd4e2460189fc15a125a80db5e7f4&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=179cd4e2460189fc15a125a80db5e7f4&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=4670c4e933c6bd09efb141f9ba7bc804&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=4670c4e933c6bd09efb141f9ba7bc804&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=8173f768b6eae858605a4adde67f7574&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=8173f768b6eae858605a4adde67f7574&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=97650dd8b71ac88f0ceb73aad1b3c447&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=97650dd8b71ac88f0ceb73aad1b3c447&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;/p&gt;</description><category>Amoy</category><category>XMU</category><category>Xiamen</category><pubDate>Tue, 01 Sep 2009 23:03:32 +0800</pubDate><author>youngking</author><comments>http://blog.xmu.me/2009/09/01/goodbye-amoy/#comments</comments><guid isPermaLink="false">http://blog.xmu.me/?p=71</guid><dc:creator>youngking</dc:creator><fs:srclink>http://blog.xmu.me/2009/09/01/goodbye-amoy/</fs:srclink><fs:srcfeed>http://blog.xmu.me/feed/</fs:srcfeed><fs:itemid>feedsky/youngking/~7542090/308984830/1324224</fs:itemid></item><item><title>玩转浪点之打造自己的django环境</title><link>http://blog.xmu.me/2009/08/15/topsy-londit-django-create-environment/</link><content:encoded>&lt;ul&gt;
&lt;li&gt;说明:
虽然本文是针对django而写，但对于其他python框架应同样适用。
浪点现在只支持mod_python这一种部署方式了，详细了解mod_python请参考&lt;a href=&quot;http://blog.csdn.net/gashero/archive/2006/04/03/649506.aspx&quot;&gt;mod_python 官方手册翻译&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;构造虚拟环境:&lt;/h2&gt;

&lt;div class=&quot;codecolorer-container text default&quot; style=&quot;overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;&quot;&gt;&lt;div class=&quot;text codecolorer&quot; style=&quot;padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap&quot;&gt;$ python virtualenv.py --no-site-packages sandbox&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href=&quot;http://svn.colorstudy.com/virtualenv/trunk/virtualenv.py&quot;&gt;virtualenv.py下载地址 &lt;/a&gt;&lt;/p&gt;

&lt;p&gt;浪点默认装了一些有用的Python包，如PIL、lxml等，这些依赖c的包是你无法自己在virtualenv环境中使用的，不过好在直接拷贝过来就可以用了&lt;/p&gt;

&lt;div class=&quot;codecolorer-container text default&quot; style=&quot;overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;&quot;&gt;&lt;div class=&quot;text codecolorer&quot; style=&quot;padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap&quot;&gt;$ cp /usr/share/pyshared/* -r sandbox/lib/python2.6/site-packages/&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;切换到虚拟环境，安装自己的包&lt;/p&gt;

&lt;div class=&quot;codecolorer-container text default&quot; style=&quot;overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;&quot;&gt;&lt;div class=&quot;text codecolorer&quot; style=&quot;padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap&quot;&gt;source sandbox/bin/activate&lt;br /&gt;
easy_install Django&lt;/div&gt;&lt;/div&gt;

&lt;h2&gt;自定义Pythonhandler：&lt;/h2&gt;

&lt;p&gt;这里做的最核心的事情就相当于你运行source bin/activate,把Python运行环境切换为你自己的虚拟环境。&lt;/p&gt;

&lt;div class=&quot;codecolorer-container python default&quot; style=&quot;overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;&quot;&gt;&lt;div class=&quot;python codecolorer&quot; style=&quot;padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;#myve.py&lt;/span&gt;&lt;br /&gt;
activate_this = &lt;span style=&quot;color: #483d8b;&quot;&gt;'/home/virtualhost/${username}/sandbox/bin/activate_this.py'&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #008000;&quot;&gt;execfile&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;activate_this, &lt;span style=&quot;color: #008000;&quot;&gt;dict&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#40;&lt;/span&gt;__file__=activate_this&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;from&lt;/span&gt; django.&lt;span style=&quot;color: black;&quot;&gt;core&lt;/span&gt;.&lt;span style=&quot;color: black;&quot;&gt;handlers&lt;/span&gt;.&lt;span style=&quot;color: black;&quot;&gt;modpython&lt;/span&gt; &lt;span style=&quot;color: #ff7700;font-weight:bold;&quot;&gt;import&lt;/span&gt; handler&lt;/div&gt;&lt;/div&gt;

&lt;h2&gt;配置 .htaccess&lt;/h2&gt;

&lt;p&gt;注意这里的mysite和project。PythonInterpreter可随意写，只要别和其他目录下重复就行了，不写也可以&lt;/p&gt;

&lt;div class=&quot;codecolorer-container text default&quot; style=&quot;overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;&quot;&gt;&lt;div class=&quot;text codecolorer&quot; style=&quot;padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap&quot;&gt;SetHandler python-program&lt;br /&gt;
PythonPath &amp;quot;['/home/virtualhost/${username}/sandbox/bin', '/home/virtualhost/${username}/xmu.me/public_html/${mysite}/'] + sys.path&amp;quot;&lt;br /&gt;
PythonHandler myve&lt;br /&gt;
SetEnv DJANGO_SETTINGS_MODULE {project}.settings&lt;br /&gt;
PythonDebug On&lt;br /&gt;
PythonInterpreter wayhome&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;现在你就可以访问你的django程序了，have fun :)&lt;/p&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/308984836/youngking/feedsky/s.gif?r=http://blog.xmu.me/2009/08/15/topsy-londit-django-create-environment/&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/youngking/308984836/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/youngking/308984836/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;fsflare&quot;&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=dc5eb075400c35d38d5dc88a188516f9&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=dc5eb075400c35d38d5dc88a188516f9&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=0887622f012d7965debea59bcb606f7e&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=0887622f012d7965debea59bcb606f7e&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=bca920c1c75ade3434387d6da0ac1138&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=bca920c1c75ade3434387d6da0ac1138&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=6f2a88e9022350af331e48d17c341a8d&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=6f2a88e9022350af331e48d17c341a8d&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=36d489a749857d1f874ab6ec7b5fec13&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=36d489a749857d1f874ab6ec7b5fec13&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;/p&gt;</content:encoded><wfw:commentRss>http://blog.xmu.me/2009/08/15/topsy-londit-django-create-environment/feed/</wfw:commentRss><slash:comments>0</slash:comments><description>说明:
虽然本文是针对django而写，但对于其他python框架应同样适用。
浪点现在只支持mod_python这一种部署方式了，详细了解mod_python请参考mod_python 官方手册翻译


构造虚拟环境:

$ python virtualenv.py --no-site-packages sandbox

virtualenv.py下载地址 

浪点默认装了一些有用的Python包，如PIL、lxml等，这些依赖c的包是你无法自己在virtualenv环境中使用的，不过好在直接拷贝过来就可以用了

$ cp /usr/share/pyshared/* -r sandbox/lib/python2.6/site-packages/

切换到虚拟环境，安装自己的包

source sandbox/bin/activate
easy_install Django

自定义Pythonhandler：

这里做的最核心的事情就相当于你运行source bin/activate,把Python运行环境切换为你自己的虚拟环境。

#myve.py
activate_this = '/home/virtualhost/${username}/sandbox/bin/activate_this.py'
execfile&amp;#40;activate_this, dict&amp;#40;__file__=activate_this&amp;#41;&amp;#41;
from django.core.handlers.modpython import handler

配置 .htaccess

注意这里的mysite和project。PythonInterpreter可随意写，只要别和其他目录下重复就行了，不写也可以

SetHandler python-program
PythonPath &amp;#34;['/home/virtualhost/${username}/sandbox/bin', '/home/virtualhost/${username}/xmu.me/public_html/${mysite}/'] + sys.path&amp;#34;
PythonHandler myve
SetEnv DJANGO_SETTINGS_MODULE {project}.settings
PythonDebug On
PythonInterpreter wayhome

现在你就可以访问你的django程序了，have fun :)&lt;img src=&quot;http://www1.feedsky.com/t1/308984836/youngking/feedsky/s.gif?r=http://blog.xmu.me/2009/08/15/topsy-londit-django-create-environment/&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/youngking/308984836/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/youngking/308984836/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;fsflare&quot;&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=dc5eb075400c35d38d5dc88a188516f9&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=dc5eb075400c35d38d5dc88a188516f9&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=0887622f012d7965debea59bcb606f7e&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=0887622f012d7965debea59bcb606f7e&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=bca920c1c75ade3434387d6da0ac1138&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=bca920c1c75ade3434387d6da0ac1138&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=6f2a88e9022350af331e48d17c341a8d&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=6f2a88e9022350af331e48d17c341a8d&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=36d489a749857d1f874ab6ec7b5fec13&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=36d489a749857d1f874ab6ec7b5fec13&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;/p&gt;</description><category>Tech</category><category>python</category><category>django</category><category>virtualenv</category><category>mod_python</category><pubDate>Sat, 15 Aug 2009 00:45:40 +0800</pubDate><author>youngking</author><comments>http://blog.xmu.me/2009/08/15/topsy-londit-django-create-environment/#comments</comments><guid isPermaLink="false">http://blog.xmu.me/?p=54</guid><dc:creator>youngking</dc:creator><fs:srclink>http://blog.xmu.me/2009/08/15/topsy-londit-django-create-environment/</fs:srclink><fs:srcfeed>http://blog.xmu.me/feed/</fs:srcfeed><fs:itemid>feedsky/youngking/~7542090/308984836/1324224</fs:itemid></item><item><title>处理wsgi时需小心的问题</title><link>http://blog.xmu.me/2009/08/13/wsgi-careful-dealing-issue/</link><content:encoded>&lt;p&gt;首先，&lt;strong&gt;response的所有heaer必须为字符串&lt;/strong&gt;,unicode，数字都不可以！&lt;/p&gt;

&lt;p&gt;当然，在一般的测试服务器中没什么大不了的，但是在apache的mod_wsgi中你或许就会遇到这种很奇怪的问题。&lt;/p&gt;

&lt;p&gt;再者，&lt;strong&gt;计算response的content-length时需小心&lt;/strong&gt;。不然就可能出现页面下载不完全的问题。&lt;/p&gt;

&lt;p&gt;请注意 len(&amp;#8221;中文&amp;#8221;) 和 len(u&amp;#8221;中文&amp;#8221;)的长度是不同的，因此计算输出页面长度之前，最好先encode为utf-8。这样页面显示就正常了。&lt;/p&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/308984838/youngking/feedsky/s.gif?r=http://blog.xmu.me/2009/08/13/wsgi-careful-dealing-issue/&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/youngking/308984838/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/youngking/308984838/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;fsflare&quot;&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=295bc6d769dc5e3a29f1b2b863960a92&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=295bc6d769dc5e3a29f1b2b863960a92&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=fa88317c6d169ceaf48e640da3147799&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=fa88317c6d169ceaf48e640da3147799&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=afbaf6bcc259b370fc2b6f4915e7f295&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=afbaf6bcc259b370fc2b6f4915e7f295&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=37a5b8fe8d303ea10dc43b1fb1165740&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=37a5b8fe8d303ea10dc43b1fb1165740&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=7207da544644eba804f5793b789c77a3&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=7207da544644eba804f5793b789c77a3&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;/p&gt;</content:encoded><wfw:commentRss>http://blog.xmu.me/2009/08/13/wsgi-careful-dealing-issue/feed/</wfw:commentRss><slash:comments>0</slash:comments><description>首先，response的所有heaer必须为字符串,unicode，数字都不可以！

当然，在一般的测试服务器中没什么大不了的，但是在apache的mod_wsgi中你或许就会遇到这种很奇怪的问题。

再者，计算response的content-length时需小心。不然就可能出现页面下载不完全的问题。

请注意 len(&amp;#8221;中文&amp;#8221;) 和 len(u&amp;#8221;中文&amp;#8221;)的长度是不同的，因此计算输出页面长度之前，最好先encode为utf-8。这样页面显示就正常了。&lt;img src=&quot;http://www1.feedsky.com/t1/308984838/youngking/feedsky/s.gif?r=http://blog.xmu.me/2009/08/13/wsgi-careful-dealing-issue/&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/youngking/308984838/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/youngking/308984838/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;fsflare&quot;&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=295bc6d769dc5e3a29f1b2b863960a92&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=295bc6d769dc5e3a29f1b2b863960a92&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=fa88317c6d169ceaf48e640da3147799&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=fa88317c6d169ceaf48e640da3147799&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=afbaf6bcc259b370fc2b6f4915e7f295&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=afbaf6bcc259b370fc2b6f4915e7f295&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=37a5b8fe8d303ea10dc43b1fb1165740&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=37a5b8fe8d303ea10dc43b1fb1165740&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=7207da544644eba804f5793b789c77a3&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=7207da544644eba804f5793b789c77a3&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;/p&gt;</description><category>Tech</category><category>python</category><category>wsgi</category><pubDate>Thu, 13 Aug 2009 21:19:21 +0800</pubDate><author>youngking</author><comments>http://blog.xmu.me/2009/08/13/wsgi-careful-dealing-issue/#comments</comments><guid isPermaLink="false">http://blog.xmu.me/?p=52</guid><dc:creator>youngking</dc:creator><fs:srclink>http://blog.xmu.me/2009/08/13/wsgi-careful-dealing-issue/</fs:srclink><fs:srcfeed>http://blog.xmu.me/feed/</fs:srcfeed><fs:itemid>feedsky/youngking/~7542090/308984838/1324224</fs:itemid></item><item><title>easy_install is not so easy</title><link>http://blog.xmu.me/2009/08/13/easy_install-easy/</link><content:encoded>&lt;p&gt;Easy_install is not so easy,you may got problem some times.
For example,when I install PIL,it will got an error:&lt;/p&gt;

&lt;div class=&quot;codecolorer-container text default&quot; style=&quot;overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;&quot;&gt;&lt;div class=&quot;text codecolorer&quot; style=&quot;padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap&quot;&gt;Searching for PIL&lt;br /&gt;
Reading http://pypi.python.org/simple/PIL/&lt;br /&gt;
Reading http://www.pythonware.com/products/pil&lt;br /&gt;
Reading http://effbot.org/zone/pil-changes-115.htm&lt;br /&gt;
Reading http://effbot.org/downloads/#Imaging&lt;br /&gt;
No local packages or download links found for PIL&lt;br /&gt;
error: Could not find suitable distribution for Requirement.parse('PIL')&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;You can got it work like this:&lt;/p&gt;

&lt;div class=&quot;codecolorer-container text default&quot; style=&quot;overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;&quot;&gt;&lt;div class=&quot;text codecolorer&quot; style=&quot;padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap&quot;&gt;easy_install --find-links http://www.pythonware.com/products/pil/ Imaging&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And also,by default,the reportlab 2.3 is not supported by easy_install,you can install it like this:&lt;/p&gt;

&lt;div class=&quot;codecolorer-container text default&quot; style=&quot;overflow:auto;white-space:nowrap;border: 1px solid #9F9F9F;width:435px;&quot;&gt;&lt;div class=&quot;text codecolorer&quot; style=&quot;padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap&quot;&gt;easy_install --find-links http://distfiles.minitage.org/public/externals/minitage/&lt;/div&gt;&lt;/div&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/308984848/youngking/feedsky/s.gif?r=http://blog.xmu.me/2009/08/13/easy_install-easy/&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/youngking/308984848/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/youngking/308984848/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;fsflare&quot;&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=5ad91710eacd833c3cbb61a9859f5053&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=5ad91710eacd833c3cbb61a9859f5053&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=507df9f66c85d222396aaea8c94cce21&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=507df9f66c85d222396aaea8c94cce21&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=646ac04f679a49792f988138af14b7a4&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=646ac04f679a49792f988138af14b7a4&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=dffbf79f609c80a27a0bfbcbeb6dab16&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=dffbf79f609c80a27a0bfbcbeb6dab16&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=93f685ed9ed8bd6a55e5e90bd8a5886b&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=93f685ed9ed8bd6a55e5e90bd8a5886b&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;/p&gt;</content:encoded><wfw:commentRss>http://blog.xmu.me/2009/08/13/easy_install-easy/feed/</wfw:commentRss><slash:comments>0</slash:comments><description>Easy_install is not so easy,you may got problem some times.
For example,when I install PIL,it will got an error:

Searching for PIL
Reading http://pypi.python.org/simple/PIL/
Reading http://www.pythonware.com/products/pil
Reading http://effbot.org/zone/pil-changes-115.htm
Reading http://effbot.org/downloads/#Imaging
No local packages or download links found for PIL
error: Could not find suitable distribution for Requirement.parse('PIL')

You can got it work like this:

easy_install --find-links http://www.pythonware.com/products/pil/ Imaging

And also,by default,the reportlab 2.3 is not supported [...]&lt;img src=&quot;http://www1.feedsky.com/t1/308984848/youngking/feedsky/s.gif?r=http://blog.xmu.me/2009/08/13/easy_install-easy/&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/youngking/308984848/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/youngking/308984848/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;fsflare&quot;&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=5ad91710eacd833c3cbb61a9859f5053&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=5ad91710eacd833c3cbb61a9859f5053&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=507df9f66c85d222396aaea8c94cce21&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=507df9f66c85d222396aaea8c94cce21&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=646ac04f679a49792f988138af14b7a4&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=646ac04f679a49792f988138af14b7a4&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=dffbf79f609c80a27a0bfbcbeb6dab16&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=dffbf79f609c80a27a0bfbcbeb6dab16&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=93f685ed9ed8bd6a55e5e90bd8a5886b&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=93f685ed9ed8bd6a55e5e90bd8a5886b&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;/p&gt;</description><category>Tech</category><category>python</category><pubDate>Thu, 13 Aug 2009 01:19:28 +0800</pubDate><author>youngking</author><comments>http://blog.xmu.me/2009/08/13/easy_install-easy/#comments</comments><guid isPermaLink="false">http://blog.xmu.me/?p=45</guid><dc:creator>youngking</dc:creator><fs:srclink>http://blog.xmu.me/2009/08/13/easy_install-easy/</fs:srclink><fs:srcfeed>http://blog.xmu.me/feed/</fs:srcfeed><fs:itemid>feedsky/youngking/~7542090/308984848/1324224</fs:itemid></item><item><title>如何作一个优秀的程序员</title><link>http://blog.xmu.me/2009/08/11/good-programmer/</link><content:encoded>&lt;p&gt;诚然，自认为自己距一个优秀的程序员还相差甚远，只是抛砖引玉，说说自己的感觉。&lt;/p&gt;

&lt;p&gt;《编程珠玑》上言,优秀的程序员都有点儿懒：他们会舒适的靠背坐着，等待灵感出现,而不急于将自己的第一思想转化为编码。网上流传一个传说，是懒人创造了这个世界。一些问题，苦思冥想不得其解，走在路上，吃饭回来，忽然就想出来了。&lt;/p&gt;

&lt;p&gt;优秀的程序员信奉的几条信仰，少即是多，慢即是快，舍即是得。很多时候拿到手里即编码反而比不上慢慢设计，到心中完全清楚才开始编码。所谓欲速则不达即是如此。&lt;/p&gt;

&lt;p&gt;优秀的程序员应努力看到问题的本质，不该问了问题而问题，更应该看到问题身后的背景，问题带来的影响。不要匆匆忙忙的就把程序写出来，那个帮爱迪生量瓶子容量的研究生该不会就是你吧？&lt;/p&gt;

&lt;p&gt;优秀的程序员的程序应尽量简短，干净，漂亮。优秀的代码不是你还能增加什么，而是你不能减少什么，优秀的程序是赏心悦目的。重构，重构到你无法再重构。如果一个东西复杂到你无法理解，那就不应该是你理解的。任何东西都应该有足够清晰的方式表达出来。&lt;/p&gt;

&lt;p&gt;多学几门语言，多看几本书,但一定要读好书，程序员的生命实在宝贵，别把时间浪费在那些不值得一读的烂书上。视野要宽阔些，不要被语言的局限所限制，不要太过于钻研细节，要有大局观，诸葛亮就是被累死的!&lt;/p&gt;

&lt;p&gt;一年有数月，一月有数日，一日有数时，跳出程序外，不在五行中。&lt;/p&gt;

&lt;p&gt;先只想到这些，以后想到慢慢补充。&lt;/p&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/308984851/youngking/feedsky/s.gif?r=http://blog.xmu.me/2009/08/11/good-programmer/&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/youngking/308984851/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/youngking/308984851/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;fsflare&quot;&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=65af9c28dd7e22a7399424ed72a34185&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=65af9c28dd7e22a7399424ed72a34185&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=7be880bd5d21381514cc82cc376234fa&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=7be880bd5d21381514cc82cc376234fa&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=8506ec5000cb335f486f0ee1603c36bb&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=8506ec5000cb335f486f0ee1603c36bb&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=118ef07b10aa70cdf03ec7fec5841fce&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=118ef07b10aa70cdf03ec7fec5841fce&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=1e4de05c150700c4e6a0047d0e878906&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=1e4de05c150700c4e6a0047d0e878906&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;/p&gt;</content:encoded><wfw:commentRss>http://blog.xmu.me/2009/08/11/good-programmer/feed/</wfw:commentRss><slash:comments>0</slash:comments><description>诚然，自认为自己距一个优秀的程序员还相差甚远，只是抛砖引玉，说说自己的感觉。

《编程珠玑》上言,优秀的程序员都有点儿懒：他们会舒适的靠背坐着，等待灵感出现,而不急于将自己的第一思想转化为编码。网上流传一个传说，是懒人创造了这个世界。一些问题，苦思冥想不得其解，走在路上，吃饭回来，忽然就想出来了。

优秀的程序员信奉的几条信仰，少即是多，慢即是快，舍即是得。很多时候拿到手里即编码反而比不上慢慢设计，到心中完全清楚才开始编码。所谓欲速则不达即是如此。

优秀的程序员应努力看到问题的本质，不该问了问题而问题，更应该看到问题身后的背景，问题带来的影响。不要匆匆忙忙的就把程序写出来，那个帮爱迪生量瓶子容量的研究生该不会就是你吧？

优秀的程序员的程序应尽量简短，干净，漂亮。优秀的代码不是你还能增加什么，而是你不能减少什么，优秀的程序是赏心悦目的。重构，重构到你无法再重构。如果一个东西复杂到你无法理解，那就不应该是你理解的。任何东西都应该有足够清晰的方式表达出来。

多学几门语言，多看几本书,但一定要读好书，程序员的生命实在宝贵，别把时间浪费在那些不值得一读的烂书上。视野要宽阔些，不要被语言的局限所限制，不要太过于钻研细节，要有大局观，诸葛亮就是被累死的!

一年有数月，一月有数日，一日有数时，跳出程序外，不在五行中。

先只想到这些，以后想到慢慢补充。&lt;img src=&quot;http://www1.feedsky.com/t1/308984851/youngking/feedsky/s.gif?r=http://blog.xmu.me/2009/08/11/good-programmer/&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/youngking/308984851/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/youngking/308984851/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;fsflare&quot;&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=65af9c28dd7e22a7399424ed72a34185&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=65af9c28dd7e22a7399424ed72a34185&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=7be880bd5d21381514cc82cc376234fa&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=7be880bd5d21381514cc82cc376234fa&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=8506ec5000cb335f486f0ee1603c36bb&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=8506ec5000cb335f486f0ee1603c36bb&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=118ef07b10aa70cdf03ec7fec5841fce&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=118ef07b10aa70cdf03ec7fec5841fce&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=1e4de05c150700c4e6a0047d0e878906&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=1e4de05c150700c4e6a0047d0e878906&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;/p&gt;</description><category>Tech</category><category>programming</category><pubDate>Tue, 11 Aug 2009 23:36:42 +0800</pubDate><author>youngking</author><comments>http://blog.xmu.me/2009/08/11/good-programmer/#comments</comments><guid isPermaLink="false">http://blog.xmu.me/?p=36</guid><dc:creator>youngking</dc:creator><fs:srclink>http://blog.xmu.me/2009/08/11/good-programmer/</fs:srclink><fs:srcfeed>http://blog.xmu.me/feed/</fs:srcfeed><fs:itemid>feedsky/youngking/~7542090/308984851/1324224</fs:itemid></item><item><title>又一个框架-bobo</title><link>http://blog.xmu.me/2009/06/14/framework-bob/</link><content:encoded>&lt;p&gt;话说python里面的框架还不够多么，这不又来了一个轮子&lt;a href=&quot;http://bobo.digicool.com/&quot;&gt;bobo&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://bobo.digicool.com/_static/bobo.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;这是Jim Fulton(何许人也？Zope的精神领袖是也)最近刚刚写的一个wsgi 框架。和pylons,tubrogears,bfg等新兴wsgi框架同出一辄，都是基于&lt;a href=&quot;http://pythonpaste.org/&quot;&gt;Paste&lt;/a&gt;的。
非常小，包含注释在内只有1000多行，40多kb因此速度也很快。&lt;/p&gt;

&lt;p&gt;感觉和bfg的设计理念比较类似，但是不同在于bfg明眼人一眼就能看出是对Zope的改造，而bobo就目前看来与zope没有任何关系，除了依赖里有写
zope.testing，但是完全没有用到，可能未来会用于测试。Routes规则，实在和ror太像了！不过其还有独特的SubRoutes。&lt;/p&gt;

&lt;p&gt;这个框架目前还没有正式发布，Jim Fulton声称会在下周一发布。&lt;/p&gt;&lt;img src=&quot;http://www1.feedsky.com/t1/308984854/youngking/feedsky/s.gif?r=http://blog.xmu.me/2009/06/14/framework-bob/&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/youngking/308984854/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/youngking/308984854/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;fsflare&quot;&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=af610eee42a3d2103731644c433f7891&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=af610eee42a3d2103731644c433f7891&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=7e7750c0494e03b2c993fe0f8164ecf6&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=7e7750c0494e03b2c993fe0f8164ecf6&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=1720a6691699e745168dd4352a040393&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=1720a6691699e745168dd4352a040393&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=6134c98f340bcfa5a5e39207d53f6ec6&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=6134c98f340bcfa5a5e39207d53f6ec6&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=e4ee582ceb9c84739bc54c2b189a2c44&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=e4ee582ceb9c84739bc54c2b189a2c44&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;/p&gt;</content:encoded><wfw:commentRss>http://blog.xmu.me/2009/06/14/framework-bob/feed/</wfw:commentRss><slash:comments>0</slash:comments><description>话说python里面的框架还不够多么，这不又来了一个轮子bobo.



这是Jim Fulton(何许人也？Zope的精神领袖是也)最近刚刚写的一个wsgi 框架。和pylons,tubrogears,bfg等新兴wsgi框架同出一辄，都是基于Paste的。
非常小，包含注释在内只有1000多行，40多kb因此速度也很快。

感觉和bfg的设计理念比较类似，但是不同在于bfg明眼人一眼就能看出是对Zope的改造，而bobo就目前看来与zope没有任何关系，除了依赖里有写
zope.testing，但是完全没有用到，可能未来会用于测试。Routes规则，实在和ror太像了！不过其还有独特的SubRoutes。

这个框架目前还没有正式发布，Jim Fulton声称会在下周一发布。&lt;img src=&quot;http://www1.feedsky.com/t1/308984854/youngking/feedsky/s.gif?r=http://blog.xmu.me/2009/06/14/framework-bob/&quot; border=&quot;0&quot; height=&quot;0&quot; width=&quot;0&quot; style=&quot;position:absolute&quot; /&gt;&lt;p class=&quot;fswww1&quot;&gt;&lt;a href=&quot;http://www1.feedsky.com/r/l/feedsky/youngking/308984854/art01.html&quot; target=&quot;_blank&quot;&gt;&lt;img border=&quot;0&quot; ismap=&quot;ismap&quot; src=&quot;http://www1.feedsky.com/r/i/feedsky/youngking/308984854/art01.gif&quot; onerror=&quot;this.style.display='none'&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p class=&quot;fsflare&quot;&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=af610eee42a3d2103731644c433f7891&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=af610eee42a3d2103731644c433f7891&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=7e7750c0494e03b2c993fe0f8164ecf6&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=7e7750c0494e03b2c993fe0f8164ecf6&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=1720a6691699e745168dd4352a040393&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=1720a6691699e745168dd4352a040393&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=6134c98f340bcfa5a5e39207d53f6ec6&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=6134c98f340bcfa5a5e39207d53f6ec6&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://feed.feedsky.com/~flare/youngking?a=e4ee582ceb9c84739bc54c2b189a2c44&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://feed.feedsky.com/~flare/youngking?i=e4ee582ceb9c84739bc54c2b189a2c44&quot; border=&quot;0&quot;&gt;&lt;/a&gt;&lt;/p&gt;</description><category>Tech</category><category>bob</category><category>bfg</category><category>python</category><category>Zope</category><pubDate>Sun, 14 Jun 2009 02:03:06 +0800</pubDate><author>youngking</author><comments>http://blog.xmu.me/2009/06/14/framework-bob/#comments</comments><guid isPermaLink="false">http://blog.xmu.me/2009/06/14/framework-bob/</guid><dc:creator>youngking</dc:creator><fs:srclink>http://blog.xmu.me/2009/06/14/framework-bob/</fs:srclink><fs:srcfeed>http://blog.xmu.me/feed/</fs:srcfeed><fs:itemid>feedsky/youngking/~7542090/308984854/1324224</fs:itemid></item></channel></rss>