Category Archives: Mac OS X

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


真係未見過有公司咁樣 launch website 嘅,原本個 website run 得好地地,為咗推新 service,將成個 site 換咗佢,結果係搞到好多俾咗錢聽 archive 嘅人聽唔到,特別係一眾 Mac user 同非 Windows user。嗰個新推出嘅 Toolbar 又唔 support OS X,又唔 support Firefox 3。原本嗰 site 都仲有得俾 user 揀用 RealPlayer 定係 Windows Media Player (Microsoft ASF format) 來收聽 realtime 廣播同 archive,但係個新 website 淨係 serve ASF 同埋用佢個 P2P toolbar。香港公司搞 website,已經無眼睇好耐。宜家咩年代啊,做 website 竟然仲唔注意係唔係 cross-platform。雖然 Real Audio 同 ASF 都係 proprietary,但係點計 RealPlayer 嘅 cross-platform support 都好過 ASF 好多,Mac 有 client,Linux 又有,連 Unix 都有。宜家商台竟然仲廢埋 Real Audio,有無搞錯。其實商台真係好天真好傻,將個 site outsource 俾大陸公司做,大陸公司做 website 出名 IE-only,商台自己嘅 project management 又好有問題,無做好 testing 唔駛講,個 site 宜家俾人媽到飛起,俾咗錢嘅用唔到應有服務,咁都仲唔 rollback 番個舊 site 出來,又或者同時間放番個舊 site 出來一齊行,咁係咪即係話根本無諗過任何 fallback plan,無 contingency plan 嘅呢?前幾日入去商台個 website,赫然發現個 domain name 變咗,心諗,唔係唔記得改番 DNS 吓嘛,邊有人用咁嘅 domain name 架,後來先發現原來商台係認真嘅,仲喺埋個 logo 寫住 beta,懶係 web 2.0 咁,真係膠到無朋友。人哋啲 website 寫住 beta,好似 gmail 咁,alpha, beta, gamma 都無問題,因為第一,佢就算係 beta 都仍然好 stable,第二,佢無收我錢。但係商台呢個 case 唔係咁,我真係唔信竟然有人 launch beta service 俾 paid service 嘅 user 咁樣搵香蕉皮自己踩。

好,鬧完,既然俾咗錢,唯有自救,用 XCode + Applescript + shell script 寫咗個 application 俾 Mac OS 10.5 嘅 user 用(唔知 10.4 得唔得,得嘅話通知聲),可以聽得番 archive,呢度 download。Download 完記得睇 README 點樣用!為咗獲得最佳效果,請同時下載 Real Player & Flip4Mac,得閒可以順手裝埋 Perian

更新 2/7/2008 6:25pm: 如果你安裝咗 Flip4Mac,你要先響 System Preferences 度打開 Flip4Mac,make sure “Use Filp4Mac WMV Browser Plug-in” 選項無被揀中。

Is switching proxies on Mac OS 10.5 scriptable?

I often need to change the network proxies settings frequently due to the need to bypass the GFW when accessing websites that are considered “bad”, and have to set the settings back to not using any proxies when accessing “good” websites.

Doing so in Firefox is easy thanks to the little yet handy plugin called SwitchProxy, but for Safari or other applications which use the global system settings of Mac OS, one has to go through many steps in System Preferences to set them, and then go through the exact steps again to unset them. Too repetitive. I wish there is a way to set and unset proxies easily, but I cannot find one. I bit the bullet and use AppleScript (yuck) to do that, here’s the complete script (beware, this is my first AppleScript program):

I hate to use AppleScript as it simply plays back what a human does, and so the speed is slow, which takes about 5 seconds to finish. I tried to do that by shell script but I couldn’t find the right way to do so, having looked at the defaults command but seems it is not capable at what I want. Anybody knows?

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!

Ripping FLAC on Mac OS X

I always want to listen to my music on my iAudio M3 portable player at the highest fidelity, so OGG Vorbis (.ogg) is already not enough to me. I’m slowing migrating my collection of music to FLAC. On Linux this task is trivial, because I just have to change the encoder setting in jack (the name of the text-based frontend that I use) from oggenc to flac. But ripping CDs on Mac OS X is new to me. After some searching and testing, I stick with MARS.

There are other encoders like xACT and jRpper, but they all require some setup like installing the backend encoders separately. MARS is straightforward and easy to use, and can encode to OGG or FLAC files. Most importantly, MARS can query FreeDB and tags your songs automatically. The drawback is MARS inherits the same encoding problem like any other ripping softwares that make use of FreeDB. If the names of your songs are all in English, you’ll be fine, but if you have to rip Chinese and Japanese CDs like me, then all you get is some strange characters, because there is no encoding information in FreeDB records, they can be in Big5, GB2312 or whatever encoding. Moreover, until CDDB protocol level 6, only ASCII and ISO-8859-1 are supported. So unless your client is compliant with level 6, you will always get rubbish. At the end, I have to copy the song names manually from iTunes to MARS. Yes, iTunes get it right.