A common socket programming mistake: not handling short IO

With normal file IO, when you do do ' read(fd, buf, len) ' you'll almostalways get back len bytes unless you hit EOF or a disk IO error. Thisbreeds a certain sloppyness when filling buffers; an awful lot of codeeffectively ignores the return value of read() except to check it forerrors.

This can and will bite you on the rear when writing socket code, becausenetworks only give you so much data at once. Short reads are routine for socket IO


Apple joins the webmail hall of shame

Selected headers of a just-received advance fee fraud:

Received: from smtpout.mac.com  ([17.250.248.89])  by  ...Received: from mac.com  (webmail11-en1 [10.13.10.117])  by ...;  Sat, 8 Apr 2006 03:01:49 -0700 (PDT)
                    
                
                
                    
                
            
            
            

Section9開放編輯申請

這是有關小弟的攻殼網站 Section9 的更新小廣告!

Section9 是使用 PmWiki 架站的,因此有 Wiki 的功能:讓不同用戶增加修改內容,共同寫作。我最近終於為 Section9 加入了用戶管理功能,讓我可以為站上加入有編輯權限的用戶,現在想開放申請給大


撐小販!!!!!


文學.政府工

最近幾次在不同的情形下被問到以下問題:澳門大部分有潛質的作家都被不同的政府部門收編了,這對澳門文學的發展有沒有影響,你有什麼意見?

較早前本澳一位詩人亦在其詩集中寫過類似的話,看來這事情在某些人心目中真

偽分析

在《世界》的結尾對話:「我們已經死了嗎?」 「不,我們才剛剛開始。」一直讓人推敲是喜是悲。張某謝某之流,堅持是悲——墮落的無止境,連死都並非中止。我呢,因為《kids return》式的情調,落泊小混混那種無可理喻的輕盈

A bash irritation

Presented in illustrated form:

; cat foo#!/bin/shcat "$@"; ./foo /etc/termcap | sed 1q >/dev/null./foo: line 2: 3632 Broken pipe  cat "$@"

This behavior is new in Bash 2, as far as I know. I find itextremely irritating, because programs having broken pipesis perfectly normal in Unix. Many filters and so on don'tconsume all of their input, and


A pleasing Python regularity with __future__

The other night I was writing a Pythonprogram that wanted to divide two integers and get a floating pointresult. Normally integer division in Python produces integers, followinga C style model of distinct numeric types; however, Python is slowlymigrating towards a model where the types of numbers are more of animplementation detail.

The general way to get early access to an incompatible change likethis is a magic statement at the start of your module: from__future__ import whatever . I knew that the change in


Some quick SMTP connection statistics

Recently I've been wondering about the usage pattern of zombie machines.Do spammers typically make only a few connections from each zombie andmove on, or do they use the same machines over and over?

Through my weekly spam stats I know thatsome machines that we reject at connection time try again and again.But what's the distribution like? For example, do most IP addressesget refused once or twice and then go away? So I grabbed our logs andstarted looking.

All of these figures are


五四


前天接受某青年社團訪問,主題是對“五四”,因為對方是十多年前與我一起在紅街市青少年牧民中心文學小組認識的朋友,我也就試著去亂講一通。

“五四”對我來說最大的影響是一大批出現在“新青年”雜誌上的作品,訪問