Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
剛開始時,除錯比起寫程式要難上兩倍。因此,如果你將程式寫得聰明無比,你必然不夠聰明以至於能除錯這個程式。
—Brian W. Kernighan, co-author of The C Programming Language and the "K" in "AWK"
Code Like a Pythonista
一個 pycon 2007 中的簡報, 總結了 Python 語言的編程習慣. 看起來相當棒.
ipv6 howto book
以前同學領導的國科會計畫, 提供在 FreeBSD 環境上架設 IPv6 Enable 相關服務的中文書, 每個動作都測試過兩遍以上保證可以照著執行,真是佛心來著 @@
還有附錄教怎麼安裝 FreeBSD
Index:
Chapter 1: FreeBSD 與 WinXP 的 IPv6 相關基礎 Chapter 2: DNS 架設 — 使用 bind 9-9.3.2 Chapter 3: WWW 架設 — 使用 apache 2.2.0_7 Chapter 4: FTP 架設 — 使用 proftpd-1.3.0.r3 Chapter 5: Mail Server 架設 Chapter 6: NEWS 架設 — 使用 inn-current-20040118_1 Chapter 7: 在 FreeBSD 與 WindowsXP 上使用 Tunnel Chapter 8: FreeBSD 與 KAME project Chapter 9: FreeBSD 上建置 IPv6 Router Chapter 10: ISATAP Tunnel 附錄: 安裝 FreeBSD
XML templates 比 Plain-text templates 還快?
genshi 的開發者說 genshi 的 markup 核心用 C 重寫後測效能時比原來快 10%~20%, 測試工具所測出來的效能已超越了 Django templates .
yesterday I merged the cspeedups branch into trunk, which adds a C implementation of the genshi.core.Markup class. This improves performance around 10-20% in the benchmarks (Genshi now outperforms Django templates in the bigtable.py benchmark).
trac-subversion 安裝配置設定三合一 (Ubuntu)
因為電源不穩的關係,苦吞 "svn: No such revision 425" 訊息. svnadmin recover 都不管用,只好重新 import 一次 Source 啦... 下次一定研究怎麼自動備份 Orz.
安裝 install apache
$ sudo apt-get install apache2
安裝 install subversion
$ sudo apt-get install subversion
$ sudo apt-get install libapache2-svn
設定 Confiigure subversion
Enter menu system/management/user_and_group
change to group tab, add atwo new group named "www-data"(apache) and "subversion" then add user [your account] and "www-data" to "subversion"'s group members.
or use command instead::
$ sudo adduser www-data subversion $ sudo adduser [your account] subversion
Then we could create svn repository::
$ sudo svnadmin create /home/svn (or $ sudo svnadmin /usr/local/svn)
Then Change the folder owner
$ sudo chown -R www-data:www-data /home/svn $ sudo chmod -R g+ws /home/svn
Setup apache host site $ sudo gedit /etc/apache2/mods-enabled/dav_svn.conf
uncomment following lines:
[Location /svn]
DAV svn
SVNPath /home/svn
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/subversion/passwd
[/Location]
or add following just above the /location:
[LimitExcept GET PROPFIND OPTIONS REPORT]
Require valid-user
[/LimitExcept]
為 subversion 存取加上密碼:
sudo htpasswd -c /etc/subversion/passwd user_name
重開 apache:
sudo /etc/init.d/apache2 restart
驗證能取得 svn 檔案:
$ svn co http://hostname/svn/myproject myproject --username user_name
安裝 Install Trac
$ sudo apt-get install trac
$ sudo mkdir /home/trac $ sudo chown www-data:www-data /home/trac
To add a virtual host to host trac:
$ sudo gedit /etc/apache2/sites-available/trac
[VirtualHost *]
ServerAdmin webmaster@localhost
ServerName trac.example.com
DocumentRoot /usr/share/trac/cgi-bin/
[Directory /usr/share/trac/cgi-bin/]
Options Indexes FollowSymLinks MultiViews ExecCGI
AllowOverride All
Order allow,deny
allow from all
[/Directory]
Alias /trac "/usr/share/trac/htdocs"
[Location /]
SetHandler mod_python
PythonHandler trac.web.modpython_frontend
PythonOption TracEnvParentDir /home/trac
#PythonOption TracEnv /home/trac/singletrac
PythonOption TracUriRoot /
[/Location]
DirectoryIndex trac.cgi
ErrorLog /var/log/apache2/error.trac.log
CustomLog /var/log/apache2/access.trac.log combined
[/VirtualHost]
Uncomment the AddHandler line in /etc/apache2/apache2.conf so that the Trac CGI program will be executed:
To use CGI scripts outside /cgi-bin/:
AddHandler cgi-script .cgi
Disable the default virtualhost, enable the Trac virtualhost, and restart Apache2:
sudo a2dissite default sudo a2ensite trac sudo /etc/init.d/apache2 reload
Make New Trac Project expose to web
sudo trac-admin /home/trac/YourProjectNameHere initenv
Then the interactive interface was prompt: [specify the repository to /home/svn/YourProjectNameHere]
sudo chown -R www-data /home/trac/YourProjectNameHere
Refer to http://trac.edgewall.org/wiki/TracOnUbuntu http://trac.edgewall.org/wiki/TracModPython http://www.blendedtechnologies.com/setting-up-subversion-on-ubuntu/11 http://philipatswarchy.wordpress.com/2006/11/27/apachesslsubversionpam/