Skip navigation

Sign up | Lost password? | Help

My first widget

The Beijing Olympics Tracker Widget

My first widget - Part 2

In continuation to my previous article, I will describe in detail the architecture of the widget.

The widget uses Google App Engine as a back end server. I created what is known as a WebApp in Python. I also used the BeautifulSoup screen scraping library to scrape HTML pages for extraction of relevant information. The reason for using a back end server is to relieve the client on which the widget runs of processing burden. This widget doesn't use any XML based RSS (Really Simple Syndication) feeds. However, future versions may use them.

Python is well suited for server development since it provides a huge number of libraries on almost every technology available out there. It suited my needs perfectly for the creation of a Web2.0 mashup widget. I wrote a simple WebApp in Python and hosted it on AppEngine. The widget just basically makes AJAX (using XMLHttpRequest) requests to the WebApp. The server retrieves the appropriate HTML pages and scrapes them for the required information. It then processes this data and sends the information to the client widget. The information is a string in its final form. However, some other form such as JSON may also be used. I kept the information sent as a string since I plan on porting this same widget to mobile devices. Since, processing power is limited on such types of devices, I decided to send simple strings with HTML markup so that I can simply load it into a table or some equivalent UI mechanism.

The widget also sends information back to the server (the DD view). This demonstrates that communication is bidirectional. This opens up a host of new possibilities. For example, a user may configure user preferences. This can be sent to the Google App Engine server where it can be stored using the DataStore API thus eliminating the need for storage on the client device (which is another plus point if the widget is running on a mobile device).



Please send me feedback at earlenceferns@gmail.com :D


First Steps into an unknown world - Part 1

I was introduced to the world of Opera Widgets by my mentor at Vavni Inc, Anthony Raj. We were just brainstorming for a few ideas to work on for my BE project. All of a sudden, like a bolt of lightening, there was a common realization that, "Hey dude, The olympics are just about to start, an opera widget that displays in depth information about the games would be wickedly cool!!!". However, we were on a damn tight schedule as a few days were left and I did not know head or tail of the development process. Hell, I didn't event know JavaScript that well as a matter of fact. But, as the saying goes "Fortune favors the brave", we decided to push on and start work.

I started off by playing around with a few small widgets already available on http://widgets.opera.com . Then, I started brushing up on HTML, CSS and JavaScript. I got to tell you one thing, you better be careful about programming events in JavaScript because I was stumped for almost 3 days by some weird error in a button event handling code. It turned out that if you have to assign any literal value to a form element using DOM there should be no spaces on either side of the assignment. Weird, but it cost me a hell lot of time.

Anyway, as I gained facility with the basic widget development process, we began experimenting with ways of getting useful information into the widget. The obvious choice is AJAX, but writing all of the processing code in the widget would result in some serious performance penalties, not to mention the size of the overall widget!!!. So we started thinking about porting the information processing code to a back end server. We discovered that Google App Engine suited our needs perfectly (because I was learning Python at the same time).

MORE NEXT TIME... :smile:

January 2009
M T W T F S S
December 2008February 2009
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31