Monday, April 28, 2008

was checkout on a windows 2000 computer

You see, my uncle actually own a windows 2000 machine in his shop. Only to found out that it is pretty under utilized. and quite safe, it doesn't have usb, and not connected to a network.

But it really shows, how much vista bloats. BTW, it runs on a pentium 2 600mHz. and 64mb of ram. It is like, vista giving someone 90% of stuff of most ordinary, computer user, that isn't tech savvy at all, don't need. Imagine that.

Monday, April 21, 2008

Never try to release something

Was testing the App Engine application, uploaded to appspot.
Then the humiliating thing happens, I didn't saw it before. The interface is broken, it is ugly, and now unusable.

What I learn is, One never rush to release something to the public, Two, I am lousy at doing user interface.

I really want to fix it, but I have my finals in the next few days. Can't fail this because I want to graduate this year

Saturday, April 19, 2008

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
http://sweemengsandbox.appspot.com/main

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.

Wednesday, April 09, 2008

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
handlers:
- 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):
name=db.StringProperty(required=True)
date=db.DateTimeProperty(required=True)

class MainPage(webapp.RequestHandler):
def get(self):
day=range(1,31)
month=range(1,12)
year=range(2008,2020)
hours=range(0,23)
minutes=range(0,59)
events=Events.all().order('-date')
templ={'events':events,
'day':day,
'month':month,
'year':year,
'hours':hours,
'minutes':minutes}
path = os.path.join(os.path.dirname(__file__), 'main.html')
self.response.out.write(template.render(path,templ))

def post(self):
dt=self.request.get('year')+'-'+self.request.get('month')+'-'+\
self.request.get('day')+' '+self.request.get('hour')+':'+\
self.request.get('minute')+':00'
event=Events(name=self.request.get('name'),
date=datetime.strptime(dt,'%Y-%m-%d %H:%M:%S'),
location=self.request.get('address'),
description=self.request.get('description'))
event.put()
day=range(1,31)
month=range(1,12)
year=range(2008,2020)
hours=range(0,23)
minutes=range(0,59)
events=Events.all().order('-date')
templ={'events':events,
'day':day,
'month':month,
'year':year,
'hours':hours,
'minutes':minutes}
path = os.path.join(os.path.dirname(__file__), 'main.html')
self.response.out.write(template.render(path,templ))

def main():
apps = webapp.WSGIApplication([('/',MainPage)],debug=True)
wsgiref.handlers.CGIHandler().run(apps)

if __name__=="__name__":
main()
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 dev_appserver.py. Then it runs. It's ugly, but it shows a few thing to me.