Archive for December, 2008

胡先生豆腐

Tuesday, December 23rd, 2008

胡光煒哲嗣胡令暉在《回憶我的父親–胡小石》一文中寫道:“當今八十八歲的廚王胡長齡最近還在菜譜書上找到我父親解放前自己所創的一道菜的記載–‘胡先生豆腐’。”(《學苑奇峰–文史學家胡小石》,南京大學出版社2000年4月,ISBN 7-305-03512-2, 118頁)

不過,據2006年5月28日的《江南時報》8版所載,“胡先生豆腐”實為在胡光煒在南京馬祥興菜館就餐時常點的一道菜。此菜用雞肝、蝦仁、筍尖等鮮嫩配料烹制而成。因胡光煒大加贊譽,遂有此名。

[Haskell筆記]case語句

Tuesday, December 23rd, 2008

不知道你是否完成了練習13.2中的函數?是否覺得函數的定義過於冗長了?的確,這種情況用if/then來定義不是很方便。case語句更適合這類情況。

用case語句重寫的13.2中的函數:

myCase x =
    case x of
      0 -> 1
      1 -> 5
      2 -> 2
      _ -> -1

其中,_匹配所有情況。

case語句還有一種一段一段的寫法,比如,和上述函數等價的寫法:

myCase 0 = 1
myCase 1 = 5
myCase 2 = 2
myCase _ = -1

練習

14.1 如果將myCase改成以下定義,會出現什麽情況,為什麽?

myCase _ = -1
myCase 0 = 1
myCase 1 = 5
myCase 2 = 2

答案

13.1 輸入為5時,mySignum判斷5不小於0,故返回else if後面的語句,判斷5大於0, 故返回1。輸入為0時,mySignum判斷0不小於0,故返回else if後面的語句,判斷0不大於0, 故返回0。輸入為-1時,mySignum判斷-1小於0,故返回-1。

13.2

myCase x =
  if x == 0
    then 1
    else if x == 1
      then 5
      else if x == 2
        then 2
        else -1

git的index

Monday, December 22nd, 2008

一直是git commit -a的,也沒多想。嘗試hg後開始想為何git要這樣設計?發現自己忽略了git的一個重要的概念:index或者staging area。

兩篇談git的index的很有意思的文章:

Git’s Killer Feature

Limbo: Why users are more error-prone with git than other VCSes

ssmtp連aliases也不支持

Sunday, December 21st, 2008

從這點上看,還是nullmailer方便些。雖然SMTP STARTTLS、 SMTP AUTH CRAM-MD5 之類的不支持。

cgit powerpc deb

Sunday, December 21st, 2008

Currently there is no cgit deb in the official Debian software repository. If you’re using i386 or amd64, you get can the package from stbuehler’s server. If you’re using powerpc, I’ve complied a deb package for powerpc.