Search this site:


Gmail's Download Attachment via Drag & Drop is not working recently

Gmail released a useful feature in August which allows user to drag and drop attachments out of the E-mail directly to the computer. As far as I know it supports only Google Chrome It was really handy and I use it nearly every day.

However, in recent days, I can only get a GIF image (which is the file type icon) instead of the file if I drag it out from Gmail. I seems not to be alone and someone has reported it to Google at here. The issue is still open. Let's look forward to the fix soon.

Update 2011-04-07:
Finally, as confirmed by Google Employee on the support forum, the feature comes back again!!! Late better than none!!! Hurray!!!!


Facebook Spam.... CLICK HERE TO SEE

SPAM never dies on Facebook. I just blogged (in Chinese) one wave using hidden iFrames last month, another wave has just come today.

  • XXXX likes OMG... Look What This 6 YEAR OLD found in Her HAPPY MEAL from McDonalds! on CLICK HERE TO SEE.
  • XXXX likes █► I Will NEVER TEXT Again After Seeing THIS!! ◄█ on CLICK HERE TO SEE.
Clicking any of the links shows you this screen:

And with a little bit magic the evil truth is revealed:

A like button following your mouse cursor... I laughed...

Don't have time to further look into the following pages to see what it really does, but it won't be anything good. Trust me. Ha


Testing from Mobile

Just installed an app to write blog from mobile. This is a testing post.

<a href="" target ="_blank">Blogaway</a>

Testing 123

Posted from mobile


2 Missing Important Features in Android

Well, Android is really a nice platform. I enjoyed it so much, except that Android is lacking two important features.

First of all, there are no handy way to configure web proxy in Android. One may suggest the "Proxy" field in the APN setting (Settings > Wireless & Networks > Mobile network settings > Access Point Names > Proxy), but that's just applicable when you use 2G/3G network. In other words, when you use Wi-Fi connection, you will not be able to access the Internet if proxy is required (quite common in corporate environment). How dare Android miss this?! It seems that those with HTC Sense UI got such a configuration, but I don't think Android should be that crab without Sense UI... Some apps on the Market used to be able to let user change the system-wide proxy by modifying the Settings.System.HTTP_PROXY setting. Unfortunately the value has been moved to Settings.Secure.HTTP_PROXY which can no longer be modified by 3rd-party apps. I understand that this is a security measure aiming to protect the user from malicious apps, but this completely remove the proxy support on Android when you use Wi-Fi (unless you root your handset).

Another important feature missing in Android is the support of Ad Hoc Wi-Fi network. This can improve local connectivities with other devices. All other smart phones including iPhone and even Windows Mobiles support this... Why not Android? There are some hacks for root-ed device to connect to Ad Hoc Wi-Fi network, but first it is not convenient and second it can only connect to pre-defined SSID... How stupid it is!!!!

If you also want these features on your Android handset, please cast your vote by starring the following issues:
Issue 82: wifi - support ad hoc networking
Issue 1273: IP Proxy Settings for Wifi Network

Yes, these issues have been there for long long time already and the features are still missing... Google, please ask your top-class engineers to do something !!!


Source Code Syntax Highlighter (Javascript)
Use Javascript to hightlight source code in web pages, with line numbers.

Look quite nice. Note down for future reference.


Creating Time Lapse with ffmpeg

Here is how I made this time lapse video from image:

  1. Rename the images in sequence as frameXXX.jpg (where XXX is 000, 001, 002, etc). Many photo viewing software like XnVew (free solution, recommended!) and ACDSee can do this easily
  2. Run the ffmpeg with the following parameter:
    ffmpeg -r 12 -i frame%03d.jpg -sameq -s hd720 -vcodec libx264 -vpre hq -crf 25 OUTPUT.MP4
  3. Done!

You may want to change the -r parameter to your favorite frame rate. If you want 1080p, simply replace the -s hd720 parameter as -s hd1080, or -s 1920x1080 if you want.

One more important point to note is that the order of parameters matters. Any parameters before the -i will become options for input stream. Like if you type something like ffmpeg -r 12 -i blah blah blah, you will make the specified rate meaningless as it will be applied to input stream which are still imagesthis is how the rate parameter should be specified. Make sure that you don't mix them up when you customize the parameter. Another common problem I've seen is the format for -i parameter. It is actually the same as that of the printf() function in C++. For example, frame%03d.jpg will make ffmpeg looks for images with names frame000.jpg, frame001.jpg, frame002.jpg... while frame%05d.jpg means frame00000.jpg, frame00001.jpg, frame00002.jpg...

Yet I think the quality is not very perfect. Maybe need further fine tunning the parameters. Anyone has hints please?

A uncompressed version can be done like this:
  1. Resize your image to your desired output resolution (e.g. 1920x1080, 1280x720, etc)
  2. Rename the images in sequence as frameXXX.jpg (where XXX is 000, 001, 002, etc). Many photo viewing software like XnVew (free solution, recommended!) and ACDSee can do this easily
  3. Run the ffmpeg with the following parameter:
    ffmpeg -r 12 -i frame%03d.jpg -vcodec copy OUTPUT.AVI
  4. Done again!



Documentation Tool for .NET

This is a really nice one... released by MS:
Sandcastle -

Capable to output HTML (with ASP.NET files so that you can deploy to IIS with more feature), HTML Help 1.x (.chm), and HTML Help 2.x (.HxS).

And you would probably like this nice GUI of the tool:
Sandcastle Help File Builder (SHFB) -

There is also a Visual Studio integration:
DocProject for Sandcastle -
It's powerful but I like the SHFB more for simplicity :)

Some notes to add:

  • Remember to read the instructions for SHFB before installing and you will find prerequisites like the Microsoft HTML Help for outputting .chm files.
  • Simply specifying the solution files in SHFB will do the job - don't really need to add all source files!
  • You may need to reconfigure your C# projects so that it also generates XML document files when building, or else the method/field descriptions will not be available in the output.
  • If you encounter errors when generating the output, try to change the Working directory in SHFB settings to something really simple - alphanumeric onlys, without spaces, etc (something like C:\Temp\working might be a good one)... It seems that the hhc.exe from Microsoft HTML Help packages does not handle special characters well...

That's it. Enjoy!


Graph Layout for .NET/WPF

Found some useful libraries:

A tutorial on QuickGraph:

And a screenshot of the Graph# sample app:

Look nice!

Update 2010-04-27:
Another library is named Netron, seems to be nice. A tutorial of it:


Open Source Website Design

Recently I am working on a web application project. Found a nice web site that has many open source or creative commons web template for lazy developers like me to use.

So here it is:
Open Design Community

Enjoy! Hope this helps you too!


view-source URI scheme

Accidentally discovered some tricks in Firefox. I was viewing the source code of a web page in Firefox. In recent versions of Firefox, I am able to click on hyper-links in the source code view to link to another page, just like normal web pages do. I thought it was a internal feature of Firefox and didn't ever check out it works.

Until today when I accidentally dragged the hyperlinks from the source code windows to a normal Firefox windows, and WOW, the source codes was displayed! An URI staring with view-source: was shown in the location bar like this:


By Googling I know that it is an special URI scheme for showing the source code of a web page, although some of the browsers may not not support this. Tested with Firefox 3.6, Chrome 5.0.335.1 dev on Windows 7 and it works well. IE was reported to drop such support since version 6 in Windows XP SP2 due to so called "security reasons". Well... I really wonder what're the security reasons and how secure it can be by dropping the support... Come on... Web page source codes are never secrets...

Fantastics! This is yet another useful little tricks when I would like to view the source code of the page without having it to be loaded, for example when performing penetration tests or when peeking suspicious web sites!

How about making a simple Firefox extension adding some shortcuts for this?


Development Environment

I need a perfect environment to start my work, that's why I always spend many of my time tuning the workspace to make myself enjoy the work more. I just spent some time this weekend tunning the two IDE I used often~

Courier New was my choice for coding font, but sometimes it makes me feel bored. Tried a few other fonts come with Windows, but most of them are non-fixed width and not good for coding. At last I found one called Consolas and look nice to me at the size of 9pt. I made the font a bit smaller to display more codes on the screen. Scrolling really slows down my sense and feel on the codes that I want to avoid as much as possible.

I saw many other developers are using dark backgrounds instead of the default white ones in most of the IDE. Maybe it looks more comfortable in long time coding. However, those theme with dark background colors usually come with colorful foreground colors which may distract me... Pure white background is really a bit tiring, light gray may be a nice choice to me.

So this is how my Eclipse looks like now:

I did the similar for Visual Studio, and soon I noticed Visual Studio has no built-in support for current line highlighting... There seems not to be one for the coming 2010 version either... I can only rely on extensions for this tiny but killing feature... What a pity... Anyway found one useful and free one called Slickedit Gadgets. There are other alternatives like the famous ReSharper but they seems to have too much unnecessary feature for me. I am always reluctant to install too much... Simple is always the best :)

This is how my Visual Studio looks like after fine tuning:

That's it :)


Locales in Android

I live in Hong Kong, and my mother language is Chinese (or Cantonese). However, I don't really enjoy user interfaces in Chinese. The fact that digital world is based in US cannot be changed - most computer terms are originally in English, and they are often poorly translated to other languages, at least not for Chinese... That's why the OS I use is always in English, and I install English version of software, and I use English interface in my Nexus One.

Unfortunately, Nexus One has only limited choice in locales (DO NOT mix up with the Android app named "Locale") by default. In the list, only 中文(繁體) [zh-HK] or English (United States) [en-US] are applicable to me, but none of them is my preference.

Non-tech guys may ask what codes like zh-HK and en-US are. These are so called locales in the computer world. The first part is a language code defined in ISO 693 describing what language should be used, while the second part is a country code defined in ISO 3166-1 describing things like date/time format, phone number format and currency. Software is supposed to display values accordingly to this locale settings.

So you may notice the problem here. I can't have both English user interface and the Hong Kong set of formats... For example, when displaying phone numbers...

This is how it looks like when en-US is chosen.

The dashes look really strange to people living in Hong Kong. We seldom divide phone numbers into groups. And even when we do, we don't make 3-digit groups (but 4-digit groups). I really can't recognize the phone number at first glance...

Changing to the zh-HK locale make the phone number looks better...

But as said, I am not comfortable with Chinese user interfaces...

Finally, I found a solution tonight. Some nice guys in Japan developed the MoreLocale 2 app for Android. Thanks to this great app I can finally set my locale as en-HK, having the result like this:

Footnotes #1: Yes, I know someone will notice that the phone number is the one in a recent popular TV ads (in Chinese). :D

Footnote #2: Yes again. I am that kind of people who are over-focusing on tiny parts of overall experience. One simple disadvantage may kill a product in my mind, and one simple advantage may make me become die hard fans :)


1st Look at Buzz

Tried Buzz today... My question is why we need yet another "status" service...

Well, anyway, I am using it. LOL. It's nice for it to have easy importing from other content providers like Flickr, Blogger, Twitter, and etc. It doesn't require (or allow) you input credentials for imported (they called it "connected") sites, therefore only public content will be imported. And that's why my Twitter feeds aren't buzz-ed.

Also noticed that comments & follow-ups would be sent to your inbox automatically. I really wonder why this is needed when the Buzz link is directly below that of your Inbox. Anyway, it may be due to the fact that Buzz is built on the G-mail platform. Your own Buzzs even appear in the All Mail folder.

Can't find an option to turn that off yet. But if you are thinking how to get rid of those auto E-mails, try to create a filter. Buzz updates sent from address:, where XXXXXXXX is profile ID of the sender. Anyway, it seems to be safe to create a filter like this:

Happy Buzzzzzzzzzzzzzzzzzing!


Batch insert to SQLite database on Android

I am using LIME for Cangjie(倉頡) input method on my Nexus one. The app is really nice and handy. However, there are quite a lot of users asking to improve the speed for loading the mappings.

After knowing the app was released as open source software, I immediately checked out the source and had a look on the loading function.

Oh, data was stored in SQLite. Below is the simplified version of pseudo code for the importing:

ArrayList list = new ArrayList();
count = 0;
while (reading a line from input file succeed) {
if (count = 100) {
count = 0;
} else {

In order words, the author was trying to do a batch insert of 100 records (indeed 101...☺). This is a reasonable trial as batch insert can normally save some overheads. However, when I further went into the insertList() function, I saw something like the below pseudo code:
for each record in the list {
if (line represent a valid entry) {
db.insert(SOME_TABLE, null, SOME_VALUE);

Thanks to my previous projects involving SQLite, I believed I had found out the potential issue of the slow loading of mappings.

As described in my previous notes, SQLite, by default, creates a journal file for each transaction, and delete the file after the transaction completes. The above code does not explicitly create any transactions, so each insert call will be treated as an independent one. As a result, expansive file operations will be called frequently and slow down the process...

Therefore, I modified the code to make all the insert calls in the same batch in a single transaction:
for each record in the list {
if (line represent a valid entry) {
db.insert(SOME_TABLE, null, SOME_VALUE);
} catch (SQLException e) {
} finally {

I then tested the code in the emulator running on my notebook. The original code inserts at a rate of around 10 records per second, while the version with transaction inserts at a rate of 30+ records per seconds. WOW, that's a sound improvement!

I then attempted to increase the batch size from 100 (ok, 101...☺) to 500 (501...☺) and hoping for a further improvement. However,the insert rate drop to around 28 records per seconds. Still sounds good, but why not just keep the old batch size for a better result? The drop may due to limited resources in emulator, so in other words, the app will have a different optimal batch size on different handset. I rather keep that part untouched.

Reported the findings to the author, and hoping for a new release soon~ Anyway, just another story of optimizing the insert speed of large amount of data to SQLite. Enjoy! :)


How to screw up a Solaris with the crle command

I was helping a friend to setup an web album on Solaris 5.8. To enable thumbnail resizing when user upload photos to the album, I grabbed an pre-complied netpbm from and installed on the server. The installation was successful but the utilities failed to find some libraries which are already located in /usr/local/netpbm/lib. Obviously this is a problem of the shared library path and could be solved easily by adding the path to LD_LIBRARY_PATH environment variable. However, as said the utilities would be used by web server, I don't really want to modify the startup script. Instead I go for the crle solution, which update the system default search path when linking shared libraries.


  1. Login the system remotely via SSH using a non-privileged account
  2. Glancing through the man page of clre on adding a default path, and i found the -l option.
  3. Using sudo to issue the command: sudo clre -l /usr/local/netpbm/lib
  4. Test the netpbm utilities again and hurray, they worked!!!
It would be really nice if life had ever been that simple. Experienced Solaris guys would have already noticed the problem here: the -l option REPLACES the default search path with the provided one if the -u option is not specified. In other words, the system now only search for shared libraries in /usr/local/netpbm/lib, not even /usr/lib nor /usr/local/lib. Most binaries on the system were no longer working. They includes, sshd, telnetd, and... bash!!!

OK, already running processes were not affected since the linking had already completed before the changes effected, so I was still with the shell. The clre command was working too. It seemed that I could correct the problem with the command immediately. But sorry, no, I couldn't. Changing the system default search path requires root privileges, and commands like su and sudo WAS NOT WORKING!!! One may suggest me to add back those /usr/lib and /usr/local/lib to the LD_LIBRARY_PATH environment variable so that I can su/sudo in the current session. No it didn't work either because setuid scripts like su/sudo would ignore the variable for security reasons. I even tried to search for privilege escalation exploits for Solaris 5.8, but unfortunately (or you can say fortunately) the system had been well patched...

It was 3am in the midnight and no operators were working... Well, even someone was, I don't think he/she could help me since they can't even login with getting bash to work.

So, the system was completed screwed up.

What's the solution? I finally rushed to the server room on the next day, boot the system with a Solaris boot CD and fix the default search path...

Hmm.... here are what I've learnt in this incident:
  1. Please read the man page really carefully.
  2. sudo command is somehow really dangerous... This was not the first time I screwed up a system with it... Maybe next time when I am doing things like this I should really consider a su so that I can at least keep a root session...

Anyway, I hope this sharing of my stupidity does save someone from similar issues...


Backspace in Explorer of Windows 7

I suddenly noticed today that the backspace key in Windows Explorer of Windows 7 has a different effect than that of Windows XP. In the XP days, the backspace key brought you 1 directory level up, just like the command "cd ..", while in Windows 7, it bring you to the last folder you were in instead, i.e. the command "cd -" in the Unix family.

Just a funny discovery.