Category Archives: Open Source

Google Chrome is the winner, Javascript speed-wise

Did some benchmark testing on the Javascript engines of several Mac OS X web browsers by using SunSpider and Google’s V8 benchmark suite. Although Google Chrome is still a development release on OS X, it’s already the winner in this test. Safari 4 comes second, it shows similar results in the SunSpider test but loses more in the V8 test. Sadly Firefox 3.5 loses to both of them by quite a significant margin, despite the fact that Firefox 3.5 introduces the new TraceMonkey JavaScript engine. Opera 10.00 beta 2 is just not a viable competitor to all of the others, I hope this is just because of the beta thing.

Here are some charts that show the results:

sunspider javascript benchmark of firefox, safari, opera and chrome

OS X web browser Javascript speed comparison among firefox, safari, opera and google chrome

V8 benchmark total score of Firefox, Safari, Opera and Google Chrome

I helped Firefox today, I’m feeling great

It’s not easy to find a reproducible bug in a stable open source software that has the exposure as large as Mozilla Firefox, which has more than 20% market share of the web browser market in Europe. But I did, and I think I’m very lucky. Not only that, this bug has been hiding in Firefox since 2003 (was it the Firefox 1.0 days?), so this bug has been in existence for 5 years, wow, I think I’m really very lucky to have spotted it.

This bug is serious, but very difficult to manifest itself. Under rare conditions, a form post will be sent to the web server twice without your notice. Say, if you’re shopping in an online e-shop, and you’re so “lucky” that you encountered this bug, you would be buying the same goods twice, or if you’re making a payment, you would be paying the amount double.

Thanks Alfred Peng for confirming the bug so that Firefox developers began taking a look at the bug. From the perspective of open source development, identifying and testing thoroughly for the existence of the bug and filing a detail bug report with reproducible steps is the task I should do. The fix for the bug is just less than 10 lines long (the test case is much longer), but it may take me days if I have to come up with a patch. Filing a bug report is something anyone who speaks English can do, so if you find a bug in Firefox, please go to their bug tracking system and submit a problem report. The more people contribute to it, the better the software will become, and by doing so, we, in turn, are helping ourselves to create a more pleasant web experience.

Using Kai font for MacTeX on OS X

Typesetting LaTeX with CJK on Mac OS X is provided out-of-box by MacTeX, so working with LaTeX should be a breeze on Mac OS X. However, MacTeX ships with only two Chinese fonts, Arphic Ming Big5 (bsmi) and Arphic Sung GB2312 (gbsn). As I want to use Kai I have to look around for solutions.

I found this great website that explains how to use LaTeX and the CJK package on OS X. The good news is that the author of the page provides a shell script for installing any Unicode truetype fonts for TexLive so that you can use the truetype fonts in your LaTeX documents. The bad news is… it doesn’t work on my system. I tried it on both Arphic Big5 and GB2312 Kai fonts, and when I ran my LaTeX document through the latex command (or in TeXShop, for that matters), I came to this error:

Trying the shell script on the STKaiti font (/Library/Fonts/华文楷体.ttf) shipped with OS X, is even worse, because ttf2tfm gives a “Bus error” (or segfault on Linux) when parsing the truetype font, looks like a bug in ttf2tfm:

At the end, I resort to extracting the necessary files from Debian packages (hurray Debian) and put them into ~/Library/texmf, and that works!

The Debian packages I use are latex-cjk-chinese-arphic-bkai00mp and latex-cjk-chinese-arphic-gkai00mp. Since Debian packages are just ar archives, they can be extracted by the ar x command. After the deb package has been extracted, extract the data.tar.gz file, and then look for the folders called fonts and tex, move them to ~/Library/texmf, which you have to create. Now you should have a directory structure like this:

MacTex font installation

After the font files have been put in place, run these two commands (for the Big5 Kai truetype font):

$ sudo texhash
$ sudo updmap --enable Map

For the GB2312 one, use:

$ sudo texhash
$ sudo updmap --enable Map

It’s that easy!

深入研究發布管理 (release management)

上一屆的 Debian leader Martin Michlmayr 在他的 blog 上發表了一系列關於自由/開源軟件發布管理 (release management) 的分析文章。由於 Martin Michlmayr 在劍橋大學所做的 PhD 論文是針對自由軟件質量保證方面的研究,他的幾篇就 Debian, GCC, GnomeLinux kernel 的分析都很精確,重點的列出了每個 project 管理發布的問題和解決方法,各有千秋,非常值得參考。雖然篇幅不多,但是對於需要宏觀了解這些大 project 的朋友起了很大的幫助。相信他的論文會有更詳細的分析,非常期待可以早日看到他的研究成果,並希望能同時為 Debian 找到一條光明之路。

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: