Saturday, June 26, 2010

The Google Buzz API

It's been a month Google released their Buzz API at Google I/O and I have been dying ever since to write an article on it. Finally got an opportunity today and really hope that the posts live up to my expectation :)

In this post, I am going to introduce the Google Buzz API and the technologies surrounding it like OAuth, REST, AtomPub and JSON. And in my next post, I will be emphasizing on how to integrate OACurl, an OAuth wrapper, with a simple Java Desktop Application. Most of the information in this post is pretty basic and if you are comfortable with these technologies, I would recommend you to skip the post.

Google Buzz

Google Buzz is a social networking and messaging tool from Google, designed to be integrated into Gmail. Google Buzz was an attempt by Google to compete with micro-blogging services like Twitter. After the release of the Buzz API, it has been well received both as a platform and as a service.

The Google Buzz API revolves around two main concepts - Authentication which is done through Open Authorization (OAuth) and Service Usage which is managed using the REST architecture with data formats like XML (through AtomPub) and JSON.

Authentication

OAuth is an open standard that allows users to share their private resources like photos, videos, etc. stored on one site with another site without having to hand out their username and password. It works through the exchange of tokens which provides access to a specific site for specific resources for a defined duration.

Most of Google Data APIs like the Google Calendar Data API, Blogger Data API, Google Contacts Data API, etc. use OAuth for authentication. The authentication process is done through a Web Browser for web applications as well as desktop applications using the APIs. A browser pops up and users are authenticated with respect to their usernames and passwords directly by Google and then the control is returned back to the application which can proceed accordingly.

A major disadvantage of this process is that a web-browser should be available for authentication even for desktop applications.

Service Usage

Data transfer for the Buzz API is done primarily on the basis of REST (Representational State Transfer). It is a style of software architecture for distributed hypermedia systems such as the World Wide Web. The crux of REST is that is uses the basic HTTP methods like GET, POST, etc. for resource manipulation (getting a resource, saving a resource, etc.)

Google Buzz API returns data in two formats - XML and JSON. XML is sent in the form of AtomPub. AtomPub (also known as APP) stands for Atom Publishing Protocol. It is a HTTP-based protocol for creating and updating web resources. It uses an XML language known as the "Atom Syndication Format" (ASF) and is very popular for web feeds. The Atom Syndication Format and AtomPub form the Atom Standard. The ASF is primarily an XML format with tags like feeds, links, etc.

Google Buzz API can also return back data in the form of JSON. JSON, standing for JavaScript Object Notation, is an open standard designed for human-readable interchange. Despite its strong relationship to JavaScript, it is language-independent with parsers available for almost every language.

The major reason for Google Buzz API to offer JSON besides ATOM was that JSON parsing is comparatively faster than XML parsing in JavaScript. So in web applications which might pull data from the Google Buzz API using JavaScript and AJAX, JSON parsing will be a major performance gain.

A Quick Example

Navigate to https://www.googleapis.com/buzz/v1/activities/userId/@public to see your latest public buzzes in the ATOM format and to https://www.googleapis.com/buzz/v1/activities/userId/@public?alt=json to see them in the JSON format.

There are several URLs like these available at the Google Buzz API site - http://code.google.com/apis/buzz/v1/using_rest.html. However most of them require authentication before they show the results, which means that without authorization by OAuth, a URL based mechanism will not fetch the data.

To know your userId, you can do the following steps -

  • Login to GMail and go to the Buzz tab
  • Click on your name which is displayed at the upper-left corner of the Buzz tab
  • The last handle (the string after the last /) is your userId

Saturday, June 19, 2010

NetBeans 6.9 - The JavaFX Composer Rocks

NetBeans 6.9 has finally been released a few days back, June 15th 2010 to be exact. It was a very special release in the NetBeans community as this was the first major revision after Oracle's acquisition of Sun Microsystems this January. Check out the release notes at http://netbeans.org/community/releases/69/relnotes.html.

Along with NetBeans, a minor revision of GlassFish, GlassFish 3.0.1 has also been released. The minor revision contains several bug fixes and the GlassFish Server Open Source Edition 3.0.1 has been integrated with NetBeans 6.9.

There are several new features which been added to NetBeans this time, like the support for Zend Framework on PHP, Ruby on Rails 3.0 Beta support, Spring Framework 3.0, JavaFX SDK 1.3, CSS Refactoring and Code Completion, support for JDK 7 and several other features. The complete feature enhancement list is available at http://wiki.netbeans.org/NewAndNoteworthy69.

But personally, I felt the best feature addition to NetBeans this time was the JavaFX Composer. For people who are new to JavaFX, it is a Java platform for creating and delivering Rich Internet Applications (RIA) that can run across a wide variety of connected devices like computers (as browser-based and desktop applications), mobile phones, TV set-top boxes, gaming consoles and Blu-ray players.

The JavaFX Composer is a visual layout tool similar to Project Matisse for Swing. Initially released as a plugin for NetBeans 6.8, it has now been completely incorporated into NetBeans 6.9. The primary features of the JavaFX Composer are -

  • Visual editor for a form-like UI using components
  • Dynamic design editing based on states
  • Data access to Web Services, databases and local storage
  • Support for JavaFX binding
  • Simple animation editor
  • Multi-screen-size editing

Create a new JavaFX project using the JavaFX Composer by navigating to File, New Project and choosing a JavaFX Desktop Business Application or a JavaFX Mobile Business Application under the JavaFX category depending on the requirement. Give a project name and the UI editor opens for creating the UI from the JavaFX components.

Drag and drop components from the palette and create the user-interface as you want. Here's a small echo application which echoes what has been typed in the text-box. To be honest, this is my first application in JavaFX and I could finish it by typing only a single line of code and that too a JOptionPane.showMessageDialog and I had help from the auto-complete feature of NetBeans for this :), rest of the work was done the JavaFX composer. That actually reflects the ease of development which the composer and NetBeans are driving. On a whole, a big thumps-up for the JavaFX composer and the entire NetBeans development team for integrating this into the IDE.

Download the project here.

If you give the JavaFX Composer a try, check out the huge arsenal of features which the palette possesses like Shapes, Effects, Charts, etc. You will definitely love them.

This blog-post was shown as a featured article on NetBeans -

Friday, June 04, 2010

Capital IQ - An Interns View

Successfully, my 6 months intern at Capital IQ which started on December 14th has come to an end on May 31st. These six months are a few of the best days in my engineering life which I can never forget.

After hiring us during Campus Placements at our college, Capital IQ gave us an offer to work for six months as an intern at their company. I was working for three days (Wednesday, Thursday and Friday) at Capital IQ and three days (Monday, Tuesday and Saturday) I had to attend classes at my college. I personally felt that this was a perfect blend of enjoyment and work.

I learnt a lot at Capital IQ and enjoyed more than what I learnt. I was a part of the Web Mining team and was working on a very critical project for the company at that time. I guess we were lucky to be in the team as we learnt a lot of technologies and understood a lot about the dynamics of the corporate world - bottom-lines, dead-lines, project management, etc. But as we were interns, there wasn't any pressure on us :)

The three days at office were fun and work. However, the remaining three days at college was completely fun :D. In fact, I think we bunked more classes than we attended :P

The project at college was another exciting thing, as we weren't allowed to submit the project which we were doing at Capital IQ, I had to work on a separate project. Though it was exciting to manage office, project and classes together at the same time, it did become very hectic.

On a whole I had a great time at Capital IQ along with the other interns (Aishwarya, Dinesh, Jame, Rohan, Sasikiran, Simantha, Sneha and Suvansh) and I joined Capital IQ on June 1st (the next day we completed our internship) as a full-time employee :)

Sneha and Suvansh - best of luck for your future, we will be missing you here and for the rest, nice to be working with you again. And before I sign out, a big thanks to the Placement Office of Osmania University and the entire hiring team of Capital IQ for the opportunity.