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


蘋果搞什麽?

要跟kama做完網上電臺嘉賓之後去超市買野?OMG!

https://appledaily.atnext.com/template/apple/art_main.cfm?iss_id=20081204&sec_id=462&subsec_id=830&art_id=11927656

“至 訪 問 完 畢 後 , Kama 笠 上 漁 夫 帽 往 寓 所 樓

To blog or not to blog?

談一件舊聞:話說在十月的時候,Wired 出了一篇蠻惹火的文章 《Twitter, Flickr, Facebook Make Blogs Look So 2004》 ,說的是 Blog 已經不夠新潮,人們應該退出。大家想表達自己,可以到 Twitter、Facebook、Flickr 等等平台。主流的 Blog 大都是由專業團隊組成,個人 Blog 變


廣告的廣告

思存那裡賣書,有游靜《另起爐灶》及李歐納.科恩《美麗失敗者》



我家有4.5個書架,日內倒塌三格;地上原有積書已逾二百。我也要賣書。但我的電腦壞了,無法上載照片。如果一個人的電腦壞掉整整一個月仍未恢復正

又一整個月

文明單位:樹
嘉賓:詹志勇

詹教授是個很有趣的謙謙君子,說到對石牆樹的愛惜、石牆樹無故被斬的事,我們一起擊節憤恨,但他說話仍是笑咪咪、慢吞吞的。

文明單位:亞洲獨立電影節
嘉賓:崔允信、黃思傑

亞洲獨立電影剛於

Mapping IP addresses to ASNs

Prompted by my old SpamByASN entry, I was recently asked how you woulddo IP to ASN lookups, and ideally ASN to IP lookups too. Since the fullanswer is complicated, I will do the simple and useful one first.

Assuming that nothing funny is going on, each IP address has exactlyone ASN that ultimately announces it. The easiest way to find out thismapping for a given IP address is to use the asn and aspath reverseDNS lookup zones that routeviews.org provides; these return TXT records with