PageRank



轉移公告

計劃把 http://blog.hoamon.info/ 文章全部轉移至 http://www.hoamon.info/blog/ 這裡,而本 Blogger 站台的文章近 500 篇,我預計在 2014-12-31 前移轉完畢,完成後 http://blog.hoamon.info/ 將只作代轉服務,一律把舊連結如 http://blog.hoamon.info/index.html 轉成 http://www.hoamon.info/blog/index.html ,敬請舊雨新知互相走告。

新文章只發佈在 http://www.hoamon.info/blog/

何岳峰 敬上

2009年2月26日 星期四

2009年2月15日 星期日

組工會是天賦人權! 在民主國家,連小朋友都有學生會可以組的。

supports -player's union

最近,興農牛的高層因為球員組工會的事,不太高興,他們認為球員不尊重球團。以下是新聞來源: http://www.nownews.com/2009/02/15/341-2408806.htmhttp://mag.udn.com/mag/sports/storypage.jsp?f_MAIN_ID=104&f_SUB_ID=544&f_ART_ID=177616 。甚至,他們還嗆聲:「誰參加工會,誰解約!」

本來前天我還高興四隊中只有兄弟球團隱約對組工會之事加壓,反正我本來就不喜歡兄弟球團,因為我覺得沒錢燒就別玩職棒,品質是要花錢的,不花錢就沒有品質,與其看沒品質的比賽,不如就把球員往外送,我寧願看日職、韓職、美職。

但今天,興農牛高層居然講明了他們「不喜歡」工會。

虧我今年,因興農牛豪邁地簽了謝佳賢、林英傑,且推出消費卷看 20 場球賽的優惠,努力地說服老婆,今年要一起去看至少 10 場興農牛的比賽。

我失望了,只是我想如果不去看比賽,那球員怎麼辦呢? 還是捐錢給球員工會嗎?

2009年2月11日 星期三

把 Mercurial 用 mod_python 裝在 Apache 中

實際上, Mercurial 這種分散式版本控制器是不太需要架個 Web Server 來 Run 的,尤其是我多半都是獨自在寫程式,但架了個 Web Server 後,我會比較方便在多台個人電腦中轉移陣地,且這也多了一種備份的機制。

不過,目前已有人將 hg 成功移植成 GAE 版(hg-repos.appspot.com),現在只待作者把說明文件完成,我就會將跑在 apache 上的部份儲存庫再移至 GAE 去。

廢話不多說,透過 mod_python 來跑 HTTPS 版的 Mercurial 儲存庫方式如下:

一、 下載 modpython_gateway.py ,載點何處? Google 比較快且安全。下載後放到 /raid1/A2B2/www/HG/ (可自行更換其他資料夾) ,也就是在 apache.conf 中所設定 PythonPath 。此檔案內容不用修改。

二、 設定如何執行 modpython_gateway.py ,一樣在 /raid1/A2B2/www/HG/ 下,新增一個 hgwebdir.py ,其內容如下:

import os
os.environ["HGENCODING"] = "UTF-8"

from mercurial.hgweb.hgweb_mod import hgweb
from mercurial.hgweb.hgwebdir_mod import hgwebdir
from mercurial.hgweb.request import wsgiapplication

def make_web_app():
return hgwebdir("/raid1/A2B2/www/HG/hgweb.config")

def test(environ, start_response):
toto = wsgiapplication(make_web_app)
return toto (environ, start_response)


三、 設定你的檔案庫位置,一樣在 /raid1/A2B2/www/HG 下新增一個 hgweb.config 其內容如下:

[paths]
/trachg = /raid1/A2B2/www/trac/hg

[collections]
#我把 /raid1/A2B2/www/HG/product soft link 到 /product
#這樣在連結上,才會是用 /product/product1 來觀看 product1 儲存庫。
/PathDoesNotMatter = /product/

[web]
style = gitweb
allow_archive = bz2 gz zip


四、 apache.conf 設定如下:

<virtualhost *:443>
--ServerSignature Off
--ServerName hg.yoursite.name
--DocumentRoot /raid1/A2B2/www/HG/tmp
--RewriteEngine On
--RewriteRule ^/(.*) /DoesNotMatter/$1
--<Location />
----PythonPath "sys.path + [ '/raid1/A2B2/www/HG' ]"
----#PythonDebug On #Uncomment this ligne if you got a problem and need debug information
----SetHandler mod_python
----PythonHandler modpython_gateway::handler
----#PythonOption SCRIPT_NAME /repo
----PythonOption wsgi.application hgwebdir::test
----AuthType Basic
----AuthName "Mercurial Repository"
----AuthUserFile /raid1/A2B2/www/auth_users
----Require valid-user
--</Location>
--LogLevel warn
--ErrorLog /var/log/apache2/hg_error.log
--CustomLog /var/log/apache2/hg_access.log combined
--SSLEngine On
--SSLCertificateFile /etc/apache2/ssl/apache.pem
</virtualhost>

五、 重啟 apache

你就會在 https://hg.yoursite.name/ 中,看到 trachg 、 product/product1 、 product/XXXproduct ... 的儲存庫了。

2009年2月9日 星期一

難道我真的是 Windows 白癡! 搞個 https 憑證花了一個上午還是沒成功

照著這位仁兄的筆記: http://blog.roodo.com/myroodo/archives/4219557.html ,就是會在最後一個指令

> openssl ca -config openssl.cnf -days 3650 -cert ssl/ca.crt -keyfile ssl/ca.key -in ssl/server.csr -out ssl/server.crt

出現

I am unable to access the ssl
ewcerts directory
ssl
ewcerts: Invalid argument

查了相當多的地方,也找不出原因。後來想想,這不過是個憑證,它是一種資料,所以它應該與平台無關,且之前我在 Linux 上作了那麼多的憑證,也沒遇過機器重灌,憑證得重作的現象,所以它應與當時製作的平台也無關,索性在 Ubuntu 上打了三個指令,作出憑證,再送到 Windows 去用。

您猜猜,這麼著了?

It's Work~
Related Posts Plugin for WordPress, Blogger...