Skip to main content

· One min read

· One min read

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).

· 2 min read

因為電源不穩的關係,苦吞 "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/

· 2 min read

前篇 中提到模擬程式跑完會產生 trace (.tr) 檔。這幾天再仔細看了一下,模擬程式跑完竟然也會產生 .pcap 檔!

pcap 封包檔案是用來紀錄網路封包的格式。這個檔案格式可以使用 tcpdump 或是圖形介面的 wireshark 等工具開啟,從除錯的角度上來看,因為有一些現成封包分析工具可用來分析 pcap 封包檔,因此比起 .tr 檔更容易分析。對熟悉網路開發的人來說,pcap 讓人有從真實網路抓封包的錯覺 :D

一打開 pcap 封包,NS-3 目前的優缺點就無所遁形:

優點:

1. 封包格式參照真實封包定義,擴充性佳

缺點:

1. 封包目前只支援 IP, UDP, 沒有 mac 層支援 2. 沒計算 checksum (計較起來這其實不算缺點,沒有那個做網路模擬的還真的去算 checksum)

另外 NS-3 還比較差的一點是目前的拓樸描述還蠻醜的,宣告一個網路節點會用到這種鬼語法:

Ptr[node] n0 = Create[internetnode] (); 相對 8 月中預計發佈的 3.0.5 版中可使用的 Python script 版本宣告則是: n0 = ns.MakeInterNetNode () 同樣的 simple-p2p 拓樸,Python 版的可能是因為加入較少與實做相關的 code 所以比較好理解. 擁有較好可讀性的 Python script 應該是個學習網路模擬的好幫手 :D