Category Archives: Technology

iPhone so sexy

10 days have already past since 2007, and Apple, Inc today gives me an idea for my new year resolution, to get an iPhone this year.

Am I too materialistic? No, I just love good design and appreciate their attention to details. Take a look at their demos and you’ll also wonder why traditional mobile phone company can’t make a phone that’s as easy to use as Apple’s. Be creative.

QR code WordPress plugin

I used to show QR codes in my old theme (not in the current theme as they don’t blend very well) and my friends think that’s intriguing, so I had been working on releasing a WordPress plugin to do that for quite some time. It’s not difficult because WordPress documentation is quite clear, and I’ve finally brushed up the code and released it under an open source license. If you want to get your hands dirty to embed some wierd codes in your blog to scare your visitors away, or you want to show off your technical savviness, you have come to the right place. Go to this page for downloads and instructions.

Related article:
http://blog.anthonywong.net/2006/01/18/qr-code-for-blog-entries/

vi search

visearch

Creators of any website that resembles my homepage must be vi-addicted. *grin*

The author is crazy enough to implement hjkl keystrokes for movement in the search results, i for insert, commands like :q and :help for quit and help messages, etc. There is also a status bar at the bottom that looks exactly like a normal vim. Uber-cool.

來自当当网的奇怪短信

前天突然收到一個莫名其妙的短信,內容如下:

恭喜您成为当当网VIP体验会员。VIP帐户名:xxxxxxx@yyyyyy.zzz 密码:dangdang,请查询当当网“我的帐户”

表面看這個短信好像沒甚麼特別,但是其中有兩個疑點。疑點一,我從來没有把我的個人資料給当当网,從來沒有注冊會員,更不用說曾經使用他們的服務了。疑點二,這個更可疑,短信裡面的那個VIP帳戶竟然是我留給卓越网作為通信電郵的那個電郵地址!我可以肯定那個電郵地址我只用在卓越网,因為我在不同的网站都是用不同的電郵地址的(不要問我為甚麼我有這麼多不同的電郵地址)。這個可不得了,当当网怎麼會擁有我的卓越网的個人資料?是因為這兩家網站有合作嗎?還是因為卓越网的會員資料被涉露了,或者被当当网的員工用某种方法取得卓越网的個人資料,換句話說就是被盜用了?

為了求證,我打了電話給当当网,当当网的客服說這個短信只會寄給已注冊的用戶。但問題是我從來沒有在当当网注冊過,客服人員幫我查到我的注冊時間,日期是 2006-05-22,就在十幾天前,我就莫名其妙的注冊了,而且電郵地址是我只會在卓越网用的那個,密碼也是一個簡單得過份的密碼 (dangdang),試問我又怎會用這種密碼呢。只能说,非常可疑。

簡單測試 bandwidth 方法

公司需要在北京找一個 data center 放 server,最後通過 agent 決定在位於中關村科技發展大廈的電信通數據中心(前身中關村數據)租了一個 2U 100M shared 的地方。Agent 說能保證 bandwidth 最少 1Mbps,最多也不會超過 1.2Mbps。但基於 sales 的不可信性,還是有自己去測試一下 bandwidth 的必要的。這裡給大家一個簡單的 poor man’s way 來測試 bandwidth,一般人會用 HTTP/FTP 傳送 file 的方法來看一下速度有多快,但是需要先裝好 HTTP 或 FTP daemon。我喜歡用 netcat,因為使用非常簡單。除了 netcat,你亦需要一個用來 monitor network bandwidth usage 的軟件,用來查看實際的網絡流量,推薦使用 muninntop

netcat 的使用方法非常簡單,步驟如下:

  1. 假設我的 server 叫電腦 A,你需要再多找一台電腦,叫電腦 B(我就找了一台在香港 data center 的 server)
  2. 在電腦 B 執行命令:netcat -l -p 10000 > /dev/null。意思就是用 netcat 監聽 port 10000,而且接收到的所有 data 都當成是垃圾扔到 /dev/null 這個黑洞裡。
  3. 在電腦 A 執行命令:netcat [電腦 B 的 IP] 10000 < /dev/urandom。意思就是連接到電腦 B 的 port 10000, 並且不斷 send data。 Linux 會為 /dev/urandom 不斷的供應一些隨機的 data。

就這樣,便可以測試電腦 A 的 outbound bandwidth 了。再多找兩三台電腦(當然是在不同的 network 的)同時 send 和 receive,差不多就能把可用的 bandwidth 用盡了。如果要測試 inbound bandwidth,把 A 和 B 的身份對換就可以了。

P.S. 測試後發現,bandwidth 比想像中的要好,深夜的時候可以達到 3Mbps,連到國內的 server 更可以達到 10Mbps!到白天基本上 bandwidth 就回落了。

Network bandwidth testing for Beijing server using munin