July 08, 2006

So after working for ELAB for the past year, the time has now come to part ways.

I shall be joining Interface21 who produce the excellent Spring Framework, and where I spend most of my time.

It has been fun and enjoyable, and I have learnt a lot, and hopefully passed on a bit too. In particular I produced webgroups, formsbuilder (taken over by Hongfeng, the Oracle guru) and sitebuilder2, although all the funky cool GUI stuff was done by others; I am strictly a server side guy…..javascript (shudders) urgh :)

My next role will be as a consultant providing training/architecture+code reviews etc for the Spring framework, Spring Web Flow and possibly hibernate. I have done mentoring + training courses before, but the main focus of my previous jobs has always been to produce architectures/code, it will be interesting to see whether I “take” to the new balance (mainly mentoring, reviewing, little code).

We shall see ;)

Anyways, it has been fun, and working for a Uni is most definately a different experience from working in the “real world” ;) and I have thoroughly enjoyed it, and dare I say may return one day :)

And yes Chris, SBR2is August 2006, and even 2007 compliant ;) As for webgroups and formsbuilder…. ;)

and everything stopped working :( More specifically, when I programatically rolled back a transaction I would end up with an UnexpectedRollbackException :( After asking the exceptionally helpful people at the Spring forum (http://forum.springframework.org/showthread.php?t=26574), it turned out that I had somehow managed to end up with a nested transaction….the nested transaction was marked as rollback whilst the outer transaction was trying to be committed.

So, off I go exercising my brain trying to determine how on earth I was getting a nested transaction and I thought “hmmm, the pointcut is Controller., maybe this is being applied to implementations of Controller”. Given that the AbstractController has a “handleRequest” and “handleRequestInternal” method, I assumed *yes, ass out of u and me ;) that one transaction was being started when handleRequest was invoked and another when handleRequestInternal. This is wrong wrong wrong for two reasons; Controller.* doesn’t match (although I need to confirm this) methods on subclasses and secondly the transaction advice explicity only handles the “handleRequest” method, but why should I let little things like that stop me :)

So I thought, “well, the pointcut is obviously too inclusive, lets restrict it” and ended up with

Then it struck me…..the method on the Controller is called “handleRequest”, not “handle”.....as a result the pointcut would match absolutely nothing :)

So how the flipping heck is this thing working, because rollbacks were working, commits were working etc.?

The other point to this joyful account is that fact that the context in which the aop was defined was importing another context which had a controller defined (actually it was the Spring Web Flow controller). And after looking in their, it was immediately apparent that the flow controller was wrapped using the old style.

Great.

So actually what was happening was the controller was coming out of the included context already wrapped in a transactional proxy. The aop: stuff in the “parent” context was then wrapping it in another transaction.

By “fixing” the aop:pointcut I had ineffect disabled the aop:pointcut, hence there was only one transactional proxy..the one explicitly defined in the included flow.

The fix was easy when I understand the problem.

I managed to spend a good couple of hours identifying the problem and the “solution” not by understanding the problem, but understanding its behaviour. The “solution” was identified not because it fixed the problem, but because it appeared to work.

This is actually quite rare for me…I am usually so anal that I absolutely have to understand why it is breaking…it usually isn’t enough to simply know it works, I have to know why :)

Ah well…..

Moral of the story…make sure you really understand the cause of the problem, and not just its characteristics…..and don’t believe everything I say about aop :)

July 04, 2006

So the book I contributed to (I did the last two chapters on Spring Web Flow) seems to be doing well.

No idea about the number of sales (although I did receive my first commission cheque ;)), but all the reviews seem to like it.

Anyways, if you understand the title (Expert Spring MVC + Web Flow) then go and buy the book :) If you are really lucky and bring it to me in elab before the end of the week I might even sign it for you ;) :)

June 30, 2006

A famous heart specialist doctor died and everyone was gathered at his funeral. A regular coffin was displayed in front of a huge heart. When the minister finished with the sermon and after everyone said their good-byes, the heart was opened, the coffin rolled inside, and the heart closed.

Just at that moment one of the mourners started laughing. The guy next to him asked: “Why are you laughing?”

June 29, 2006

So I have been a long time Linux fan, not because it is any "better" than Windows (whatever that means) but more because it wasn't windows. Hey, I didn't say I was going to be grown up about this did I :)

Anyways, whlist being a fan, I will freely admit that in terms of getting things done, windows is usually easier…there I have said it :) But that isn't really the point is it? I, along with most people also used Linux because it was so much more difficult than Windows, we wanted to find out what was happening beneath the shiny GUIs, we wanted to understand compiler flags and the funky command line etc. etc.

Anyways, what with other time commitments, my use of Linux has dropped off somewhat, but I have kept my eye on ubuntu and been very impressed with recent versions. Actually, to be more accurate, I have been impressed with debian package management (which ubuntu uses), XGL (a funky new GUI rendering architecture) and cool utils like tomboy (wiki like notetaking utility) and beagle (think google desktop indexing like utility)....but it is still more painful than it needs to be to install it and get it running.

Along comes Novell with their SuSE based Enterprise Desktop 10. They have completely redesigned the interface, replaced the desktop menu and managed to integrate all the "cool" things I mentioned before.

If you follow the link you will find a rather large video demoing their latest and greatest features (link). Well worth a look, but I suggest you turn the sound down as the American (I presume) narrator seems to take himself a bit too serious and gets right on my nerves :)

The javadoc clearly states that DateFormat and its implementations are not threadSafe and so usages of it need to be threadsafe.

If these had been merely class members instead of static then we probably would have never run into a problem because we have very few classes which are not instantiated once per request, but because these are static they are obviously shared by all instances of the class.

As to why DateFormat is not threadsafe…SimpleDateFormat (at least) stores a member calendar instance which it modifies during parse and format….

Joy.

Lesson is…read the javadoc of classes you think you know and be really sure anything that is static is threadsafe.

This was illustrated BTW by the use of IE7 on a page which used AJAX…. I can only think IE7 was issuing multiple requests at the same time? Who knows. And of course, debugging and stepping through didn't highlight the problem :)

So I am big fan of pair programming, when used correctly, but it can also be a horrendous waste of time and do nothing more than introduce fraction, reduce morale and end up being a simple drain of resource.

Anyways, found these two links, nothing deep or revolutionary, but quite a nice read:

June 21, 2006

I was having a technical chat with Rob Harrop of Interface21 fame and we got talking about java synchronisation and the farce that is double checked locking, both concepts I thought I had a handle on.

Anyways, I decided to do a bit more reading and am astounded at how much I don't know :) Admittedly I don't feel too bad about this because I have never explicitly looked at these in depth, but here are some interesting links:

Hi Ya,
I came across your advert during my search for buying these item---“1990 HONDA ST PAN EUROPEAN ST1100,Pls let me know whether is still available for sale and also the price,my name is micheal brown ,am situated in Canada the best country so far.I have a shipper that will be responsible for the shipment,shipment will not be your stress.but before payment, i will want you to make me asure you will be honest and trust worthy with me throught this transaction.Pay will issued by a certified GBP Bank draft.Pls let me know the prise pls.
micheal brown

and then:

Hi Sound Good…i want the pics now…..
I’m ready to proceed with the purchase, I will instruct my UK bank to raise the GBP BANK cheque directly in your name and favour from my account for the sum of £4,500 You’ll allow the cheque to clear for 2-3 days at your Bank. After you might have deducted your payment, the excess fund should be sent to my shipper in the UK, via westernunion moneytransfer. My shipper’ll handle the shipping to Canada, he deals with Quick Time,and fast delivery.I’ll like to pay you £150 for your efforts and the westernunion charges.
Pls send your full datas,so that you’ll recieve the cheque very
soon.NAME…PHYSICAL ADDRESS…PHONE NUMBERS…
Hoping to hear from you asap,shipper will come for pickup at your address.
miheal brown