Wednesday, April 09, 2008

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.

Sunday, March 30, 2008

eyeos: open source webtop


http://eyeos.org/
eyeos, according to its website is a new kind of operating system. Well I have my doubt on that, one it rely on other OS for it to run, and require a webserver. Not a stand alone OS, but like an OS, it provides library to write application, a kernel to control the process. And like an OS it provides applications too. What really not like an OS really, it do not feature a development environment.

What interesting to me is, everything is written in php, does not require a database, and well some application have barely enough features. Also it is dead easy to install, as long you have php and a webserver it should work. But it have tendency refresh many time, have to check out th server.
I personally think that it have it uses, but really not much, probably as a frontend for web hosting? I thing lively from sun is more interesting. On the other hand, lively don't work well on other browser yet.

Either how, it is interesting.........

Wednesday, March 26, 2008

Digest of what happening

Been busy with assignment, and job interview, and some time to check application, and either here is a summary of what I have done.

Multi thread download on linux
one thing that windows have but linux doesn't is a multithreaded downloader. But now they have
dfast like most open source project it also runs windows, and uses a frontend written in wxwindows in c++.

It is a bit crashy, on my ubuntu box, it does make download faster. You can get from getdeb.org too

Job Interview
Noticed that, really malaysian job really don't use python, damn..............
There mostly involve in java, and vb(yes, the abomination), at least I can do java, even though it is a bit hackish

And after 2 interviews, I realize a few thing,
1) my programming is getting rusty, really need to refresh it, begin to wonder how people respect my programming skill........
2) I didn't really learn enough, so I'm not into enterprise programming, until now, seriously java is not what you call a fun language to play, it is a language for job.
3) My sql is getting rusty(wait that is number one)
4) probably i spent too much time in server room or having fun, but that keep me motivated. That's make me sane to be a programmer(i think)
5) My java is rusty(oh wait that's number one too), i can hack stuff out in java, provided I have an IDE(aka netbeans or eclipse), and google
6) Really after a career talk from a big computer company, I really really cannot stand corporate culture, must be spending too much time reading dilbert or my nightmare from my industrial training, or watching too much pirates of silicon valley

Tuesday, March 04, 2008

What happen........

Long time didn't add stuff to blog. Basically, many thing happens.

1) Basically my gout is back,
2) I got involve with a job interview, which hopefully I will get through, it is not often to find interesting job in Malaysia.
3) And assignments.
4) On the positive side, other than job interview, I finally retired from the server project, and finally able concentrate on hobby and stuff.

After what happen, what I have done, well,
1) dabble with lisp, very interesting language, might dabble more after assignment
http://lisperati.com/casting.html
http://www.gigamonkeys.com/book/


2) Put slax on my pendrive and external hard disk. Finally. Either way it is easy to install, on pendrive, except bios is a pain. But it is not ready for most people yet, but easy to customize is a big point.
http://www.slax.org/

What to look foward to,
1) Documenting my slax adventure, didn't really start using it yet.
Maybe I try customize it. Or it will turn into one of my many unfinished project.
2) Actually finishing a project.

Sunday, March 02, 2008

Make windiws unix like using cygwin

Got involve with a job interview, in a way, need to use windows, it is a job thingy description thingy. After using linux in a while, I do not take long to ask why windows not unix like. Scriptable using bash, It does not long either for me to try to look at cmd, only to be disappointed.

On the other hand, before I switched to linux 4 years back, I actually have a unix environment, using cygwin. Cygwin is setup a linux like environment for windows. And actually provide api, to emulate linux, provided you need to port it.

Either way it is linux like, almost, some of the command don't work well, like ps -aux, or ps -A.
But it's close enough, for some. But windows environment is still not linux like.

You can get it much.
http://cygwin.com/