Life Codecs @

Ruminations. Reflections. Refractions. Code.

Feb 6, 2009 - software dev


The title means “Wicket is Wicked!” in German (I know, lame, still kinda funny though :P). More seriously I just finished Parts 1 and 2 of Wicket in Action. I found the book to be very well-written with one exception: the analogies to the lasagna preparation made me very hungry – I am currently fasting, ahem. Apart from that, it certainly explained the framework well enough to enable to me to write this post, so kudos to the authors and Manning. Here’s my ‘review’ (if I may be so bold) of the book/framework (note that this is based on fairly limited usage writing toy apps, so caveat emptor):

I fully read and tried out examples in parts 1 and 2. I love the framework, it truly brings an OO component-driven model to web programming. As the authors aptly pointed out, Wicket solves the impedance mismatch problem between the stateless nature of HTTP and stateful object model, and Wicket solves it well! The impedance mismatch issue is analogous to the one we have between OOP and RDBMSes which of course ORM solutions like Hibernate solve. Some pros and cons:


  • Familiar OO UI programming model, especially for people who’ve written thick client apps in toolkits like Java Swing.
  • Encourages typesafe – almost transparent – state maintenance using objects rather than direct manipulation of the Servlet HttpSession.
  • Excellent abstractions make learning logical and intuitive, for example a Page represents a top-level container, similar to a Frame object, to which you can add child components.
  • Minimal configuration gets you started. Pretty much just web.xml to configure your wicket app, the other plumbing can be done using Maven 2, definitely check out the bonus chapter 15 online very early on to configure your IDE so you can play with the examples.
  • Makes wizard creation – a fairly common and very tedious task in web programming, God the pain… – a breeze, not because it has specialised classes or declarative ways of doing it, but because state maintenance is easy, passing one page instance to the next page instance is straightforward ( page1 = this; … setResponsePage(new Page2(page1, …)).
  • Previewability – allows HTML pages to be viewed with dummy data that will be removed at runtime. The authors admit however, if a page has a lot of components, it makes it more tedious to preview.
  • A lot of thought has gone into packaging new components, complete with their own resources such as CSS files, images, and Javascript. This extensibility does allow a lot of reuse of components easily, very much in line with OO principles.
  • I did not mess with this a lot – but Wicket seems to have decent Ajax support, including transparent fallback to non-Ajax behaviour if it is disabled on the browser. The authors point out that Wicket takes the view that Ajax is optional, and assuming you use the correct Ajax+Fallback component, no code changes are needed to accomodate both Ajax and non-Ajax behaviour. Chapter 10 of the book which I hardly read (part 3) goes in more depth about using Ajax.
  • Due to the stateful nature – makes checkbox and multi-selection handling a breeze, woohoo!!
  • A lot of built-in validators for common validations – having said that, these days I tend to prefer having validations (== business rules) done via my models, so this doesn’t buy me a lot – in fact it would make me put business rules in the web tier. Ideally we could annotate models and use some form of code generation (I hear screeches of pain…) for both the models and the client side for better responsiveness, of course some validations just can’t be done on the client side, so still thinking on this.


  • There’s a lot of reliance on Java object serialization – to achieve transparent state maintenance, Wicket serializes the manipulated markup and code at the end of each request. This means any models you have used in the session must also be serializable. The good news is the authors spend time talking about this, and ways to get around it, using detachable models (I’d rather call them model wrappers for they wrap your actual model object) for example. This is also something to take note of when considering performance issues.
  • For people used to request-response based frameworks like Struts, the programming model will take a little bit of getting around – although I got around it pretty quickly, it seriously is way easier and more logical, especially to back-end programmers. As with any framework, there are new concepts to pick up here and there.
  • To bind models to web forms, strings are used in the form of property expressions (e.g. foo.getAddress().getStreet() -> “foo.address.street”), this obviously will not be picked up when your models get refactored. Hopefully smarter or Wicket-aware IDE plugins will help in this area. This plague is common to many frameworks… (e.g. in Hibernate: HQL and even when using the Criteria API).
  • In spite of adherence to the DRY principle, it does not generate HTML for you, and markup (which are tagged with “wicket:id” attributes referenced in the code) and code must remain in synch or Wicket will throw an error when accessing that page. This is good and bad, the nice bit is it does allow web designers to maintain the look and feel for you. Wicket IDs, Code Hierarchy, and Markup Hierarchy synchronisation is another place where Wicket-aware IDE plugins would be useful.

I only skimmed through Part 4, but it definitely has a lot of useful advice on integrating Wicket with with other toolkits and middleware such as Spring and Hibernate, and on internationalization (i18n) and localization (l10n) (still trying to figure what the latter’s scope is exactly…), something that’s missing in many books – while it’s not strictly necessary thoeretically, practically no framework works in isolation these days except perhaps if you get full-stack frameworks like Grails or JBoss Seam that Ruby on Rails popularised; dunno, I still kinda like cherry picking my parts, but I haven’t explored these so I may change my mind.

Hmm, I wonder how it compares to GWT – something else to try out when I have time, for now, time to check out EJB 3.

— Kamal

Feb 2, 2009 - general gripe personal

Bad Hairday!

Ya know, like many geek-types, I am not one who is too concerned with how I look, at times I look a little messy, but clean, not dirty or icky – to me that is sufficient. Fortunately (for it is overall fortunate), hair grows and there are times when I need to cut it. I kept long hair for a couple of years – looked very hacker-ish, but alas, it was a maintenance nightmare. So anyway – I do not have a regular salon that I go to, and am not one to spend any more than 30 dollars per haircut, even that is excessive! Unfortunately, it seems that in Melbourne, there’s no such thing as a “decent” haircut unless (I assume here, for I have not done it) you shell out some absurd amount. So today, despite my inner voice telling me to do it tomorrow (no kidding!), I decided I needed to get a haircut. I went into the city, looked at a few places on Elizabeth St., went to Melbourne Central basement – there was a place I had intended to try out but they were closing already. Went into China town, entered a place… and for a simple male cut in this standard-ish looking place in an arcade, they were charging 63 dollars! Can you believe that?! Like, what magical I-Ching hexagram was consulted to get that number?! So I stood there, raised an eyebrow, then declined and left. I ventured back to Elizabeth Street to this decent looking salon (by no means a 2-seater barber shop, though I reckon I’ll try that next time… couldn’t be worse). I was asked to wait 15-20 minutes, and then it was my turn…

The lady (in her early 20s) asks what kind of cut I’d like, I said I wanted it short, and “square at the back” – the latter phrase is something I picked up way back when I moved here, to say I want a clean angular lining at the back, as opposed to curvy one I suppose. Firstly, I asked for a haircut and I came to a salon, so what’s with these people asking me what number I am!? Like how the heck am I supposed to know what clipper I want to use, isn’t that why I’m there!? Okay, so maybe there are people who know their hair and the tooling for it well, I am not one of those lucky folk. So anyway, I tell the lady I have no clue, she says she’ll try a number 4 (she was Chinese, I am told the character for “4” in Chinese is similar/the same to the character for death!). I’m like yeah whatever. And BANG, she runs the thing like a bloody lawnmower on grass. I mean I asked for “short“… not “let the outline of my head be visible to all who will see“! She moved it so fast that by the time I told her that I didn’t want it that short, she replies in her accent, “this is no. 4 – must be same len’ everywhere, if start, cannot stop”… what the bleep!? I realised then there was nothing I could do about it, it was way too late.

Now if it was just that, perhaps I could let go and move on (actually I have done that already, I’ll just feel better once I have this all in writing!), she also had no sense of symmetry… when she was placing the mirror at the back of my hair, I had to point out a couple of things – it wasn’t “square at the back” damn it!, and in one case, she just could not see what was wrong… so I literally just went “nevermind”, because I was afraid she’d ruin it further :(. Folks, if you have no sense of symmetry – please, don’t consider hairdressing, or software engineering, become an abstract artist or something, you know. So yeah, I have had a bad hairday – this must be the worst to date, once it grows I shall be able to get it cut again (I don’t where, but I do know where NOT!). Oh and worst of all… she did not use scissors… the biggest no-no in my book1. I asked for a haircut, not a clipper cut (a concept I have only heard of here…)!

Now some upsides – yes there are upsides, hard to believe: despite the cost advertised – 30 dollars – I was charged 15 – I so would have left some diplomatically caustic (is that even possible, or is it an oxymoron?) words for her to ponder otherwise. It appears she thought I wanted a clipper cut (but I said I wanted a HAIRCUT, H-A-I-R-C-U-T!!) – boy I must look like a starving student (that’s another upside, I must look young and fresh)… I suppose I hadn’t had any food yet at the time. The final upside I guess the lack of hair will keep my head cool during the summer. Meh.


1 Kamal’s Book of Life Skills, by yours truly, Chapter 33, p22, verse 11: “Profess’d as a hairdresser, ask’d for a haircut, clippers come and clippers go, but thou shalt use scissors without fail, else, a pox o’ thee, curses, boils, and sores spattereth across thy body, Heretic O’ A Hairdresser, Liar, Cheat, Heathen and Most Unholy Scum.”

Jan 31, 2009 - martial arts philosophy

Hoosain Narker’s “My Karate Odyssey” Travelogue

Back when I was a toddler (well not quite that young), a few influential people influenced me (coz that’s what influential people do…) and made me stick to practicing Karate. Hoosain Narker, a master of the Ashihara style was one of these people. He has written a wonderful travelogue, full of fascinating tales, and more importantly life tenets that he’s learnt and lived through his several decades of of training. I highly recommend his book, for martial artists and non-martial artists alike.

— Kamal

Jan 12, 2009 - how to software dev

Change Favicon In Joomla 1.5

While there are some extensions to do this (okay, I found one but it was broken), in Joomla 1.5 (decent product, a good balance between ease of use and uber flexibility), it seems that each template (in /templates/) have a favicon.ico file. Simply replace this file (keeping the same name obviously), with your own version. Google favicons and how to create them if you don’t know what they are :P. Note that favicons are usually cached by the browser, you’d either need to do several reloads, or clear your browser’s cache before the icon shows up/refreshes.

— Kamal

Jan 12, 2009 - general gripe

My Change Please, Yes All of It

So, the Jakarta Post doesn’t seem to like my letters (or me) very much, after my last unaccepted letter, I sent this little gem:

  • * *Dear Editor(s),

I’ve noticed a trend here. I visited a couple of large and famous cafe chains (names coming up) in our many malls. I purchase some food and drink and I pay cash, and they don’t always have small change available. In some instances the cashiers have half-heartedly, very quickly apologised while handing me back partial change. It is clear that they’re not really sorry, and would not have made any effort to get all my change. In other instances, they just give me back partial change! No fake apologies, no effort to explain, nothing, as if they committed no mistake – to quote the Brits, “How Rude!”.

It is small change, I’m talking usually between Rp. 100 to Rp. 500 or so, so my gripe is not so much the money as it is the principle. I can tolerate this behavior if I were buying nasi pecel from a warteg in the streets, heck I would even consider it charity. But from multinational and large joints like Dunkin Donuts and Cafe Oh La La (ooh la la, names!), er no way! I wonder, if I went to Dunkin Donuts, where a donut costs about Rp. 6000, and I had Rp. 5900, would they allow me to have the donut if I apologised for my lack of cash? Or perhaps I had an Rp. 25 candy to supplement my insufficient cash, would Oh La La give me my hot chocolate? Or perhaps, even better, were I to hand in insufficient cash and glibly walk away with my donuts, would they let me? Or would donut guards be called in? Oh, does this also mean that if all the small change adds up, they make hidden profits? Perhaps something the tax department might want to look into, heh.

I want my change, yes, all of it.

Oh well, their loss, they just ignored a very valid opinion, and some A-Class gripe material. For foreign readers, warteg or Warung Tegal is a street side food tent, and nasi pecel is a delicacy: rice and vegetables (optionally with catfish – pecel lele), spicy peanut sauce and sambal (== chilli sauce), yum yum.

— Kamal

Dec 27, 2008 - arts personal

Enya, “On My Way Home”

It’s hard to see how I forgot this one till I was reminded by my friend a couple of weeks ago. I spent many-an-evenings in the lab listening to this prior to going home back when I was at uni in Jakarta! Very uplifting song, definitely one of my all-time favourite, and very personal too. Anyway, as usual, video and wonderful lyrics! Be carried away!

— Kamal

PS. Actually most things Enya make it to my all-time favourites list easily, but this one tops it :-).