Thursday, September 24, 2009

Overheard conversations

I was at Cash Converters the other day, rummaging through some stacks of CDs when I heard this conversation between a female customer and a male sales assistant.
女:请问你们有PS2吗?

男:有。

女:怎么卖?

男:69快。

女:是不是买回家就可以玩?

男:我们保证原装的disc可以玩。

女:这样说就是不可以玩啦?

男:如果是原装的disc一定可以玩。如果不可以玩,可以拿回来换。

女:那么pirated的可以玩吗?

男:我们只保证原装的disc可以玩。

女:那么就是pirated的不可以玩啦?

男:小姐,你还是听不懂我的意思。

For those who don't read Chinese, here's a translation.
F: Do you sell PS2 here?

M: Yes.

F: How much?

M: 69 bucks.

F: So I just bring it home then I can play?

M: We guarantee that you can play original discs.

F: That means it cannot play?

M: If it's original discs, it can play, if it doesn't work you can bring it back for exchange.

F: What about pirated ones?

M: We only guarantee that original discs can be played.

F: That means I cannot play pirated games?

M: Ma'am, you still don't understand what I mean.

Saturday, July 25, 2009

Young programmers win big

Young programmers win big
Straints Times, July 20, 2009

TALK about starting young: Celine Chan, four, took on competitors far older in a national computer programming contest held here recently.

Celine and her sister, Charlene, eight, proved more than a match for the older competitors, trumping most of them handily in the contest, organised by the Information Technology Standards Committee which is supported by the Infocomm Development Authority (IDA).

Called XtremeApps, the competition required those taking part to program computer applications from scratch.

Armed with just the basics in the Squeak programming language, as well as encouragement - but no help - from mum and dad, the Chan sisters came up with an application called Health Fairies.

Two things interest me about this story. First, it is the age of the girls. I think it's quite hard to even understand what computer programming is about at the age of eight, let alone four. I didn't know what programming was when I was eight. Hmm..I don't think I've even played with a computer when I was eight. Anyway, even though tools are greatly simplifying programming, basic programming stuff like looping, conditionals, function calling, differences between classes and objects,etc can still easily overwhelm a young kid's mind. Then you also need to consider things like how the users interact with the program and the animation. You need a certain degree of logic and training to do programming. So I'm truly impressed that they can not only complete the project, but also beat the older competitors.

Second, it's interesting that they used Squeak to implement their project. Squeak is an implementation of the Smalltalk programming language. Most programmers I've talked to have never heard of Smalltalk, but I did manage to use the VisualWorks implementation  for about 3 years for work. Generally, you hear about the SAP, J2EE, .Net stuff powering the enterprise systems, so it is mildly surprising that Smalltalk used to be powering one of the biggest pay systems here. All those policies, payment stuff, bonuses, income tax, CPF computation in beautiful Smalltalk code. Funny how things appear though rose-tinted glasses. Anyway, we have difficulty recruiting people because most people consider Smalltalk to be an antiquated language. There really isn't a market for Smalltalk so no one wants to learn it, at least in Singapore. I'm a bit language agnostic (Ok, actually I prefer Java) so I didn't really think it mattered that much.

Sunday, July 5, 2009

Manhã de Carnaval

The best interpretation of the classic on Youtube by Ulli Boegershausen

Saturday, June 20, 2009

Javascript performance tuning

Recently, I was working on a customer complaint that our application was slow when churning out reports. The worst case occurs when the user selects to generate a report for the time-span of 18 months, and the application will take about 3 minutes plus to generate the reports. Not being very familiar with Javascript and DOM, I googled and found the following resources which were extremely helpful.

Nicholas C. Zakas


Speed up your JavaScript, Part 1
Speed up your JavaScript, Part 2
Speed up your JavaScript, Part 3
Speed up your JavaScript, Part 4

Yahoo! Developer Network
Exceptional Performance

Dev Opera
Efficient JavaScript

IE Blog
IE + JavaScript Performance Recommendations - Part 1
IE+JavaScript Performance Recommendations Part 2: JavaScript Code Inefficiencies
IE+JScript Performance Recommendations Part 3: JavaScript Code Inefficiencies

In our app, I found that main bottleneck was that that there was simply too much DOM interaction when creating the report's table. Creating the report involved  creating TD and TR DOM elements and adding them to a table, and deciding when to break the page. After the report is created, some of the TD cells will be merged based on some criteria.

To tune the app, I cloned the TBODY node of the table, added all the child nodes into this cloned node, and replaced the original node. Then, I has to clone the node again for doing the breaking the pages and merging the cells. Basically, it involved multiple calls to cloning the nodes, creating new doc fragments, and replacing the original nodes. Basically, it seems like the code is doing a lot more work than the original. However, it is more than 60% percent faster after tuning!

As a side-note, it really is hell trying to work on a JSP that mixes scriptlets and badly-written Javascript. First, visually it's so messy it's disorientating. Second, sometimes you can't do profiling until you've refactored the Javascript, which is sometimes hopelessly entangled with the JSP scriptlets.  And some people always wonder why I'm rewriting so much code :/

Friday, March 13, 2009

Quick trip to IT Show 2009

It's the first day of IT Show 2009, and there was a huge turnout of eager shoppers looking for good deals. Being a Thursday afternoon, you'll expect the crowd to be a bit thinner. I expected to be in and out within an hour as I'm a focussed shopper, but the snaking queues almost began the moment I stepped out of City Hall MRT. After about an hour and a half I finally completed my re-contract and purchase of Nokia's XpressMusic 5800. There was a minor hiccup when a staff did not give me free earphones worth 139 bucks, but thankfully it was resolved promptly. Finally, I'm back to owning a camera-phone after more than 3 years!

There's many interesting IT products in the show, like ACRyan's Playon! DVR. I own an older version of ACRyan HD recorder, but the new version is on steroids! Expanded connectivity options (wired and wireless), video-stream playback capability and the ability to record analog and digital TV certainly makes it very attractive.

UOB credit card owners looking for a new camera can check out Harvey Norman for the Fujifilm Finepix F60FD. It's 349 (originally 499) after trade-in with ANY camera (including those using film) and you get a whole lot of freebies (mini-tripod, 8GB SD card, etc) just by swiping your card.

Overall it's a pretty nice shopping experience. With lots of stuff at discounted prices and with cute show girls manning some of the booths, even the congestion can be forgiven :)

Tuesday, February 17, 2009

拭目以待 - "未来不是梦"主题曲 ("The Dream-Catchers")

最近在追“未来不是梦”,觉得题材相当有趣,更有趣的是拍摄的动机。主题曲相当特别,是我近期来最喜欢的歌曲。


歌词 by 小寒

http://blog.omy.sg/xiaohan/2009/02/02/我用悲觀去樂觀著。/

Tuesday, February 10, 2009

Singapore IT sector resilient against current recession?

With all the news about retrenchments  locally and abroad and how hard it is for people to land jobs, I'm seeing quite a lot of new faces in and around my workplace, quite a number of them fresh grads. And among my friends and colleagues, quite a few have switched jobs. My mailbox is full of alerts from job portals about new opportunities. So amidst all the doom and gloom, I'm just wondering, is the local IT sector more resilient against the current recession compared to the other industries?