Archive

Archive for September, 2011

Debian Squeeze on HP 620 Notebook

September 16, 2011 Leave a comment

Problem:
External speakers and wireless not working on HP 620 Notebook

Solution:
Followed the step by step instructions here. Now everything works.

http://blog.sviluppoweb.eu/2011/08/05/how-to-install-debian-6-0-squeeze-linux-on-hp-620-notebook/

Appengine – Appstats (python)

September 15, 2011 Leave a comment

Setting up Appstats for python and djangoappengine.

Assuming you have your djangoappengine setup as explained here.
Now following the instructions from http://code.google.com/appengine/docs/python/tools/appstats.html

1. Add this to settings.py

MIDDLEWARE_CLASSES = (
    'google.appengine.ext.appstats.recording.AppStatsDjangoMiddleware',

    # ...
)

2. Add this to app.yaml

builtins:
- appstats: on

That’s it. Now start your server is running

python2.5 manage.py runserver

Point your browser to http://127.0.0.1:8000/_ah/stats/
You should see something like
Appstats

Now add some data by visiting some pages eg http://127.0.0.1:8000/ (Do this in a different tab then refresh.) You should have some stats now.
Appstats

That’s it. Very simple and straight forward instructions from the docs.

Categories: appengine, django Tags: ,

Google I/O: Building Scalable, Complex Apps on App Engine

September 15, 2011 Leave a comment

appengine – SELECT using OR clause – alternative

September 15, 2011 Leave a comment

Problem:
Appengine does not support SELECT using an OR clause. There are a number of options out there and this is one of them. The Kind I am using this on will not have alot of data and I am hoping (fingers crossed) that it will not cause a performance issue later on.

Solution:
Filter, StringListProperty.

from googleappengine.ext import db

class Post(db.Model):
    author = db.StringProperty()
    category = db.StringListProperty()

post = Post(author="Sam", category=['bash', 'emacs','lisp'])
post.save()
post = Post(author="Peter", category=['bash', 'appengine'])
post.save()
post = Post(author="Ken", category=['mail', 'django','irc', 'sql'])
post.save()

results = Post.all().filter('category = ', 'bash')

for item in results:
    print item.author, item.category

Results
You would then get the following two items.

Sam [u'bash', u'emacs', u'lisp']
Peter [u'bash', u'appengine']

Source:
http://stackoverflow.com/questions/3455090/querying-for-a-value-existing-in-a-models-list-property-in-appengine/7430151#7430151

Categories: appengine

Linux Crontab: 15 Awesome Cron Job Examples

September 3, 2011 Leave a comment
Categories: bash Tags: , ,