Move over to {proton:fever}

Migrated the blog to, henceforth please check the new blog for updates

iPhone SSH screenshots

It's been some time the iPhone jailbreak is available, and there are many posts available online. But I wanted to boast about my jailbroken version. Here are a few screenshots.

First the unix version; uname -a

After that I wanted to use some standard linux commands, but they were not available. When using Cydia, I saw some apt-get being executed; so tried it and installed 'top'
I started MobileSafari to check if was realtime, or it popped up in ms on this screen.

I was bored over the weekend and decided to jailbreak it, and was wondering; "What kept me away from it!!"

The e-Book progress

I was initially using google docs to write the e-book, but then was too lost in formatting the book, or proof reading it again and again. Also I could not update it using my phone, which is pretty much my hand held computer now. I was reading someone else's book online, when using the blog as an ebook sounded reasonable, so I've gone ahead and ported some chapters over to a new blog.
As of now the access is restricted, but if you want access, just comment to this post and I shall be glad to add you as a proof reader to my book.

DWR + Lazy Loading

Time immemorial, we are all aware about the famous lazy load exceptions in Hibernate. Using a detached object does not exactly hide us from the issue. We are using DWR in our application and found that when marshalling (or unmarshalling if you insist) a detached object to JSON, DWR was erratically trying to call a null (lazyly loaded) object, causing LazyLoadExceptions.

We did not want to use OpenSessionInViewFilter as it is evil (some day I'll post all the consolidated rantings as one). You can google and find a lot of info around it.

As a quick fix we did what one would first think of, "It's a demo, just eager load it!". Well the demo was over and now was the time to investigate a better solution, and we did find it.

It was no rocket science, the solution was available in front of us all along, we just did not look hard enough. When using DWR, there are BeanConverters available which are responsible for this marshalling process. There was one for Hiberante, called "hibernate3".
The HibernateBeanConverter tries to avoid reading from un-initialized properties. (If you just want something that blindly reads everything then just use a plain BeanConverter).
Bingo, so when exporting a detached hibernate object to DWR, use type="hibernate3" and that should resolve the lazy load issues.

Cheap Memory

Finally upgraded myself to 4GB of memory on my personal laptop. The price was so cheap just could not resist it :)

Other reasons I was waiting for was better 64-bit Ubuntu support. I still need to reformat my machine. Some of the issues resolved by 64-bit which I was waiting on;
  • Flash browser support (had to use a 32-bit script)
  • Video codecs (works like a charm, even apple trailers work)
  • Open Office (the icons & menu was all messed up)
  • Support for my wi-fi atheros chipset (8.10 cured the problem, no more ndiswrapper)
Hopefully this weekend, I should be able to make a transition. Only if I had 64-bit Windows, what the heck, will wait for Windows 7.

TODO: Cleanup blog

I'm not able to get any good templates, I think I need to search more on the web, or come up with a good design myself...

Can I go back to Photoshop & CSS again?? Been quite some time now...

Hmm let me think..

By Contract or By Convention

Should we be using interfaces for everything and making everyone explicitly implement them or should we trust that everyone follows the same convention.

By Contract

For use cases, where a certain contracts needs to be followed, we should use interfaces, this allows easier testing and loose coupling of implementation, allowing us more flexibility to change the implementation at run time as asked for.

eg: UserService interface has a method fetchUser();

We can have two implementations for this service method, one using a DAO and other the WebService. Thus the implementation is loose and "the contract" is set to return a User.

By Convention

In certain cases, we cannot implement a contract, esp where the concerns span across multiple layers of the app. This is when we need to define convention over contract. AOP is the perfect use case where this needs to be strictly followed.

Let's consider the service methods which fetch information for displaying info to the front end. They need to have a specific security restriction associated with it, or a use case where we need to assign "READ_ONLY" rights to certain users for an object. In order to keep the code as decoupled as possible we use AOP, which apply concerns on these methods, without having actual references in the code.

For these concerns to be properly applied, we need to follow conventions.

eg: All DAOs should persist an object using the create() method only, that ways we can add a concern to block access to all create() methods for a group of user. If someone plans to "be different" and follow their own convention, like calling the method persist(), this can open up a huge security hole in the application. The AOP concern will skip "persist()" as it does not follow convention. Such issues will not be caught unless there is a proper code review performed on the code base, or we have really really strong test case.

If your module needs to follow a convention, which cannot be controlled using a contract, please document it, so as the team can follow is correctly.