Wednesday, August 18, 2010

Monkey Visitor at my Place !!

   It was just an ordinary morning. 9.15 AM, Wokeup and was booting up for the day. Suddenly from my window, noticed a Monkey at 20-30 Mtr. distance. Its kind of unusual !!




   I thought its gonna be something special today. I was wishing that I can see him face to face. And my wish came true. As if he was here to meet me only, he came right in front of my Window and sat down on the roof in front of me. Then he started some breakfast. Suddenly I was surprised to see that he wasn't alone !! There was one more, and he also joined breakfast.

   I was really happy, but worried as well at the same time for their security. Its a residential area and being them a kind of unexpected visitors, their life is at threat as poeple may harm them as precautionary measure.

  I immediately called up (National Park) Borivali Forest division. I got response that its a job of Mumbai Range division and gave their number to call them. This was expected, I was 200% sure that I wont get satisfactory response in just one call. So I called up Mumbai Range division. I thought call will never get answered, but luckily ( really luckily ??) some sarakri "BABU" answered the call.
 
  I explained him the situation and why I am worried for these two sweet monkeys, here is the response:
(My conversation was in Hindi, just puuting it in English here....)

Babu: Ok. Just do one thing, as we can NOT take your complaint on Phone. Come here to office and we will lodge complaint and then come to catch.
Me: Were is your office?
Babu: Thane
Me: ( Man !!!!) It will take me more than 2 hours to reach Thane. And god knows how much time to lodge the complaint.
Babu: Yes, but poeple call us and by the time we reach there, animal runs away.... (sad as they can't do anything?? / Smiling, as I am fooling this caller !! god knows .....)
Me: Exactly, if that is the case, what is the guarantee that Monkey will be Obidient to me and will wait untill I return from Range office with lodged complaint ??
.........................
  Then he started giving all non-sense excuses that you all can imagine....

Babu:What is your address ? I will just take informal complaint .... ( Kidding with me ??? What the hell is Informal complaint ?)
Me: ( After giving my address !!!!) are you guys gonna come ??
Babu: Lets see. (In their typical style for being Govt. Babu).....If our persons comes here, I will try to arrange something. Till that time, you keep an eye on those two !!!!!!!!! (BANG !!!!!! )

     I was so sad !! When will we start caring for others ?? Those guys just want to take thier salaries, nothing else !!! Hope some day they will realize their duty !!!

Spring MVC 3 Showcase

Came across very good stuff for Spring MVC 3.

Spring MVC 3 Showcase

Wednesday, August 4, 2010

GroovyPagesTemplateEngine memory leak/ Perm Gen space issue

Hi,
  Was working on to resolve one of the issues that our production server was getting while running Grails based application which uses org.codehaus.groovy.grails.web.pages.GroovyPagesTemplateEngine for templating etc.
  Actually it turned out to be a very serious issue. when we digged into the issue and found that while creating dynamic classes by compiling the templates, it keeps on using more and more memory if there are many requests comming to the application (no matter how fast/slow) which uses org.codehaus.groovy.grails.web.pages.GroovyPagesTemplateEngine.createTemplate(Resource) method.
  After sometime it used to full whole our PermGen space (1 GB as well very easily under load) causing application to stop responding any further requests.

  That forced us to go through the Grails code and luckily we were able to resolve the issue.
We have created Grails Jiras for the same as provided link below:
   1.  http://jira.codehaus.org/browse/GRAILS-6573
   2.  http://jira.codehaus.org/browse/GRAILS-6571

 

Refs:
http://markmail.org/message/y67xrhy3foy4rfqe#query:+page:1+mid:gm7ms4ljghqql2ei+state:results
http://www.nabble.com/MetaClassRegistryImpl-memory-retainment-and-1.5.7-td19979094.html#a20040179

Thursday, July 22, 2010

Reading i18n messages from the database with Grails

   Many Grails based applications wants to read i18n messages from some other resource instead of from static properties files. Below link gives a great explaination how you can do it if you want to read messages from DB.
http://graemerocher.blogspot.com/2010/04/reading-i18n-messages-from-database.html

Monday, July 19, 2010

Comparing Grails and Tapestry

Hi,
   Was going through some details of Tapestry to findout whats good/bad in it. Currently I am working with Grails based application for almost 1.5 Yrs. But believe me I would try to be very unbiased during this comparision.

Note: All the comments are my based on my personal likes and dislikes, so please excuse if you think otherway round ;). Your comments are welcome if you want to correct me or share your own experiences.

  Basically Tapestry and Grails both are  frameworks which gives you Convention Over Configuration platform where you can focus on your problem domain rather then settingup the environements for developement like Spring & Spring MVC configuration, Hibernate configuation etc.
  But  following are reasons why I still prefer Grails over Tapestry:

1. Tapestry is focused on UI development with Model based architecture in mind. Even though it says minimum configuration and more over convention, but didn't like the way we hare binding UI with backend as shown at http://joshuajava.wordpress.com/2008/09/11/a-glimpse-of-wicket-14-and-tapestry-5/ when we compare it with GRAILS. I feel GRAILS is much more mature in many ways.
   a.  We will still have to manage all the Hibernate Mappings (annotations) by hand. Though we do it in GRAILS in GORM way, but somehow GORM ways makes it look much readable and maintainable.

2. Like Grails there is TRAILS as well. But dont see TRAILS group really active as there is hardly in Traction there. ex. look at the JIRA summary page: http://jira.codehaus.org/browse/TRAILS#selectedTab=com.atlassian.jira.plugin.system.project%3Asummary-panel

    Trails: http://today.java.net/pub/a/today/2005/06/23/trails.html

3. Code in Tapestry still looks much more Verbose than in Grails. I mean we have to write relatively bigger code than in Grails.

4. I feels there are just ample of Grails plugin there are reusable components compared to whats are available for Tapestry based apps.

5. Environment based application behavior support in Grails is just too good to have it. Grails support to create custom environment as well that too without doing complex coding.

6. Its just too easy to write JSP taglib and template based apps which also changes relatively frequently in Grails and it can be use very extensively when you are developing a site which needs pages which gets data from multiple places and you dont want to hardwire your controller with all data.

     So basically I am not saying Tapestry is Bad. Its is good when someone is working on old frameworks like Struts/Spring only. But as a developer I would say, one someone starts working on Grails, would not prefer writing code in Tapestry atleast. Grails just so addictive ;) by its design and flexiblility :p

Some links for Tapestry:
http://tapestryjava.blogspot.com/
http://skillsmatter.com/podcast/java-jee/tapestry-5-java-power-scripting-ease
http://howardlewisship.com/screencasts/tap5-classreload-oct2006/tap5-classreload-oct2006.html
http://howardlewisship.com/screencasts/actionlink-oct2006/actionlink-oct2006.html
http://blog.taragana.com/index.php/archive/move-over-rails-we-have-grails-trails-and-now-sails/
http://moatazanany.wordpress.com/2008/09/13/boost-your-productivity-using-apache-tapestry/

Grails:
http://stateyourbizness.blogspot.com/2008/09/pessimistic-locking-with-grails.html

Grails Intro by Scott Davis:
http://www.youtube.com/watch?v=RqHwwAWXcbE
http://www.youtube.com/watch?v=gkaaOXGomzg

http://www.viddler.com/explore/oredev/videos/29/
http://naleid.com/blog/2009/10/01/batch-import-performance-with-grails-and-mysql/
http://sacharya.com/transactions-in-grails/

Thursday, July 15, 2010

Grails DB Sharding Plugin

Here is the link for Grails DB sharding plugin.

Lucene Search Index

Hi,
  Sorry for not updating blog such a long time. May be I was just too lazy to do it. But I will try to not to be so lazy from nowon ;)
      Lucene is a framework which allows you to store some data that cab be indexed so that fast search operations can be performed on it. This data can actually from from any source like file system, Database, http etc.
     Data is stored in a "Document" form within by Lucene. Its is programmer's responsibility to get the data and create documents. Lucene takes responsibility to index it and make them searchable.
    Was reading on some articles to confirm the Lucene implementation in my Grails app is proper or not. Came across following few very good links for starters.


http://www.ibm.com/developerworks/web/library/wa-lucene2/?S_TACT=105AGX52&S_CMP=cn-a-web
http://www.darksleep.com/lucene/
http://www.javaranch.com/journal/2004/04/Lucene.html