Tuesday, October 26, 2010


JiuZhai and HuangLong are my wife's dream vacation places for years. This October we finally embarked on the journey. The cost of 3-days trip was very high (even more expensive than some overseas travel), but the view is very beutiful and unique. More photos taken by me can be found here, here.

Thursday, September 2, 2010

Sun set in China

Sun, my favorite brand.
Sun, my favorite logo.
Sun, the best engineering culture I have met with.
Sun, the most important career experience for me.
Sun, set in China on August 31st, 2010.

Sunday, July 18, 2010


I don't want to use my laptop provided by the company any more: 1) it's 4 years old. 2) overheating problem. I decided to buy a device with my own money. I don't want to invest much because any computer becomes out of dated very soon. The requirement are: light, fast to start, energy efficient. iPad is not my choice because I need do some coding occasionally.

Finally I chose a netbook ViewSonic VNB 102p, it is based on Intel N450 Atom platform, the price is reasonable (less than RMB2000). I evaluated several OSes and installed MeeGo and Ubuntu Remix 10.04, these are designed for netbooks. Amazingly, all devices work out of box on these 2 OSes.

When I started to use this new netbook, I found I spent more time on MeeGo than Ubuntu. It might be because everything is fine on Ubuntu but I need some time to make some applications work on Meego. And Meego looks more simple, faster to start. I installed and customized thunderbird (for mail), openoffice 3.2.1 and skype (for voice chat), compiled Shrew (for VPN) and Shotwell 0.6.1 (for managing photos and online albums). Now I have used it for one month and this netbook can meet my demands for daily use.

Thursday, June 17, 2010

Why flying east takes shorter time

I'm not a frequent traveler. Some years ago I found flying from west of U.S to east U.S. took 1 hour less time than return trip, I didn't find answer at that time. Recently I decided to investigate this by the help of google search.

The answer is simple: WIND . But wait, why do most people in the world find flying east takes shorter time, does the wind over Earth surface always flies east? Then I studied some flights schedule around the equator such as Singapore to Tokyo and some flights in South America, there's no significant difference in flying time between goes and come-backs. After I read some articles, below factors should be considered:

- Wind and Earth Rotation or Prevailing Winds .  You know the directions of the winds in different areas of the world.

- The locations of most cities with flights. Open the world map, you can find the much more cities are located between lattitude 30 and 60, in this area, the direction of wind is from the west to the east.

- You should consider long distance flights (>3 hours), otherwise the airplane may not spend most of time at cruise speed, and many other factors (such as reserving time for air traffic control) can affect the flying time.

- Coriolis effect. Yes, it affects the direction of the wind and it also affects the trails of airplanes, i.e. when the airplane flies from low lattitude to high lattitude, the plane will be deflected to the east. However, Coriolis itself nearly does not affect the differences of flying time between goes and come-backs. For example, if you fly northwest from Singapore to North Eurpoe, the real flying distance may be longer than you imagine from the map, the return trip is also longer.

Am I right? I'm not 100% sure. I'm just trying to explain the reason :)

Thursday, May 13, 2010

10 years later, Beijing

It has been nearly 10 years since I moved away from Beijing. In end of April 2010,I took a vacation with my family in Beijing. A lot of changes took place in 10 years: more people, more subways, soaring house prices... We visited some famous places, the Square, the Great Wall, Beijing Zoo, etc. Nice feeling.I love vacations more and more...

Sunday, April 18, 2010

Strugling with the partition table

I hate to use MS Windows: 1) insecure 2) dog slow after patching for years. Recently I decided to try Solaris Express or the new OpenSolaris. The first step is to leave some space for Solaris partition, so I deleted a Windows partition.

Now the partition table looks like:

| Free (for solaris) | Ubuntu | Windows | extened partition including several ntfs and linux swap|

Unfortunately, after I installed the solaris, both the existing Windows and Ubuntu failed to boot. For Windows, the error message is: "Windows\System32\ntoskrnl.exe is missing", for Ubuntu, it jumped to grub command  directly.

I guess the reason was probably the partition number changed. I logged into Solaris, run format -> fdisk command, the result is below:

      Partition   Status    Type          Start   End   Length    %
      =========   ======    ============  =====   ===   ======   ===
          1                 Linux native   2551  5099    2549     21
          2                 IFS: NTFS      5100  7011    1912     16
          3                 EXT LBA      7012  12160    5149     42
          4       Active    Solaris2          1  2550    2550     21

then use ntfscat to show the content of boot.ini of Windows partition:

bash-4.0# ntfscat /dev/dsk/c1d0p2 boot.ini 
[boot loader]
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Home Edition" /noexecute=optin /fastdetect
C:\Ubuntu81.img="Ubuntu 8.10"

You can see the partition number "1" is not correct since the Windows partition number has changed to "2". So to fix it: make a new boot.ini (also need unix2dos command to add "/r" for Windows), then overide it on Windows:
 ntfscp /dev/dsk/c1d0p2 ./newboot.ini boot.ini
Also, change the /rpool/boot/grub/menu.lst to correct the partition numbers to:
title Windows
        rootnoverify (hd0,1)
        chainloader +1
title Ubuntu8.1
        rootnoverify (hd0,0)
        chainloader +1

Reboot the system, I can start Windows normally.

Next, for Ubuntu problem, I need to get the content of Ubuntu grub menu.lst. Solaris currently does not have built-in supports for linux ext2/ext3 file system. I need to install some packages by following the guide, then, mount the Ubuntu partition:
mount -F ext2fs /dev/dsk/c1d0p1 /mnt
and got the content of Ubuntu grub menu.lst:

title           Ubuntu 8.10, kernel 2.6.27-14-generic
uuid            2786d26c-beb2-43e6-93a8-1cb3be921f23
kernel          /boot/vmlinuz-2.6.27-14-generic root=UUID=2786d26c-beb2-43e6-93a8-1cb3be921f23 ro quiet splash
initrd          /boot/initrd.img-2.6.27-14-generic

Reboot the system, select to boot Ubuntu in Solaris's grub menu, I was prompted to enter grub command. I tried to manually input: root (hd0,0) and the content of "Kernel....", "initrd....", then boot command, however, the system failed to boot up in the process.

So there must be somthing wrong with the Ubuntu's grub (My Ubuntu's grub was installed in Ubuntu's partition not the MBR), it seems I need to re-install the grub:
grub> root (hd0,0)
grub> install /boot/grub/stage1 (hd0,0) /boot/grub/stage2 p
grub> boot

O.K. The problem is resolved.

Don't delete a partition then create a new partition, it would possibly cause the partition numbers to change, making all things suck.

Saturday, April 3, 2010

Shanghai Flower Port

This spring comes so late. At China traditional QingMing holiday, my family went to Shanghai Flower Port. The park is famous for tulips and other flowers. It's located at faraway and seaside suburb of Shanghai, about 70km from downtown. The ticket price is RMB100, and free for little children. In this park, I can feel much fresher air and see beatuiful flowers.

For more photos, see here.

Wednesday, March 17, 2010

Send SOS to twitter in one button

Nowadays location based applications become more and more popular. Maybe the simplest location based app is sending emergency message with your location. For example, if you go to a place with potential risk, when the accident happens, you might not have enough time to send SMS or make a call to tell where you are exactly.
My little project ttlite is for this: you can preset your SOS message and turn on GPS on your phone, in case the accident happens, you just push one button to send SOS with your location to twitter. You have known about twitter's great power in spreading messages instantly, right?
It is here: http://code.google.com/p/ttlite/

Saturday, February 13, 2010

This winter in Shanghai

Last night it was very cold, this morning I found the wall behind the curtain was wet because of the cendensed moisture in the warm room.
It's sunny today, I went to a park nearby with my family.Suddenly we found ice slush, it's the first time I saw it in Shanghai. Very interesting. The photos are here:

Tuesday, February 9, 2010

JavaFX colorlines game (on JavaFX 1.2)

One of good things at Sun is that there are always new technologies to play with, even if it's not related to my daily job. In November, 2008, I did a simple implementation of colorlines game with JavaFX, of course it runs on JavaFX 1.0. 
Over one year passed, I know there's a lot of changes from JavaFX 1.0 to JavaFX 1.2. So today I decided to upgrade it. Fortunately, I don't need change one line of codes, it passed  compilation with JavaFX1.2 on Netbeans 6.8.  However, it had problem during runtime on Windows XP: running as applet is O.K., but running as web start did not show anything. Then I changed to ubuntu linux and opensolaris, everything worked fine. I checked the source codes and Java debug console, but could not find any clue, It's so weird. 
Anyway, JavaFX 1.2 showed faster than JavaFX 1.0. I put the codes to Google Code. If anybody can point out the problem I will  appreciate that  very much.

Thursday, February 4, 2010

The best tribute I've ever read about Sun Microsystems

This was written by @jimparkinson on his blog :

About this blog (why I am here)

I had several blogs, SDN China, msn live spaces, javaeye, and Sun blog. Due to various reasons (company rules, privacy protection, censorship, etc), I emptied or discontinued them.
Currently I decide to use blogspot.com as my blog site because it's free (free of charge and free to speak, no censorship), although blogspot.com is blocked by some countries, which means the users need to work around the firewall to read/write blogs on blogspot.com.