How to help programmers (part 1): the os.listdir() problem

How to help (Unix) programmers: silently omit data under certaincircumstances. From the Python 3000 release notes :

Note that when os.listdir() returns a list of strings, filenamesthat cannot be decoded properly are omitted rather than raising UnicodeError .

(Background: in Python 3k, os.listdir() is normally called with adirectory name that is a str Unicode object.)

Yes, os.listdir() had problems , butthis is not a solution; this is making


One of Python's problems with packages

One of the problems with Python's current approach to CPAN-like packagesis, to put it in a particularly blunt way, that it hasn't quite sunk inthat not everyone has root.

(I am aware that Python doesn't have an approach to packages as such;it's all done by distutils et al, although distutils is part of thestandard library. That's part of the overall problem.)

Oh, sure, you can use distutils to install packages in places besides


On line endings and honesty

Dear software, I have a small and simple request, from a working systemadministrator:

Please stop pretending that \r\n and \n are the same thing.

That is, please stop pretending that MS-DOS line endings and Unix lineendings are the same thing, because they are not. Pretending that theyare is one of those collective hallucinations that only work if absolutely everyone is playing along. Sooner or later(usually sooner) you will run into a program that does not play along,and things


Lady First 專欄 (23-24)

徵友廣告


最近,我的網誌「空姐的行李篋」好熱鬧,全因為一個徵友廣告。

我的男性朋友K先生,開始想settle down結婚生子,找一位願意陪他共行人生路的女子。

而我就根據他提供的個人資料,替他寫了份CV,賣廣告去也。

廣告一出

化妝全攻略---episode 1:粉底篇

請移玉步到
elle.com.hk/erica

A little gotcha when implementing shell read

Reading a line from standard input, as the shell's read builtin does,certainly seems like it should be easy to implement or reimplement (ifone's shell is sufficiently primitive). However, it turns out that thereis a subtle problem that forces a pretty inefficient implementation, andmakes it basically impossible to duplicate read with any common Unixprogram.

I can neatly illustrate the problem with a little script:

(echo a; echo b) |   (echo `sed 1q`; echo `sed

有關 Google Reader theme 更新

Google Reader 更新了版面 ,有人覺得不夠好用,但我覺還不錯啦,版形更緊密一點。隨著這個更新,取全文 script 變成看不到 icon,但其實按 G 還可以用。我更新了 script,現在應該可以看到 icon 了,再順手同步一下那個 site parser,大家可以到 Google Code Rssget 更新


做政客如果肯認錯,真的那麼不光采嗎?

剛看了木村拓哉主演的日劇Change的第一集。

劇中向來對政治厭惡的木村,因當政客的父親猝然去世,被逼臨時拉夫成為了補選的候選人(看此劇前我也不知道,原來在日本,選這類區議員一類的崗位,是可以世襲的)。

雖然只是日


The rewriting problem on ZFS and other 'log structured' filesystems

When they are planning how to organize their IO , programs (and designers) normally assume thatrewriting (overwriting) an existing, already written file is the fastestsort of write operation possible and will not change the existing filelayout (for example, if it has been created to be sequential). Thisis because all of the data blocks have already been allocated and allof the metadata has been set up; if you write in block-aligned units,pretty much all the operating system has to do is shovel


next week左右紅藍綠

Monday and Tuesday
1320 @ TVB
1740 @ ATV