Initial Glitches in Python Scripting by a Tyro

Google released its Google App Engine in April 2008 and I am enthralled by the idea of the Google. I have always been inclined in automating. Hence thought of learning Google App Engine and thereby confronted Python Scripting which Google App Engine supports. A novice user like me installs Pyhton 2.5.2 and Google App Engine SDK to develop a server application.

As one starts following the Google App Engine tutorial and trys to copy paste the code available in the tutorial pages one encounters numerous error jargons on the explorer. The coder needs to understand some basic requirements and understanding of Python scripting.

1. Python Script Files (.PY) use indentation to differentiate the blocks of code. It does not have curly braces (unlike in C,C++; BEGIN END in VB Scripts etc). Hence if you are writting blocks of statements be sure that you use indentation properly. One can use Python IDLE as a Editor of Python scripts. For example :

IF you are using IF statement the following should be the indentation

IF USER

        print ‘User available’ — Observe the indentation. The block belongs to IF hence is lower indented

ELSE

        print ‘User not available’ — Observe the indentation. The block belongs to ELSE hence is lower indented

2. One needs to run the command ‘dev_appserver.py ….’ on the DOS Command Prompt not on the Python Command Line as I did.

These are some of the intial faults I committed during my encounter with Python language. I hope to come with some more soon as I face them. Hope the above two slip-ups of mine help novice developers.

Google Docs as Database

Quiz Gadget is a quizzing gadget which has been developed using GCE (Gadget Control Editor), Google Pages and Google Docs. The Quiz Gadget uses Google Documents as the database. Many people would be wondering on the fact that the Quiz Gadget uses Google Document as database. Eventhough Google Pages does not provide server side scripting and database feature, one can combine the power of widgets and Google Document to get the same affect.

How do I create the database in Google Documents?- I create a spreadsheet in Google Spreadsheet with columns as my fields. Now fill in the data in the spreadsheet and now publish your spreadsheet as it makes the data available on net.  The link to the published spreadsheet now forms the connection string to the database for the widget.

How do I connect to the data in the spreadsheet?- One can easily  retrieve the HTML content of a webpage using the Remote Data Extracting Functions available in Google Widgets. Visit http://code.google.com/apis/gadgets/docs/remote-content.html for information and in depth understanding of such functions. The functions only requires the link to your published spreadsheet and fetches the HTML content as text to your widget.

How do you identify information from the HTML content?– One aquainted with HTML parsing should find extracting data from HTML content using HTML parsers an easy job. Though initially you may find the content to be unextractable but constant observation shall help you observe the patern and tags necessary to extract the info. Once you have the information playing with the information should be a easy job for techies and web page designers.

Limitations and constraints of such databases– One needs to heavily rely on Javascript for attaining the functionalities required for database support. Some users do not enable javascript on their browsers hence can be a severe limitation. As publishing of the spreadsheet is essential for database support, one cannot keep information privy from the users.

You might find handy the following link in better understanding of the blog – http://code.google.com/apis/gadgets/docs/dev_guide.html .

Link to Quiz Gadget – http://carte.blanche.leeway.googlepages.com/gkquizgadget

Looking at the interest of people in using Google Docs as a Database, I am contemplating on opening up a dedicated discussion forum on using Google Docs as database. Please take survey and help me finalize on my plans: