Shimming modules for testing (and fun)

Suppose that you have a chunk of Python code that wants to properlymap IP addresses to hostnames , and you wantto test this code to make sure that it actually works (especially withunit tests). In order to do this you need to contrive for various IPaddress and hostname lookups to fail in various ways, and to do thison command.

The easy way to do this is to exploit Python's freedom by shimming (well, replacing) the gethostbyname() and gethostbyaddr() functions in the


現在,大家比較容易明白(reloaded)



朋友剪好了一條片,是5月1日在西洋菜南街的街頭劇行動,給大家看。片子比較沉重,也許是我那天不在場的緣故。但是剪得好的,有表達力,可以給國內朋友分享呀。現在,大家都會明白這是真切的關心。

西洋野蠻女友

這條預告,當然有很多似曾相識的場面、劇情,不過換了人物、場地、音樂、角度,而出來的感覺也完全不一樣,就好像平平無奇的愛情片般。

這種預告片「不對調」的感覺之前在 The Departed 也有,不過結果這個版本也很不錯,拍得很


American Gangster


這是一部非常長進的警匪片。

男主角是羅素高爾(Russell Crowe)和丹素華盛頓(Denzel Washington),這個雙雄對決的組合,原來可以媲美羅拔廸尼路對阿爾柏仙奴,那種旗鼓相當,那種惺惺相惜,很久沒有在電影中出現了。

丹素華盛頓演的黑幫新

The risks of forcing frequent password changes

People can talk about the risks of not changing passwords at the dropof a hat, but they rarely talk about the risks of forcing people to gothrough frequent password changes. This matters a lot, because thereare significant risks.

(And when people do acknowledge the risks, often it is to decry or mockthe 'bad habits' that people adopt.)

The obvious problems are that people can't remember things at the dropof a hat just because you want them to, and people have trouble coming


Making a good Unix glue language

The problem with a search for alternatives to the Bourne shell is that the Bourne shell isstill one of the best Unix programming languages. Or perhaps it wouldbe clearer to call it a 'Unix glue language', a language for connectingexisting programs together.

You might sensibly ask what the problems are with things like Perl andPython as Unix glue languages, and my answer would be that they make ittoo hard to interact with external programs. This is important, becausethe way you write small programs fast on Unix


五月困鬥

四月時覺得很變態,怎麼會這麼辛苦呢?不過就是因為中間有點空閒,看了幾天書而已。現在是五月,才知道變態未完。除日常各專欄,手上還有這些工作:

.某學報編輯工作
.某書籍撰稿及編輯工作
.字花十四期編輯工作
.兩

當官豈是平常事:談王永平《平心直說:一名香港特區政府局長為官十二年反思集》

書名:平心直說:一名香港特區政府局長為官十二年反思集
作者:王永平
出版:經濟日報出版社

今時今日,做官難,做高官更難。香港退休官員王永平出書談為官之道,開宗明義說“反思”,其實有為自己平反的意味,也刻意把

做人不能太time square

終於可以扮secure!

Times Square欺人太甚 齊來支持街頭藝人
香港公共空間管理之嚴,講起都羞家,不單示威遊行要警察批准,趕盡殺絕流動小販, 為普羅市民提供免費娛樂的街頭藝人,更被視為乞兒,經常被警察、康文署職員和保安驅逐。
timesquarepin.jpg

Dear applications: WEP keys are not passwords

Every so often, I have the dubious pleasure of entering WEP keys in orderto get access to some wireless network around here. Invariably, theapplications treat the WEP key like a password, and has me type it in atext box where all the feedback I get is a ' * ' for each characterthat I type.

(We use WEP keys mostly as a way to keep random passers-by out. Notso random passers-by can crack the WEP key, at which point otherprecautions keep them