Showing posts from 2011

CherryPy - I love it because it's pyhon.

CherryPy moved to bitbucket a while ago, and also got a website refresh.

I love cherrypy, since I can use it with python 3 - not legacy python.

I love cherrypy, because I can just use python objects.

I love cherrypy because it has a clever name.

I love cherrypy, because it just works.

I love cherrypy, it is minimal.

I love cherrypy.

Thoughts on Python 3

It's awesome.

Go get some!

PyGameZine issue0

Today we are very excited to announce the launch of PyGameZine!

There is more information about it on the website.

Vintage in Paris

Our Vintage in Paris app has been published on the Nokia app store!

The process was pretty simple, since it was a very technically basic but content heavy app.

The main difficulty in this app was walking around the streets of Paris taking pictures, and researching really good places to find Vintage.
Why a Vintage in Paris app? Finding cool second hand and retro clothes is a hobby of mine, and my partners.   It's always fun finding interesting old styles, rummaging through clothes racks.  Especially in other countries, and especially when you find a bargain.

There's something special about wandering down some back alley, and finding an old shop stuffed to the rafters with old stuff.  It's like taking a journey back in time to some fantastical version of Paris you may have in your head.  If you like Art Deco stuff, then Paris is the place to get it.

What was the signup to the Nokia store like? I have been signed up as a Nokia developer for quite a while already,…

Halloween pumpkin juggling published to intel appup

So it looks like the little Halloween game we made has been published on the intel appup store.

It is listed here:

Getting into the Samsung store

So, I registered for the Samsung app store 'thingy' the other day.

Samsung have a number of platforms themselves, not just one platform.  Including Bada, Android, Tizen, and windows mobile 7.  They have tablets, TVs, laptops, mobile phones... and probably other things too (maybe internet fridges?).

It seems most of the platforms support web apps of some sort.  Either through wrapping with phonegap (Bada, Android, win7) or just accepting an archive of the files.

Once joined you can distribute free apps through there.  Which is quite lovely really.  They have their own advertising program, and I'm not sure if you're allowed to do In App purchases with them.

It seems for TV, you can only distribute to the US.  Not to other places around the world.  No idea when or if that is going to be possible.  Yes, their SDK does include support for 3D content.  After speaking briefly with someone(I didn't get their name) at a JavaScript meetup I found out you can try out apps on…

Android developer store, problem. No problem.

So, I've got my app working on Android.  It's not even all that slow.  Ok, it is a little slow.  However the new webkit upgrade in Android 4.0 should get it going fast.  Note that Android 4.0 has approximately 0% of the android users on it at the moment - since they haven't really released it yet.

I had to get touch events working with gamejs, which wasn't all that hard.  I had a little chat on the mailing list, about it, then implemented it not long after.  I will send a pull request soon to that project soon.

I'd like to do a phonegap implementation of sound for shitsound too, but haven't got around to that.  This should get around the html5 Audio issues on the android browsers.  But the game is pretty much ready.

So now that it's ready, I went to sign up to the Android market place so that I could try and release the application.  I went through the signup process, and paid my $25USD.  I even got sent a receipt.  But then something weird happened.  I fo…

notes on chome, and android.

One thing I forgot to mention was that my flash sound for chrome did not work after uploading to the chrome web store.  I made the change at the last minute to use flash for sound, because chrome sound was bad for me.  Of course, a change made at the last minute will be a bug!  Luckily the bug was reported to me, and I fixed it quickly.  This made me glad that the chrome webstore allowed very fast updating.  I can deploy updates there as quickly as uploading to a website.  It also made me remember the importance of testing from the users perspective.  Always check you changes on the live version that people use, rather than just on development servers or simulators.  You need to get into the users shoes and experience it the same way they do.

I did a quick port to android, and tested it on my Advent Vega tablet with android 2.2.  Surprisingly the game ran fairly well.  There were a couple of modern javascript features I was using that did not work, but I quickly found those bugs (htm…

beta testing intel appup apps

So, I've been going around in circles the last few days with the validation our app on the intel appup store.

The support people escalated my request, and it looks like they have fixed a problem with the validation program.  It looks like their automated validation program had a bug.

In the mean time I've gone through the beta testing process.  This is where you can send your app to some beta testers and ask them to test for you.  If they already have the intel appup installed on their computer, your app appears in their "My Apps" section.  Then you can click on it, to try and download+install.

Just like the Mac OSX Application stores, if the download fails halfway through the system fails.  This is 2011 mind you, so you'd hope that people had figured out that internet downloads could possibly fail, and might need resuming.  Especially on mobile netbooks which are using unreliable 3g wireless internet connections.

As far as I can tell, there is no automated feed…

'Halloween Juggling Pumpkin' published to the chrome web store... I think.

Well, I clicked the publish button, and it seems the 'Halloween Juggling Pumpkin' app has been published to the chrome web store.  I'm quite happy that it is up!

Here is a screen shot of the menu screen.

Well, that wasn't too hard to do after all.

Here is a screenshot of some game play.

Here is the lovely store URL it gave me for the store:

This was way less work compared to the intel appup store, which I'm still having issues publishing it. To be fair, their store is still in beta for html5 apps.

encapsulator app 'binary validation failed' no other details.

Just got a rejection notice for my intel appup app, with 'binary validation failed'.  There were no other details, which seems to be typical for this program.

I've sent them some messages for more information, so I'm expecting a few days of waiting before anything happens.

chrome audio sucks

Chrome Audio is worse than firefox, safari, and internet explorer Audio.

There are cracks, pops, and sounds cut short.  It seems there's also not many sounds that can be played at once.

Luckily I can use jquery.shitsound and soundmanager2 to prefer using flash audio over a javascript bridge.  This has a slight delay compared to firefox/safari html5 Audio, but is better than the built in chrome Audio.

export scripts for app

So today I've been writing a couple of export scripts for my October challenge apps.

I set the config in the main html file using html5 data attributes.  Then read that config on app startup.  This seems like a fairly easy way to customise the app depending on platform.  My export script selects the correct html for each platform on export.

I have to create the correct data sets for each platform.  The right sound formats (ogg, mp3, wav), and the right sized images (From 1080 HD to 320x200 screen).  As well as select the correct fonts.  I can't just include all the assets for each platform, since there are size restrictions.  As well the source, full sized raw data can be over 5GB for one app (for my content heavy app).

Then I have to package them up depending on platform, with manifest files and other strangeness.  Or I need to zip them up in a zip archive.

I'm not completely automating the process yet.  I'll wait to see if the apps get any traction before investing …

Signed my app with certificate, and submitted for validation again.

So, I managed to sign my app and submit it for validation on the appup store.
It took at bit of messing around, converting certificates, and installing lots of microsoft software, but eventually got my msi signed, and submitted to the store.
That made me happy.  Now I’m off to drink wine!

Intel appup progress. Got certificate, looking forward to webkit upgrade.

Well, some good news on the intel appup front.
I finally managed to get my certificate, so I should be able to now sign my apps to upload.  Unfortunately I used firefox to download the certificate, which means that I need to convert files in order to get into the microsoft fomat needed for code signing.  So I’d recommend anyone else use IE8 to save that hassle.
As well, I’ve been reporting my problems with the webkit they use in their forums.  They just gotten back to me, and say they hope to use the latest webkit (which should include a year of webkit bug fixes and feature additions).
So now, I’m going back to trying to submit my app again.  I hope that it gets through!

chrome web store

We’ve started to look into distributing our app via the chrome web store.
I’ve signed up for a developer account, and started reading the documentation on how to publish apps.  So far it has been easy.  All of their forms have worked, and so far the documentation is easy.  This time I’m trying to do as much of the administration up front.  Things like validating my account and setting up payments.  Only after that works will I actually attempt to publish my app.
Let’s hope it’s easier than the intel appup program, which I’m still not able to publish my app through.

Applied for certificate, thinking about what to do next?

I got an email back from Comodo about the code signing certificate, and now their form works.  Then I had to submit my company certificate, and then have to wait for up to 2 days to get the certificate.
I probably should have realised I needed this certificate before, and applied earlier.  Oh well.  For some reason I didn’t remember this was needed.
Next I’ll begin packaging it up for the google web chrome store, so maybe we can sell some on there too.  I don’t think that will take all that long to do.
Finishing the iOS port might be hard since I’ve noticed the performance of JavaScript and canvas on old iOS devices is terrible.  I could just make it available for iOS 5, and the latest iphone 4 phones though… they might be fast enough.  I’ve been exploring possible optimizations for it too.  So I’ll see how that goes.
I’m in the same situation with the android port.  The current web browsers on there are fairly garbage for canvas performance, so I’d need to do some perfo…

Battling Intel Appup submission

Well, I managed to prepare my app for submission to the intel appup store.
I first had to figure out bugs: Sound doesn’t work. Also fonts don’t work. This was very disappointing considering that I’ve been working with a musician on sound effects and music. So we’re not able to use any of that work we did until they fix sound. I even tried to use a flash based sound player, and use the embed tag. None of it worked.
Also the lovely font we selected does not work. Trying to use a font-face crashed the browser completely. So instead I had to use ‘Arial’. arg.
I’m not sure what sort of html5 games and apps they expect if fonts and sounds aren’t working?
It seems they are using a 1 year old webkit implementation, so I hope they will upgrade their encapsulator soon. One year in web browser years is about 70 human years.
Anyway, we decided to submit the app anyway. The font makes it look a bit ugly, and without sounds it looses a lot – but at least the game play works.
Then I fille…

EULA we can use? (End User License Agreement)

got my app up to the packaging stage now…
Does anyone know of a decent (End User License Agreement) EULA we can use for our games?  If you know of ones we can use please leave a comment.

I'm in

October came around, and I started working on a game.
It’s javascript/canvas based, instead of my usual pygame. But, I’m using gamejs which uses the pygame API, so I feel pretty much at home.
We got most of our new graphics and sound into the game today, and all of the game play is done.
It’s not running fast enough on my ipod touch 2g, but I think with some work it could be playable. So we’re aiming to release on the various web stores first. Then perhaps improve things for the mobile platforms.
I had to work on improving a sound engine I call jquery.shitsound, or just shitsound for short. Which uses various web browser sound APIs to work. I’ll have to get it using the phonegap framework to play audio too, since html5 Audio on mobile platforms is simply broken.
We’re in, I should say. Since I’m doing a collaboration with Spencer Sternberg ( ) video game audio and music productions.
The second app I’m working on next after this one is released …

Server Side jQuery - ssjquery

I've got a new server side jQuery project up.  It's an extension on some ideas and projects over the past couple of years.  It uses the node.js javascript interpreter, and node libraries like jsdom, and htmlparser to do all the work.  It can be used within various projects that are not javascript via a command line process or a web service.

This is what the pipeline looks like on the server side.
json + html + server side jquery => rendered html
Instead you can run it on the client side so you don't need a server for development.
json + html + ssjquery run on client first before other scripts => rendered html
A webservice creates the json, and your server side jQuery scripts populate the html.  Think of it as an industrial strength templating language that millions of front end developers know how to use.

Here are my server side jQuery slides I gave at the reject.js conference in Berlin last week.  It wasn't a great talk, but I think it's helped me understand …

pygame on raspberrypi, pyconuk was awesome

Thanks to @ntoll I had a chance to play around with the raspberrypi alpha board at the pyconuk conference (which was a great little community conference with a big heart).
That is it on the pink bubble wrap.  It's hooked up to a monitor via the digital HDMI video port, with a keyboard and mouse connected up via USB.

We only had a few hours to play around with it, but managed to try a few things out.  Whilst we were there playing around with it, a whole bunch of people popped there heads in to have a look and ask questions.  Lots of enthusiasm for the project, and also the machine, but also a bit of cautiousness about the project.

In another room, there was a talk going on about how the BBC was going to help bring a programming education project into the schools of the UK again - like they did with the bbc micro.  Tweets started to fly around on the tweet projection screen about it, but then at the end of the talk we found out it was a hoax.  Haha.  It was more a "wouldn'…

jquery.shitsound.js - a shit sound player for web browsers

Yesterday, I made the first release of shitsound. jquery.shitsound.js is a shit sound player for web browsers.
Listen (demo): code: Used like this:
$.snd.init({}, function () { // we are ready to play sounds! Brilliant. $'hello'); }); shitsound only does a few things with sound::play, stop, stopAlljquery.awesound.js might do:changing volume, pitch, playing with a different tempo, playing in stereo, 3d sound, etc. jquery.shitsound can not do any of this fancy stuff. It can just play sounds, and stop playing them.
shitsound detects which implementation to use at init time.
html5, using the html5 audio tag.embed, for using the embed tag.soundmanager1, for old flash 7.soundmanager2, for modern flash (8,9,10+).empty, pretend implementation that does nothing. It currently requires jquery, since I use jquery. However it could quite easily drop the jquery dependency with s…

pygame sprint at pyconuk, and virtually. Friday 23rd to Sunday 25th of September

There is going to be a pygame sprint at this years pyconuk. We're going to tackle whatever the participants who turn up want to hack on. That might be porting to a new platform like the $25 rasberrypi computer(there's going to be a couple at pyconuk), or improving the pygame android support. Or it might be polishing off one of the new modules like the new freetype font module, or perhaps implementing a brand new module.  Or maybe it's jazzing up the documentation, or working on a new import pygame.examples. I'm getting there on Friday, so I hope to do some hacking then, and we might be able to get some sprint space for the Friday(conference propper starts Saturday, but some people are getting there early) - otherwise it will have to be in a cafe or something.
Also going on during the conference is the python core sprint and CKAN sprint.  It should be fun to join in on those sprints too.  Of course there will be talks, work shops, an unconference room, lightning t…

Let's make a shit JavaScript interpreter! Part Three.

Let's put the Research into R&D. I guess it should be called Shit Research to go along with the name of this series (p1) of articles (p2) I started one year ago. It takes a lot of time to read over hundreds of thousands of lines of undocumented C++ and java code, so part three took much longer than expected.

Let's explore existing JavaScript implementations. In this part we are going to take a small digression to look over other JavaScript implementations. I'll provide a short description of how each JavaScript implementation is made. We can use the Architectural knowledge from each implementation to inspire our own implementation.

Another benefit of researching each implementation is that we can find all the different tools they use. For example different test suites.

Make sure to read the URL's for each implementation to find out more information about each one.

There is a list of ECMAScript implementations at wikipedia. We will not cover all of the ones li…

bugzilla bugs to bitbucket issues

As part of the pygame move to bitbucket, we are converting a bug database stored in bugzilla.

Work is progressing on the issues migration:

Bugzilla is more comprehensive compared to bitbucket. So not all things can be migrated from the bugzilla bugs to the bitbucket issues.

Also, the bitbucket API is limited in what it can do. You can't add user comments or add attachments.

To get around the attachments part, I made the migration script create a directory of attachments, and then link to them in the bug text. Then I've extracted the attachments from bugzilla and put them online.

To hack around the lack of comment adding in the bitbucket API, I'm just combining all of the comments into the content text.

Other features bitbucket issues API does not have are priorities, and platforms. The issues features _does_ support priorities, but it doesn't look like the API is set up yet. You can't add platforms (like 'Windo…

bye bye launchpad

I'm starting to move most of my projects off launchpad onto bitbucket.

launchpad just hasn't gone in the direction that is useful for me, or my projects.

It still has some nice features, such as packaging farms (PPAs) and of course bzr integration. However, github and bitbucket have just been moving more towards making it easy for developers compared to launchpad which is more geared towards for distributors who work with an upstream. Last year I hoped launchpad would improve after it went open source, and it has improved. Just not really in the direction useful for my projects.

Many people these days are able to use hg, or git... but still very many people have never even heard of bzr. I feel bzr+launchpad was holding one project back a little from gaining collaborators because of this. By that logic, I should be using svn for it... but I don't want to do that :)

The documentation to convert repositories to mecurial is on the hg wiki. The conversion seems to mostly have… opengl shading language toy shader

A couple of months ago I made a python port of the WebGL shadertoy. The shadertoy website is written in JavaScript and the opengl shading language.

Here is the python port:

Maybe it'll be useful for someone learning shading languages through python. Or not.

It's a fun demo anyway. Press the 'Anykey' to change between shader. You'll find the 'Anykey' on your keyboard. If the Anykey you press is Escape, then the program will 'quit'.

Requires 1 tsp of pygame, and a cup of pyopengl.

cherrypy daemontools

Cherrypy and daemontools work nicely together. However, I have not found any instructions on how to use them together on the interwebs... so I've written up some basic notes for people who love cherrypy and daemontools.

daemontools is a collection of tools for managing UNIX services. It can be used to automatically start, and restart processes on a unix system.

The instructions to run services in daemontools are here: I'm assuming you have daemontools set up already.

Cherrypy is a python library for making website applications. There are many ways to deploy cherrypy apps, but I will describe how to deploy cherrypy apps with daemontools.

Firstly, you do not need the cherryd tool to use with daemontools. Daemontools does the daemonising for you. But cherryd can be used if you want, since it provides some nice options (just don't use the -d daemonize flag). You may want to use cherryd with daemontools if you'd like to us…


Was playing around with jquery mobile the other day, which has planned it's first beta release sometime next week.

jQuery mobile is what jquery+jquery-ui are to desktop browsers. It abstracts a lot of the parts away so that you can write your code without having to figure out all the different mobile browser quirks yourself. It offers a structure to make web apps which are cross platform across current mobile devices and which as a bonus work in desktop web browsers as well.

Mobile style events are provided as well. Like touch and swipe which work across the various mobile browsers is a nice touch.

Another great thing it provides is media queries. CSS media queries are buggy on some browsers so this abstracts out a lot of the bugs on the various different devices.

Supported are most of the mobile devices. Some are supported better than others, and some provide certain features that others do not provide. For example, the ajax style page loading is not done on opera mini. But wor…

Running jslint on saving JavaScript with vim

autocmd BufWritePost,FileWritePost *.js !jslint <afile>This will run jslint on your JavaScript files after you save them.

You can add the command to your ~/.vimrc

Hotmail, xbox and microsoft live have been hacked.

update: hotmail have added a my friend has been hacked button, so people can report when one of their friends accounts have been hacked. Also I got my account back after 5 days or so. I don't think any of my contacts lost any money from the scam. Other people who got their accounts hijacked have not been so lucky.

Many people have been having their hotmail accounts been broken into and stolen.

Microsoft writes about it on their security blog.

I've meet a few people over the last week who know of people who have had their accounts stolen.

The fraudsters are sending everyone in their contact list and telling people they have been robbed - and to send money. They say they are in a hotel and the hotel will not let them leave.

A friend told me about how some people call up, and someone answers pretending to be the hotel manager mentioned in the scam email.

I haven't read any media coverage of this, but have heard first hand of people who it has happened to. Could this be related …

Let's make a shit JavaScript interpreter! Part Two.

Let's make a shit javascript interpreter! Part two. As a learning exercise, I've begun writing a JavaScriptECMAScript interpreter in python. It doesn't even really exist yet, and when it does it will run really slowly, and not support all js features.

Homework from part One - A simple tokeniser.We ended "Let's make a shit JavaScript interpreter! Part One." by setting some homework to create a tokeniser for simple expressions like "1 + 2 * 4". Two readers sent in their versions of the tokenisers (ps, put a link to your home work results from Part One in the comments, and I'll link to it here).

Our simple tokeniseroperators = ['/', '+', '*', '-']
class ParseError(Exception):
def is_operator(s):
return s in operators
def is_number(s):
return s.isdigit()

def tokenise(expression):
pos = 0
for s in expression.split():
t = {}

Pyweek April 2011, this weekend.

Pyweek 12 – April 3rd-April 10th

Find out more about PyWeek - "Invites entrants to write a game in one week from scratch either as an individual or in a team. Is intended to be challenging and fun. Will hopefully increase the public body of game tools code and expertise. Will let a lot of people actually finish a game. May inspire new projects (with ready made teams!)"

Hammering nails - the hard way.

Do the following 1000 hammering tasks, and you will have learned how to use a hammer the hard way. You can do them from your bedroom. These are just like these guitar tasks that I do - in my spare time as a rock star. Well not really a rock star... but I sure can do some awesome guitar solos. They're also like katas I practice for my martial arts... in my spare time as a ninja.

"pssst..." "the world doesn't like guitar solos any more - and playing in your bedroom will never be like playing to real people. Also martial arts practitioners who use katas loose to fighters who practice fighting in real fights."

"pssst... you there..." "The pros don't use hammers. They use nail guns."


You don't need a book to learn python the hard way. To learn python the hard way, do some real world projects.

This pay out brought to you by the awesome Programming, Motherfuckers manifesto.

Hacking on android and pygame.

For the last couple of weeks I've been hacking on my new android tablet in my spare time.

It's one of those cheap 25cm ones (10 inches). Dual core, nvidia graphics, and all of that stuff. Not a bad little device really.

One project has been to port an old game of mine to it using PyGame subset for android(pgs4a). It's a package of a subset of the pygame modules - along with a bundled port of CPython for android. You can either package your apps standalone, or simply install the launcher from the android market, then upload your game to your SD card. Simples.

So far it's been pretty fun, and the other weekend I got something running. Next up is to work on the UI parts. Already it supports keyboard, mouse, mouse+keyboard, and also joystick mode. However, none of them really work with the touch screen on my tablet. I'm not a very big fan of the touch joypad approach. Where they make a virtual joypad on each side of the screen to touch. There are two main actio…

london clojure dojo

(Last night I went to the London clojure dojo.)(. javax.swing.JOptionPane (showMessageDialog nil (reduce str ["Hello" "London" "Clojure" "Dojo"])))This dojo was hosted by @otfrom and @rrees at the ThoughtWorks offices (many thanks to them). They put on a nice spread of quiche and sandwiches. Here's some of the quiche... which was nicer than it looks in this photo.) (

-- quiche picture credit to @otfrom (used without permission ;))

There was a github repo setup before the session with the code from previous weeks.
After grazing, and drinking of softdrinks - the night started with a mini talk on cake (the tasty build tool + enhanced repl(interpreter) + kitchen sink for clojure) by the co-organiser of the dojo (Robert Rees from ThoughtWorks).
A programmer from Deutsche bank was there recruiting clojure programmers, and getting involved in the dojo too. It kind of reminded me of python in the early days... whe…

JQuery 1.5 promises a better future.

One of the new features of the unreleased JQuery 1.5 is a new $.ajax module.

Apart from many bug fixes, the most interesting, and useful part for me is that it now uses promises. Those familiar with python and twisted, or the JavaScript library mockikit, Dojo Deferred, or java.util.concurrent.Future might know these as deferreds or futures. jQuery is using promises, and not futures. They are similar but slightly different. It's a very commonly used technique in concurrency libraries now - so it is good that jQuery has hopped on board.

Since jQuery always returns a promise, you can now add callbacks even after you have done the call... or even change the callback later.
jQuery.getJSON( url ).error( errorCallback )Pluggable ajax lets us test more easilyThe other great thing(from a testing perspective) is that jQuery now allows you to use plug in mock implementations. This lets you make a fake ajax implementation for your unit tests more easily.

This pluggable architecture could al…

London python dojo pygame write up.

Last night I went to the London python dojo at the Fry IT offices.

The night started with pizza, beer, and nerdy chats with everyone.

Then two lightning talks. The first by @tomviner (Tom), on some funny and useful python modules. `pip install oo && python -moo` Python goes moo (dad joke). `pip install e && python -me 1+2`

Next up was @otfrom (Bruce). He has a cunning plan to work on an engine that could be used later in a cross language dojo to display a game world. @otfrom is trying to see if other language dojos in london are interested in having a bot war tournament in the future. So far the clojure dojo, and perhaps the scala dojo are interested in participating.

@otfrom also announced the London dojos mailing list at: A group for people interested in programming dojos in london (not just python).

Then 30 of us took an open source game from, forked it and hacked on it!

I brought along a big bag of joypad cont…