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.
Popularity: 9% [?]
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):
set proxyServer to "localhost" set proxyPort to "30000" tell application "System Preferences" activate set the current pane to pane id "com.apple.preference.network" get the name of every anchor of pane id "com.apple.preference.network" reveal anchor "Proxies" of pane id "com.apple.preference.network" end tell tell application "System Events" tell process "System Preferences" tell window "Network" tell sheet 1 tell tab group 1 tell group 1 repeat with n from 1 to 3 tell scroll area 1 tell table 1 select row n tell row n click checkbox 1 set turnOnProxy to value of checkbox 1 end tell end tell end tell if turnOnProxy is 1 then tell group 1 set focused of text field 1 to true set value of text field 1 to proxyPort set focused of text field 2 to true set value of text field 2 to proxyServer end tell end if end repeat end tell end tell click button "OK" end tell click button "Apply" end tell end tell end tell ignoring application responses tell application "System Preferences" to quit end ignoring if turnOnProxy is 1 then say "Proxies are set" else say "Proxies are unset" end if
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?
Popularity: 8% [?]
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:
! Package inputenc Error: Keyboard character used is undefined (inputenc) in inputencoding `utf8'. See the inputenc package documentation for explanation. Type H
for immediate help. ... l.194 ^^[ ndinput
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:
$ ttf2tfm stkaiti.ttf -P 0 -E 3 -w "stkaitiu@Unicode@" This is ttf2tfm version 1.5 stkaitiu00: Glyph Code Glyph Name Width llx lly urx ury ------------------------------------------------------------------------ Bus error
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
tex, move them to
~/Library/texmf, which you have to create. Now you should have a directory structure like this:
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 bkaiu.map
For the GB2312 one, use:
$ sudo texhash $ sudo updmap --enable Map gkaiu.map
It's that easy!
Popularity: 18% [?]
Stumbled upon a toy which performs Japanese handwriting recognition online by using ajax as the frontend. As I said it’s just a toy so the correctness is so so, but nonetheless a very good proof-of-concept. This toy uses Support Vector Machine as the underlying algorithm so the program is able to learn from the user’s handwriting. Ever since I made lamerpad I realize that pattern recognition should be a better means to handle handwriting recognition than analyzing stroke patterns, such as stroke order, numbers and positions, which lamerpad employs, as stroke structures vary from person to person. But by using machine learning algorithms like SVM or artificial neural networks, a hybrid system could be made, such system not only can learn from how the character looks, but also how the character is written by the user. By now Chinese handwriting recognition technology is already quite mature, but just no such open source programs, SCIM handwriting module, anyone?
- http://www.teresi.us/html/writing/handwriting.html: “Handwriting Recognition, Using a Neural Network Character Classifier”, have a description of Newton Messagepad’s handwriting recognition engine
- http://www.byte.com/art/9609/sec17/art7.htm: overview of companies that work on Chinese handwriting recognition
Popularity: 23% [?]
Now Google Calendar users in China can finally enjoy the same SMS alert service as in other countries. Although they mentions China Unicom as the only mobile provider to be supported, I have no problem in registering the service and receiving alerts even I’m a China Mobile subscriber. This alert service is very handy to everyone, as Google Calendar will send you SMS to your mobile phone whenever an event is going to begin.
An interesting tidbit is, they sent the verification code to my mobile phone via HUTCHISON_HK, where HUTCHISON is one of the mobile service providers in Hong Kong. It seems that Google choose neither China Mobile nor China Unicom, the two major mobile providers in China, as their partners.
Popularity: 6% [?]