Getting kids into programming (and what the Raspberry Pi is lacking) (by )

Back when I were a lad, if you bought a computer, you'd bring it home and plug it into the telly and turn it on and a BASIC prompt would appear.

Tough luck if you wanted to do practical tasks like word processing, but you could type a single command (such as CIRCLE 100,100,50) and be instantly treated to a circle appearing on the screen. Before long, my generation were writing programs to crunch numbers for our statistics homework, and lots and lots of games. And thus a generation of software engineers was born.

Getting started in programming is trickier for the contemporary twenty-first-century child; they have to install a software development environment (their computer probably didn't come with one), and then go through a wizard to Create New Project, write initialisation code to open a window, then write a redraw event handler that takes a graphics context and draws a circle with it. A little less approachable than "CIRCLE 100,100,50". At least you get a simple word processor and a Web browser out of the box, though... I'm no nostalgic Luddite 🙂

Now, the Raspberry Pi has been widely hailed as the answer to our woes; costing just twenty pounds and usable given access to a TV and a dirt cheap USB keyboard and SD card, it's cheap enough to be purchased and given to a child to play with, unlike Mummy's laptop. Also, it has a user I/O port, meaning it should be relatively easily to integrate with home-built robots and other such fun electronics projects.

However, that's just the hardware side. What's seriously lacking is the software. If you buy a Pi and install one of the available Linux images onto an SD card and boot it up, you'll be presented with a Linux desktop environment. You'll be able to get to a shell prompt with little effort, and start learning shell, or get into a Python prompt and start to write Hello World, but that's not incredibly inviting; the effort required to do anything interesting from there is quite high. In particular, getting graphics going is hardly a job for a beginner.

So, I set out to improve on this situation. I've written a turtle graphics engine on top of Chicken Scheme, called Simple Graphics. Installing it is often painful as you need to get all the required bits of SDL and Cairo installed, but once that's done, thanks to Chicken's excellent egg system, installing simple-graphics is easy. And once you've done so, it's just a matter of:

(use simple-graphics)
(forward 10)

...to get started with drawing things on the screen.

However, that initial installation pain can be bypassed by making a Raspberry Pi image, based on the existing excellent work on basic Linux distributions for the Pi, that has Chicken and simple-graphics pre-installed, with a desktop icon to fire up a Chicken prompt with the simple-graphics library already loaded so you don't need the use line. But then I'd also like to add Chicken eggs to drive the I/O port on the Pi, including I2C and SPI. And sound generation, so you can make noises to go with your graphics while driving a real robot turtle through the I/O port...

It would also be good to have a version that boots straight into a full-screen Chicken prompt (which, if you start doing turtle graphics commands, splits into two, a graphics area that can be hidden/revealed/made full screen with hot keys, and the command-line area), for people using small screens.

That way, kids of all ages could immediately have an interactive environment that lets them program the full range of capabilities of the Pi. And being based on Scheme, it wouldn't be a "dumbed down" environment they'll grow out of and have to learn a new language in order to do more powerful things; they'll be able to use all the Chicken Eggs available, as well as being able to write their own code in a language eminently capable of the full range of programming tasks - yet still simple enough for anybody to get started with. Sure, I could have based Simple Graphics on Python or Ruby; but anything they can do, Scheme can do better.

Krav Maga (by )

I've always enjoyed combined mental/physical challenges. As a child, I often entertained myself with things like getting from one part of the house to another without touching the floor. This required planning, and finesse; the combination was exhilerating.

I enjoyed my time in the Combined Cadet Force, as many of the exercises we were set involved this combination; and I particularly enjoyed being in the school shooting team. Especially when we went out to electronic target ranges and did exercises involving running to checkpoints with an assault rifle, diving into the prone position, inserting the magazine, shooting at targets as they popped up, and then running to the next checkpoint. It was like playing Time Crisis!

However, that kind of thing has been missing from my life for the past decade or so. Also, I've been spending far too much of my time sitting in cars or at desks, with my main exercise being carrying heavy objects (such as sleeping children) for short distances. I was feeling a keen desire to exercise more.

Then about a year ago, Jean started doing Ju Jutsu, and I started to wonder about taking up a martial art. I remember, many years ago, a friend saying he was taking up Krav Maga, an interesting-sounding Israeli martial art that grew from self-defence techniques in the Jewish gettos of Hungary before World War 2.

However, my searches found no nearby Krav Maga groups; the nearest was in Bristol. So I gave up on this idea for the time being. But a few weeks ago I spotted a poster in a shop window in Cheltenham advertising local Krav Maga courses; sure enough, a group had started!

So yesterday evening, I turned up to give it a try.

It's delightfully pragmatic; most of the attacks seem to revolve around wacking your attacker as hard as you can in the softest bits of them you can reach, then running away. The first skill I started practicing was how to kick somebody in the groin, punch them in the face twice in quick succession, pull them down hard onto your rapidly-rising knee into their stomach, elbow them in the kidneys, and end up behind them (running away, of course), in one smooth motion. We then proceeded to have a try at being pinned from behind by one person while another ran at you from the front; there is a technique to escape the grip and leave the person gripping you curled up in a painful ball on the floor, but doing it while also dealing with the person coming at you from the front makes it a lot more interesting. There were also some more abstract exercises in dealing with large numbers of people coming at you, avoiding being cornered or surrounded, and getting them to get in each other's way. That involved some physical activity in keeping moving, but it was mainly a mental exercise, observing the paths of the attackers and planning your movements.

The practising was good exercise in itself, but we also did a bit of general fitness exercise, largely as part of the warm-up before getting into the practice. I left feeling tired but lively, and today I've been feeling the ache of growing muscle over much of my body, so it's been a good work-out.

I got on well with the other students, who were very helpful with the new people in their midst; and the instructor seems to be a truly intriguing and inspiring person!

It was good challenging fun, so I'm going to keep going, hopefully switching to the Gloucester group that will be starting on Mondays in September!

I turned up in a shirt and trousers, straight from the office, but most of the people there had track suits. Black ones, and t-shirts with martial-looking imagery on, were particularly popular. The contrarian in me is now wondering if I can get a glittery pink tracksuit in my size...

ORG-mode and Fossil (by )

I'm always moaning about how I have too many ideas and not enough time, so it's quite important to me to manage my time efficiently.

My biggest concern, with many projects on the go at once (and I don't just mean fun personal projects, I'm including things my family depends upon me for as well), is that I'll forget something important I'm supposed to do. And I'm also concerned that I'll forget a fun personal project, so that when I do get a moment, I can't think of anything to do, or that I spend my time on something that doesn't get me as good a reward for the available resources as I could have had.

Therefore, I've always been a big fan of "To Do" lists in one form or another. I've tried a few apps to manage TODOs for me, from the excellent personal information management facilities of the Palm Pilot to Things on the Mac, but I've tended to find such things restrictive. For a long time I had a complex OmniOutliner setup that also computed my timesheets with AppleScript, which suited me well; indeed, I've still yet to completely migrate all of the content out of that file (tricky now I no longer have a Mac, but I've looked at the underlying XML file and it seems reasonably parseable), and I think it still contains some notes about ARGON that I've not written up anywhere else!

However, I've had the most success with text files, adding hierarchic structure with headings, so it was fairly natural for me to try Org Mode one of these days. For those not in the know, this is an Emacs package designed to help you organise things with hierarchically-structured plain text files. You write heading lines prefixed with an asterisk, indicating the level of nesting by adding more asterisks, and Org helps by syntax-highlighting the header lines, hiding entire subtrees so you can see the large-scale structure, editing operations to cut and paste entire subtrees (properly adjusting the levels to match where you paste the subtree too), and so on.

But that's just the start. That's what it inherits from the Outline Mode it's based on.

What Org Mode adds on top of that is really hard to list. You can add workflow tags (TODO -> INPROGRESS -> STALLED -> DONE, for instance; you get to define your own little state machine), along with optional priorities, to mark some headings as tasks requiring attention (and obtain a report in the "agenda view" of all headings in certain states, ordered by priority, for instance). You can attach tags to headlines (and use them as filters in the agenda). You can attach arbitrary key-value metadata lists to headings (which are folded down into a single line, and opened up on request, so they don't clutter it), and use those to annotate things with deadlines, or scheduled dates, and have a calendar view in your agenda. Or use the key-value properties to filter the agenda view. Or have Org Mode automatically record a log book of state transitions of a task in the metadata. Or take metadata keys out and display them as extra columns in the hierarchy of headings, in a manner reminicent of OmniOutliner. You can embed links to other files that can be opened in Emacs; if it's an org-mode file you can link to a heading by a unique ID, or you can link to any old text file by line number or by searching for nearby text. There's a feature you can use, while editing any file, to create an Org-Mode heading containing text you are prompted for and a link to the place you were at in the file you were editing, timestamped, inserted under a specified heading of a specified org-mode file, so you can trivially create tasks referencing the file you're working on. Or you can embed executable elisp code to perform arbitrarily complex operations.

I'd been using Org Mode for a while, but I wasn't really using it properly; I had a whole bunch of .org files for different areas of my life, but it was sometimes difficult to fit things into the taxonomy. However, lately, I've had a big tidy-up of my home directory.

I've migrated old projects from Subversion or Git into Fossil, for a start, so now all of my projects - open-source ones at Kitten Technologies, and personal ones, are in their own Fossil repos, which means they have their own ticket trackers for their individual tasks. But each and every one of them has a heading in my new single tasks.org file, which is a unified repository of things I should, or would like to, think about. Fossil projects have a single heading, tagged with "FOSSIL", that lists the place in my home directory where I have the repo working copy, and the URL of the master repository on my server; ŧhis exists to prevent me from forgetting about a project.

I've migrated our long-standing home wiki (mainly a repository of recipies and other such domestic stuff) into the inbuilt wiki of the Fossil repo I already use to store documentation about the house, such as network configuration, a PDF of the plans from the Land Registry, and stuff like that; and the ticket tracker in that repo is now the domestic TODO list. Running the Fossil web interface for that repo off of the home fileserver means that Sarah and I can share the Wiki and task list. And I've configured the Fossil user roles so that anonymous users can't see anything too sensitive.

So in general I've moved as much as I can to Fossil repositories, combining versioned file storage and ticket tracking with a wiki as appropriate; and my tasks.org exists to act as an index to all of them, and to store actual task list items for things that don't naturally map to a fossil repo, although I may find ways to deal with those as well (for instance, I have a fossil repo I use to store my org files, encrypted password database, household budget, address book, and the like, that I'm not using the ticket tracker on; that could be used as a place to put my general administrative tasks as tickets).

However, although putting tickets in the repositories that store individual projects is conceptually neat, and allows for third parties to interact with my task list for open-source projects on Kitten Technologies, it does mean that I have a lot of separate task lists. tasks.org means I won't forget about any of them, but I still have no simple way of knowing what the most urgent or interesting task out of all of my twenty-five repositories is. That's not a great problem in itself, but the next logical step will be to use the automation facilities of Fossil to pull out the tickets from all of my repos and to add them into tasks.org as tasks beneath the corresponding Fossil project heading (including the ticket URL so I can go and edit them easily), so I can see them all consolidated on the agenda view...

Part of this process which has been interesting, though, is digging out various old TODO lists (such as the aforementioned OmniOutliner file) and project directories scattered over archives of old home directories and consolidating them. I've found various projects I'd forgotten about, and neatly filed them as current projects or into my archive tree as old projects (and, oh, how I look forward to being able to put things like that as archives into Ugarit, automatically cross-referenced by their metadata...). Having brought everything together and assembled an index reduces the horrible, lingering, feeling of having lost or forgotten something...

AVR microcontrollers and Arduinos. (by )

I'm a fan of the Atmel AVR microcontroller. The main competitors in its area are the older 8051 and PIC architectures, which have less pleasant instruction sets and are generally harder to program.

Ease of programming is key. Most AVRs can be programmer via a SPI link, which is just four digital I/O pins following a widespread standard that most microcontrollers can drive, and there are widespread interfaces to drive an SPI bus from a PC. It's almost as good as the LPC2000 series 32-bit microcontrollers' asynchronous serial programming interface, which can be driven from an RS-232 port with a little bit of level shifting. I'm also a fan of the LPC2000s, but they fit into a higher-powered niche than the AVRs!

A long time ago I did some AVR development professionally, with a programming board driven from a PC parallel port by some Windows software. I still have the board, and a windows PC with a parallel port and the software installed sitting under a desk, but the "activation energy" of getting the PC powered up and plugged into a keyboard and monitor, and digging out the board, and having to deal with Windows-based development software and all that has stopped me from doing anything with AVRs for a while, given my shortage of time.

However, Sarah has tasked me with developing some electronics for her, as part of a project she's working on. And it looked like the easiest way of doing what's required will be to drop an AVR in.

But rather than dig out the Windows-based dev environment, I've just picked up a USBtiny ISP kit for less money than my original AVR dev system cost. It runs off of a USB port, and supports an entirely open-source AVR toolchain that I can run on my laptop. Inside, it's just an AVR itself, with a USB interface on one end and a SPI interface on the other; everything that I need in one neat little package.

As a plus, it has a cable coming out that I can plug into a header on the board the AVR is part of; my old dev board needed me to pull the chip out of its circuit and put it into the board to program it. Pah!

But while I was there, I also picked up an Arduino Uno. This is a little gadget that has been taking the hobbyist electronics world by storm lately; it's basically an AVR on a board with an inbuilt USB programming interface and a bunch of female headers to make it easy to wire up to various things, and some software to let you program it in C easily with a useful library. There's a wide range of boards that plug directly into the headers to do all sorts of fun stuff, too.

Now, I'm a bit disdainful of the Arduino; given the ability to program bare AVRs directly and to assemble my own circuits on protoboard, I can easily do all sorts of stuff that Arduinos can't, at a fraction of the cost.

However, they're great for beginners, as they are plug and play devices; you can get started without touching a soldering iron or having to work out which pin is which. My disdain is purely personal, I think they're a great thing for the community as a whole 🙂

So why am I getting one, I hear you ask? Well, I have a wife who wants to be able to control LEDs and a six year old daughter who is passionate about building a robot, so I'll be glad to have an easy-to-use module I can just hand them rather than needing to build AVR boards for them all the time; but mainly, I plan to use it as a Bus Pirate clone by putting a FORTH on it along with some words to do things like I2C and SPI...

Time (by )

Tired of lying in the sunshine
Staying home to watch the rain
You are young and life is long
And there is time to kill today
And then one day you find
Ten years have got behind you
No one told you when to run
You missed the starting gun
Pink Floyd - Time

I've always felt rather cursed with the fact that I have an addiction to designing things. It's bad enough knowing that I can easily design something that will take a week to actually do in half an hour, and that I can do that designing while walking or driving or in the shower or lying in bed, while I can only actually do any making when free of distractions... I try to make the best of it, writing the best of my ideas up on this blog when I get time in the hope that some of them will inspire others in some way, as I can't bear the thought of them all being lost. I believe that ideas are cheap, especially for me, so there's no point in hoarding them - I can always come up with more!

However, the past few years have been worse than ever; I've been crucially short of time, so I'm lucky to get a day a month to sit down and make things. I knew that parenthood would take up a lot of my time, but I didn't reckon on pregnancy and childbirth making my wife an invalid, or our house flooding, or all the knock-on effects of these things. I'm running a Cub pack on my own, because nobody else can spare the time to help me; I'm already barely keeping up with the basic requirements of running the pack, and I can't put in any less time without shutting the whole thing down (which would weigh very heavily on my heart, as I love working with those kids, and couldn't bear to let them down). That takes up two or three evenings a week. And I lose a lot of evenings or weekend days helping Sarah build her career, to keep her sane (I don't want her being stuck in a dead-end life of childcare) and to help relieve our financial pressures. I lose three lunch breaks a week to transporting Jean. I'm barely keeping up with keeping the house clean; it gets worse all week and I catch up at the weekend if there is time. And yet most of the things that are taking up my time are the kinds of things I can do while still designing things in my head, so the creative output hasn't slowed that much, even though the time I have to follow up any of the ideas has nearly vanished. There just really isn't much time for me in the week; my one safe escape valve is my weekly visit to Bristol Hackspace on a Thursday after work, where I have two hours.

But then a second problem kicks in: When I do get some time without pressure, I often don't actually want to concentrate on things right away. Over the bank holiday weekend I got about a day to myself (in a few chunks of several hours here and there), and I think I spent at least the first three hours playing Cyber Empires; I only felt up to doing something mindless. After that I got stuck in and did some work on a couple of Ugarit tickets (4363bc7631 and 34e21d597f)... But it's too easy to spend my two hours in Bristol each week just nattering to people!

I've found I'm starting to get self-conscious about it. I'm feeling embarrassed about telling people about the fun ideas I've had, because I know they know I probably won't ever execute them.

There are too many people who go around being smug about the great ideas they have, that they can't implement as they don't have the skill (often, these folks feel that implementation is a mindless task to be given to hired goons). But you can't design something you couldn't imagine every step of the construction of; knowing the limits of the medium is essential to designing something that pushes those limits to their best... It's no better than a child triumphantly saying they have designed the best car ever, that drives at a hundred miles an hour AND flies AND has a laser gun AND has a fridge full of cakes in the boot. That's not a design; it's a requirements document (of sorts).

I don't want people thinking of me like that. Every time I've updated the ARGON web site I've put in more and more perrimistic estimates of my hope of ever implementing it. When I started it, it looked like a tractable project I could slowly work on over several years; now it looks like something I might manage to do in my retirement, at best. That makes me sad. I'm not a person who designs things they can't build (except when I'm doing science-fiction worldbuilding, at least...); I'm a person who just doesn't have the time to build the things they design...

WordPress Themes

Creative Commons Attribution-NonCommercial-ShareAlike 2.0 UK: England & Wales
Creative Commons Attribution-NonCommercial-ShareAlike 2.0 UK: England & Wales