Monthly Archive for December, 2007

Transition 2

  • Safari 和 Firefox 图片色彩渲染的差别。Move to Safari!ff2 vs safari

    (在 Neo 的提点下,发现 firefox 3b2 果然改进了)
    ff3 vs safari

  • OSX 用 launchd 代替了传统的 init, cron, anacron, inetd, xinetd 等等,所以管理各种 daemons 的配置文件变得统一。As other open source products from Apple, launchd uses “plist file” (xml)。下面就是一个简单的例子,让 /Users/eickgadias/Unix/lib/launchd/daily.diary 这个脚本在每天的 3:45pm 和 4:45pm 自动运行,下载 national geographic 的每日图片,freedictionary.com 的没日名言,copy diary entry,更新汇率数据和 index quote。
    <?xml version=“1.0″ encoding=“UTF-8″?>
    <!DOCTYPE plist PUBLIC “-//Apple//DTD PLIST 1.0//EN” http://www.apple.com/DTDs/PropertyList-1.0.dtd>
    <plist version=“1.0″>
    <dict>
    <key>Label</key>
    <string>org.eickgadias.daily-diary</string>
    <key>ProgramArguments</key>
    <array>
    <string>/Users/eickgadias/Unix/lib/launchd/daily.diary</string>
    </array>
    <key>StartCalendarInterval</key>
    <array>
    <dict>
    <key>Hour</key>
    <integer>15</integer>
    <key>Minute</key>
    <integer>45</integer>
    </dict>
    <dict>
    <key>Hour</key>
    <integer>16</integer>
    <key>Minute</key>
    <integer>45</integer>
    </dict>
    </array>
    </dict>

    </plist>

  • Hpricot 是一个挺好用的 ruby html analyzer。下面是一个在 yahoo 搜索歌词的例子。response 是一个 hpricot object,response.search(“table”) 是一个返回 “table” element 的 iterator。

    def yhlyric(data)
    postdata = http://music.cn.yahoo.com/lyric.html?pid=ysearch&source=ysmi_hsch_r&p=
    postdata << URI.escape( data.join(+) )
    postdata << &mimetype=lyric&source=ysmi_hsch_r
    response = Hpricot(open(postdata))
    i = 0
    response.search(table).each do |table|
    if i > 1
    break
    end
    i += 1
    puts “”
    table.inner_html.to_s.gsub(/(<br \/>)+/, \n).gsub(/<[^>]+>/, “”).each do |line|
    if not line =~ /^[ \t]*$/ and not line =~ /^[ \t]*(发送|查看)/
    puts line.gsub(/ /, “”).gsub(/^[ \t]*/, “”).gsub(/[ \t]$/, “”)
    end
    end
    end
    end
  • mitbbs 的热点话题从来离不开外嫁女,北美 wsn,更有甚者说趁着学校报销保险生个孩子啥的。还是 tianya 好。看月光的单骑西藏帖,格外心动。身体下地狱,眼睛上天堂,灵魂归故乡
  • 那一天
    闭目在经殿的香雾中
    蓦然听见
    你诵经的真言

    那一月
    我转动所有的经筒
    不为超度
    只为触摸你的指尖

    那一年
    我磕长头匍匐在山路
    不为觐见
    只为贴着你的温暖

    那一世
    我转山转水转佛塔呀
    不为修来世
    只为在途中与你相见

  • 教会里的老人讨论《金婚》,小孩讨论
  • 朋友一句“还记得陈楚生吗”让人想起一夜:
    这一夜是伤心夜
    这一刻说再见
    这一夜是孤独夜
    半瓶酒和半支烟 20071221-night_kitchen (by Phidias)