Why I don't write 'if (NULL == foo)' in C code

One of the infamous trivial bugs in C code is accidentally writing' = ' instead of ' == ' in conditional expressions; you get assignmentinstead of equality checking. One common piece of advice for avoidingthis is to reverse the order of the check, putting the constant first.This way, if you accidentally write ' NULL = foo ' instead of the == version, you'll get a compile time error.

I can't stand to write this version, because it looks wrong to me.


向肥腩宣戰!

腩!

由於身形日久失修,又缺少運動,肚上的肥肉越長越大,形成一個肥美的腩。

相比起其他人,我的腩其實不算嚴重,至少在外觀上不太「凸」出。但有苦自己知,當你平常穿的褲子開始勒住肚皮,就知道已經到了警界線。我


20051120網摘 – 咪咪

文化

  • 再談福娃 一場誤會,全因資訊誤傳,只有看沒有想
  • 免費人體奧妙展 Quote: 陳列於全港九新界各便利店、報攤的八卦雜誌封面,尤其近期那些,不堪入目之程度簡直已與咸書無異
  • 咪咪 林志玲殺死男人的疊字

IT 技術


Weekly spam summary on November 19th, 2005

Once again, I'm leading with Hotmail's stats to highlight their spam problem :

  • three email messages accepted.
  • 320 messages refused because they came from non-Hotmailemail addresses.
  • 22 messages refused because their sender addresses had already hitour spamtraps.
  • 21 messages refused due to their originating IP address (17 in theSBL, two in the CBL, one in the XBL, one because it's fromGilat-Satcom).

Gilat-Satcom is a serious problem here; it


沒有甘草綠葉,那來大紅大紫?

Continue reading...

數學電影

我發覺自己可能有一舖「看數學戲癮」。原因是今天看了《情來‧算盡愛 Proof 》,此片,演員還算有吸引力:Gwyneth Paltrow、Anthony Hopkins 和 Jake Gyllenhaal ,但除此之外則不算得上很吸引,不過在看過故事簡介後,還是進場了。

關於數學的電影,前前後後看


Solaris 9 sendmail irritations

Here's how to give a system administrator a heart attack: the defaultSolaris 9 sendmail configuration apparently allows other machines thatyour Solaris machine thinks are in your local domain to relay throughyou. I say 'apparently' because there's nothing in the sendmail.mc aboutthis, and nothing clear in the generated /etc/mail/sendmail.cf either.

In other fun discoveries, the default sendmail configuration is alsoset up to relay all your mail through a machine called 'mailhost' inyour domain


偶然的真相

已經不止一次,攤在床上極累極累,關了燈滅了聲閉緊眼睛,手腳都像斷掉一樣。以為會進入死亡般的沉睡,但卻轉醒,胸口汗濕,看看鐘已過了一、二小時,卻彷彿沒睡過,四肢離散依然。疲倦像一層油,淺眠把它洗了下來,

約會.機關算盡心亂如麻

自由文化音樂節

社運電影閉幕電影《黃幡翻飛處》

日期:2005年11月20日 (星期日)
時間:自由文化音樂節--中午12時至晚上6時30分
社運電影節閉幕--晚上7:15pm
地點:油麻地榕樹頭公園

演出單位:Billy

SQL as metaprogramming

I'll start by quoting Glyph Lefkowitz from a recent article (okay, recent for my techblog writing):

Metaprogramming is hard, and dress it up however you like, that'swhat using SQL is. Your code is generating other code, andevaluating its results.

Because metaprogramming is so hard, it is almost exclusively theprovince of frameworks, environments and operating systems. For goodreason, too. Whenever code generates other code, there arepotentially very serious mistakes that can get made. [..