Archives for May 2011

Getting started developing for Maemo in Python

After a few months of owning a N900 finally came the itch to write an app for it -- using of course Python! The Maemo documentation is excellent, I'm only putting my notes down here for future reference.

First off, making sure to know which version of Maemo is on the phone: Settings -> About: Maemo 5.

Setting up

The documentation at is truly excellent. Of interest to us to begin with is installing the SDK. The wiki has been kept up to date with tips and links to solutions of potential problems at the stage where you might encounter them, making any issue a non-event.

Note: It turns out that the SDK is optional to develop with Python. If you would prefer not to set this all up, you can simply move your Python files to the phone or write the code there directly. Personally I found having a full SDK on the laptop to be really handy to try things out quickly, and to tweak and understand what the final result will look like.

Getting started, every time

The SDK docs lists the various commands that may work for your distro and system specifics, which is awesome but can be a bit dense to read through and find again later on. Here's what I do on Debian unstable:

Xephyr :2 -host-cursor -screen 800x480x16 -dpi 96 -ac &


export DISPLAY=:2 start

Important: Don't forget to run ` stop` at the end, or say, if you messed your Xephyr command and need to restart it -- you will need to stop this script before attempting to start the emulator environment again. Otherwise there will be D-Bus conflicts and things won't work.

Hello, world

After setting up the SDK, the documentation recommends you go learn about packaging next -- I kept that one for later, it's more interesting to build something first!

By following the documentation you can find the Hello world for Python, which does work on the phone with no hassle and without stopping by the SDK: Developer Guide -> Programming Environments -> PyMaemo quick start.

If you'd like to work in scratchbox (quicker turnaround!), you can go back to the Maemo SDK on your machine and follow again the instructions to set up a Python development environment.

Hello world, again

The same Python-related packages need to be installed into the dev environment, within scratchbox.

nano /etc/apt/sources.list
deb fremantle free non-free
apt-get update
apt-get install maemo-python-env (and qemacs :o))

Note that on the phone, you would install maemo-python-device-env (cf. Quick Start Guide), while when working in scratchbox  you should install maemo-python-env instead (cf.  Python support)

qemacs -nw

Make sure you're calling `python2.5` explicitly or the program will fail with "ImportError: No module named gtk". While working with Hildon I use this command instead, which you'll learn when doing the UI Tutorial. python2.5

Because of the various warnings messing up my scratchbox screen, I ended up using emacs from outside of scratchbox. The files you're working with are located at /scratchbox/users/<username>/home/<username>.

Once you can run the Hello world program, the next step is to go through the handy UI tutorial, which teaches a lot about Hildon and GTK.

I would also recommend installing the devhelp packages for:

  • PyGTK (python-gtk2-doc),
  • the PyGTK tutorial (python-gtk2-tutorial), and
  • the hildon API (libhildon-1-doc) (also available online). The API reference is in C but after doing the tutorial it's easy enough to guess the Python names. Note that although it's still handy, the Debian package does not appear to be the very latest version, e.g. HildonSizeType isn't documented.

I'm really happy with that setup, and it's lovely to get a nice looking UI working so quickly and easily. This is reconciling me with GUI programming -- it looks nice and because of the small screen, there isn't a ton of repetitive boilerplate to write. I can't wait to be far along enough in that project, that I have an excuse to learn again about Debian packaging! :-)

Screenshot of development environment

Leave a comment

Reimaging Learning Conference

Last week-end I attended the Re-imagining Learning conference in Limerick, a conference by the Educate Together folks aiming to rethink early secondary school.

As expected the majority of the talks were very interesting and/or inspiring. The way the schedule seemed to work, keynotes were meant to be higher level and make the audience think and ponder and imagine, while the sessions in between were more practical, sharing information on past or current initiatives by education professionals.

Attending a conference outside of my field was an interesting experience, although I found it awkward to introduce myself. I thought afterwards I should have simply left it to "I'm interested" rather than trying to justify my presence, but thinking again I'm not quite sure it really explains what the hell I'm doing here. Ah well. I can figure it out as I participate in more of these events, I guess.

I took a ton of notes, however as I haven't been good in the past at transcribing talks, I'll start by posting a mishmash of thoughts, themes and ideas that I took home with me.

First and foremost, there is a lot happening in Ireland in education at the moment, including curriculum reform (recommendations) at the Junior level. It was inspiring to be surrounded by professionals in the field who obviously care so deeply about what is going on and how to improve the state of things.

The Friday morning keynotes looked at the early years of the Junior level, covering how these first few years have a major impact that will affect the attitude of the student toward school until the end of their schooling. "Curriculum integration" was a big theme over the two days and another speaker noted curriculum cannot be looked at independently, it is heavily dependent on the political context even if we like to pretend it is neutral.

John Portelli's keynote was very interesting, explaining the importance of a critical-democratic framework and the dangers of pre-judging. He touched on a lot of themes and it was incredibly frustrating to see him having to rush through the ideas he was introducing. Although the conference was very professionally organised, time-keeping was terrible from the beginning and it put a lot of undue pressure on speakers who felt they had to fly through their material.

Some practical tips I picked up during some of the sessions:

  • In Sean O'Leary's talk on science differentiation, he mentioned simple ways to make material more accessible, for instance language level readability. He showed examples of a science exercise, and how to rewrite it so that it means the exact same thing, the problem is framed the same, however the language is simpler which removes a potential barrier. That's something I absolutely want to look into, because I know I am guilty of it, as I tend to switch to smartass academic language whenever I write an exercise sheet that I know I will be handing out. He also uses visual cues as often as possible to help with memory (rebus). To dos:
    • Find a site or software to assess the readability level of the material I write.
    • Check out the Science Differentiation Pack the speaker worked on and see what I can use in there
  • Neil Bulter showed us all sorts of games he used in class to encourage students to develop their problem solving skills. See notably Fantastic Contraptions, Gravity Pods, and Light bot. To dos:
    • This last one I must check out properly and see if it can help newcomers come to term with how programming works

Some general ideas that stick to mind:

  • Like everyone teenagers want to know more about themselves, understand who they are and what is their place in the world. By teaching them about development theories they can learn to make better decisions. Development theories include multiple intelligences, etc.
  • Teaching in groups is excellent and the ideal way to do things, however the teacher needs to help/teach/promote higher level thinking and discussions, to move it beyond disputes (e.g. partner phrases)
  • I didn't know the Irish Computer Society was so involved with school and education! They train schools in using technology to engage with students. And they even have an awesome Scratch handbook! To dos:
    • Get the handbook
    • Find out more!
  • Many times speakers put forward the idea of having the teacher stand back and act more as a facilitator and guide. For instance, community-based learning (Martin Galvin), that encourages young people to look into a problem in their community (e.g. nutrition based health problems) and learn about it in a self-driven way and through community service. Giving an ill-structured problem (a very general question) that has no clear-cut answer, and let students run with it! See also the Global Learning Initiative Project (Lori Holcom) that hooks up students with other students from schools around the world.

Some books/articles I want to look into:

  • The Passionate Teacher, 1995
  • Something to learn more about teacher follow-up moves, by Brodie (2008). This was mentioned as part of the talk on "fostering a 'conjecturing atmosphere' in mathematics lessons" (Therese Dooley).

Of course the conference covered all these topics (and more!) in much more details and I have a lot of things to think about, think through and hopefully use to better my own beginner-teaching and make it more relevant.

Additionally, I met with Paddy, a retired school principal from Cork, who was kind enough to give me some advice on how to find a school near where I live and who to talk with to see about teaching programming to high school students. A big to-do!

Leave a comment

Bees with machine guns Load testing

Another interesting PyCon talk to watch was Best practices for impossible deadlines. One of the tools mentioned in the talk is Bees with machine guns, a load testing tool that uses the power of EC2 and with a name like that I was gleeful thinking about the day when I would have an opportunity to use it.

This week the day came :D And despite the useful README I had to tweak a bit to get things working; here are my notes for later, and for anyone else who might ask themselves the same questions.

Bringing up the swarm

The documentation mentions some of the defaults you should override, but not all of them and you might find yourself scratching your head wondering why things are timing out.


  • Creates a 'bees' (or whatever) security group, with SSH/port 22 open (-g)
  • Make sure the AMI you're trying to find is available with that name in the zone you're in (-i)
  • Make sure the region in your Boto config file matches the region you're trying to connect to (-z)
  • Mind the default username! If you don't specify it, it will default to newsapp and the bees won't be able to connect (-l)
  • For additional paranoia I also created a specific key pair just for the bees, to make sure there's no way in hell I can bring down an instance with something important on it (-k)
./bees up -s 4 -g bees -k bees -i ami-12345678 -z eu-west-1a -l root

Still timing out!

Now... The bees use the apache benchmark tool to hammer your site. If the tool doesn't produce any output the script assumes there was a time out. Which means, if the tool isn't installed on the AMI the bees will always time out! Without an appropriate error message. There are a few options. You could create a custom AMI that has ab installed. This is a bit overkill. Or, if the AMI you're using supports it (not a given!) you can launch a user data script by tweaking the script around line 100 and adding something like this to the run_instances call. (Debian-based system, use sudo if necessary.)

   user_data = '#!bin/bash\napt-get -y install apache2-utils'

thus becoming:

reservation = ec2_connection.run_instances(
        user_data = '#!bin/bash\napt-get -y install apache2-utils')

Other tips

If testing say a Django-based site, don't forget to add the ending slash at the end of the URL. ab doesn't follow 301 codes.

If changing regions to test from elsewhere:

  • Find the new AMI id for the image. It has to be EBS backed.
  • You may encounter errors if the zone doesn't offer t1.micro images, but the error message will clearly indicate so.
  • ~/.boto must be updated:
#ec2_region_name = eu-west-1
#ec2_region_endpoint =
ec2_region_name = us-east-1
ec2_region_endpoint =

aws_access_key_id = ......
aws_secret_access_key = .....
Leave a comment | 2 so far

Squishy Circuits workshop! Having fun learning about electronics by playing with conductive dough

On July 2nd, I will be facilitating a workshop on Squishy circuits, kindly hosted by Tog and taught by Tríona O’Connell.

Squishy circuits are a great way to demonstrate electrical circuits to kids (and adults!). It consists of a conductive dough and an insulating dough that are used in the building of circuits, along with batteries and more usual electrical components like motors and LEDs. During the workshop, we will make some batches of both types of dough, and afterwards we’ll see some useful demos you can use to teach with it, and also have some hands-on fun building circuits.

For more information, including how to register, see the Tog announcement.

If you're around Dublin and knowledgeable about some cool open project for which you would like to share the love with that kind of event, please get in touch with me! I would love to have more of these workshops in Tog! See my About page for contact info.

Leave a comment