Latest Comments

Newbie in CA Part 1

My major reservations of moving to california have, fortunately, not been realized. However, this makes for terrible blogging inspiration, but I will try. As always.

The Non-Form

I arrived in California an hour early for a reason. This occurred for a reason. I mean, there must be a reason why tail winds were really pushing hard that day such that we would arrive at 11am instead of 12:30pm.

See, this extra hour gave me ample time to get stuck at immigration puzzling why I did not present an I-797 petition.

Me: "I'm sorry. What?" (Dazed look you give after 18 hours of flying)

Officer #1: "An I-797 petition - you must always bring it along with you everytime you travel as a H-1B visa holder"

Me: "??? - That's all I have." (Pointing to H-1B1 visa in passport)

Officer #1: "Go to secondary."

Me: "???" (yeah, I'm going to know that refers to a secondary interview, and that I have to walk to the end of the hallway)

So I trot down hastily to a separate office and got interviewed by another border officer, who kept grilling me about my non-existent I-797 form. Images of me getting hurled back to Singapore in handcuffs flashed by my eyes - all because I did not bring this piece of paper. Sheeesh. As the interview continued, I felt quite of bad, because, frankly, I just had no idea what an I-797 form even looks like. I get a sense the border officer was half-expecting me to be an illegal immigrant, but got stuck with ... well, me.

I must have worn him down, either that or because a queue of people needing to undergo secondary interviews was forming. This "must have" document all of a sudden became not completely essential - I managed to get my visa approved after receiving a warning to always carry my I-797 form with me. I was extremely curious at this time in point what a "I-797" petition is, and the first thing I did after getting internet connection was to search for images relating to "I-797" on Google. That got me to this page - which, if you enlarge the photo, is a I-797 for a H-1B1.

No. I do not have that. What the heck is that?

As I was freaking out, I searched for "i797 h1b1" and got this, which states, "Unlike a traditional H-1B visa, the employer does not have to submit Form I-129, Petition for Nonimmigrant Worker, to the Bureau of Citizenship and Immigration Services (Department of Homeland Security) and you do not need to obtain a Notice of Action, Form I-797."



So yeah, I arrived early so that my schedule would not be disturbed by this non-form.

Kudos to Miss Loi

I do not have much things to discuss lately, but I have to plug, also known as Jφss Sticks - For effective prevention of Last-Minute Buddha Foot Hugging Syndrome, the significance of which is duly explained in her FAQ.

Well done to Miss Loi, who is clearly a very enterprising mathematics tutor in Singapore. For example, she sells exams papers online, and of course, tuition services (that do not come cheap). Her website is an excellent example of branding and marketing.

I really like reading her blog, which I find tickles me to no end. The funniest part of her blog is how she continuously refers to herself in a third person perspective with "Miss Loi" or "sexy maths (sic) tutor". It reminds me of the scene in Heroes Season 2 episode 2, Lizards, where Hiro Nakamura impersonates Takezo Kensei and uses his power to stop time and disarm 11 bandits. To ensure his opponents remember his hero, he repeatedly refers to himself as Takezo Kensei, to which one bandit exclaimed, approximately, "why does he keep saying his own name??"

Making a career choice

While growing up, many people will give you generic advice that sound like this: “chase your dreams”. This seems to imply that you are looking at the goal-point and deciding what you should do now. This is potentially so disastrous that it should come with a disclaimer - "Chase your dreams* - Terms and conditions may apply".


First of all, what is a dream? If your life goal is something transient like “I want to be rich”, or, horrors, “I want to be a PhD”, then what happens after you have attained that objective? You have achieved the purpose of your life. That's a mean feat to beat, but I suppose once you are rich, you are able to pursue other interests and engage in philanthropist activities like funding the cure for cancer, or saving the world. Or once you are conferred a PhD, you can, uhm, well, that's not go there.

The point is that if your satisfaction is achieved only at the endpoints, that means you spend most of your time unsatisfied while you are working. Instead of evaluating your life based on what you have achieved, view life as a journey - enjoy the ride.

I think the solution is to move generally towards your goal. This is in reference to one particular trekking exercise when I was training in the army. I was lost and asked the leader where exactly we were on the map. "Well, I'm not sure where we are too. But the end-point is at the North, so I am moving generally Northwards". I thought he was crazy back then, but in retrospect, I would have been consumed by the inane need to know exactly where we were and would have wasted time by stopping whereas his decision to simply proceed towards the goal was the most sound decision. We got to our destination ahead of schedule.

In other words, you pursue the things which you are interested in. As long as you are not wasting your time, you can worry later about what actual paths you take. However, taking up scholarships in Singapore is particularly noteworthy and there is a specific question students considering to take up scholarships which have bonds (like those in Singapore) need to ask themselves. Are you truly interested in the work that the institution will assign you after graduation? I am not talking about faint interest like "oh yeah, I find health policies to be important and 'interesting'. Working at the Ministry of Health will be a breeze!" I am talking about the fire and the passion to work on something even if you are not going to be paid. Are you as eager to start work as Rambo is to dash into the battlefield? Yes, that's the kind of dedication I am referring to.

Many, in fact, most people have a resigned view on this. Oh, it is impossible to be working on things that you love. Seeing them work is almost like clockwork, start at 9, perform work, end at 5. It does not mean that they are not good at what they do, but it does mean that when things become difficult, they will be the first to leave. Motivation, that's the key. Even the misguided individuals (IMHO) who are working for the pot of gold at the end will persevere longer than unmotivated people. But, only the truly passionate people are deriving any sense of satisfaction from the work.

The Almost Non-Job

Undoubtedly the most amazing fact is that almost everyone knows this, and yet so many choose the daily grind of going to work doing things they do not like. Going to Google is a fantastic opportunity - one that I think few would hesitate to take up. But it almost never came to be because I never actually wanted to apply.

My wife had found out that one of her friends knew someone in Google, so she requested her friend to forward my resume without asking me. And I got angry. I got angry because I did not think I was ready to apply. It's too soon, too early. What if they reject me? That would ruin my chances in the future.

But guess what, what if it's not too soon? Maybe the time is now, and you never know. That's why I am on a crusade to encourage people to venture out of their comfort zone. I openly ask people if they want to apply to Google, and if so, they should get me to refer. Cynical people like to retort and ask, "There must be a catch - There has to be employee referral bonus". And why yes, there is a $2000 referral for each successful referral. But that's not the point. Getting a Google employee to refer you vastly improves your chances of being noticed by recruiters because Google is on track to receive more than two million resumes in 2007.

If you do not dream big, you will not do big things. I hope your life can be shaped by your own dreams and curiosity. Just remember you do not have to wait to start - take the first step now.

I love DHS!

Last friday I returned to my high school alma mater, Dunman High School, to give a career guidance talk about computer science. The invitation gave me some pause and allowed me to reflect heavily on career/life choices, which I hope to consolidate into an essay later.

However, I have to discuss these adorable 50th anniversary dolls that were presented as tokens of appreciation for, uhm, talking about ourselves. It was initially all, Ohh AHHHH look at the cute dolls in school uniform.

However, upon close inspection the dolls seem to be have been created by someone very, uhm, zealous of Dunman High. I wonder if I can buy real-life replicas of the ... attires.

DHS Dolls

Look - Dunman High Socks!

Love those socks

And ... Dunman High underwear for girls, that say, "I love DHS"!

I love DHS!

Edit 24 Sept: In other news, Dunman High has a Sakae Sushi store in its canteen. Don't believe me?

Sakae Sushi Store in Dunman High

The store is also listed in Sakae Sushi's website. As it turns out, the founder of Sakae Sushi is an alumni of the school.

Not Doctor Doctor

I received the official notification for the conferment of the PhD degree yesterday, and my parents, a family friend and my wife were commenting and joking how it is so nice to have a fake doctor in the house.

Because you know, I'm not a Doctor Doctor. :)

The Fake Doctor -- Useful only for service and reservations.

Moving to California

As I prepare to move to Mountain View, California to work at Google, I have come to the realization that working in USA starts with a flowchart of applications and the unfortunate conundrum of cyclic requirements.

Of utmost importance, one needs a social security number to start work, but you are advised to wait 10 business days after stepping foot in US before applying. That practically means you have to arrive two to three weeks at least before commencing employment.

Do not kick off your shoes and relax until the 10 days are up. You can take your time to open bank accounts, which typically require a local mailing address. The local mailing address that you do not have because you have only just arrived.

No problem, you seek out a rental apartment, which often have landlords that want to see your credit history and bank account, that you do not have because (1) you do not have a social security number so you do not have a credit history, (2) no bank will allow you to open an account because you do not have a mailing address (that you are currently negotiating to get) and (3) heck! you have not even started working in the US yet!

Speaking of credit history, as first-time worker in US, you have zero credit history even after getting your social security number. As it turns out, this interesting omission means you cannot apply for credit cards. Well, not the usual ones in Singapore at least, where the bank gives you a credit limit without any collateral based on salary information. No, you got to earn that right. You start with a level 1 weenie credit card - a secured credit card.

However, I am sure I will get by as countless of individuals have. Here's my plan:
1. Open Citibank Singapore CitiAccess - this US$ checking and saving accounts gives me access to my (pathetic) US funds without having to resort to Traveler's Cheques (1% commission + conversion commission!) or carrying hordes of cash into US.

2. Go to US.

3. Find a rental apartment, show Citibank account and pay cash upfront for security deposit and first month rent.

4a. Apply for bank account, most likely from Citibank USA.

4b. Apply for driving license from your state (in my case, California DMV) - you need an address for this

5. Apply for SSN

6. Kick off shoes and relax for 30 minutes before heading out for first day at work.

Liquid Resize

One of the talking points of SIGGRAPH has been Liquid Resizing, also known as seam carving/removal or content aware image resizing.

Check out the YouTube video demonstration, and then read the paper []. While the effect is visually impressive, the mathematics and concept are surprisingly simple and easy to explain.

There are "uninteresting" parts of an image - these occur when nothing in particular is present at a pixel. There are numerous measures we can use to detect this, but one simple function is edge detection. If there are no edges (i.e. transitions to other objects) around a pixel, that means nothing is there! This is easily computed using the intensity gradient, which is a fancy way of saying I(x) = 0.5*I(x+1) - 0.5*I(x-1), where I(x) is the intensity of the pixel at location x. Using dynamic programming, it is computationally tractable to find the minimum energy seam where energy is just the intensity gradient, and a seam is a 1-pixel width line from one edge of the image to the other edge (can be vertical or horizontal). This minimum energy seam can be thought of as the most "uninteresting" single-pixel line in the image.

To downsize the image by width, delete the most "uninteresting" vertical seam. We surely will miss it the least of all the vertical seams present in the image. Likewise, to reduce the height of an image, remove the minimum energy horizontal seam. We repeatedly remove such seams until the desired dimensions are reached.

The word "easy" is thrown around too often

It's really simple. I spent one morning coding it up in Python using PIL and numpy, and the source code is available here. (Disclaimer: It's slow.)

To resize an image to width 100 pixels and height 200 pixels and preview it:

import liquid

An example

Let's see an example. Start by using an image from flickr - "a man, a whale, a beach"
a man, a whale, a beach - medium

We can take a look at some of the low energy seams, which seem roughly correct.
a man, a whale, a beach - seams

We now proceed to remove seams to resize from 373x500 pixels to 249x249 pixels.
a man, a whale, a beach - resized

Not bad not bad - The man, most of the cloud and the wave on the right are largely preserved. This is all the more surprising because the algorithm has no concept of "man", "cloud", "whale" or "wave"! It's simply looking for seams with as few "edges" as possible (in a manner of speaking).

It's also possible to resize the image larger. We do this by inserting averages of pixels beside minimum energy seams instead of removing them.

1. Find minimum energy seam. (Horizontal or Vertical depending on which dimension to lengthen)
2. Insert a 1-pixel seam beside (left or right is fine) minimum energy seam and set the pixel value to be the average of the adjacent pixels.

Let's try that on our man, whale, beach picture:
a man, a whale, a beach - resized

Ah well. I really should be getting back to work.


I love using Python as it enables me to create prototype applications quickly and efficiently, and then some.

Recently I have been tasked to combine elements of statistical analysis and machine learning in a Windows application, while developing on a MacBook Pro.

With the magic of VMware Fusion (VMW ftw!), Python, PyQt (based on Trolltech's Qt application framework), R, rpy and Orange, Windows development has been... bearable.

Strange stray thoughts about Names

A stray thought got me thinking - A name is supposed to represent a person, and even though it cannot possibly be an accurate portrayal of that person, a name evokes a lot of emotions/perceptions (e.g., Bush, Osama, etc.). What if the name describes an opposite trait, or is not even wrong. (I apologize, but I had to use my latest favourite phrase somehow - even if it's incorrectly used). Can you think of ironic names?

  • a guy named Christian but is not christian, and is [insert opposing religion]
  • a girl named Jewel but is not a jewel (eupherism for other, perhaps more appropriate, phrases)
  • a person named [Month of Year] (e.g., June) but is not born in that month. "Hi, I'm June. I was born in December"
  • a girl named Joy but is not very joyful. "Hi, I'm Joy. Go away".

I suspect last names are the easiest to be "ironic". For example, "smart" as a last name. Think of the possibilities. And of course "carpenter" is also a fairly common last name. "Hi, I'm the carpenter, Mr. Carpenter" or "Hi, I'm the butcher, Mr. Carpenter".

Another observation is related to a well-respected professor named Tan Chew Lim in the School of Computing, NUS. Each part of his name (Tan, Chew, Lim) is a possible surname. My name can also be decomposed similarly.

Update: One addition by wc - Roger Director, the director.

Update 2: Roger Director is a producer, not a director. (Hence the "irony")

Strictly business

I just returned from US yesterday on a 180 degree Singapore Airlines seat. And no, I was not on the business or first class section.

180 degree seat

I visited Google to meet the person (let's leave it at "a friend of a friend" because the real relationship is rather more complicated than that) who had initially forwarded my resume. Incidentally, I met another ex-NUS postdoctoral fellow who is now in Google Mountain View. Of course I had the free lunch (sushi) and walked around the campus (beautiful). It was a joy to be in Google campus as employees actually seem happy to be there. I'm really looking forward to starting work there.

Oh, also, the toilets have the self-cleaning devices that clean your ... posterior.