Friday, February 25, 2011

Playing with the Play Framework

Back to blog after very long time. This post is basically about the new exciting Java web framework Play and a small implementation of app using it: pptViewer a simple PPT file viewer.

After successfully implementing (basically porting) a small application in Play I can say that every Java programmer who wants to taste agile development must use this framework at least once. Its really simple and lighting fast to build (small to medium size) applications. I have selected this framework for few of my upcoming prototype developments.

The demo application is very trivial one. It accepts a Microsoft PPT file and shows the slide contents on pages.  Apache POI is used to extract PPT file content and stored in MySql database. The original application is intended to manage multiple format Office files over web and is currently under development using Spring MVC. I choose to rebuild a small part of it using Play to evaluate it for slightly bigger and complex application and it worked really well. The framework documentation is very clear and concise for the beginners to quickly learn and implement stuff. The Play Community is growing day by day and illustrates a lot of new features\implementations of the framework.

Play provides most of the features required by any standard web applications (just like RoR, Django and Grails - actually the search is not over yet)). Standard (Static) MVC model, no upfront compilation (a great boon), front-end scripting and full Java stack are few of them. Play infrastructure can be extended with Modules (plugins) and many useful modules are already available. Play can fit nicely between regular Java web framework like Spring MVC and very dynamic framework like Grails. In the end Play has many similarities to Rails and one can say that like many other modern web frameworks (Grails, Roo) Play Team is also quite inspired from RoR.

After "playing" with GWT, Vaadin, Roo and Grails for a while and with my ongoing implementation I think Play is a very good framework in one's framework wardrobe.

A very good discussion of Play and RoR can be found on this Stackoverflow link.

Although my journey with Play is quite short till now but I quite impressed at the moment (if it doesn't work then something new will come, it has always come and I will start using that :) ).

Keep "play"ing.

(Special credit to Linode which enabled me to host the application from setup to deployment in just couple of  hours. I found Linode setup rather easy enough than to convert the application to GAE compatible.)

Tuesday, October 5, 2010

Important Callers - My first android app into the wild

Important
Callers
After developing several Android apps just for fun I finally developed the Important Callers app which can be used by many app users. The app is quite simple and helps the mobile user to not miss important calls by selecting the contacts as important one through the this app.

This is the review (very poor on first day) page of AppBrain for my app and if you have AppBrain installed in your mobile you can install the app from the web page itself. I am upgrading the app as I have started receiving  errors and comments as well.

Tuesday, August 17, 2010

Using jQuery with Vaadin

After spending some time with Vaadin and developing a small application and a usability framework the moment came in which Vaadin application had to be integrated with another existing application. The integration wasn't tough at all due to the nice work done by the Vaadin folks.

However at my place we have separate team for Vaadin core development and jQuery / JavaScript doing the client side hacking. So to make the job easier for both the sides I developed a small Contact Us demo application which creates a Vaadin form and beautifies it with jQuery Effects and Tooltip plugin.

Monday, July 19, 2010

Story Board - a small app built with jQuery and jQuery UI

After spending much time with Java and other Java technologies working behind the curtains in the dark and smoky rooms I started exploring front-end dominant languages like JavaScript, HTML5 and much talked CSS.

There are many JavaScript libraries and tools available out there but in all I really liked jQuery; it is simple and easy to use and growing at very rapid speed. More and more applications have started using jQuery extensively.

In this small application (I call it StoryBoard) I have used jQuery along with equally power jQuery UI library which gives a lot of functionality and control with much less code.

I use http://jsfiddle.net/ along with NetBeans to create small demo and find it really helpful to develop and test the application rapidly.

Monday, May 10, 2010

Twitter API with jQuery

After spending some time with Twitter REST API and jQuery; I decided to develop a small application to test both of these together. The example uses jQuery Ajax commands to load the given users public timeline through Twitter REST API.

jQuery is awesome and very popular JavaScript library which provides zillions of operations to manipulate client side objects. jQuery Ajax operations make it very easy to call the Twitter REST API and get the data in JSON format. The following line of code will call the Twitter for a user public timeline.

var url = "http://twitter.com/status/user_timeline/"+ $("input#tweepal").val()+".json?callback=?"; 
$.getJSON( url, function( data ){
   // process the reply  
});

For simplicity I have taken a textbox to enter the Twitter username with id "tweepal". The Twitter REST url contains a query string parameter "callback" without which Twitter reply will not be available to the Ajax function. Once received the data can be accessed like a normal JavaScript object. The received object is an array of tweets which can be easily traversed with jQuery.each() function.

$.each(data, function(n, tweet){
      $("div#tweet_time").val(tweet.created_at);
      $("div#tweet_text").val(tweet.text);
});

This completes all the blocks required to interact with Twitter from client side only. 


However there are plenty of libraries available for Twitter but its always exiting to make something on your own (specially using Twitter). Well I am struggling on how to post update using OAuth in same example. Will definitely post if get success.