Sunday, December 30, 2007

Installing PHP 5.2.5 on Windows XP for Tomcat 6.0.13 - Issues resolved

I was playing around with the idea of doing a small personal PHP project, and I decided to do a fresh install of the latest version of PHP, which is 5.2.5. Since I'm already using the Apache Tomcat 6.0.13 server, I decided to run PHP on that instead of setting up the Apache HTTP server. I've done something similar before, so I didn't think it would be much of a problem. However, it is a bit more tricky than expected.

Windows PHP installer is broken

Initially, I used the Windows installer. The PHP install directory used was "C:\Program Files\PHP". Installing was a breeze and I could even use the php5srvlt.jar and put it into the WEBINF\lib directory without doing anything. The reflect.properties and servlet.properties files already have the line

library=php5servlet

instead of

library=phpsrvlt

So I followed the steps outlined. When I tried to access the test page, I got this.
HTTP Status 500 -
type Exception report

message
description The server encountered an internal error () that prevented it from fulfilling this request.

exception
javax.servlet.ServletException: Servlet.init() for servlet php threw exception
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
.....(edited for brevity)

root cause
java.lang.UnsatisfiedLinkError: C:\Program Files\PHP\php5servlet.dll: Can't find dependent libraries
java.lang.ClassLoader$NativeLibrary.load(Native Method)
.....(edited for brevity)

I checked the install directory and php5servlet.dll was there. What are the dependent libraries? After reading some of comments on Angusman's site and some discussions on Java forums, it turns out that the problem is due to missing DLLs. I downloaded a tool called Dependency Walker. It is very useful, I loaded php5servlet.dll and got the following.

Dependency Walker says php5ts.dll is missing

So php5ts.dll is missing. Searched for the file on PECL4WIN but could not find it. So I downloaded the zipped PHP files, then I noticed that there is an error in the original installer for PHP 5.2.5. Apparently the updated installer still has issue.

Steps I took to get it working

  1. Uninstall the initial install and remove all the files in the install directory

  2. Unzip the downloaded PHP zipped file into the install directory.

  3. Download php5servlet.dll from PECL4WIN and put it in the install directory. If you don't have it you will get an error message like:
    exception
    javax.servlet.ServletException: Servlet.init() for servlet php threw exception
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
    .....(edited for brevity)

    root cause
    java.lang.UnsatisfiedLinkError: no php5servlet in java.library.path
    java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
    .....(edited for brevity)


  4. Edit the following paths in the php.ini file: include_path = "C:\Program Files\PHP\PEAR", doc_root = "C:\Program Files\Apache Software Foundation\apache-tomcat-6.0.13\webapps", extension_dir = "C:\Program Files\PHP\ext"

  5. Uncomment a few extensions in php.ini and ensure the DLLs are in the extension directory, eg curl or bz2

  6. Save the php.ini file.

  7. If you right-click and php.exe, php-cgi.exe and php-win.exe and see the properties, you will see this message "Security: This file came from another computer and might be blocked to help protect this computer." I chose to unblock, but I'm not sure if there's any issue leaving it on.
    Security message

  8. Create web.xml, php5srvlt.jar and test page like what Angusman says in the appropriate directory in the webserver. If php5srvlt.jar is not in the correct directory you'll get an error message like this:
    exception
    javax.servlet.ServletException: Wrapper cannot find servlet class net.php.servlet or a class it depends on
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
    .....(edited for brevity)

    root cause
    java.lang.ClassNotFoundException: net.php.servlet
    .....(edited for brevity)

    I already have them so I skipped this.

  9. Create the following environment variables PHP_HOME="C:\Program Files\PHP", PHP_HOME_EXT="%PHP_HOME%\ext", PHPRC="%PHP_HOME%". PHPRC is used to determine the location of the php.ini file but it is not the only place where it can be set. The locations being searched for the php.ini file follows a certain order. For my purpose this setting PHPRC is sufficient. If this is not set, the default location will be used, and may result in php.ini not being loaded, which in turn results in the configuration settings being set to some unexpected values, modules not being loaded as seen in phpinfo(), etc. Some examples.

    Wrong include path
    Wrong include path
    Wrong extension directory
    Wrong extension directory

  10. Append the environment variables to the PATH environment variable.

  11. Reboot so that the PATH changes are set. If not, you'll get some error like this where the environment variable appears correctly on it's own but not in the PATH.
    Computer needs to be rebooted for PATH changes to be effected

Sunday, December 16, 2007

High Street 5 - Dance up your life

I was going to Funan to get some stuff when I saw this banner for a game called High Street 5. The banner had an attractive lady drawn on it so that's what caught my attention :p Then I took a closer look and realised it was some sort of dancing game. I'm not into dancing, and I've not even played the famous Audition SEA. But since I was bored I got a copy of the DVD client at 2 bucks. (Alternatively, you can download it. It's free to play.) Here's a preview of the game:

[youtube]ECc0a22zcnE[/youtube]

Startup pain and an unintuitive user interfaceInstallation was simple, but getting to actually play the game was a tad more difficult. First I was required to download a patch to version 0.12 when I tried to start the game. But the user interface showed some IE page with a message on it. No go trying to update it by clicking on the "Update Server" button either. I had to go to the website and download the patch. After installation, I had to reboot as there was still a connection problem.

Then when I tried to register an account in-game, Windows Internet Explorer popped up and I was directed to the website to register an account. That's not a seamless experience but it's still not very annoying.

The worst part is that the user interface is not intuitive at all. I couldn't figure out how to get started after registering an account. The instructions said something about clicking some part of the screen, so I spend a good couple of minutes figuring out where exactly that part is. Out of frustration I went to the forum and finally got some help from one of the posts there. Now, any game that makes me do that gets an immediate poor rating for user experience.

Finally I get to play

After getting into the game, there's the standard character creation, choose name, sex, physical characteristics, etc. The story is supposed to be that you are talent-scouted for some agency or something. Not exactly intriguing but who cares about the story in this kind of game anyway? After initial part of the story gets out of the way and you are taught the basics of the game (hit the directional, space and some number buttons at the right time), you get to choose certain locations to dance in,like the school, beach, etc. As you get better more areas will open up to you.

And it's quite fun actually to see your character groove to the music along with the rest of the players. Here's a replay of one of my game sessions. The parts when the character is just standing around are the parts where I missed :)

[youtube]bKDm6W0ma_s[/youtube]

[youtube]yErxF1qVumc[/youtube]

Summing up

It's a simple and addictive game. Currently the selection of songs is somewhere ard 30-40 I think, so you'll here the same songs being recycled ad nausem if you do play long enough. Hopefully they will add more songs to the library else it'll get boring after a while.

Monday, December 10, 2007

Switched webhosting to Godaddy

Finally switched my webhosting to Godaddy, it's value for money in terms of disk space, but the everything seems slower than Focushub.

Sunday, December 2, 2007

Sitex 2007

Needed to get some computer stuff, so hopped down to Sitex to pick up some bargains.

Some stuff I've gotten:

HP F4185 AIO printer, scanner, copier - $99 (Usual price is $149. Challenger members can get it at $139, so the savings at this show is quite significant)

Maxtor One Touch 3 - $130 (Not sure if I saved much on this buy)

Disk repairer for CD/DVDs - $25

Quite happy with my buys, but I spent quite some time installing the AIO. During the installation, the program got stuck, some error message about unsigned drivers and USB printing. Downloading the latest installation frpm the support website didn't help. In the end, what happened was that when I was prompted to plug in the USB cable, DON'T! Wait for the installation to complete, THEN plug in the USB cable.

Wednesday, November 21, 2007

Browsershots - web app to check your web page rendering

For most of us who do web pages, we don't have the luxury of a Common Operating Environment. That means, we're not in an intranet environment with standardised OS, browsers, etc. So there's the issue of making sure your webpage renders correctly, if at all, on different OSes and browsers. If resources such as hardware or software (like VMWare) are limited, a sensible solution would be to use Browsershots.

Basically it's a web app that lets you submit a website and check if it displays correctly on a variety of OSes and browsers. It will produce a bunch of screenshots which you can view and check if the rendering is correct.

test options

Hmm....this website doesn't quite pass the test.

test result

A note though. It might take some time to produce the results. If speed is an issue , you can consider getting priority processing.

Saturday, November 10, 2007

Trace Bundy - Pachelbel's Canon

An amazing rendition of Pachelbel's Canon on an acoustic guitar! You don't want to miss it!

[youtube]GihjEGWxBnI[/youtube]

Sunday, November 4, 2007

Granado Espada - Halloween Quest completed!

Have finally completed the Halloween Quest and gotten my pumpkin hats. It's not a difficult quest, but I've barely found time to complete it.

Photo Sharing and Video Hosting at Photobucket

Photo Sharing and Video Hosting at Photobucket

Photo Sharing and Video Hosting at Photobucket

Photo Sharing and Video Hosting at Photobucket

Thursday, November 1, 2007

Policy-makers need to eat their own dog food

For the six months, some policies have been passed in my company which has greatly inconvenienced us. The workload ballooned but the manpower shrunk. It's pretty frustrating at times, having to jump through hoops to do some simple things. It's even worse when you have to jump through hoops to do what I think are stupid things. And just because you've jumped those hoops before, they think it is ok for you to jump through another set of hoops, because they ASSUME you can do it again. But it isn't the same set of hoops. This time they're barbed and set on fire and you need to jump through them twice as fast. But hey, they say, hoops are hoops. Yeah, it's not called a dog's life for nothing.

Dog leaps through hoop

Picture source

Eating your own dog food

Still on the subject of dogs, policy-makers need to eat their own dog food. What, no proper meal? Not even a slice of Gardenia? Well, I'm not exactly suggesting that we feed them dog food, though I have a fantasy of stuffing it down their throats at times. As Joel Spolsky explains,
Eating your own dog food is the quaint name that we in the computer industry give to the process of actually using your own product.

Eating your own dog food is an important process during policy formulation. It is as someone said, it's nothing to them if they can't feel the pain. When they feel the kind of impact their policies will cause, hopefully they will be more discerning and refine them. Something like what HDB's CEO and senior managers do:
At the Housing Development Board (HDB), its chief executive officer and senior managers lead by example in addition to rewarding and publicising good service performance. During its annual Quality Service Day, for example, they will personally man front-line counters at HDB Hub and branch offices.

Knowing how your dog food comes about

This deals with the implementation of a policy. By that I mean mean that policy-makers should communicate with people who implement them. It's like if you're getting the same old brand of dog food all the time, don't expect that special can of mint-flavoured dog food with cherries in it to have the same kind of availability. In other words, don't dismiss that just it's just a piece of ice floating on the water when there could be an iceberg underneath. Don't set deadlines according to your own whims and fancies or some unfounded assumptions when you can check with those who know the ground conditions better.

 Change is not always the constant

In the end I guess it's difficult to change the mindset and the culture of those policymakers I'm referring to. I guess this problem will continue to dog me.

Wednesday, October 24, 2007

分享 - 当我老了

早上在 电台听到了这篇文章,觉得很有意思,想跟大家分享。配上蔡淳佳的"陪我看日出",相当的感人.有时在忙碌中会遗忘父母曾给与我们的关怀与照顾.

[youtube]hTfj8LSTCVo[/youtube]

当我老了

当我老了,不再是原来的我.请理解我,对我有一点耐心。

当我把菜汤洒在自己衣服上时,当我忘记怎样系鞋带时,请想一想当初我是如何手把手地教你。

当我一遍又一遍地重复你早已听腻的话语时,请耐心地听我说,不要打断我。你小的时候,我不得不重复那个讲过千百遍的故事,直到你进入梦乡。

当我需要你帮我洗澡时,请不要责备我。还记得小时候我千方百计哄你洗澡的情形吗?

当我对新科技和新事物不知所措时,请不要嘲笑我。想一想当初我怎样耐心地回答你的每一个“为什么”。

当我由于双腿疲劳而无法行走时,请伸出你年轻有力的手搀扶我。就像你小时候学习走路时,我扶你那样。

当我忽然忘记我们谈话的主题,请给我一些时间让我回想。其实对我来说,谈论什么并不重要,只要你能在一旁听我说,我就很满足。

当你看着老去的我,请不要悲伤。理解我,支持我,就像你刚开始学习如何面对生活时我对你那样。当初我引导你走上人生路,如今请陪伴我走完最后的路。给我你的爱和耐心,我会报以感激的微笑,这微笑中凝结着我对你无限的爱。

摘自《参考消息》

Monday, October 22, 2007

SingTel mio TV promotion - not signing up after all

A few weeks ago, a SingTel mio TV promoter came to my place and told me I was eligible for a SingTel's mio TV promotion as I was a mio plan user. After he told me the benefits of the promotion, I proceeded to sign up. I distinctively remember that it was a six month free trial, but I had to subscribe to at least one channel. To me, that means I don't have to fork out a single cent for it, right?

First problem - loss of DSL signal from my modem/router

On the day of the installation, the tech guy came down to do the set up, but he noticed I has lost my connection. After checking with his colleague and some testing of the phone-line, he concluded that there was a misconfiguration at the back-end for the mio TV. This resulted in the loss of the DSL signal. He wrote down some stuff about the failed installation and ensured me I won't be charged for the follow-up installation as it's not my fault. He also told me the connection would be back up within the day and gave me a number to call in case it didn't .

As it turned out, the connected failed to resume and the no one picked up the number. The following day, I called again and was told to call the mio hotline. Conveniently, it was Sunday and there was no one to service me. The next day, I called up the hotline again and was told to call the mio TV hotline. The tech support wanted to step me through the troubleshooting process but I was at work. By the time I got home, I was finally reconnected.

Installation date - no arrangement

I was told that someone would contact me to arrange another date for installation. I waited a few days but no one contacted me. In the end, I called up the hotline again and asked them about it. I also told them I was disconnected for 3 days and was seeking some form of compensation. So after an exchange, I thought my problem was noted and waited for a reply. But there was none.

Checking for date of installation once more

After a few days, I called the hotline again and told them my problem once more. For some reason, the CSO told me they don't have a record of my previous call and was unaware of my problem. But she did finally manage to get someone from the installation team to contact me. That was after I found out it's not entirely free after all.

What kind of free are we talking about?

I was browsing through the hardwarezone forums when I came across the following exchange.

nWo:
Hi guys,

I tried to access the MIO webpage, but I had to fill up the information and select the channels? Seems to be that it will bill me for the full amount.

Will it be a free trial offer as you guys are having?

alanchia67:
you may have misunderstood the offer. the miotv promo is that they will not enforce the minimal billing amount. if you get miotv without DVR (digital video recording) and no pay-channel, it will be free.

I called up the CSO and she confirmed that the promotion is the waiver of the minimum charge for 6 months and some additional discount for mio plan users. What kind of "free" is that? I promptly told her I do not want mio TV after all. I hope I will get my compensation for 3 days of loss connectivity.

Sunday, October 14, 2007

Some things to note when upgrading to WordPress 2.3

Was upgrading to WP 2.3, got the following error message during the course of upgrading.
Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 46080 bytes) in XXXXXXXXXXXXXXXXXXXXX/xxx.php on line 68

The solution is provided by riteshTilve here.

To quote him:
In cache.php, add the following code at the top in line 2 just after "<?php" :

ini_set("memory_limit","12M");

If even then it fails, try increasing the 12M to 20M.
After the upgrade runs successfully, you may remove that line or keep as it as you wish.

After that was solved, I tried to post something, but realized that the visual rich editor was missing. That is an easier problem to solve. Just hit the F5 key to refresh, and it should appear :)

The tricky thing is, somehow WordPress decided to delete my last post on CPF changes. It's a really weird bug, so I had to somehow recover it. I could grab it from a backup of the database before I updated WordPress. But I decided to use Google to try and retrieve a cached copy as it's faster. Thankfully it can be found there. So I copied the post in it's entirety and made some quick edits. Now it's back online again.

$20,000 requirement on CPF OA

(Reposted as WP somehow deleted it.....)

I’ve read the Sunday Times piece on 7th Oct 2007, “Taking a closer look at the growth of unit trusts”, with great interest, because I’m concerned with the impact the latest changes to CPF will have on my funds bought under the CPF Investment Scheme (CPFIS).

There will be a minimum requirement of $20,000 on the Ordinary Account (OA) before you can use money from the OA for investment, so if you have $25,000 in the OA, you can use only $5000 for investment. It seems that the changes will take effect in April 2008.

I’m a little dismayed by this development, because my financial advisor has helped me come up with a portfolio that’s beating 2.5% by a mile. Even with the additional 1% on OA interest that is part of the CPF changes, I’m still getting much better returns on my portfolio than from CPF. There is a lot of talk about the risk-free nature of CPF returns, how the government guarantees it and no one else can make such claims.

Risks besides loss of capital

Yes it is risk-free returns, but are there other risks besides potential loss of captial? I think so. To me, there is a potential loss of opportunities. I’ve randomly selected some bond funds from fundsupermart:

ABN AMRO Star Asia Bond
AIGIF Singapore Bond Fund
Franklin Templeton F-Global Bond Fund
Henderson Global Bond Fund - Class A Units
ING Singapore Dollar Bond Fd
Schroder Asian Premium Bond Fund
UOB United International Bond Fd
UOB Optimix Asian Bond

I looked at their performance for the last 10 years, and all of them beat 3.5% with the exception of Schroder Asian Premium Bond Fund which has been established for less than a year I think. This is just a quick-and-dirty look, let’s see what the Sunday Times report says:

How CPFIS funds have done
    THE Sunday Times commissioned fund data house Morningstar Asia to assess the performance of CPFIS-approved unit trusts over a 10-year period up to the end of June this year. Note that the table provided does not reflect when a fund joined CPFIS. Its track record might range from three to 10 years, but it may have joined the scheme two years ago, for example.

Of the 53 funds with a 10-year history, 43 grew over 5 per cent every year in the period studied. Of the 156 funds with a five-year history, 128 beat this growth. In the three years to June 30, 145 funds out of 185 have managed at least a 5 per cent annual return.

While underperforming funds tend to be excluded from the CPFIS, it seems clear that, in absolute numbers, more funds have beaten the annual 5 per cent returns in recent years.

My point is that it is risk-free returns, but there are other opportunities lost as well, especially when so many of them have beaten the annual 5% returns rate.

Different minimum requirement based on age

It’ll take me some time before I can invest again, once the new changes kick in. What I cannot understand is why can’t they have some sort of tiered system where you have different minimum OA requirements based on age. For example, let’s say you’re 20-29 years old, you need to have $10,000 in the OA, anything above that you can invest. If you’re 30-39, you need to have $20,000, or something like that.

The article, “Taking a closer look at the growth of unit trusts”, is reproduced on:

ChannelNewsAsia Forums


Alvin Soong

Tuesday, October 2, 2007

Cheer Chen 陈绮贞 - [ A Piece of Summer 2007 Singapore ]

好不容易等到了这一天,二零零七九月二十九,一个难忘的夜晚.音乐才女陈绮贞在新加坡Expo, Max Pavilion,举行的一场大型售票演唱会!我还记得,她曾经来过新加坡,和陈升一起.那时错过了,感觉很可惜,所以告诉自己不要浪费这一次的机会.我一向很欣赏她,总觉得她在音乐创作上很有自己的想法,而且嗓音很独特甜美.最大的加分点是她是个很棒的吉他手!所以我对她情有独钟.

倒数八点十五

约了朋友的朋友做伴,入席时是七点半.我们坐在右边前方,察看四周,人群相当稀疏.难道喜欢陈绮贞的新加坡朋友那么少吗?朋友说,她在台湾演唱会的票一小时就卖光了,我听了吓了一跳.在两地的人气有那么大的落差吗?我的担心是多余的,可能是国人的迟到习惯在作祟,仁然有人在演唱会指定开幕的时间从入口进来. 十五分钟后,现场几乎爆满,大荧幕上也计时倒数.五,四,三,二,一. A Piece of Summer, 引爆!

嫦娥绮贞

四周黑暗,台前的白幕后,一道光照出一个人影.这道光形成了圆形,像足了月亮,月里的人更像是月宫中的嫦娥.嫦娥正拿着一把吉他.尖叫声四起,只因今夜嫦娥就是绮贞.白幕落下,弦声响起,她头戴花圈,身穿白色长裙,唱起了一首我不熟悉的歌曲.这是"九份的咖啡店"吗?这是收录在已绝版的"Demo3"的歌,而"Demo"系列正是我收集中的缺憾.但能够听到这首歌在现场演唱,也算难得.
p1

振奋人心的曲目

鼓手槌起了浑厚低沉的鼓, 槌的不只是鼓,也包括了观众的心.手风琴弹出悠悠的欧式风情.在这样的配乐下,绮贞弹唱了"就算全世界与我为敌","小尘埃",及其它优美的歌曲.但让观众情绪高涨的是电子吉他带动的"Sentimental Kills","华丽的冒险".观众都站起来随着节奏拍手,甩荧光棒,有一群蜂拥到台下,还有很多站在椅子上.
p2

零距离的接触

当绮贞唱着"女明星"走进人群中,观众骚动了起来,纷纷往走廊上挤,为了要跟她牵手打招呼,做零距离的接触.坐在走廊旁的朋友真走运!无缘的我只能在旁迟迟的望着...
p3

经典的绮贞

我想我还是最喜欢她经典的歌曲." 告诉我","让我想一想","还是会寂寞",虽然已不新了,但依然那么的清新悦耳.而我相信,这也是许多人的想法,是这些歌让我们认识了她.当我看到不论是十来岁的少女或是三四十岁的中年人不止懂得唱,而且还很投入得唱,我再次的确认了这一点.

p4

五个Encore仍意犹未尽

观众的热情与表演者的不舍,把我所讨厌的结束往后挪,虽无法避免,但能多看她一眼,多听一首歌,我就觉得开心.所以我很感谢那些头戴安全帽的可爱家伙,他们猛喊"encore",带动我们也跟着喊,收获竟然是五个"encore"!其中包括我正在学弹的"太聪明".一首"微凉的你"为这个微妙的音乐会画上了美丽的休止符. 她说,她毫无保留的献给了我们.她的诚意, 我们感受到了.
p5

看了演唱会后,让我了解到了不单是旅行的意义,还包括了安全帽的意义...哈哈!Special thanks to fellow Cheer fans slowstatic, Greenstone, and beast78 from Hardwarezone for allowing me to use their pictures :)

Other coverage:

Clubsnap coverage

Hardwarezone coverage

Loozihan

Agstan

StaticIP's gallery

Aomoon

Nameless Fun


A woman's insanity



呵呵 - A helmet-wearer!


难忘夏姿 - 陈绮贞A Piece of Summer演唱会

Sunday, September 23, 2007

Granado Espada - Irritating server lag, disconnects

When IAHGames announced the business model for Granado Espada, one of the reasons quoted is:
An extremely large player base can also lead to server crowding, without providing adequate revenue for IAHGames to install and run new servers. It is our goal to maintain an optimal volume of players on all worlds, and to open new worlds as necessary. A free to play system would hamper our ability to do so.

Preventing server overcrowding makes for a great gaming experience, I mean, having 15-20 families squeezed in a small part of Porto Bello's Cabin is pretty claustrophobic. Ever since the game has gone P2P, I find that there's a noticeably less overcrowding, so that's a plus point there.

However, I still have gripes about the server lag and disconnects. After every Thursday's server maintenance, you'll find that the game is extremely responsive. The elementalist swings her arms and fireballs zoom in on target without any hesitation, the fighter slashes the wolf with a smooth, clean stroke, the musketeers cocks her rifle and unleashes a bullet to the skeleton's mid-section with nary a delay, and you get from A to B without unexpected pauses. The sun is shining, the birds are singing, and the world is happy and at peace.

But come every Saturday and Sunday, things start to go awry. You can't switch stances easily. You can't get your party to follow orders promptly. You can't get from A to B without the screen stuttering. At times, you can't even stay in-game for long. Well, usually it's not that bad but sometimes it's irritating to click on a monster to attack it when you're in the heat of the battle only to see your party stay rooted for 10 seconds before getting slayed.

The problem gets a lot worse for major in-game events like the 'Dark Lord Returns'. Supposedly a exciting event where players unite to fend off the forces of evil, the greatest thrill you'll get is actually registering a mouse-click in the game with all the screen spasms going on. IAHGames , I'll expect to get better connectivity when I'm paying for it, thank you very much.

Sunday, September 9, 2007

Thoughts on Joseph Chia’s letter on “If There’re Seasons…”

About 2 weeks ago, I read Chim Kang's piece on Zao Bao ( a Chinese daily, dated 28 Aug 2007 IIRC) about his conversation with a middle-aged female teacher. They had just finished watching the musical "If There're Seasons...", and the teacher remarked that it was such a good show that she wanted to bring her students to watch it. Chim Kang pointed out that there were some parts of the musical which touched on the subject of homosexuality. She dismissed such a view as ancient, noting that there are much more liberal views on the Net that the young were exposed to. "What are you going to do when parents complain about the musical having 'objectionable content'?" It was then that she realised the possible repercussions she might face.

As it happens in real life

And just a few days later, we see a concerned parent writing to the Straits Times forum about the subject. Letter reproduced below.
Sep 1, 2007

'Gay' musical should have come with rating

RECENTLY, my family and I attended the Chinese musical, If There're Seasons..., by The Theatre Practice at the Drama Centre. By and large, it was a good production featuring various familiar songs written by local composer Liang Wern Fook.

While it was a good production, I was very disturbed by part of the story. One of the characters, Ah Qiang played by Sebastian Tan, turned out to have been jilted by his boyfriend in a homosexual relationship. His boyfriend then came back to woo Ah Qiang with love songs pledging his unending love, and even gave up his heterosexual marriage and his relationship with his parents, in order to be with Ah Qiang again.

Given that Ah Qiang was not the main character, and that the homosexual relationship was not even the main story, I wonder if it was necessary for them to be included.

I was even more disturbed because there were many schoolchildren, perhaps on an excursion trip, and families with young children among the audience. The children may not have the maturity to understand the implications of such a controversial subject.

When I checked the musical's website, as well as ticket-seller Sistic's website, there was no rating or information to warn audiences of the musical's content. No wonder there were so many children and families in the audience.

Perhaps this is an area the Censorship Board needs to look into.



Joseph Chia Yoong Leong

First, we should keep in mind that the Joseph probably did not come up with the title to the letter. The branding of "If There're Seasons..." as a "gay musical" is quite likely to be the idea of the editors, just to grab the reader's attention. Moving on, take a look at what are some of the comments to Joseph's letter. Morality, human rights, religion, biology, theology are all mentioned, you know, the mind-numbing, heavy-duty subjects that you don't discuss over dinner. There's quite a lot of strong reactions being triggered here, so you can tell that Joseph's letter and the reader's comments actually touched a raw nerve in some people.

Portrayal of gays is common, so what's the issue?

While society is still divided on the issue of gay rights, we are not short of portrayals of gays in the mainstream media. I mean, we see depictions, caricatures or distortions of gays in a lot of TV programs or movies that we watch. Now I haven't watched the musical so I'm not sure what kind of homosexual scenes we are talking about, whether it's explicit or sensual or what not. But I'm going to assume that it is not something that is different from similar scenes shown during normal prime-time TV as one, the musical was not slapped with a PG or R rating, and two, I haven't heard a people emphasizing the gay scenes. What then is the problem?

Exploration of homosexual love and expectations of standardised ratings

I'm not sure, but I reckon it's due to 2 factors. First, the portrayal of homosexuals on TV are usually in comic roles or some secondary role. And these roles may delve into the conflict with the traditional concept of family but they do not explore the love and relationship between them. In this sense, the roles in "If There're Seasons..." are a significant departure from the usual ones we seen on TV. Can't remember any show shown on national TV with regards to this. In the case of movies, it'll usually be rated PG or NC-16 and above I think.

Second, assuming that a TV show or movie will be tagged as PG and above, then it is interesting to note that "If There're Seasons..." is not given a rating at all. Does this mean that this topic is not as taboo as it seems, and that the censors feel that it doesn't need a rating? But then, "Spider Lilies", which dealt with some aspects of lesbianism, was given a R21. Even "Evan Almighty" is PG. Is this a case of double standards?

Saturday, August 25, 2007

潘玲玲力抗众美女,游刃有余

最近上档的“宝贝父女兵”里,云集了许多美女。点算一下,有白薇秀、庄米雪、杜慧萍、潘玲玲、徐艳玲。但是资历最深,年纪最大的潘玲玲,仁然是他们当中最 耀眼夺目的。什么小公主,明星偶像,绝对SUPERSTAR都得靠边凉快凉快。不见岁月在潘玲玲的脸蛋留下一丝痕迹,反而让她散发一种成熟女人的魅力。世 南真幸福。

剧照:
Beauties at war

美女之斗, 白薇秀和潘玲玲的对决.从此照可见,很明显的,潘玲玲占尽上风.

Thursday, August 23, 2007

Before catching Daniel Wu in Blood Brothers...

Blood Brothers will start screening tomorrow, but before that you can catch the wackier side of Daniel Wu and his friends in ChiSeen. "Chiseen" means "crazy" in Cantonese. ChiSeen is like the Hong Kong version of Jackass, which basically means you have a bunch of people performing some pretty outrageous stuff like scuba-diving in a fountain, changing clothes in a train and tattooing their tongues (ouch!). You can search for "Chiseen" on Youtube of if you prefer to watch it fullscreen you can catch it on Joost as well. Or, if for some weird reason you want to get it on DVD, you can order one from Amazon.

I've seen quite a few of the clips, my favourite one involves Daniel Wu shooting live fireworks at a guy positioned like 15 metres away. Dangerous? Yes. Stupid? Definitely! Watch out for the guy doing the firefighting afterwards.... he's pretty dumb too.

[youtube]1rRo3IzOn4w[/youtube]

Sunday, August 19, 2007

Debugging a JSP compilation problem on Tomcat 6

I was doing some experimentation with Maven and Tomcat 6 when I hit this error.
SEVERE: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 8 in the generated java file
Only a type can be imported. net.project_00.interview.java.mock.web.SomeThingStupid resolves to a package

An error occurred at line: 17 in the jsp file: /interview-java-mock-web/index2.jsp
SomeThingStupid cannot be resolved
14:
15: <%=new Date()%>
16: <%=new GregorianCalendar()%>
17: <%=SomeThingStupid.getString() %>
18: </body>
19: </html>

Stacktrace:
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
........... (rest of stacktrace)

Steps taken to debug the problem

Now, it appears to me that the error message is telling me that net.project_00.interview.java.mock.web.SomeThingStupid is not a type, but a package. I'm very sure that this is not the case after checking my code and package. Eclipse also does not give me this error when I do the import of SomeThingStupid . Conversely, when I import a package like java.util, Eclipse does give me the error.

Then I went to check that my WEB-INF\classes folder in my web-app's folder in Tomcat contained the class in the correct package. It did.

Not sure what's going on, I went to look for the generated Java class for the problematic JSP in $CATALINA_HOME\work\Catalina\localhost. I looked inside the code, nothing fishy there.

So I googled the error message, hoping to find some indication of what went wrong. Nothing useful turned up, all of them talked about importing of a package instead of a type or the exclusion of a required JAR file. Until I hit this Chinese website.

It mentions something about the Context path and docBase not being set correctly. Suspecting that my directory structure is wrong, I took the JSP page in question and copied it to the corresponding page in a web-app I know was working properly. I also copied the entire directory structure corresponding to the fully-qualified name of the class SomeThingStupid to WEB-INF\classes folder of the working web-app. And the result of the test was that it worked.

Then I checked the directory structure of the 2 web-apps and confirmed that the problematic web-app 's directory structure was wrong.

The structure of the working web-app was: $CATALINA_HOME\webapps\examples

The structure of the wrong web-app was: $CATALINA_HOME\webapps\interview-java-mock-web\interview-java-mock-web

The problem was that it was nested under an additional folder called "interview-java-mock-web" instead of being directly under the folder "webapps".

Reason for the difference in directory structure

I had used Maven2 to build the web-app, and part of Maven's advantage is that it makes the management of build life-cycle simple. However, there is a slight problem in executing "mvn clean". As stated in the "Getting Started" guide, this will remove the target directory with all the build data before starting so that it is fresh. Unfortunately, if your target directory is the $CATALINA_HOME\webapps folder, as indicated in the POM file, you will delete the entire webapps folder. This is not what I want. I want to delete only the files pertaining to the project in question and not the entire "webapps" folder, which contains other projects.

Hence my approach is to change the target directory in the POM file to $CATALINA_HOME\webapps\${artifactId}

Setting the Context element


So to resolve the original problem of the compiler not being able to find the class SomeThingStupid, the Context element has to be set in Tomcat. Taking a look at the docs, I created the file $CATALINA_HOME\conf\Catalina\localhost\interview-java-mock-web.xml

The file contains the following line:

<Context path="" docBase="/interview-java-mock-web"> </Context>

Working, but with a warning

Setting the Context element makes my web-app work, it also solves another problem of erroneous servlet mapping. However, there is a warning message when Tomcat starts up. I haven't found time to solve this.
Aug 18, 2007 10:21:06 PM org.apache.catalina.startup.HostConfig deployDescriptor
WARNING: A docBase C:\Program Files\Apache Software Foundation\apache-tomcat-6.0.13\webapps\interview-java-mock-web inside the host appBase has been specified, and will be ignored

Tuesday, August 14, 2007

MOM’s Report on Wages in Singapore, 2006

The annual report on wages in Singapore has been released recently by Ministry of Manpower. If you're wondering whether your recent pay increment makes your salary comparable to others in your industry, this is the best place to start. Take a look at the the reports here. There's a lot of data in the reports, and it can be used to find certain trends and info.

Top 100 jobs in Singapore

Salary.sg has put up a ranked list (two lists, in fact) of the top 100 jobs in Singapore in terms of pay. While I believe that pay should not be the sole criteria for evaluating a job, it remains a very important one. We do need to put bread on the dining table after all, and pay decides whether that piece of bread is slice of plain Gardenia or loaf from Delifrance.

As for the actual jobs in the list, I've taken a quick look and there's no surprises there. What is disappoint for me is that it appears that the pay for those in the public sector are not factored in, eg teachers, policemen and firemen. I can't find them in the list. It's worse considering that my job should be out of the top 100 if they had been included...lol

Wage differentials between the sexes

There's no doubt that men do earn more than women, something which we all recognize. What is interesting is that the difference is that the gender wage difference
ranged from 5.7% for professionals to 46% for plant & machine operators for those aged 35 – 39. Quoting the full report,
The differential mainly stems from the tendency for females to disrupt their workforce participation for family reasons which reduces the years of service and experience of working women. Other possible factors include differences in skills, qualifications, job nature/level and working experience as well as possibly higher incidence of males working overtime than females.

If this is the case, I see the huge gap as an indication of how some jobs can utilise IT to minimise the impact when women are at the workplace. I believe it's quite common for companies to have flexible arrangements to allow women to work from home.

Little difference between NUS Bachelor of Computing for honours and non-honours

This is somewhat surprising to me. From table 11, the mean monthly gross starting pay for a graduate with Bachelor of Computing is $2,544 while it is $2,600 for someone with honours. In terms of pay alone, the difference is not significant enough to me. The opportunity cost is one year of expenditure, lost income and experience. Perhaps there are other factors like the research experience gained during the extra year and that students with honours are more employable (87.4% vs 79.5% were employed). As a side-note, SMU students from the Information System Management had a mean monthly gross starting pay of $2,975. That's a pretty big difference considering Information Systems students probably learn the same topics in NUS.

Doing National Service increases your pay

It's true, from table 12, people who have served National Service have a higher mean monthly gross starting salary. But why? Does it imply that employers see that National Service makes a person better to handle work?

Sunday, August 12, 2007

Granado Espada - Business model revealed, and bikinis too

Well, the long-awaited business model for Granado Espada has been announced, and along with it a lengthy piece on the rationale behind the decision. The goal is simply to make money, question is how to make it viable. Like, how do make sure 90% of the players don't quit once you start charging them in some form...lol. The dungeons don't seem to be congested with players today. :p

Plenty of talk about it on the forums (here, here, here, here...) and blogosphere. Don't have too much feelings about it, but generally I feel it is (might be?) a fair price to pay, provided they fix a few bugs, get rid of the botters and continue to create new content for the game. So what's the pricing gonna be like?

Granado Espada will run on a hybrid pay to play model.



Gamers will be required to invest at least SGD$9.90/P300/RM$20/USD$5.60 into the game per month via various payment methods. Minus a nominal fee, this amount will transfer into G-Points which can then be used at the cash shop for premium items. Players have the option to invest more than the minimum per month for large cash shop purchases:


Table of charges
Players will get locally priced game value cards from their local distributors. Watch your local distributor's official GE websites for more information.

Not sure if I'm understanding this correctly buy if you spend US $40, you can play for 1 year. That's around SGD $60, or 5 bucks per month. Seems affordable to me. But that's not saying I'm gonna subscribe to the game, cos there's other considerations like time.

And speaking of creating new content, look at what else has been revealed about Granado Espada recently. (First spotted in the House of Reclusion.)
Nice ....

Yeah, that's the scout and fighter with more than their armour removed. (And getting a bit too intimiate too)Summer

The gang's enjoying a bit of the sun and the breeze.

I suppose we'll soon be able to see them on our shores. It's nice to see that new content is being rolled out even as the players have to start paying for the game, hopefully it will enrich the whole experience. Customisation is a huge factor in MMORPGs. IMHO. Check out the Japanese site and the Korean site for more potential content coming our way.

Wednesday, August 8, 2007

At work: Why do you think I can when you can’t?

Received a call from a user to help her solve a problem. I asked her to take a screenshot and send it to me via email.

Woman: What's your name?
Me: I'm XXX.
W: How do you spell that?
M: It's spelt as "XXX".
W: I can't find your name in the address book leh.
M: That happens sometimes.
W: Why ah?
M: I think that there is some problem with the email server's configuration.
W: Are you able to help?
M: Er...it's under the purview of the email team. I'm only responsible for the application you're using.
W: Like that ah?
M: How about you give me your name and I try to find you?
W: Ok. My name is "LLL"
M: Hmm...can't find you either.
W: It's spelt "LLL".
M: Your name is "LLL" right? Nope, it's not here.
W: You scroll down to "KKK".
M: Ok.
W: It's right after that.
M: Nope, I'm having the same problem as you.
W: Cannot be. Look properly.
M: ....

Monday, August 6, 2007

Thunderbird not receiving new messages for RSS feeds

Recently a lot of my RSS feeds in Thunderbird were not updated. There seems to be some issue with receiving new messages, a lot of my feeds were affected, though not all. Here's what I did to resolve the issue.

  1. Right-click the affected feed and choose "Properties.." .

  2. Under the "General Information" tab, tick the checkbox "Check this folder for new messages".

  3. Click the "Rebuild Indexes" button.

  4. Click the "OK" button.

  5. From the toolbar, click the "Get Mail" button.


That managed to solve the problem, but you have to do steps 1 to 4 for each affected feed, before proceeding to step 5. It can be a pain if you have dozens of affected feeds, but I don't know of a better way.

Monday, July 30, 2007

Granado Espada - Getting rid of high-level spinelles

One of the things that some high-level players like to do, but yet is very irritating to lower-level players, is the releasing of powerful monsters. These monsters are released through something called a "spinelle". It's supposed to be some sort of gem with a monster trapped inside, and the monster is usually a "normal" one (ie, not those chieftains or bosses). Usually, lower-level players can't even scratch them. You'll see a bunch of players just shooting, slashing or casting spells on them but all the attacks will simply miss. They are truly a bane to us.

I used to flee when I see them, but yesterday I got an inspiration from a friend and tried to get rid of them. Here, my party of a wizard, a scout and a fighter takes on a level 64 wolf. That's about 20 levels more than me. As you can see, I've managed to hurt it quite a bit.
Killing wolf spinelle 1

Dealing more damage to it....
Killing wolf spinelle 2

And good-bye!
Killing wolf spinelle 3

 I've replicated the method with huge success on other monsters, including those level 70 and level 80 monsters! How's that for a little of David and Goliath? Hahha

Monday, July 23, 2007

Granado Espada in Singapore's education system

Was surfing the web for Granado Espada related stuff, when I found out that the game is being integrated into Singapore's educational programmes. The piece of news can be found on Today and ChannelNewsAsia, though somewhat dated. Quoting the report:
SINGAPORE: So, you think your child is spending too much time on computer games at home. What if he tells you he'll be playing them at school too - with his teacher's permission?

Next month, at least two schools here are expected to pilot a unique initiative to introduce students, teachers and principals to the world of online gaming as part of the curriculum.

None of the schools have been identified yet as plans are still being fine-tuned and awaiting the authorities' endorsement.

Then again, perhaps it was only a matter of time before the drive to harness IT to the Singapore school experience turned to the powerful influence of role-playing games (RPG) among the young.

The initiative represents a "shift" in direction for the education system, said Assistant Professor Muhammad Faishal Ibrahim, who sits on the Government Parliamentary Committee for Education.

"I see gaming as a new and broadened platform for learning, and by making it interesting to students, it will help motivate them to learn new skills," Prof Muhammad Faishal, who was pleased to learn that teachers would be around to guide the youngsters, told TODAY.

Is that cool or what? I wouldn't mind playing Granado Espada as part of the school programme if I'm still a teenage gamer. What I'm really curious about is what kind of skills they hope the students can pick up or how it can enhance their learning experience.

Granado Espada - a suitable game for this experiment?

First, the game has an awkward number of mis-spellings when it was ported over to English from Korea, not sure if the English teachers are gonna sit up and complain.

Second off I'm not sure why Granado Espada was chosen over other games such as The Sims, Second Life, Command and Conquer or something. Yeah sure the game has great visuals and music, but I'm not sure it has much depth. From my point of view, the game involves a lot of grinding. If you are going to get students deeply involved in it, they will be spending vast amounts of time leveling up or completing quests. I have my doubts about the life-skills and decision-making insight they will reap from the game, despite what the report says:
Following focus group discussions with principals, teachers, students, academics and counsellors, the RPG Granado Espada was "carefully selected" to have its colourful fantasy characters introduced into the school curriculum.

Mr Thomas Chong, director of education initiatives at Infocomm Asia Holdings (IAH), which is spearheading the initiative, said it was "not your typical slash-and-kill" game, but one that can help players learn life-skills such as decision-making and problem-solving.

"This is not an educational game dressed up as an MMOG (massively-multi-player online game). Rather, we want to ask students whether, say, a war can be won without fighting, but instead by signing a treaty? We want them to see the merits of discussion, strategising, and coming up with alternative ideas," he said.

Singapore is believed to be the first country in the world planning to use Grenado Espada as a learning tool. And lest parents are worried it might open the school doors to other addictive RPGs, the online games operator gave the assurance that any future games introduced would undergo the same strict selection process.

Granado Espada in National Education - GENE

This is pretty interesting to me. Remember the videos Singapore in Clay Art and Singapore in Sand Art? Those were the videos shown by the PM during the last National Day Rally speech when he talked about making National Education less boring. Now, there is contest for producing a machinima (machine animation) for National Education using Granado Espada. The themes are "Singapore is our homeland; this is where we belong", "We must preserve racial and religious harmony", and such. I'm guessing we may get to see the winning entries during the National Day Rally this year. A sample is included here.

For the potential of using Granado Espada machinima in story-telling, take a look at the rather famous Lonely Hearts Club clip.

Part 1

[youtube]QgdXhZvJylc[/youtube]
Part 2

[youtube]NMpiENuQD3g[/youtube]

Sunday, July 15, 2007

Thoughts on Li Hongyi's email and the "Chain of Command"

Was surfing the net just now when I came across this on tomorrow.sg.This 2LT Li Hongyi apparently emailed a letter of complaint to some some people who had no business knowing it, and the recipients included some big shots like the Defence Minister, Chief of Defence and Chief of Army. Then I realised that this was on the news yesterday. Well, jumping the chain of command is something we do hear of now and then during our time in NS, so it's nothing earth-shattering. We're frequently reminded not to do it, so it must take something extra to send the email to the people in the top echelon of SAF. Either you've got extra guts, or you're extra stupid, or you're extra equal. As it turns out, Li Hongyi is PM Lee Hsien Loong's second son. That complicates matters somewhat.

He did the right thing
The letter, with important names and details blanked out out, are reproduced on The States Times and Simply Jean , among other blogs. My first thought is, he did the right thing. He saw the injustice in his unit and he took action to correct it. Even if he did it because he was aggrieved, there is no doubt what LTA X did, or that his superiors trying to cover up for LTA X, were wrong. I think a lot of us have witnessed unjust acts during our NS stints, but were impeded by powerlessness or fear of retribution, so we did not report it.

While some have offered the view that Li Hongyi might have breached the Official Secrets Act (OSA), but I'm not sure about that. It is grossly inappropriate to email the Defence Minister or Chief of Defence Force, but they belong to the same branch in the hierarchy, hence it is not outside of their authority. Jumping the chain of command, but there's nothing else there. On the other hand, he did email to a whole lot of other people as well. Who they are, I can't tell, but with this kind of letter, you'll suppose he'll be wiser not to mass-mail loads of people about it. But the leaking of this email to the public definitely amounts to a breach of the OSA. I'm sure SAF is conducting an internal investigation about this leak right now.

Chain of command suppresses the reporting of problems
The whole idea of this chain of command thing reinforces the perception that you'll have to work your way up the chain to air your grievance, and if somewhere along the chain some superior judges that your case is frivolous or something, you'll meet with some undesirable consequences. Given that there is little information about what proper channels are available (especially for the those not in leadership positions), and that there is a lot of hearsay about the ineffectiveness of things like the SAF hotline and being blacklisted for reporting certain stuff, it's no surprise that a lot of servicemen face a lot of problems but don't voice out, due to ignorance and fear.

An important issue is the attitude of the commanders in leading their men. Can they command the trust of the men? How serious do they view the problems reported to them? From a typical , corporal-and-below point-of-view the whole channel of redressing grievances fail when one or two commanders in the chain belittle or mishandle your problem. If your commander fails you, are you confident that your problem will be given different treatment from another commander whom you always see him hanging around with in the officer mess or at the canteen?

Check your recipient list and think twice before hitting the SEND button
It's very easy to just add people to the recipient list and send the emails out to them, but it's very easy to come back and haunt you as well. Some of my camp-mates sent out emails complaining about some other people just before they ORD, and some of these emails were circulated like crazy. We do bitch a lot among ourselves about people who slack or don't do their area cleaning or some problem with our superiors, but it's a different matter to put it down in writing. And once it's written, digitally or otherwise, you'll want it to reach the hands of the right people, not people who treat it as something to talk about over canteen break.

Sunday, July 8, 2007

Trying out Joost - the new, free way to watch TV over the internet

I've finally got an email from Joost telling me I can download the program and use it. What is Joost?
Joost is a new way of watching TV on the internet. With Joost, you get all the things you love about TV, including a high-quality full-screen picture, hundreds of full-length shows and easy channel-flipping.

Or so we're told. After installing and starting the program, the first thing you'll notice about Joost is it's user interface. It's simple, but it's slick. It's quite easy on the eyes, with the translucent menus and large rounded buttons. In general, it's quite easy to get around, and most things can be achieved by clicking the left mouse button.

To start watching videos, you can access them through the channel catalogue. It's pretty well-organized and lets you pick the channels from sorted by popularity or recency or staff recommendationsChannel catalogue
You can also search for particular videos.

Search results

Once you've found a video, you can click on the triangular "Play" button on the right-hand side of the entry to start watching. At full-screen, the video quality is watchable, it's somewhat better than Youtub, but not by a lot. You can reduce the size of the screen by clicking on it, and you'll notice the images are a lot sharper.

Screen 1

You can bring up the control panel by moving the mouse about when the video is playing, which allows you to pause, fast-forward or rewind, among other things.
Screen 5

A neat feature for bloggers is that there is an integrated function for blogging from within Joost. Not sure if it provides any value for me, but it seems useful for the multi-taskers who can watch the streams and blog at the same time.
Blog

Joost also lets you critique the shows by allowing you to rate it. The lowest one star means terrible and the max of five means awesome. It's a bit crude as there is nowhere to place your comments on why you think it sucks or shines. Anyway, here's what I think of "2005 Making of Sports Illustrated Swimsuit".
Rating shows

If you decide Joost is something you can recommend to your friends, you can send them an invite.

Invite

Is Joost worthy of the attention it's getting?

The user interface is well-done, but ultimately content is still king. There's some interesting content out there, including documentaries and sports and music videos, but I don't think there is enough. And I've been getting the following messages when I try to open a few videos, which is pretty annoying. Other times, clicking on the "Play" button simply has no effect.
Channel not available

Channel has no programs

Saturday, July 7, 2007

Excellent 11 year-old guitarist

Was looking for a specific song on Youtube when I came across this video clip. I'm totally impressed by his skill. Take a look at what he can do on the guitar!

[youtube]HsthlD-nMIg[/youtube]

Wednesday, July 4, 2007

Clearing the Sun Certified Java Programmer exam

It has nearly been 1 year since I bought the exam voucher for the Sun Certified Java Programmer (SCJP) exam, and today I've finally passed it! Overall, I think I've become more knowledgeable about what Java programming is about. It's definitely more in-depth and more challenging than what I had expected, even though I've been at it for a few years.

And with the advent of Java 5 and the host of new features it boasts, I definitely felt the need to upgrade myself. Moreover, my present scope of work doesn't really let me gain as much exposure or knowledge about Java than I had expected.

Preparing for the exam

You've got to be armed with a few resources to help you tackle the exam. My recommendations for books are:
SCJP Sun Certified Programmer for Java 5 Study Guide (Exam 310-055) (Certification Press Study Guides)
This is an excellent book. Incredibly informative and insightful, it is full of  relevant examples and peppered with some surprises about Java 5 that I felt were quite bewildering initially. The book explains the concepts well and if there is only one book to get for SCJP, it is this one. A big plus point with this book is the way the authors have imbued it with humour, making it a joy (sort of) to read.
SCJP Exam for J2SE 5: A Concise and Comprehensive Study Guide for The Sun Certified Java Programmer Exam
More of a supplementary text, it's as it's title states: concise and comprehensive. Not enough by itself, nonetheless it's pretty well-organized and certain chapters are quite well done, for example the chapters on enums and exception handling.
And here are some sites with some interesting test questions pertaining to Java,  though not necessarily Java 5.
JavaRanch
You'll want to play the Rules Roundup Game and reinforce some Java concepts. Get all your cows in the pen! No Java 5 stuff though, but it's good for the rest of SCJP.
Java Black Belt
Neatly organized site with all sorts of Java-related questions, including Hibernate and Struts. Look out for those related to the Java 5 features.

And with the passing of the SCJP, at least I've fulfilled one of my resolutions this year.

Tuesday, June 26, 2007

Naruto’s Shadow Clone technique in Granado Espada

With it's fierce advertising, I'm sure everyone has at least heard of the MMORPG Granado Espada.

I've been playing it for a bit, not too much as I'm preparing for my SCJP. As with games of this genre, there's always a problem of botting. Well, I was playing in a dungeon in Alt Quelt Moreza, when I saw this.

Shadow Clones

What I initially saw was a lot of the models of the same characters, I thought my graphics card was acting up or something. But nope. There are up to 50+ characters running up and down the corridors, and when they stopped running they converged at one spot, making it look like only a few characters were present. But when they start running and killing, it's practically an army.

Shadow clones 2

They just kill and loot running up the same corridor for around 10 minutes, at least that's about how long I cared to watch. Naruto would be proud...lol.. shadow-clone botting

Sunday, June 17, 2007

SCJP Prep - surprising autoboxing behaviour

One of the features introduced in Java 5 is autoboxing. Boxing means that we take a primitive such as a char, byte, int, etc and wrap it using it's corresponding wrapper class such as Char, Byte, Integer, etc so that we can use the object. Unboxing means retrieving the value from a wrapper. In the code fragment below, the Integer object is first unboxed, the value is summed with 10, and the summed value is boxed into a new Integer object.

[java, Y, 1]
public Integer addTen(Integer num)
{
return new Integer(10+num.intValue());
}


With autoboxing, all this boxing and unboxing is transparent to you. Therefore you can write simpler code like

[java, Y, 1]
public Integer autoboxAddTen(Integer num)
{
return 10+num;
}


While it allows developer to write succinct code, it can be a problem if we are not careful. For example, we'll have to be careful of NullPointerExceptions when we do autoboxing, which we will hit in the code below

[java, Y, 1]
public void doSomething()
{
Integer num=null;
System.out.println(autoboxAddTen(num));
}


Another snag we might hit is if we try to autobox a primitive into a non-corresponding wrapper type. In the code below, we can assign b to i according to conversion rules. But we'll have to take note that autoboxing only occurs primitives and it's corresponding wrapper type, eg int and Integer, byte and Byte, double and Double, etc

[java, Y, 1]
public void doSomethingElse()
{
int i=1;
byte b=7;
i=b;
Integer iObj=i;
iObj=b; //error. Type mismatch: cannot convert from byte to Integer
}


The most surprising behaviour though, is this. I saw some bloggers posted this problem, but I couldn't see what the problem was until someone explained it. Can you see where the problem is?

[java, Y, 1]
public class SurpriseAuoboxingTest1 {

public static void main(final String[] args) {

Integer i1 = new Integer(2);
Integer i2 = new Integer(2);
System.out.println(i1 == i2); // false

Integer j1 = 2;
Integer j2 = 2;
System.out.println(j1 == j2); // true

Integer k1 = 150;
Integer k2 = 150;
System.out.println(k1 == k2); // false
}
}


It might be clearer if we test some more values.

[java, Y, 1]
public class SurpriseAuoboxingTest2 {
public static void main(final String[] args) {
Integer l1 = 127;
Integer l2 = 127;
System.out.println(l1 == l2); // true

Integer m1 = 128;
Integer m2 = 128;
System.out.println(m1 == m2); // false

Integer n1 = -128;
Integer n2 = -128;
System.out.println(n1 == n2); // true

Integer o1 = -129;
Integer o2 = -129;
System.out.println(o1 == o2); // false
}


The second set of values are the edge cases, for something...but what? Basically, it's the range of integral values for cached objects.

Here's what Sun has to say on this:

The primitives are equal and the values of the boxed ints are equal. But this time the ints point to different objects. What you have discovered is that for small integral values, the objects are cached in a pool much like Strings. When i and j are 2, a single object is referenced from two different locations. When i and j are 2000, two separate objects are referenced. Autoboxing is guaranteed to return the same object for integral values in the range [-128, 127], but an implementation may, at its discretion, cache values outside of that range. It would be bad style to rely on this caching in your code.

In fact, testing for object equality using == is, of course, not what you normally intend to do. This cautionary example is included in this tip because it is easy to lose track of whether you are dealing with objects or primitives when the compiler makes it so easy for you to move back and forth between them.


It's good to remember what is happening beneath all this autoboxing, we're not getting the convenience for free. For a more in-depth look at the possible repercussions of autoboxing, take a look at this post on murphee's Rant.


# Newbies will write slow code because of it: Well, one of the problems that might occur, is newbies that write horribly slow code, because they never really grasped the difference between primitives and their reference types. If the wrapper types are overused, a lot of useless AutoBoxing and Unboxing will happen. Experienced Java developers will know when that is the case and can avoid this. One of the reasons why Sun introduced this feature, is their initiative to make Java easier to use to attract more and more developers (at the last JavaOne the number 10 million was mentioned as a goal). These would mostly be taken from the MS languages like VB. So... we are talking about a lot of newbies coming along... and a lot of newbies writing code that is slow, because of the above mentioned issues.
# Memory usage will increase tremendously: Another issue concerning inexperienced developers. A newbie might think "Why should I use some weird int[] numbers = new int[x] when I could use a more flexible List numbers = new ArrayList(x);?". Well... one the main reason is the fact, that the latter version will use up way more memory than the former one. In the worst case, it could mean a 400 % increase over the array solution (why 400%? An Integer object will use 16 bytes of memory, which is four times the 4 bytes that the int value would use. It is an 400 % increase because the int[] only uses an array of 32 bit values to hold its contents. The Integer version would need an array of references (32 bits or 64 bits, depending on your CPU) plus the memory for each object).

Wednesday, June 6, 2007

Maven2 - installing 3rd party JARs

Have a little time these few days, trying to get familiarised with Maven2. Not for work, more for it's own sake, still stuck with a legacy app at work. Been reading about the praises for Maven over Ant but the learning curve for Maven is steeper than Ant. And I'm not sure that the Eclipse plugin is making it easier. Some accidents along the way when running "mvn clean" wiped out the entire webapps folder in Tomcat, not just the test app folder I was anticipating. Thankfully it's a fresh install of Tomcat 6, so it's just the default stuff that came along with it.

Anyway tried to manage some dependencies with Maven, wasn't as fuss-free as it's made out. Tried to compile a simple servlet under eclipse, but I couldn't add the dependency via the Eclipse plugin. Had to add it in manually in pom.xml.

Went to "C:\Documents and Settings\Administrator\.m2\repository" to take a look, looking for servlet-related strings. But not too sure about what I'm looking for so decided to install the JARs that came with Tomcat 6 in the end. Here's the commands I ran.



mvn install:install-file -DgroupId=tomcat -DartifactId=servlet-api -Dversion=6.0.13 -Dfile="C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib\servlet-api.jar" -Dpackaging=jar



mvn install:install-file -DgroupId=tomcat -DartifactId=jsp-api -Dversion=6.0.13 -Dfile="C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib\jsp-api.jar" -Dpackaging=jar



mvn install:install-file -DgroupId=tomcat -DartifactId=el-api -Dversion=6.0.13 -Dfile="C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib\el-api.jar" -Dpackaging=jar



The Tomcat website has some instructions on using Tomcat libraries with Maven, but I can't figure out how to get Maven to download the libraries from the correct location.

Hang on, actually I do now. The following has to be added into pom.xml

[xml]

tomcat.staging.repos
http://tomcat.apache.org/dev/dist/m2-repository/org/apache


Friday, June 1, 2007

Problem starting Eclipse - JVM terminated. Exit code=1

Just hit this error today, I was able to get Eclipse running just a few days ago. Didn't remember making any huge change to the environment.
Eclipse error

Tried googling for the solution but couldn't find anything that worked. Then I remembered I switched the Regional and Language options under Control Panel while fiddling around with some software. Switched it back to English (United States) and it solved the problem.

Sunday, May 13, 2007

26 reasons to watch “Deal Or No Deal”

I'm sure the everyone has caught the ads on the upcoming show "Deal Or No Deal". I'm probably going to catch a few shows, but it's got nothing to do with the excitement of the game, not Adrian Pang's hosting skills. One reason is

Reason 1

Here's another

Reason 2

26 of them in total. There's more actually but only 26 appears for each show. More about the models here.
26 Reasons

It's been reported that the arrangement of the models were made after some deliberation. The most attractive ones are those around the centre of the screen. Sort of like how you'll place the best-selling products on the shelves of the super-market I guess.

Monday, April 9, 2007

Protected: 09 April 2007 - Very unhappy

Very unhappy at home. Really pity my mom, what a fucked up father I have. My brother also another crazy fucker, scold my mother for nothing.
Can really empathize with Jay Chou's lyrics:
如果真的我有一双翅膀二双翅膀
随时出发偷偷出发我一定带我妈走

Friday, April 6, 2007

Looking for the original TJC forums?

Have been getting a few visitors who are looking for the TJC forums. Well, the bad news is, it doesn't exist anymore. The school admin decided to pull the plug without informing us. The promise of an "upgraded" forum has not been realised. You're still seeing the message below, after the forum went offline for like 2 months?
Upgrade in progress

However,  the good news, is that ashke has started a new forum for us, called the TJ Rebel Forums. Instills some revolutionary vibes, hmm. Anyway, if you are looking for the original TJC forums, you'll probably be better off starting here.

Thursday, March 29, 2007

Poly route shut for average students

Recently, there was this letter to the Straits Times about average students being squeezed out of the poly courses of their choice by students who could have made it to JC.

Article can be found here.

Students also weighed in with their opinions in the Sunday Times. Polys are cranking out more attractive courses and it is increasingly easier for diploma holders to go on and obtain a degree (not necessarily from a local university), I guess that partly explains why more students are opting for the poly route.

Are there any implications when many highly qualified students take to the polys rather than the JCs? For one, will it raise the quality of the poly education? Can we assume that by and large that these students will take the top positions in poly? Granted that poly education is a completely different kettle of fish from both secondary school and JC, let me indulge in this little thought experiment a while. If this is true, that is, people who excelled in O levels will generally perform well in polys, then what does it imply for the 'mountain range of excellence' that PM Lee was referring to?

Taken from a MOE speech:
Let me start with many peaks of excellence. It’s something we have been talking about for quite some time. But it’s something which we continue to work on. To develop each child, his unique interests, his unique talents.  To help him to grow, and if he has something special, to enable him to express it, and to achieve that excellence, that fulfilment, that ability to become what he could be and make a contribution. Not all kids are the same. Not all kids can take the same approach. Some we can lecture, some we have to guide, some we have to encourage, others we work with them hands-on and inspire them by your presence. But whatever the kid’s interest, we must provide many paths for him to grow and to develop.  We need to build up this whole mountain range of excellence so that individually we are strong, but as a team, we are invincible.

Well, for one, having more peaks of excellence does not mean more people will reach the top. It could be the case that the people occupying the top positions are the same ones who would have done so anyway. They are just doing it in a different area. So the picture is that instead of 50 mountain climbers gathered on the peak, we have 10 peaks with 5 climbers on each. The status quo remains, but they have more oxygen to themselves. In the spirit of widening the definition of success, I'm not sure if that is all that different. Because, besides recognising success in different fields, another factor to consider is social mobility. How easy or hard is it for people who aren't traditionally considered excellent to grow and develop in the field of their choice?

Obviously, the concept of the "mountain range of excellence" is more important to those who aren't already strong academically, because of the qualifying criteria of certain schools and courses. But if these students are being displaced by better qualified students from their preferred schools or courses, I'll think that it will be harder for them to be strong individually. I'm assuming that students who get into the first one or second course of their choice will have greater passion than those who don't and this is a critical factor. This doesn't always hold of course, but in general I think it is the case.

Of course, this is just looking at the issue from a very narrow angle. Being the meritocracy that we are, it is logical to accept that better students should have more choice. After all, they've earned it. And quotas on course enrollment is always bound by the iron laws of supply and demand.

Tuesday, March 13, 2007

Some guidelines when choosing a job - 2007

Was talking with a friend about career options the other day, and was discussing what factors influences one's decision to choose a job over another. He sent me a SMS with the following guidelines, which I found to be an easy guide to follow. Shall keep it in mind.

Knowledge

What skills and qualifications do I need/have?
What kind of knowledge and training can I get (can be technical, managerial etc)?
Does the company encourage a culture of learning and knowledge sharing?
Exposure

What other aspects of the company's business will I be exposed to?
What opportunities are there to explore beyond my core capabilities?
Are there opportunities to venture overseas?

Money

Besides the monthly or annual salary, also look at other components like bonuses, leave, medical benefits, insurance or other kinds of flexible benefits scheme.
Power

Who will I be reporting to?
Who will be reporting to me?
What is the power structure like?
What sort of decision can I make on my own?
What kind of impact can I make?
Environment

Where is the workplace located?
What are the working hours like?
What is the working culture like (is it family-friendly, does it encourage work-life balance, etc) ?
What kind of people am I working with?

Well, Straits Times published some articles about Singapore's IT sector booming. Hope that a rising tide lifts all boats, including mine. Anyway, found this tool by MOM. It lets you do sort of a wage search. Overly simplistic in my view. If you really want to see the sort of wages people are earning, you can find some of the reports here. It's a bit dated, but I think you can factor in a 10-15% increase if you decide to use it as an anchor for salary discussions.

Wednesday, March 7, 2007

Protected: 21/98 class gathering on 03, Mar 2007

Met at Mind's Cafe or something for our class gathering, it's been almost 10 years since we first met. Played some board games, talked a bit about how each of us is doing. Overall pretty enjoyable. Some updates :
Shao is in the US studying for his PhD.

Rak is pupil in a law firm (Drew and Napier) under some MPs (Indranee Rajah and big boss Davinder Singh)

Erv has started his own company doing some photo-related stuff after dropping out of his course. No recent news from him.

Ah-wei is a contractor after doing his biz ad course. Last minute flew us pigeon.
Charles is in London with KPMG, while his Malaysian girlfriend is in Amsterdam.

Beng is a lecturer at RP and has an eventful day before coming to meet us.

Kai is at SIA cargo as a key account manager and had arrived from Japan on the day of the meeting itself.

Feng-jie is still doing petrochem.

Ivonne and YF are getting married, but not to each other...lol. The grooms are also from TJ.

Wednesday, February 28, 2007

Important task completed - lessons learnt

Finally completed the important task early this week, the tight deadline didn't allow for much room for errors, but this year's job seems especially problematic. The documentation is quite outdated, and the scheduled timing of the jobs are way off. This affected with the planned execution, and the problem was exacerbated by the shorter working days due to Chinese New Year. Then the network was constantly disconnecting, so there was a need to constantly monitor and rerun the jobs. And it's my first time running the jobs, so needed a lot of help from users, colleagues and some trial and error.

Overall, I did learn some things:

  1. Creating an index on database tables is not sufficient to ensure fast queries. Always check the execution plan to see if the index is being used, as sometimes overindexing will cause Oracle to use a full table scan instead.

  2. Be careful of ending commands and statements in SQL Plus with "/" instead of ";". If a command such as "spool C:\file.txt" is ended with "/", the last run statement will be run again, which can be a problem.

  3. If the rollback segment is insufficient, it may be possible to split the query into smaller batches to run and thus not trouble the DBA.

  4. Always check if an object with the same name already exists when creating new objects in scripts and do not commit in the script to save some headaches.

  5. Check if CPU usage in Win XP is a bottleneck by checking if the TaskManager constantly reports a usage of 100%.

Wednesday, February 14, 2007

Tang Lingyi on “Way To Go”

Way To Go

Even though Tang Lingyi (汤灵伊) was eliminated in the first round of Project Superstar, you can still get to watch her on TV  on Channel U's "Way To Go". She's the one in orange, for those who don't know. She's not the only cutie on the show, watch out for Macy Chen (陈美心) too. Macy is also appearing on "On The Beat".

Monday, February 12, 2007

Broken stuff for Chinese new year

Chinese New Year is usually associated with bringing it the new and chucking out the old. But this his not especially true for of this year. Let me count the number of spoilt stuff in my house. Desktop, printer, DVD player, TV set, laptop, hand phone. And the new stuff I have? A Nokia E60, from which I am making this post. At least I'm not completely unconnected.

Wednesday, February 7, 2007

SCJP Prep - when dividing by zero is ok

One of the most common examples used to illustrate exceptions is the "division by zero" example.
Exception in thread "main" java.lang.ArithmeticException: / by zero
I think I've seen it in a few Java books, so I've always had this impression that it's never ok to divide a number by zero. Until I started preparing for the SCJP, that is. I ran the code below.

[java]
import java.io.*;

class TestDivideByZero
{
public static void main(String[] arg) throws IOException
{
System.out.println(1/0.0); //prints "Infinity"
System.out.println(1.0/0); //prints "Infinity"
System.out.println(-1/0.0); //prints "-Infinity"
System.out.println(-1.0/0); //prints "-Infinity"
System.out.println(1/0); //runtime error here
System.out.println(-1/0); //runtime error here
}
}


So what's up? According to Sun:


Despite the fact that overflow, underflow, division by zero, or loss of information may occur, evaluation of a floating-point division operator / never throws a run-time exception.

Saturday, January 27, 2007

Why the “upgraded” TJ forums will be a flop

For about 5 years, I was frequenting the TJ forums. It was a forum board managed by the Temasek Junior College IT club, and was open to students, alumni, as well as members of the public. There's quite a lot of interesting discussions, debates and sharing on the forum, and I've sharpened my analytical and writing skills by defending my views and attacking other people's arguments. I've also benefited from others relating their experience on life and work. Overall it has been an enriching experience, though at times things can get quite heated or boring.

First sign of upgrading - forum unplugged

Over the last few days, I had problems connecting to the forums. I guessed it was some server or network problem, so imagine my surprise when I received an email about the school admin deciding to take the forum down. Soon after, this message appeared when I tried to access the site.

Upgrading Work In Progress

That sounds OK right? Well, I was referred to a temporary forum where I learned more of what was going on. Especially revealing was enemychaser's post somewhere here.

Hey people, sorry about not informing you guys on time. Actually I wasn't even informed of the shutdown until well, it actually went down. Didn't even get to post any messages.

Anyway, from what I heard from the tech guys (my teacher in charge didn't tell me anything at all), the forums are closed down to "protect" the reputation of TJC, whatever that means. Sounds like a pretty half assed answer to me, to be honest, not to mention that we didn't even get to protest, as makoto had said. So folks, please accept my apologies. =(


What's up with this reputation thing?

I can guess a few things. A few TJCians themselves going around the forums making silly and disrespectful comments like calling teachers their servants. But there are only a few of such people around, so I don't think it warrants measures spelled out here.
To start off, the TJC forums is not being shut down, just that a couple of changes will be implemented. To the best of my knowledge, a key reason why the forums will undergo these changes is accountability.

A key difference is that the TJ forums will be almost (I'll come to that later) exclusively TJCians
only. From what I understand, posters will have their names displayed on the forums, though the exact nature of that (appearing next to each post? or only in profiles, etc) is still unknown.

That does not mean that ex- and non- TJCians will be unable to participate in the forums, however. This group of people will be able to apply for an account, though approval will have to be granted (again, details are blurry) before these accounts may be used for posting.

MadMax, as always, hits the nail on the head.

Perhaps she has removed the forum out of fear of disapproval by the MOE, when students discuss such 'controversial' topics as religion, terrorism and politics. History has shown us that quelling discussion of controversial topics benefits noone. It is by suppression that we breed ignorance, and by ignorance that we breed racism, fear and intolerance. It is only by open discussion that we learn to understand and tolerate. And perhaps this is the time to say that the TJC forum will survive with or without her authority. The only difference is that there will be no moderation, there will be noone to prevent posts on the oppressive dynasty of LKY, or the illegal sharing of files via forum links. However, the TJC name will still stand above this forum. Whether it is "The alternative TJC forum", or "TJC forums revived", the school name will still be present and used as an identity. If it is the reputation of TJC that the principal is looking to protect, she has taken the wrong path. Abolishment leads to Dissent leads to Underground Movement.




In the war of reputations: Keep your friends close, keep your enemies closer, and keep your students where you can moderate them.




Why the "upgraded" TJ forums will be a flop

Whatever the reason for the changes, if the stated changes do go through, it can only lead to blandness and monotony.

First, anonymity encourages people to speak up more, on more varied subjects. It gives people a (false?) sense of security and freedom from the pressure to conform. Taking anonymity from them is going to make a lot of them freeze up and worry about the social consequences of what they post. Will they be gossiped about, will they be ostracized?

Second, there is an additional barrier for alumni and the public. I'll say that most of the prominent and active forum participants are the people from these groups. Subjecting these contributors to some sort of arbitrary screening process is going to breed some ill-will.They might not even register at all. Some might feel indignant, especially those who've spent some time and built up a fine reputation in the community. For new registrants, this just means another hurdle to cross. The additional screening process is not going to make it easier to join in. I'm just wondering what kind of criteria we're looking at and how many will drop at the first hurdle.

Third, the presence of better alternatives will make the "upgraded" TJ forums even less attractive. It's like you know how bad a product is, but if you place a clearly superior alternative beside it, the original product seems a lot worse. Same case here. If a new forum is really created, I can imagine the kind of embarrassment the "upgraded" forum will suffer from. I'll say, let them compete head to head. See which forum will have more users, more posts, more varied and interesting content at the end of one year. If someone suggests this to the new prinicpal, I wonder what he/she has to say.