Your browser (Internet Explorer 6) is out of date. It has known security flaws and may not display all features of this and other websites. Learn how to update your browser.

Cape Verde

Just got back from a business trip to Cape Verde. In case you are wondering, Cape Verde is a group of islands off the coast of Senegal in West Africa.

Boy, it is a beautiful country! Totally not what I was expecting, after the trip to Tanzania in the middle of the year. The only bad thing is that it is just too damn far from Singapore… It took me some 40 hours to get to their capital, Praia and another 30 hours to get back to Singapore from Praia. The reason for the the extra 10 hours to get there? I had to layover for almost 12 hours on another island, Sal, as there wasn’t a direct flight that day… So yup, I slept like a hobo in the airport.

A pretty uneventful biz trip, just some minor hiccups here and there, no biggie. This is the type of biz trip I prefer, not much surprises and things going to plan. Would like to have some free time to go explore around though. But you can’t have everything 😉


New Dogster Stickers!

Dogster is giving away their new stickers!

Same thing, just send them a self-addressed, stamped envelope if you are in the USA.
If you are not in the US of A, like me, you can send them an International Reply Coupon together with the self-addressed envelope.

And since I’m gonna mail them the IRC, I might as well send some stuff together. Pictures of my two sweeties. 😀

Also, they are having a photo competition of sorts. Once you have got the stickers and found an awesome place to stick them, take a photo and send it to them. The best photo will get featured in their blog!


Fading Ink

It seems like the Lamy T10 black ink fades pretty easily. Stuff that I wrote a few weeks back have faded to a greyish-brown colour instead of the original black colour…

Another thing I notice was that the ink’s solvent (I think…) seems to oxidize or something when it is exposed to air, turning into a yellowish stain.

Pen Ink

On the left is the Lamy T10 Black ink that came with my Lamy Al-Star and on the right is the Pelikan Brilliant Black that I filled into my Hero 336.

The paper was soaked by placing the nib on the paper for a while, letting it flow out.

Did I get an imitation ink, or are all Lamy T10 Black ink like that?


Best Friend

Best Friend


Apache Load Balancing and Session Stickiness with Tomcat

Me and my colleague were trying to set up an Apache load balancer yesterday to balance the connections to a pair of Tomcat servers. As we were balancing connections to application servers, one of the main requirements was to maintain session stickiness when routing the connections.

Most articles on the internet are dealing with load balancers serving static or session-insensitive pages. So it took us quite a while to figure out how to setup what we wanted. We went through countless articles and tutorials teaching us to set up simple load balancing functions on the Apache web server. And we followed those instructions to the word and still can’t get session stickiness to work…

That is, until we stumble across this goldmine!

Near the bottom of the tutorial was the magic that made everything work, the configuration to the Tomcat server. Seems like not many people on the internet have to deal with Apache load balancing to Tomcat with session stickiness as none of them mentioned anything about configuring the Tomcat. (either that, or we are pretty stupid and clueless about Apache and Tomcat… we are n00bs afterall) The articles and tutorials just casually mention the “route” parameter and then move on to the rest of balancing configurations.

So, to configure an Apache load balancer with session stickiness to Tomcat, you first have to configure the Apache webserver:

LoadModules proxy_module
LoadModules proxy_http_module
LoadModules proxy_balancer_module

ProxyRequests Off
ProxyPreserveHost On

BalancerMember http://server1:8080 route=http1
BalancerMember http://server2:8080 route=http2

ProxyPass /examples balancer://apacheLB/examples stickysession=JSESSIONID
ProxyPassReverse  /examples balancer://apacheLB/examples

The first 3 lines will load the necessary modules for a Proxy HTTP Load Balancer in Apache.

“ProxyRequests Off” will turn off the forward proxy function of Apache as we are only interested in the reverse proxy function.
“ProxyPreserveHost On” will preserve the host header to the proxied host.

The Proxy stanza is where you define the members of the load balancer pool and the name of the balancer url. Note value of the “route” parameter,  you can set it to whatever name you want as long as it is unique, you will need this in the Tomcat configuration. You can also set some load balancing parameters like the lbmethods, the retry timeout, the lb weightage and so on. You can find out more in the mod_proxy documentation.

You define the load balancer like any other Apache Reverse Proxy, the only difference is in the mapping. In a regular reverse proxy, you’ll map the application context to a specific server. But in the case of a Load Balancer, you map the application context to a balancer url, as defined in the Proxy stanza. Note the “stickysession” parameter, this is to define the session name. In the case of a Tomcat server, we’ll use “JSESSIONID”.

Next, you have to configure the Tomcat servers, in the server.xml configuration file:

# In Server 1 server.xml
<Engine name="Catalina" defaultHost="server1" jvmRoute="http1">

# In Server 2 server.xml
<Engine name="Catalina" defaultHost="server2" jvmRoute="http2">

Locate the “Engine” tag in the server.xml file of each Tomcat server or instance and add in a “jvmRoute” parameter. Make sure the value of the “jvmRoute” parameter is the same as the one defined in the Apache configuration file for each server.

And, you are done! A simple Apache load balancer with session stickiness to Tomcat servers.


Nike We Run SG 10K

Nike We Run SG 10K

Today was the Nike We Run SG 10K event, the one which 12,000 slots were fully registered within two days of registration opening. Quite a few of my friends were exclaiming that they didn’t get to register in time for the race. Well… For Nike running events in Singapore, you can’t really mull over the registration, you gotta decide fast.

The race expo was last weekend over at Orchard Central. Reach there around 7pm sharp and boy, was there a long queue already. The race pack was quite sparse, a race tee (that’s what most people signed up for), a race tag, a Nike water bottle and an event info sheet.

Nike We Run 10K Tee

Fast forward to today’s race. Well… It didn’t really get off to a very good start… Early in the morning, SMRT had a delay in their service… I waited for quite a while at Lakeside for the east-bound train and it didn’t arrive till 6:10am… And after Jurong East Station, the train was like a weekday peak hour train, packed to the brim… Was suppose to meet up with my friend Kenny at [email protected] to put all the barang-barang in his car before heading to the race village… But due to the train delay, had to meet him straight at the race village…

Not sure if it was due to the train delay that there was a huge crowd moving off at Kallang station, but it seems like that event was ill-equipped to handle large crowds… There were many chokepoints and funnelling of crowds… Especially bad was at the entrance into the race village and the path towards the starting pen. Why would you funnel a large crowd into a small pathway? I don’t quite understand on that…

The run itself was quite pleasant. Large crowds, but the paths were wide, spacious and well, proper paths. Unlike a certain run where there were funneling of crowds, mixture of paths and trails, dimly lit paths… (*cough*AHM*cough*) Lots of overtaking within tight spaces, due to the large crowd and I believe also due to people not really prepared for the run.

This year’s finisher’s item is a Keychain/Flashdrive. At first I thought it was just a normal keychain (cheapskate!), until Kenny told me that it’s a flashdrive too! Well… It’s only 2GB, but still much more useful than a just a keychain.

Nike We Run SG 10K Finisher's Item

All the usual stuff at the Finishing Point/Race Village, 100Plus, Ice Mountain (mineral water), banana, massage points (Salon Plus mostly…) and in addition, ice cream! Not sure if eating ice cream after a run is a good idea… Didn’t queue for it, too long…

Headed down to [email protected] for a swim and jacuzzi after the run. Man, it was awesome! The view, the swim and the jacuzzi itself. The water jet was just nice~ A good water jet massage after a run, hah.

Southbank@Lavender Infinity Pool

My next run will be the Newton 2011 Run. 30KM… Oh shit…


$1.20 Fountain Pen

Look what I found!

A SG$1.20 Hero 336 fountain pen! Who knew a fountain pen could be that cheap!
Well, it is a cheap pen meant for the masses. According to this website, it was released during the Cultural Revolution as a means for the lower classed to own a fountain pen. But still, $1.20?! Heck, it’s cheaper than most Pilot Pens…

Got this pen at Mustafa (damn! they sell everything there!), on the first level pen section, next to the sub $1000 Montblancs (hah!)

Forgot to get ink though… Gonna go buy some later.


Apparently, they never think also


Hello World!

Ah, it is finally up!

My new blog is more or less done. Finished migrating the post from my old blog and from now on, I’ll be blogging here. Cool!


WordPress Upload Problem

I’ve finished setting up the LNMP stack on my VPS, and got WordPress running on it.

I will be sharing the steps I’ve done to setup the LNMP stack on a later date, but first, I’d like share an issue I’ve encountered after getting WordPress up and running.

After running the install.php script and doing up the settings of my WordPress site, I tried to upload a free theme pack from WooThemes. (Typebased, if you are wondering which one)

The first problem I hit was the server giving me a “Connection Reset” everytime I tried to upload the theme. In the Nginx error log, this was recorded:

2011/09/24 07:34:58 [error] 30097#0: *70 client intended to send too large body: 2617076 bytes, client:, server:, request: &quot;POST /wp-admin/update.php?action=upload-theme HTTP/1.1&quot;, host: &quot;;, referrer: &quot;;

The “client intended to send too large body” tells us that Nginx was rejecting the theme zip file as it was too big (it’s 2.49MB in size). A check on the Nginx Wiki shows that the default maximum size accepted by Nginx is 1MB, and Nginx resets the connection whenever a browser tries to send or request a file greater than 1MB. So we’ll have to update the nginx.conf file with the “client_max_body_size” directive to get Nginx to send and receive a bigger file. I’ve changed mine to a value of 3MB and you may adjust yours accordingly. Note that the directive is placed in the “http” section.

http {
client_max_body_size 3M;

I tried to upload the theme file again, and this time the file was accepted by Nginx without a problem. However, WordPress threw an error, “The uploaded file could not be move to …/wp-content/uploads.” Not a very intuitive error, seems like it is a permission issue with WordPress trying to write to the uploads directory… The logs weren’t showing any error and a Google search resulted in quite a few people having the same problem.

Most of the resolution are to do with setting the correct permission for the uploads directory. A check with my uploads directory shows that the permissions are correct  and I even tried to give full 777 permission to the directory! But error still persist… It took me quite a while, trying to figure out what’s wrong and then it suddenly hit me! It could be related to the Nginx size error, but at the PHP layer. A quick Google shows that PHP has a “upload_max_filesize” and “post_max_size” directive, so I updated my php.ini to include the two directives:

upload_max_filesize = 3M
post_max_size = 3M

Bingo!  The theme file went through and was installed in WordPress.