Category Archives: google app engine

My google wave robot

Not too long ago I got myself a google wave account. Which I got myself into a wave hackathon in GTUG KL. Which happens last month.

The result of a hackathon is google wave robot, called eventdator(I’m lousy at making up names):

What it does now is, it associate a event name with a date. Which stores in the appengine datastore. To use it:

1) Add the robot on the wave, address is [email protected]
2) The command to use is:

get:event name

then done
3) To set an eventĀ 

add:event name,eventdate,true

set true if it is a holiday. else false.

I still open to feature request. And I still figure out how to have a better interface, etc.

App Engine Adventure, Redux: Thought

As I do bigger project using app engine, I see a few things,

One is, not all python module would work, so things like Python Imaging Library will not work. Which is useful for me to resize my pictures.

Two, app engine is flexible enough for me to choose the tools I use, which here I use dojo, quite freely. But also restrictive, because currently it is python, and revolve around big table, not all python module work.

three, would be nice if webapp, are able to automate a few task, like create form. But it also make it easy for me create the dojo upload form. Probably will try using django on app engine on my next project.

Actually really I have not much to complain, since, one I am to poor to get amazon service(I’m just a soon to be fresh grad), and too poor to get web hosting service with python on it.

App Engine Adventure, Redux: lesson learned

After a whole full week, working, erm not quite working, coding, and hacking, my code is a bit hackish anyway. I finished my app engine application, and uploaded it.
It is in

Here is what I learn, here is a list of stuff, that is not app engine specific:
1) Writing software is hard, ok I knew that, I finally learned it first hand
It took me 3 days, to comes out with the engine, and the next 4 days, tweaking and adding, and finishing the interface at the same time.

2) Python can be easy, if you know enough
Python make things very easy, because it provides a lot of functions and class, that make life easy, provided, you know it. Which is where 3) comes in

3) Python documentation is a nice thing to keep
At one point, I have problem to automate the task of identifying, the image format. It turn out that, there is a imghdr, module, I found that out in the python module.

4) appengine documentation is useful
I have to rely on the documentation a lot to comes out with something.

5) Interface is hard to do
Fine I was using emacs to create the HTML, most of the 7 days were spent of determining the right interface, and try to get it right. But in the end, I still didn’t get it right. Maybe I lacked the artistic side.

6) But dojo really helps in designing interface
Instead of having to craft my own css, I just use dojo own bordercontainer, Which make it easy to design the layout. As a bonus, I am able to decorate the form a little, with somewhat nice looking interface.

7) On the other hand
dojo can be overwhelming, because I have to learn while I do. Dojo can be slow, on a slow network connection, the dojo widget don’t really work well. and Dojo cannot do everything

8) Knowing the fundamental is useful
Today, I realize that there is something dojo cannot do, so I have to roll my own javascript, and css.

9) Having friends, to help out is useful
My friend Omprakash, help me found out that, I need to resize the pictures, and Ben gibe me some insight on the software.

10) Writing program can be satisfactory
Sometime writing program is just fun, for some reason, I kinda addicted to it.

And it ends up as a top 10. Imagine that.
Coding an App Engine(or any python application) is fun. Here is the last one.

11) But what really sucks is,
there is some restriction on the api, one, a few python api don’t work, such as PIL(it make image resizing easy), because it cannot be python c extension. There is limit on how many file one can upload to app engine. Because I cannot upload dojo to it, on the other hand, cdn helps a lot.

Google App Engine Adventure: Thought

The application is really, simple to build, if not because of I forget to close a { on the template, it really would take an afternoon. But really i’m not ready to upload this yet. This really show me, how it works.

What really cool to me is:
1) The datastore api, is really nice, it is somewhat like django, but is not. So it really nice to work with, because of the way query and stuff. And flexible in query because it can use GQL.

2) The template is nice, I just like shorter program.

3) The webapp framework, is easy to understand to me. The fact that it map request to a method, as handler is really nice. Make it easy for me to think of what happen when the web application runs

4) I just love python.

What is really nice to have:
1) Would be really cool, if there is an option to create CRUD ala rails. Meaning when you create a migration in rails it automatically generate a form. Would be nice to have such capability

2) Have ajax support is nice. When I write the program, I thought that it would be cool, if I am able to generate the day selection from based on the month value selected. Because currently I use range method, it is ugly, but simple enough, but really full of bug. By then javascript would work too

3) Have helper to input data application. For example, when I use a DateProperty, it is kinda pain, to create a value from input from template, to insert into that DateTimeProperty.
Or since we can’t save pictures to filesystem directly, it is not a bad idea to have a helper, to help insert and retrieve a pictures using the BlobProperty. Just to make it easier.

4) Not really important, why not bundle google’s api such as GData into app engine. Sure make things easy to create mashup.

But still, it is kinda fun, coding the an application using the sdk, since it is python. But I think I will need to fix up more of my application before I upload it.

Google App Engine Adventure: The Experiment.

Yesterday google have release their App Engine. Which provides hosting, database, scaling and load balancing, and also API’s. Which currently uses python. But there is more to come.

So I got an account, which probably not available anymore. Either way and spend an afternoon, write up a prototype. It is actually longer, since I need to refresh my html, and missed a wrong unclose { in the template. Then fixed up the database support. And check out a python doc, because not sure how, datetime work.

First thing first, assume you already have everything, is the configuration, app.yaml

application: testapp
version: 1
runtime: python
api_version: 1
– url: /
script: main.

so far pretty simple, but as application getting complex, it will have more configuration. For simple apps this would do.

Second is the code.

import os
import wsgiref.handlers
from google.appengine.ext import webapp
from google.appengine.ext import db
from google.appengine.ext.webapp import template
from datetime import *
class Events(db.Model):

class MainPage(webapp.RequestHandler):
def get(self):
path = os.path.join(os.path.dirname(__file__), ‘main.html’)

def post(self):
self.request.get(‘day’)+’ ‘+self.request.get(‘hour’)+’:’+\
date=datetime.strptime(dt,’%Y-%m-%d %H:%M:%S’),
path = os.path.join(os.path.dirname(__file__), ‘main.html’)

def main():
apps = webapp.WSGIApplication([(‘/’,MainPage)],debug=True)

if __name__==”__name__”:

Basically, now I’m worried that, it will get more complex, when it got longer.

Lastly the template. Which I can’t really show on the block

Then start the Then it runs. It’s ugly, but it shows a few thing to me.