Vision through iPhone

November 27th, 2011 at 12:24 · Filed Under Blogging, Days in My Life, iPhone, Photography · Comment 

I have created a photography blog to post all photographs taken with iPhone. Check it out here.

November Rain

November 17th, 2011 at 16:17 · Filed Under At Home, At Work, Days in My Life, Music · Comment 

Time flies. It’s November again. 2011 is waning and 2012 is just before the doorstep. Soon we will be greeting “Hello 2012.”

There is no particular topic for this blog post but I just want to share with you one of my favorite rock song, “November Rain” by Guns N’ Roses.

It’s November and at this time of the year, the beginning of North-Eastern monsoon, brings a lot of rains. No word in the Webster can describe the mixed feelings of listening and smelling the rain together with the music. If you are somewhere so happened to have rain outside your window in the month of November, turn up the volume and watch the rain outside.

Perhaps you want to share with me your feeling?

Torenia fournieri

October 7th, 2011 at 11:05 · Filed Under At Home, Blogging, Days in My Life, Flowers and Plants, Gardening, Photography · Comment 

Torenia fournieri (Wishbone flower)

Thanks to Hisao Yamada-san, a friend from Steply, who has helped to identify the above flower. It is one of my favorites. The name is Torenia fournieri or Wishbone flower.

Go here for more photos of flowers and plants in my garden.

R.I.P. Steve Jobs

October 6th, 2011 at 20:58 · Filed Under Blogging, Days in My Life · Comment 

Steve Jobs

It was a shocking morning when I learned about Steve’s death from a friend’s message on my iPhone 4. Then, I confirmed the news by reading Apple’s website and Twitter on my iMac.

No words can adequately express my sadness. My condolences to his family.

Steve, you have been a great inspiration to me. Well, I worked today to its fullest and always will be. ”Never settle!”

Here is a video “The Crazy Ones” with Steve Jobs voiced over.

老同学重逢

September 13th, 2011 at 11:08 · Filed Under Blogging, Chinese, Classical, Days in My Life, Friends · Comment 

阔别廿余载,昨晚和老同学吴毅坚重逢一起在Movida用餐,并痛快地谈了二小时多得知其他同学的现况。原来还有很多位老同学还在本州工作,真希望能好好聚一聚。一时心血来潮,剪取自李白的《将进酒》送给友人。

君不见,黄河之水天上来,奔流到海不复回。
君不见,高堂明镜悲白发,朝如青丝暮成雪。
人生得意须尽欢,莫使金樽空对月。
与君歌一曲,请君为我侧耳听。
与尔同销万古愁。
--剪取自李白的《将进酒》。

Regulus – My new (Lion) iMac

August 13th, 2011 at 14:37 · Filed Under Astronomy, At Home, At Work, Computing, Days in My Life, Mac OS X · Comment 

It has been my tradition to name my computers and mobile devices after the name of a moon, planet or star. This time is no exception.

The new OSX operating system 10.7, code-named Lion, was officially released by Apple, Inc. on July 20, 2011. In astrology, it was just two days before the Sun begins occupying Leo from July 22 to August 22. And I ordered my iMac and received it before the Sun leaves Leo.

In astronomy, Regulus or Alpha Leonis is the brightest star in Leo constellation. In Chinese, it is known as 轩辕十四, the Fourteenth Star of Xuanyuan. Regulus is also one of the brightest stars in the night sky. Together, with Eta Leonis (a fourth-magnitude star), they mark the lion’s heart.

My new 27″ iMac is a top range CTO model and will be the power horse for my works which include software development, some photography and design works. It is also the most powerful personal computer I have ever owned/purchased. Thus, Regulus is the best and most beautiful name for my new iMac.

Pluto will be passed down to my wife and kids after the data has been completely migrated to Regulus and a stable working environment is established.

iMac

iMac

 

Ada and Multiple Inheritance

July 28th, 2011 at 5:24 · Filed Under Ada, At Work, Call Me a Geek, Days in My Life, Software Development · Comment 

When developing an information system which computes real-life data, one of the most common problems a software developer may encounter is multiple inheritance. Inheritance is one of the four aspects in Object-Oriented Programming (OOP).

What is Object-Oriented?

Object-oriented technique organizes software as collection of discrete objects incorporate with data structures and behaviors. Take a software that keeps records of professors and students in a university for instance. Both professor and student are person. These three entities – professor, student and person are objects. A person has data structure such as name, gender and date of birth to make things simple. Both professor and student share the same data structure of person. A professor has employee number, salary, and room number. And a student has student number, courses and grades. Both professor and student have different behavior: to lecture and to learn respectively. We can let professor and student to inherit the same data structure and behavior from person. Person is superclass. Both professor and student are subclass. Now both professor and student can derive data structure and behavior from superclass person but at the same time, both can preserve their own data structure and behavior as professor and student respectively.

Multiple inheritance is where a subclass inherits from more than one super class. One of the most common problems with multiple inheritance is symmetry. Let subclass D inherits from superclasses B and C which inherit from another superclass A. This is called symmetric multiple inheritance.

Multiple inheritance is rather problematic at linguistic level. Many object-oriented programming languages support multiple inheritance and solve the problems in such a way that usually they cause surprises to their users. In the above example, the operations in A can be derived to B and C and overridden in any other ways by any one of them in D.

Ada provides different approach to implement multiple inheritance by simply not allowing user to get into such problem in the first place and to force the user to break the symmetry.

While I slip deeper into my software design, symmetric multiple inheritance occurs. I have two classes A and B where both of them inherit from object List.Node. Another subclass C inherits both superclass A and B. Ada forces me to break the symmetry by letting C to have a direct inheritance from A plus indirect secondary inheritance of B.


package List is
   type List is limited private;
   type Access_List is access List;

   type Node is tagged private;
   type Access_Node is access all Node'Class;

private

   type Node is tagged record
      Previous : Access_Node;
      Next       : Access_Node;
   end record;

   type List is limited record
      Head    : Access_Node := null;
      Tail       : Access_Node := null;
      Current : Access_Node := null;
      Count   : Unsigned := 0;
   end record;
end List;

   type A is new List.Node with private;

private

   type A is new List.Node with
      record
         Id   : Integer;
         Str  : String ( 1 .. 20 ) ;
      end record;

   type B is new List.Node with private;

private

   type B is new List.Node with
      record
         Precision : Float;
      end record;

   type C is new A with private;

private

   type C is new A with
      record
         Magic : B;
         Plate   : Integer;
      end record;

Bersih 2.0 – Love to my country

July 9th, 2011 at 23:05 · Filed Under Blogging, Critiques, Days in My Life, Kuala Lumpur, Malacca, Malaysia, Politics, Social · Comment 

Today, July 9, 2011 is the day tens of thousands of Bersih 2.0 supporters marched in Kuala Lumpur peacefully for the good cause to seek electoral reform for a clean and fair election. There are plenty of information spreading on the Internet about Bersih 2.0 rally so I am not going to repeat everything here.

One thing for sure, this rally has changed my perception and the spirit of a true Malaysia, where all races – Malays, Indians and Chinese united under one cause despite of the unwarranted, tyrannical acts by the National Front government and the police. I have never felt more proud of being a Malaysian.

A quote from a friend of mine from Hong Kong:

Democracy won’t come to you, is you go and get it. if you have chance just speak out loud, or shout from the rooftop. – Atropos

And from famous actor Clint Eastwood

Sometimes if you want to see a change for the better, you have to take things into your own hands. – Clint Eastwood

What happened today on July 9, 2011 will be written in the history of Malaysia. This is the day when fellow Malaysians stood up bravely to defend their civil liberties which have long been disrespected by the ruling government since independence. I don’t want my children, when they grow up, ask me: “Dad, what had you done on July 9, 2011?” and I can’t answer them. So I decided to wear yellow (the signature color of Bersih) and walked in town to show support. Honestly, as a father of three and the breadwinner for my family, such decision was not without fear. Why fear you may ask? Perhaps Malaysia is the only region in the world where you can be arrested for merely wearing yellow. And being arrested is one thing, how you would be treated after arrest is another.

This morning, I wore a yellow T-shirt and moved around at certain parts of the town. In the afternoon, after meeting my client at his office, I walked from Hatten Square, crossed the main road, and walked length of Dataran Pahlawan in the same T-shirt.

Having been following up the rally happenings in Kuala Lumpur since morning, I thought I could at least feel a little of the Bersih atmosphere here in Melaka. Disappointedly, I only saw large crowds, mostly Chinese, hanging out at Hatten Square and Dataran Pahlawan happily as usual. Everyone seemed carefree and undisturbed by the fact that thousands of people were being treated inhumanly by the police just because they wanted to ask for a clean democracy for all Malaysians. I hardly spotted one that wore yellow. If you look at the photos taken during the Bersih rally, you can see most of the protestors are Malays, relatively few Chinese took part in the rally. I am not being racist here, my point is there are too many Chinese Malaysians who simply don’t give a damn to the wellbeing of the country. They don’t even care to vote. All they care about are how much money they can make and how well they can live. With such attitudes, no wonder the Chinese are being called “pendatang” or squatters in spite of the fact that they are born in Malaysia. I think these people really deserve such labeling.

Although what I did was insignificant and actually nothing compared to those who had risked being arrested, injured or even losing their life to join the Bersih 2.0 movement in Kuala Lumpur today, I am glad that I have made one tiny step to conquer my fear by wearing yellow and walking on busy road and in busy malls in the heart of Melaka, with the spirit of Bersih (Clean).

If you want to conquer fear, don’t sit home and think about it. Go out and get busy. – Dale Carnegie

曾国藩自立下課程十二條

June 3rd, 2011 at 11:30 · Filed Under Blogging, Chinese, Classical, Days in My Life, Education, Philosophy · Comment 
曾国藩是中國近代政治家、军事家、理学家、文學家,清朝“中兴名臣”之一,官至武英殿大学士、两江总督。同治年間封一等毅勇侯,世袭罔替。

在维基百科读了他的史记,对他开始敬仰他。以下是他為自己立下課程十二條:
  1. 主敬:整齊嚴肅,清明在躬,如日之升。
  2. 靜坐:每日不拘何時,靜坐四刻,正位凝命,如鼎之鎮。
  3. 早起:黎明即起,醒後勿沾戀。
  4. 讀書不二:一書未完,不看他書。
  5. 讀史:念三史(指《史記》、《漢書》、《後漢書》),每日圈點十頁,雖有事不間斷。
  6. 謹言:刻刻留心,第一工夫。
  7. 養氣:氣藏丹田,無不可對人言之事。
  8. 保身:節勞、節欲、節飲食。
  9. 日知其所無:每日讀書,記錄心得語。
  10. 月無忘其所能:每月作詩文數首,以驗積理的多寡,養氣之盛否。
  11. 作字:飯後寫字半時。
  12. 夜不出門。

iPhone makes quick astronomy

April 16th, 2011 at 23:49 · Filed Under Astronomy, At Home, Education, iPhone · Comment 

I’ve always wanted to get into astronomy since the late 1990s but could not make it due to busy schedules (yeah lame excuse, I know), lack of mentor, not having a clue how to find and identify objects in the sky, etc.

Then, last night I stumbled upon an iPhone app, SkyView which uses Augmented Reality (AR) to reveal the current positions of planets, stars, constellation, satellites and even the International Space Station (ISS)!

I demonstrated the wonder of the app to my kids outside our home just now. Although the sky was cloudy, we could still see the moon so I used the moon as the reference. SkyView accurately revealed the exact position of the moon on my iPhone screen. Tonight, we found a lot of constellations, including Virgo which was behind the moon. Next to the moon was Saturn, as illustrated in Figure 1.

iPhone SkyView Astronomy

Figure 1: Virgo, moon and Saturn.

Not too far away from our moon, we found three satellites, the COSMOS 1536 (below the moon), COSMOS 1975 (slightly above the horizon but behind the apartment and MIDORI II (ADEOS-II) (further to the right of the moon). See their illustration in Figure 2, 3 and 4 respectively.

Figure 2: COSMOS 1536

Figure 2: COSMOS 1536

Figure 3: COSMOS 1975

Figure 3: COSMOS 1975

Figure 4: MIDORI II (ADEOS-II)

Figure 4: MIDORI II (ADEOS-II)

Beside these, we also found the Hubble space telescope and the ISS (International Space Station). Both of them were below the horizon and behind (or under?) our house!

Figure 5: Hubble space telescope and ISS

Figure 5: Hubble space telescope and ISS

The SkyView app is a great iPhone app for astronomy hobbyists and perfect education tool for both parents and kids. It’s certainly worth investing. It costs only $1 and there is also a stripped down version which is free.

The waking of a sleeping beauty

September 10th, 2010 at 15:18 · Filed Under Ada, At Play, Blogging, Days in My Life, Software Development · 2 Comments 

I wrote a board game called AdaOthello way back in 2001 using Ada (of course) and GtkAda. AdaOthello is quite a beautiful piece of GUI that I had created for the first time using GtkAda on Linux. Unfortunately, I don’t have the time to improve the game engine and port it to Mac OS X. It became a sleeping beauty!

On August 27, Gustaf Thorslund contacted me about his wish to use my code and continue the development of AdaOthello. Today, I received another email from Gustaf informing me that he has revived the project.

First, I would like to express my gratitude to Gustaf to take my code, make a second home for it, and taking it to a new height. I originally released AdaOthello under GPL 2.0 or later and I continue to wish to keep it that way.

You can find AdaOthello at its second home here.

Embrace Life

July 14th, 2010 at 12:16 · Filed Under At Home, At Work, Blogging, Days in My Life, Family · Comment 

It was a beautiful morning, starting with a cup of coffee and a few slices of toast, I began to read some articles on the Internet. The articles are related to my software project as well as some other stuffs regarding productivity and supplementary.

Among all I was reading, there was one that caught my attention, the one that I paused all my activities, and let it touch deeply into my heart. I can’t help to shed my tears.

This is the most beautiful and touching commercial I’ve ever watched. Besides the artistic and beautiful photography, the video portrays how beautiful life is and how fragile it can be. Take a moment off your work (yes, I know you are busy) to watch this video. I bet and I hope it will make you realize how beautiful our lives are.

Enjoy!

This is the new “wear your seatbelt” ad the UK is doing – started by a man not hired to do it, but because the cause is important to him, he came up with this idea, and now it’s being hailed across the world as a ‘beautiful’ commercial. And now the video has become so popular with the general public that people are forwarding it to friends/family on their own so quickly that it has spread all over the world in a very short time.

You can watch here too.

Today, Tomorrow and Todo

July 8th, 2010 at 19:07 · Filed Under At Work, Blogging, Days in My Life, Productivity · Comment 

Last night, I was reading a blog post at Time Management Ninja (aka TMNinja). In “The Secret of Today Versus Todo“,  what did you get done today is important. But sometimes it will not be the case. Someday, things just don’t work out as you wished.

For the past two weeks, I had been bugged by a silly tiny bug in one of my codes. Things weren’t moving at all. They were all still and my progress in a software project was stagnant. Before the bug was identified and removed, I could not move on to other tasks as they were highly dependent on the unit testing of that particular buggy code.

Yesterday, I finally managed to debug it and deducted 5 tasks. In actual fact, I only completed one task but deleted four. The four tasks which I deleted were no longer applicable because I completed one task which was dependent on the other four. I deleted them because they became obsolete.

So, yesterday, I completed one task that would allow me to complete more tasks today. In other words, imagine that we were traveling on a time machine to yesterday, it would be: today I completed one task and tomorrow I will be able to move on to other tasks. Confusing, isn’t it?

For a software developer, someday he/she will write many lines of code, perhaps a thousand. But someday, he/she will only write just one line of code or perhaps none. When the productivity is only one line of code for a day, is it too low? It is not. Sometimes, that single line of code will serve as a connector to many pieces of code together. That one single line that software developer has produced today, will allow many tasks to be completed tomorrow.

Praise yourself if you have got only one task done today because you will complete more tomorrow. The caveat, however, is that you do not make this an excuse for not having done so much today.

Catching HTML bugs with Safari 5

A bug in a seemingly harmless HTML code had been bugging me for almost 2 weeks. I was sort of yanking my hair while trying to trace the bug which messed up the HTML page. The debugging task was even harder because I work on a HTML template with an extension .THTML. The template does not only contain standard HTML but also tags which are only recognized by AWS (Ada Web Server) . This template file is parsed by the web application (I am developing), which has AWS library, before it is dispatched as raw HTML code to a browser.

In my design, I break down the HTML template into header, body and footer so that I can reuse the common codes in header and footer. That means, all the body templates are without <html> tag. This missing <html> tag disables the syntax-coloring feature of code editor, leading to a more laborious code reading.

Before this, I had gone through every line of html source code in the template file umpteen times. This “obscure” bug, if not removed, would throw a monkey wrench in my works. I browsed the Internet and read articles in hope that I would get some clues. So, I was reading a few articles about Extensions in Safari 5. Extensions are not really impressive to me as I do not need to add missing functionalities to my browser. Safari itself is more than enough for my daily browsing activities. Somehow, my curiosity had driven me to enable the Develop menu in Safari 5. After activating it, I noticed some debugging tools in the menu. I enabled the web inspector by selecting Show Web Inspector in the Develop menu (Figure 1) then navigated to the web page I wanted to debug. To use these debugging tools, the Develop menu must first be activated. Here is a simple guide to enabling the menu.

Safari 5

Figure 1

Safari 5 immediately detected two error messages as shown in Figure 2. These two errors were easily corrected. After removing these unmatched </div> tags, my web page still did not show up properly with the intended layout.

Safari 5 Show Web Inspector

Figure 2

Then I selected the Elements tab and it showed me the page source in debugging mode as shown in Figure 3. I instantly spotted the <div class=”data-base-layer”> tag which was supposed to be in the <div id=”container”> tag.

Safari 5 Show Web Inspector

Figure 3

I clicked on the little grey triangles in the left pane to expand the <div id=”container”> tag and the <form> tag. There were two <div class=”data-base-layer”> tags (labelled as “1″ in Figure 4) and the one in label “2″ was supposed to be right after them.

Safari 5 Show Web Inspector

Figure 4

I checked the source file again and they seemed to be in the correct place. Further investigation finally reviewed that there were two very tiny typos lurking somewhere within the second <div class=”data-base-layer”> tag as shown in Figure 5.

Safari 5 Show Web Inspector

Figure 5

The web inspector in Safari 5 has helped me to identify errors effortlessly. If only I had such inquisitiveness two weeks ago, I would have saved so much time and efforts in debugging my HTML codes. An proverb says: “Curiosity killed the cat.” It is not always true, at least in this case. I will say: “Curiosity saved the donkey.”

Transverse Myelitis

May 18th, 2010 at 20:00 · Filed Under Blogging, Days in My Life, Family, Medical · 2 Comments 

Just came back from the hospital after visiting my uncle. He has been admitted to hospital last evening. He was admitted to the General Hospital last Thursday and was discharged this Sunday. No conclusion from the GH.

His doctor came in when I was there. He said my uncle suffers from acute Transverse Myelitis.

Transverse Myelitis (TM) is a neurological syndrome caused by the inflammation of spinal cord. It is a complicated disease and takes times to eradicate inflammation. His doctor has done lumbar MRI today. They will do another thoracic MRI tomorrow to confirm clinical diagnosis.

Next Page »