Using the tempfile module to get temporary files

Courtesy of Planet Python , I stumbledover Peter Bengtsson's puzzlement with Python's tempfile module ,especially the mkstemp() function. It's an understandablepuzzlement, because what's going on is fairly tied to Unix semantics(although Python supports mkstemp() on all platforms).

The tempfile module's mkstemp() is a relatively thin shim over theUnix mkstemp(3) library routine, which exists to securely createtemporary files. This is more difficult than it looks; there are all


睏(擬周私鐘)

最近我們都知道是哭泣的時候了,最近我們常常哭泣了,星期日夜晚無端一急就在會上哭出來,開完會通了頂再打電話給英國朋友講廢話到中午黃昏醒來之後,在黑暗的房間裡,忍不住猛烈地哭如同沒頂,像在胃裡掏出來的眼淚

The id attribute considered dangerous

I've been doing various overhauls of DWiki recently (a faster andbetter DWikiText to HTML renderer written by Daniel Martin (and hackedby me, so blame me for any problems) went in tonight, for example).As part of this, I've been looking at the HTML DWiki generates,running it past HTML Tidy and the W3C validator and so on. It's been a learningexperience.

One of the things I've learned is that almost everywhere DWiki codeand templates were


20060208網摘 – Gmail Chat

Web Development

Google Chat

  • 你??的每一句? Quote: ??上,在流氓?件?行的今天,聊天??保存在Google服?器上,要比保存在网吧

五位最喜歡作者 Tag

Jansen 請我寫五位作最喜歡的作者,一時為之語塞,原因自己涉獵不多,學識不廣,一時想不起有哪些「心水」作者,所以遲遲未寫。容許我扭一扭題目,推薦一些我認為不錯的作者。喜歡說不上,但對他們我是相當佩服的:

  • 押井守

$PATH in Solaris

It's always the little things about new Unix systems that get to me.Take $PATH on Solaris.

On a modern Linux distribution with a stock install, a sysadmin's full$PATH needs only five directories:

/bin /usr/bin /sbin /usr/sbin /usr/X11R6/bin

(Sometimes /usr/bin/X11 is used instead of /usr/X11R6/bin .)

On Solaris 9, my $PATH is


coComment 的難度

在 Blogosphere 天南地北,留下不小腳毛 (即留言),但往往會忘記自己曾在哪裏留過,忘記回看,錯失之後可能出現更有價值的討論。 coComment 是一個用來追?你留言的地方,在概念上很好,可以好好追蹤管理,也可以分享,不用單靠 Search Engine 來找


暫休小記

1.我們心知的情義

儘管全片節奏明顯有點怪異,《情義我心知》一開始黎明由被兄嫂嫌棄的冷漠現實,轉入《天鵝湖》芭蕾舞台的美麗想像,那一段堪稱流麗。

2.孤草寫麥o麥,總是好看。

然後天上綻放煙花,春田花花幼稚

20060206網摘 – Google自建網絡

Google Net


The sysadmin's life

A one-line addition to httpd.conf : 30 seconds.

Restarting Apache: 30 seconds.

Making sure that the addition was the right thing to do to an oldversion of Apache and wouldn't kill the server: much longer .

(And of course the much longer doesn't look too much like work, anddoesn't entirely feel like work.)

And more of the sysadmin's life:

Accidentally using kill -USR2 instead of kill -USR1 to gracefullyrestart the