Friday, September 6, 2013


Socialism: You have two cows, and you give one to your neighbor.
Communism:You have two cows,the government takes both and gives you the milk.
Fascism:You have two cows,the government takes both and sells you the milk.
Nazism:You have two cows,the government takes both and shoots you.
Bureaucrat-ism: You have two cows,the government takes both, shoots one, milks the other and throws the milk away.
Capitalism: You have two cows, you sell one and buy a bull

Thursday, September 5, 2013

Accessing Grails components (Controllers and Services etc) from grails-app in classes /src/groovy

There is a need , sometimes, for groovy classses in /src/groovy/pkg1/ to access/work with Grails components (ex. services).  The service/controller/domain/views components are in /grails-app directory and can see/access each other. The classes (.groovy or .java) in /src/groovy or /src/java cannot see them.


//Import the required classes
import org.codehaus.groovy.grails.web.context.ServletContextHolder as SCH
import org.codehaus.groovy.grails.web.servlet.GrailsApplicationAttributes as GA
class GetServicesHelper {
   def getMyService(){
        //Get ServletContext 
        def servletContext = SCH.servletContext
        //Get GrailsApplicationContext from GrailsApplicationAttributes saved in ServletContext
        def grailsApplicationContext = servletContext.getAttribute(GA.APPLICATION_CONTEXT)
        //Get the service that is injected into Grails Application Context
        def myService = grailsApplicationContext.myService
        return myService

Monday, August 26, 2013


Once there was this guy who was in love with a girl. She wasn't the most beautiful and gorgeous but for him, she was everything.
He used to dream about her, about spending the rest of his life with her.
His friends told him, "Why do you dream so much about here, when you don't even know if she loves you or not? First tell her your
feelings, and get to know if she likes you or not". He felt that was the right way. The girl knew from the beginning that this guy loved her.
One day when he proposed, she rejected him.

His friends thought he would take to alcohol, drugs etc. and ruin his life. To their surprise, he was not depressed. When they asked
him how was it that he was not sad, he replied, "Why should I feed bad? I lost one who never loved me and she lost the one who really loved
and cared.
"When life give you a 100 reason to cry, show life that you have 1000 reason to smile."
"Life is wonderful if you know how to live."

Grails Application configuration in Websphere container.

For the first time install of Groovy/Grails app on any server, make sure following properties are set for the web container on all application servers/nodes/clusters.

§         In "Application servers > server name > Process Definition > Java Virtual Machine" add to the "Generic JVM arguments"

§         In "Application servers > server name > Process Definition > Java Virtual Machine > Custom Properties", add a custom property
   value: true
  description: Invoke IO Exception override processing

§         In "Application servers > server name > Web container > Custom Properties", add a custom property
     value: true

     description: Invoke Filter compatibility patch

Websphere WAS 6.1/7 often logs the following exceptions into SystemOut.log files.

[Servlet Error]-[Filter [DeclaredResourcesPluginFilter]: filter is unavailable.]: java.lang.NullPointerException

1. Log into Admin console of Websphere Apllication Server.
2. Navigate to

WAS Admin -> Environments -> Virtual Hosts -> default_host -> MIME Types

Add/Modify following as the MIME TYPE 

GIF gif
JPE JPEG JPG jpe jpeg jpg
TIFF TIF tiff tif
PNG png
PSD psd
ICON ICO icon ico

Note: The Extensions can be separated by whitespace

Do it in all Virtual Hosts.

See the below image for reference.

Thursday, April 25, 2013

Interesting story on Finance

Here's a very interesting anecdote that describes how an 'asset bubble' builds up and what are its consequences. Read it even if it confuses you a bit...things will be clear as you reach the end.... 
ANCEDOTE - Once there was a little island country. The land of this country was the tiny island itself. The total money in circulation was 2 dollar as there were only two pieces of 1 dollar coins circulating around.

1) There were 3 citizens living on this island country. A owned the land. B and C each owned 1 dollar.
2) B decided to purchase the land from A for 1 dollar. So, A and C now each own 1 dollar while B owned a piece of land that is worth 1 dollar.The net asset of the country = 3 dollar.
3) C thought that since there is only one piece of land in the country and land is non produce-able asset, its value must definitely go up. So, he borrowed 1 dollar from A and together with his own 1 dollar, he bought the land from B for 2 dollar. A has a loan to C of 1 dollar, so his net asset is 1 dollar. B sold his land and got 2 dollar, so his net asset is 2 dollar. C owned the piece of land worth 2 dollar but with his 1 dollar debt to A, his net asset is 1 dollar.The net asset of the country = 4 dollar.
4) A saw that the land he once owned has risen in value. He regretted selling it. Luckily, he has a 1 dollar loan to C. He then borrowed 2 dollar from B and acquired the land back from C for 3 dollar. The payment is by 2 dollar cash (which he borrowed) and cancellation of the 1 dollar loan to C. As a result, A now owned a piece of land that is worth 3 dollar. But since he owed B 2 dollar, his net asset is 1 dollar. B loaned 2 dollar to A. So his net asset is 2 dollar. C now has the 2 coins. His net asset is also 2 dollar.The net asset of the country = 5 dollar. A bubble is building up.
5) B saw that the value of land kept rising. He also wanted to own the land. So he bought the land from A for 4 dollar. The payment is by borrowing 2 dollar from C and cancellation of his 2 dollar loan to A. As a result, A has got his debt cleared and he got the 2 coins. His net asset is 2 dollar. B owned a piece of land that is worth 4 dollar but since he has a debt of 2 dollar with C, his net Asset is 2 dollar. C loaned 2 dollar to B, so his net asset is 2 dollar.
The net asset of the country = 6 dollar. Even though, the country has only one piece of land and 2 Dollar in circulation.
6) Everybody has made money and everybody felt happy and prosperous.
7) One day an evil wind blowed. An evil thought came to C's mind. 'Hey, what if the land price stop going up, how could B repay my loan. There is only 2 dollar in circulation, I think after all the land that B owns is worth at most 1 dollar only.' A also thought the same.
8) Nobody wanted to buy land anymore. In the end, A owns the 2 dollar coins; his net asset is 2 dollar. B owed C 2 dollar and the land he owned which he thought worth 4 dollar is now 1 dollar. His net asset become -1 dollar. C has a loan of 2 dollar to B. But it is a bad debt. Although his net asset is still 2 dollar, his Heart is palpitating.The net asset of the country = 3 dollar again.Who has stolen the 3 dollar from the country?
Of course, before the bubble burst B thought his land worth 4 dollar. Actually, right before the collapse, the net asset of the country was 6 dollar in paper. his net asset is still 2 dollar, his heart is palpitating.The net asset of the country = 3 dollar again.
9) B had no choice but to declare bankruptcy. C as to relinquish his 2 dollar bad debt to B but in return he acquired the land which is worth 1 dollar now. A owns the 2 coins, his net asset is 2 dollar. B is bankrupt, his net asset is 0 dollar. ( B lost everything ) C got no choice but end up with a land worth only 1 dollar (C lost one dollar)

The net asset of the country = 3 dollar.

 There is however a redistribution of wealth. A is the winner, B is the loser, C is lucky that he is spared. A few points worth noting –
1) When a bubble is building up, the debt of individual in a country to one another is also building up.
2) This story of the island is a close system whereby there is no other country and hence no foreign debt. The worth of the asset can only be calculated using the island's own currency. Hence, there is no net loss.
3) An over-damped system is assumed when the bubble burst, meaning the land's value did not go down to below 1 dollar.
4) When the bubble burst, the fellow with cash is the winner. The fellows having the land or extending loan to others are the loser. The asset could shrink or in worst case, they go bankrupt.
5) If there is another citizen D either holding a dollar or another piece of land but refrain to take part in the game. At the end of the day, he will neither win nor lose. But he will see the value of his money or land go up and down like a see saw.
6) When the bubble was in the growing phase, everybody made money.
7) If you are smart and know that you are living in a growing bubble, it is worthwhile to borrow money (like A ) and take part in the game. But you must know when you should change everything back to cash.
8) Instead of land, the above applies to stocks as well.
9) The actual worth of land or stocks depends largely on psychology.

Tuesday, March 19, 2013

Difference between OLTP and OLAP systems

Online Transaction Processing Systems Online Analytical Processing Systems
Operational Data and original source of data. The Data (integrated) comes from various OLTP systems
Application specific, Detailed and most currrent/recent data. Historical data collected from various systems to support Business decision, planning and reporting
Performance is predicted as per application architecture and design. Performance is not predicted or mandated.
Most recent data with several Insert/Update operations. Read only data.
Highly Normalized for performance. Minimal normalization with restructuring of data.
Not (least) used for reporting and analysis. High analysis for business decisions.
Many transactions. low (none) transactions.
Low to moderate space is required. Very large space is required to support volumes of data.
Backup and recovery is critical to organization. Backup is not very critical. Reloading the OLTP data is a recovery practice.