Saturday, March 06, 2010

EJB 3.1

Having come from a technical background, this is my first tech post. With the EJB 3.1 specifications finalized on 10 Dec, 2009, I wanted to touch upon the new features introduced and how it would affect the developers.

EJB Interfaces are not mandatory any more:

From Specification: “A simplified Local view that provides Session Bean access without a separate Local Business interface.”

Many a times I have wondered why we go through the pain of declaring interfaces when we know for sure that it would not be required. This gets more painful when you use RAD (Rational Application Developer), since you also have to create a separate project for the EJB Client.

One can declare Session beans or MDB with just the annotation @stateless or @stateful.

Packaging made simple:

From Specification: “Packaging and deployment of EJB components directly in a .war without an ejb-jar.”

Developers can package the EJB classes within a WAR file like a POJO and the annotations will do the magic. They can also declare the EJB in WEB-INF/ejb-jar.xml. This makes the EJB available in the same namespace as the WAR.

Singleton EJBs:

From Specification: “A Singleton session bean component that provides easy access to shared state, as well as application startup/shutdown callbacks.”

As I think of it this should have been introduced a long ago. Until now developers had no definitive way of sharing application wide data with concurrency. Most third-party caches had their own pros and cons, each having a focus area. Declaring static variables in an EJB is a nightmare (atleast for me). You can manage concurrency either by yourself or leave it to the container by  declaring it with annotations.

EJB Timers:

From Specification: “Automatically created EJB Timers” & “Calendar based EJB Timer expressions.”

Though there was some Timer support in earlier version it was difficult to use with not much support for cron like scheduling. With simple annotations developers can schedule periodic runs for a method.

Asynchronous Services:

From Specification: “Asynchronous session bean invocations”

This one is really ingenious. Developers can declare an EJB (or a specific method) to be asynchronous using annotation (i.e. @javax.ejb.Asynchronous) and this EJB can be used just like a JMS queue.

EJB Lite:

From Specification: “The definition of a lightweight subset of Enterprise JavaBeans functionality that can be provided within Java EE Profiles such as the Java EE Web Profile.”

One of the major points made in support of not using EJBs is that they are heavy-weight and many applications won’t ever need all the container services provided by the specifications. EJB lite seems to be an attempt to silence this. I’m not sure whether it’s already late with other alternatives lying around like Spring, OpenEJB, etc. But EJB lite provides support for Stateless, stateful and singleton session beans with transaction and security services.

 

Overall, EJB 3.1 specs appear to be a definite positive step forward, evolving with time and competition.

Technorati Tags: ,,

Saturday, February 06, 2010

Paradise Now

Watched this gripping Arabic movie yesterday. The movie is an work of art that could have very few comparisons. Per the director Hany Abu-Asaad the movie is an artistic point of view of the Israel-Palestine political conflict. I had very little knowledge about the issue but this movie opened up a whole new perspective of any conflict.

“Hey Ram”, the Hindi/Tamil movie had a similar concept. In that movie the protagonist, a victim of the India-Pakistan separation violence plans to revenge Mahatma Gandhi. The handler who prepares him for the task talks to the protagonist’s wife. She asks him how one could justify a wolf killing an innocent child. His answer is “You can understand only if you stand in the wolf’s legs”. How very true. Of course, it still doesn’t justify killings and violence by a human being. It’s very easy for us to dismiss such people as soulless terrorists, bent on destroying humanity. But it’s very difficult to get under their skin and realize the other side of the story.

Coming back to “Paradise Now”, the movie had not a bit of music. Not even during the titles. But that choice has an enormous effect, letting the viewer focus on the gloomy situations. The making of the movie itself seems to have had great difficulties. With an Israeli missile attack near the production location, a kidnap of the production manager by a Palestine faction and so on. The director has said that if he had a choice to go back in time, he’d probably not make the movie again.  The climax had me spell-bound for minutes.

Taking this back home to India, we have our share of lasting conflicts. Srilankan tamil woes, Indo-Pak border issues, Separatist groups in North eastern states and the list goes on. I sincerely hope politicians on both sides let go their agendas and strive for a holistic resolution in all these situations. Peace! 

Technorati Tags: ,

Monday, January 25, 2010

Facebook - Chase Community Giving

I was keenly following the chase Community giving voting that took place between Jan 15- 22. I have known Isha for nearly 4 years now and am fortunate enough to sponsor a girl’s education through Isha Vidhya for the past 2-3 years, I naturally voted for Isha Foundation. I also voted for a few other causes that I thought were really good. I noticed Invisible Children, the group that won in this voting and felt that it was a wonderful cause and voted for that too. Now even though Isha is something that I can relate to more, my thoughts were like: The children that Isha teaches may get some other way of survival; but if Invisible Children does not support the kids from the war zone, they may end up being dead or worse living through that horrible childhood.

During the last day of the voting I saw Isha being accused of foul play by a supporter of Invisible Children. He pointed out that lot of Isha voters didn’t have anything at all in their facebook profile. No friends or other activities. They were just fans of Chase community and had voted. He also pointed some names with gibberish characters in it. I also read an article in which there were accusations that some of the profiles had been hacked by replacing the profile pictures with a logo containing “Vote for Invisible Children”.

Hmm… It’s a good cause. Both the organizations seem to be doing a very good job. May be some overzealous supporter/volunteer went overboard.

But with the net income over $5 billion Chase also received $25 billion as TARP fund. But got an extraordinary marketing campaign at a dead cheap $5 million. :-). JP Morgan chase is the real winner in this. But how many other banks did that at least. So kudos to them too. And cheers to the winner and the rest of the top 5 who would be receiving $100K each. Keep up all the good work.

 

Monday, January 18, 2010

Avatar

We had originally planned to go to Tropicana in Atlantic city to watch the movie during the new year weekend. But it didn’t happen somehow and we went there on 10th. There was a huge line even before 40 minutes till the movie’s start time.

There was a couple just behind us lamenting about the frontal nudity and how they didn’t want their kids to watch it. The line opened approximately 30 mins before the start of the film and the theater was packed within the next 10 mins.

Yes, the movie had fantastic visuals and marvelous creativity. But my wife and I were sighing all through the movie because of the clichés. The plot was seriously weak. Of course the humans were greedy et al and the movie has a very nice message. India, one of the culturally and economically pregnant lands during the ancient times was pilfered repeatedly by inconsiderate rulers and colonists for a very long time. We were pushed to the bottom and called poor, ‘third world’, etc. Similarly the humans look at Navis as un-evolved creatures(‘guerillas’ as they say in the movie) requiring knowledge of culture, science and infrastructure, while all they needed was to be left alone in their own territory. I could connect to that aspect of the movie very well.

But then the predictable storyline did wear us out, despite the wonderful 3D effects.  I stumbled upon a satire on people’s reaction to Avatar. Here’s the link to an YouTube movie:

http://www.stumbleupon.com/su/6dM6IA/www.throwkickpunch.com/2010/01/avatar-satire-by-throw-kick-punch/

Technorati Tags: ,,

Wednesday, January 06, 2010

Relativity simply Explained

I recently completed reading this book by Martin Gardner. These are my notes/takeaways from the book (for quick future reference)

Special Relativity: Classical Theory (Newton’s) states that if you are on a uniformly moving object, there is no mechanical experiment by which you can prove that you are moving. Einstein took it to the next step, saying that there’s no optical (or electromagnetic) experiment by which you can prove the same.

Fundamental Postulates of SR : 1. There is no way to tell whether an object is at rest or in uniform motion relative to a fixed ether. 2. Regardless of the motion of its source, light always moves through empty space with the same constant speed.

Inferences of SR: 1. There’s no way ether wind or ether motion could be detected (if at all it’s present). 2. Light travels at the same constant speed relative to a uniformly moving observer. 3. e=mc^2

General Relativity:

GR is an extension of SR. There’s no experiment of any sort by which an observer in any sort of motion, uniform or non-uniform, can prove whether he is moving or at rest.

To put it simply, if you are traveling by a car saying that your car is traveling at 60mph in one direction is the same as saying that the entire cosmos is traveling in the opposite direction at the same speed (car is now fixed).

Inferences of GR: 1. Gravity and inertia are one and the same. (Galileo’s experiment: 2 objects of different weight fall with same acceleration because of the opposing effects gravity and inertia).  2. Gravity is the curvature of space-time line due to presence of massive objects (Objects travel through the 4-D Space-time in a straight line, which is projected as the difference in shape, size or time to an observer).

Twin paradox: At speeds closer to that of light, time runs slower. This would cause a twin traveling in a space vessel at speeds closer to that of light to be much younger when compared to his twin who is at rest in his home. (But per GR , the twin at home could also be considered to be at motion along with the cosmos relative to the space vessel. But I’m not sure of the physical laws that apply when his motion is along with the entire cosmos !!) 

Applications of Relativity (that I know of):

1. Models of the universe 2. Explanation for quasars, pulsars and blackholes 3. GPS 4. Further exploration of Quantum mechanics  (The 2 theories can’t co-exist in a single model per EPR paradox) 5. Large particle collider equipments (like the one at CERN)