ACCU World of Code

  • Scheme 3: Closures video

    Series: Feel the cool, Basics, Closures, Recursion, Quotation, Lambda, Macros. Continuing the series on Scheme, this video describes an important feature of functions in Scheme: closures. Closures allow functions to carry their “environment” around wit…

  • Scheme 2: Basics – pairs and lists video

    Series: Feel the cool, Basics, Closures, Recursion, Quotation, Lambda, Macros. Continuing the series on Scheme, this video describes some of the things you will need to understand to be able to write real programs. I introduce pairs, lists, and navigat…

  • Scheme 1: Feel the cool video

    Series: Feel the cool, Basics, Closures, Recursion, Quotation, Lambda, Macros. Here’s me trying to persuade you to be interested in a 40-year-old programming language, called Scheme, which is a type of Lisp: Slides for Scheme 1: Feel the cool

  • Generalising tail call optimised C++

    This series: Lightning talk, Explanation, Performance, Generalisation. In previous posts I discussed the construction of some C++ that does the same job that the tail call optimisation does in some other languages. The example code given showed the cas…

  • JavaScript WTFs Videos

    I recorded some videos of my JavaScript WTFs presentations: You can get the JavaScript WTFs slides. Update: all six episodes: JavaScript WTFs 1 – The Global Object JavaScript WTFs 2 – Equality and Inequality JavaScript WTFs 3 – Syntax JavaScript WTFs…

  • Closures in Scheme

    Update: watch the video In this series on Scheme: Intro, Basics, Closures. Here’s a presentation I did recently, on Closures in the Scheme programming language. Closures are the way the environment in which a function was created hangs around with it a…

  • Performance of tail call optimised C++

    This series: Lightning talk, Explanation, Performance, Generalisation. After I wrote a version of tail-call optimised code in C++ I became interested in its performance relative to normal recursion. The tail call version can process arbitrarily large i…

  • Tail call optimisation in C++

    This series: Lightning talk, Explanation, Performance, Generalisation. Some programming languages make recursive programming more practical by providing the tail call optimisation. For a tiny talk at the recent ACCU conference I looked at how we might …

  • Lighting talk – Tail call optimisation in C++

    This series: Lightning talk, Explanation, Performance, Generalisation. Update: watch the video Here’s the lightning talk I gave at the ACCU 2012 Conference: Tail Call Optimisation in C++ It’s about how you would generate C++ code that represents a recu…

  • Scheme: pairs, lists and recursion

    Update: watch the video In this series on Scheme: Intro, Basics, Closures. Here’s a presentation I did recently, on the basics of the Scheme programming language. Scheme: pairs, lists and recursion

  • Introducing VisualLintGui

    If you have been following me (@annajayne) on Twitter, you may have noticed me talking about something called “VisualLintGui”. This is actually the second of two projects (the first being VisualLintConsole – the command line version of Visual Lint) we …

  • Introducing VisualLintGui

    If you have been following me (@annajayne) on Twitter, you may have noticed me talking about something called “VisualLintGui”. This is actually the second of two projects (the first being VisualLintConsole – the command line version of Visual Lint) we …

  • What timezone Python thinks I’m in

    sudo aptitude install python-dateutil python -c “import dateutil.tz; import datetime; print datetime.datetime.now( dateutil.tz.tzlocal() ).tzname()”

  • Freeview dvb-t scan gives “tuning failed!!!” after 18th April switchover

    Usually when the channel lineup changes, I just have to do this:$ scan /usr/share/dvb/dvb-t/uk-CrystalPalace > ~/.mplayer/channels.conf But this time it is failing with:>>> tune to: 505833000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_3_4:FEC_AUTO:…

  • Scheme: feel the cool

    Update: watch the video In this series on Scheme: Intro, Basics, Closures. Here’s a presentation I did recently, introducing the Scheme programming language (a dialect of Lisp). Scheme: feel the cool Metaprogramming is very powerful, but is usually so …

  • JavaScript WTFs

    I recently did a presentation at work on “surprising” things you may encounter in JavaScript. I present it here for your delectation: JavaScript WTFs Sorting arrays was the one that wasted me the most time. Arrays in JavaScript are a neat hack on top o…

  • Goodness in programming languages, part 2 ” getting your code running

    Posts in this series: Syntax, Deployment, Metaprogramming, Ownership The fancy word for what I’m talking about here is Deployment. How easy is it, once you’ve written your code, to get it running on someone else’s computer? What barriers are there to s…

  • Building jEdit from source

    I have recently agreed to take over development of the JSLint plugin for my favourite editor, jEdit. To start developing I decided to build jEdit and its plugins from source, which wasn’t as easy as I would have expected (thanks to deffbeff for some po…

  • Goodness in programming languages, part 1 – syntax and layout

    In this series I will comment on what I like in some of the languages I use. I will cover things that I find convenient, things that might lead me to write correct code, things that tend to make my code more readable, and possibly other things that I j…

  • ResOrg 2.0 has been released

    It’s done. After a rather extended incubation period ResOrg 2.0.0.15 (the first public ResOrg 2.0 build) was uploaded earlier this morning, and the ResOrg product pages updated to match. If you have used ResOrg 1.x before, you will notice that the user…

  • ResOrg 2.0 has been released

    It’s done. After a rather extended incubation period ResOrg 2.0.0.15 (the first public ResOrg 2.0 build) was uploaded earlier this morning, and the ResOrg product pages updated to match. If you have used ResOrg 1.x before, you will notice that the user…

  • Ethernet not working on Ubuntu with Realtek RTL8111/8168B

    Thanks to rvdavid, the network on my new PC is now working, despite Ubuntu misrecognising it: How to Get Gigabit Speeds from RTL8111/8168B PCI Express Gigabit Ethernet controller on Ubuntu Linux. This is the kind of thing I had to do 10 years ago. I th…

  • FreeGuide usage stats

    A long time ago I mentioned I’d added some (opt-in) usage tracking for FreeGuide. Here are the latest stats. I think they’ve held up pretty well given how much I’ve neglected the project…

  • Visual Lint and Atmel AVR Studio 5

    From our perspective one of the more intriguing embedded environments to appear recently is Atmel’s AVR Studio 5. When I first saw a screenshot of this IDE (it was mentioned in a post in the CodeProject Lounge) it was immediately obvious that this was …

  • Visual Lint and Atmel AVR Studio 5

    From our perspective one of the more intriguing embedded environments to appear recently is Atmel’s AVR Studio 5. When I first saw a screenshot of this IDE (it was mentioned in a post in the CodeProject Lounge) it was immediately obvious that this was …

  • Entertain your baby using your Android phone

    Last night my friend and I uploaded the first version of Baby Distraction, an Android app featuring charming cartoon animals, vibration and sounds. I helped almost exclusively in an advisory capacity, but still am inexplicably proud of the result: it’s…

  • rdesktop swallows keyboard events

    The Linux remote desktop client rdesktop grabs all keyboard events by default, which is good, because it allows e.g. you to Alt-Tab between applications and Ctrl-Alt-Del as if you were in front of the remote machine. However, it is also bad because you…

  • Reclaiming desktop space with Ubuntu’s window-picker-applet

    For a long time I’ve customised GNOME to have a vertical task bar on the left and launcher buttons across the top. I’ve struggled with a long-standing bug with using a vertical panel, and I’ve sacrificed quite a lot of screen space to make enough room …

  • My Address Book 1.9.0 – rewritten from scratch

    Ordinarily, my motivations for doing open source work are clear: peer recognition and the satisfaction of knowing people are using my work. However, I’ve been distracted from that stuff recently because of my desire to scratch my own itch, by re-writin…

  • Switching workspace in GNOME via the command line

    I use rdesktop to connect to some Windows machines, and it works beautifully. I like to allow it to grab keyboard input so I can switch and close windows on my Windows desktop without fear of accidentally doing something to the rest of my Linux desktop…

  • Anatomy of an interpreter: the Evaluator

    Posts in this series: Lexer, Parser, Evaluator I’m still really enjoying writing my Scheme interpreter Subs, which can now succesfully run all the example code from SICP up to section 2.3.4. I’ve made the changes I mentioned I would in the Lexer articl…

  • How to ask technical questions in person

    In a healthy team performing a technical task, there will be a lot of questions. Those questions will sometimes be asked by those with less technical knowledge, but (in a healthy team) there will be plenty of questions going back the other way too. Que…

  • Anatomy of an interpreter: the Parser

    Posts in this series: Lexer, Parser, Evaluator Subs has reached version 1.3.4, which means that it can successfully run all the tests from chapter 1 of SICP. This is very exciting. Last time I explained a bit about the Lexer, which takes in a stream of…

  • Anatomy of an interpreter: the Lexer

    Posts in this series: Lexer, Parser, Evaluator I have been having a lot of fun recently writing my Scheme interpreter Subs. I have never implemented a full programming language before, so I am learning fast (mostly through mistakes) and wanted to write…

  • Subs Scheme Lisp Interpreter

    Why would you write a Lisp interpreter? I find that question difficult to answer, but the joy of open source is that I don’t have to answer it. Subs is a Scheme interpreter written in C++, and growing out of the excitement I have felt while reading Str…

  • Scalable Graph Coverage

    If you’re interested in dealing with large directed graphs of dependent objects and want some tips on how to process them in a way that scales in terms of memory usage, you may be interested in the article I wrote for Overload, which is a journal of th…

  • Ubuntu Lucid upgrade – a catalogue of disaster and pain

    I recently upgraded 3 machines to Lucid. I don’t recommend it. Broken after upgrade 2 out of 3 machines did not boot after upgrade to Lucid. One, an upgrade from Hardy, crashed hard during the upgrade (the screen was frozen with a prompt about lmsensor…

  • FreeGuide 0.10.11

    I’ve made a new release of FreeGuide today, which contains minor bug fixes. I changed the stability rating on sourceforge to “Production/Stable” (previously it was “Alpha”). Maybe I should bump the version number next time to 1.0. Certainly all this 0….

  • Don’t design for performance until it’s too late

    There is a piece of ancient wisdom which states: Premature optimisation is the root of all evil This ancient wisdom is, like all ancient wisdom, correct. However. It appears to have been reinterpreted as essentially meaning: Don’t design for perform…

  • Technorati appear to have broken openid delegation

    I have just changed to myopenid and can delegate to them from my own openid URL by following the instructions here: https://www.myopenid.com/help#own_domain. Google don’t appear to let you delegate to them (i.e. have your own url). I’m really glad I ch…

  • NNDB 0.1

    I’ve managed to get NNDB, my C++ data storage library which is almost, but not entirely unlike SQL, into a fit state for a release. You can create tables, set indices on columns, insert data, retrieve data using something like a SELECT, filter it using…

  • NNDB’s Not a Database

    My latest project is called NNDB. I’ve worked with databases for quite a long time now, and for a while I’ve been thinking about how they work under the hood. I know very little about it, but I thought I could learn a bit by trying to implement somethi…

  • Diffident 0.3

    My original plan for Diffident, the side-by-side diff viewer and editor that works in a terminal, was to implement basic editing capabilities before making another release. Of course, that turned out to be quite ambitious. It involves essentially imple…

  • CBeebies and other channels not working with mplayer

    It turns out the scan command from the linuxtv-dvb-apps package (on Ubuntu Hardy Heron, anyway) isn’t writing the correct channels.conf, and this makes some channels not work for me, including CBeebies, CBBC Channel and CITV. The fix is to do as this p…

  • Firefox keyword search for finding C++ keywords

    I often want to search the SGI C++ reference for a keyword. The best way I have found to jump straight to the page I want is to use Google’s “I’m Feeling Lucky” search limited to searching within sgi.com. You can create a Firefox keyword search to allo…

  • Flaws in the software patents system

    Note: I am in favour of patents on inventions. I believe the current software patents system has a number of flaws (in decreasing order of importance to me): They attempt to close off the use of knowledge rather than open it up. If we were not filing …

  • IGCC – a real-eval-print loop for C/C++

    When you first hear about the Read-Eval-Print Loop you might well think “So what?” as I did. What’s so great about being able to type commands interactively? But the thing is that it creeps up on you. Everyone already knows programming is an interactiv…

  • Diffident – command line side-by-side diff editor

    I really like Beyond Compare, which is a proprietary diff program with all those little touches that make it a joy to use*. The way I write code at work generally involves a bit of hacking in jEdit, checking the code myself, and then reviewing the code…

  • Random background in GNOME

    I’ve written a little script to show a different random background in GNOME every day, by looking inside your Photos directory. It will rotate them to be the right way up, if you have exiftran installed. Get it here: Random Background.

  • Analog literals

    I love this: C++ Multi-Dimensional Analog Literals. I quote: Have you ever felt that integer literals like “4” don’t convey the true size of the value they denote? If so, use an analog integer literal instead:unsigned int b = I———I; It goes on …

  • Separate regular expressions, or one more complex one?

    I have asked myself this question several times, so I thought it was about time I did a test and found an answer. If the user of your program can supply you with a list of regular expressions to match against some text, should you combine those express…

  • New Baby

    Finally the number of people in our family is prime again. Mum, baby, siblings etc. are all really well and enjoying ourselves.

  • Talk in code

    Last week we had an extended discussion at work about how we were going to implement a specific feature. This discussion hijacked our entire Scrum sprint planning meeting (yes, I know, we should have time-boxed it). It was painful, but the guy who was …

  • Fixing the vertical panel window list on Ubuntu Hardy

    For a long time now I’ve been bugged by GNOME Bug 86382. Recent versions of GNOME have featured a window list applet which behaves badly when situated on a vertical panel (which is where I like to have mine). Older versions were ok except the buttons w…

  • An actual difficult bug fixed

    Of course, I am bound to get a bug report immediately I have posted this telling me my fix breaks everything, but for the moment I am chuffed that I found, tested, and fixed a genuinely difficult bug. I am particularly proud because I wrote an automate…

  • FreeGuide 0.10.9

    So let’s quietly forget FreeGuide 0.10.8, which basically didn’t work. I fixed the problem (which was some nasty threading thing) by making the initial “Choose Channels for XMLTV” call from the first time wizard not do the clever stuff of displaying er…

  • Wii repaired free!

    A few weeks ago my Nintendo Wii started not accepting any Wii disks (but was still fine for GameCube ones… interesting). It made a clicking noise for a bit and then declared “Bad Disk” or something like that. I need my Wii. I watch all my TV through …

  • Another one

    Due in March. Very excited.

  • FreeGuide 0.10.8

    I am still working slowly on moving FreeGuide forward. Somehow it seems my itches for FreeGuide are all about making it less annoying for people who are trying it the first time. I guess this is motivated by my desire for world domination. Anyway, we a…

  • Debugging memory use and fragmentation on Windows using Address Space Monitor

    At work at the moment we are putting a lot of effort into making our program not crash. Sensible, eh? It’s crashing because a) it uses an enormous amount of memory and b) it tends to fragment your remaining memory. One of the characteristics of this pr…

  • C++ is an expert language

    Update: I should point out at the beginning that I love C++. Anything below which sounds bitter or critical is borne of a deep and growing love. C++ is a journey into worlds of beauty and strength. I assert that C++ is an expert language. What do I mea…

  • Templated test code?

    At work at the moment, as part of an initiative to get with the 21st century, we are waking up to testing our code. Thus, I am writing a lot of unit tests for old code, which can be soul-destroyingly repetitive and very pointless-feeling (even though r…

  • Public bzr branch of FreeGuide

    On the subject of distributed source code management, Dan Watkins has just informed me that the launchpad team have created a bazaar branch of FreeGuide’s code, so if you’re into that kind of thing, you can download the code from that instead of our ce…

  • Public git repo for GSSMP

    Git is supposed to work when you upload your repository to an http server, but in reality, no-one except me seems to use it, and it’s nothing like as useful as having a proper repository that people can commit to etc. So, here it is: http://repo.or.cz/…

  • Finally released last.fm support for GSSMP

    There was a weird bug in my last.fm support for GSSMP, where it would crash when run from the GNOME panel, but be fine when run from a terminal. After two bugs fixes from Charles Bailey, the problem seems to have gone away, so I’ve finally been able to…

  • lighttpd on Ubuntu – alias.url doesn’t work when included in a module config file

    I’ve decided to use lighttpd on my new machine (which was generously given to me and features a 700GB raid array). My main reason for choosing lighttpd was the FLV streaming plugin for it that will make my Wii TV viewing experience a lot better. (It wo…

  • FreeGuide updated to latest XMLTV, and bug fixes

    Check out a release candidate here: http://freeguide-tv.sourceforge.net/rc/ . So far I’ve only uploaded an RPM, but hopefully there’ll be a Windows exe and some other packages soon. Update: Windows installer now uploaded too. Test it! It’s got better c…

  • duckmaze 0.2

    I’ve finally released to the world the secret extra duckmaze levels. They’re contained in the 0.2 release, which is also faster, and doesn’t freeze time. (As far as I know.) It’s got 18 levels, and a level editor, which means you can make more. Do it….

  • Caution: numbers that feel prime may be divisible by 3

    Caution: numbers that feel prime may be divisible by 3. For example, 51 and 57. Conversely, numbers that feel divisible by 3 may be prime. For example, 61, 89 and 97. Nominations for least prime-feeling numbers that actually are prime: 89 and 101. Nomi…

  • Announcing Record TV

    Last night I uploaded the first public version of my latest project, Record TV. Record TV is a system for recording TV (on a Linux desktop computer) that is designed to allow lots of different user interfaces all to use the same back end. It is current…

  • FreeGuide 0.10.5

    After over a year, and several U-turns, the next version of FreeGuide is out. I was dead-set on getting recording functionality into it, and when some students turned up asking to help, I directed them towards doing that. They produced a reasonable fra…

  • FreeGuide SVN now useable

    Why not try the latest SVN version of FreeGuide, which contains lots of bug fixes over 0.10.4? There are detailed instructions on how to Build FreeGuide from SVN, and do ask on the developers’ list if you have problems. I’ve fixed the horrible bug that…

  • Heartfelt apologies for the feed URL change

    Sorry, sorry, sorry, sorry. I decided to change to wordpress’ pretty-URLs mode, and it changed the feed URL, which I was not expecting, and which I think is fundamentally borken.

  • FreeGuide – putting recording on hold

    FreeGuide has been stalled for about a year because the basic code for recording programmes has been sitting in SVN, but it contained far too many bugs to be useable, even by the developers. This kind of situation completely takes the wind out of devel…

  • New Baby arrived safely

    I won’t waste too much of your time, but here she is: She’s excellent, and mum is doing really well. Big brother appears to be a little bothered, but presumably that will pass.

  • (Badly wrong) usage statistics for FreeGuide

    A long time ago I added functionality to FreeGuide so people could opt to report their use of FreeGuide to under a username, or anonymously. This all happens as part of the latest version check, and you can turn it off, obviously. Quite a long time ago…

  • Procmail Maildir messages disappearing

    Google-friendly title, no? Executive summary: In your ~/.procmailrc MAILDIR=$HOME/Maildir – is BAD, whereas MAILDIR=$HOME/Maildir/ – is good. The slash at the end appears to tell procmail that this is a Maildir directory, rather than something else, el…

  • last.fm in GSSMP

    Obviously I should have gone to bed, but I’ve got last.fm support working in GSSMP. It’s in the git repo, and I should get a release out as soon as I’ve written a little bit of documentation.

  • lastfmsubmitd on Ubuntu Dapper

    So I had been thinking about putting last.fm support into GSSMP, and then I got an email to the mailing list suggesting it, and then I couldn’t sleep tonight, and, as ever, something that sounded easy has turned into a saga. I decided to use lastfmsubm…

  • Obviously, there was a bug

    So I’ve released GSSMP 1.1, which is guaranteed to contain one fewer bugs, and is relatively unlikely to contain any new ones. Also, thanks to João Pinto, it should build without warnings on AMD64 too! If anyone wants to make an AMD64 package, I’d be …

  • Watching TV: a simpler way

    MPlayer is a black art. GMPlayer, doubly so. It turns out this does the job much better than my previous hacks: #!/bin/bash gmplayer -cache 2048 -zoom “dvb://$1” It’s still not perfect for radio over digital TV, though – you get an empty window where t…

  • GSSMP 1.0

    Get it here: http://gssmp.sourceforge.net. This is the first time I’ve declared one of my projects stable, and given it a 1.0 version number. Prove me wrong by downloading it and breaking it. Enjoy. Now I must dash – I’ve just got to finish off my othe…

  • Choose channel dialog

    Following on from the last post about how I got my TV card working, here is a little script I wrote that allows me to choose a channel and start watching. It uses zenity for a rudimentary GUI: $ cat bin/tv_choose_channel #!/bin/bash awk -F ‘:’ ‘{print …

  • Digital TV on Dapper with my Hauppauge WinTV Nova-T card

    My card reports itself like this: $ lspci *snip* 0000:00:0a.0 Multimedia controller: Philips Semiconductors SAA7146 (rev 01) *snip Everything seemed to work out of the box: $ dmesg | grep DVB -A 0 -B 3 [17179585.872000] saa7146: register extension ‘bud…

  • Restoring a backup with Duplicity

    See the last post for how I back up my important files to a remote server. To restore them I do this: duplicity –file-to-restore path/to/file.txt scp://user@example.com//home/example/bkp/home/andy/Maildir file.txt and enter the passphrase when pro…

  • Remote encrypted backup with duplicity

    My father-in-law’s hard drive died the other day and I was just able to recover the data using Knoppix and my iRiver. Since I recently discovered a superb program that lets me create encrypted backups on a remote server over ssh, I thought I’d spread t…

  • GSSMP goes beta

    I’ve just released version 0.9 of GSSMP, and since I’ve fixed all the bugs I know about (except working around a gstreamer bug, which I will try to do before 1.0), I’ve marked this release as beta. This is the second project I’ve marked as beta, and I …

  • Recording in FreeGuide

    If you download the nightly builds of FreeGuide, you can try out the new recording functionality. There is quite a bit to do before this is ready for release. There are several bugs in the TODO list and you have to create your own scripts at the moment…

  • My daily backup

    I recently recovered my files from my daily backup, which had actually worked! (Pop quiz: this is how I deleted half my home dir – what is wrong with this Makefile? TMP_DIR=/tmp/gssmp blah: blah1 blah … blah7: … rm -rf $TMPDIR/ … …

  • Creating .deb and RPM packages

    Since I’ve managed to get it to work for GSSMP, I thought I might share how I am generating .deb and RPM packages using a Makefile. These make it much easier for Ubuntu and Fedora Linux users (respectively) to install the program. It should also be hel…

  • Moved to WordPress

    I’ve moved my blog to WordPress, which will allows you to comment on my posts. I guess it’s a sad day for DIYBlog, but hey, it was just a workaround until I got some web space that supported PHP. Happy interaction!

  • Two new babies

    I have 2 new babies to tell you about: Gnome Simple Stateful Music Player which is a music player that just stays out of your face, playing music off your hard drive without making a database or anything like that. It uses GNOME/GTK, GConf and gstream…

  • New games!

    I’ve been really enjoying the GP2X I got for our 5-year anniversary (!) and have got DVD ripping working, along with Quake playing at a decent speed, and lots of downloadable games, notably Spout, which is excellent, and (unlike many games which are re…

  • Linux Journal – Forgiveness

    Dear LJ, A few months ago I wrote to you saying we had to break up – you had become too chatty and opinion-filled for my taste. I have to admit that it turns out I was bluffing. I love you too much, and today I renewed my subscription. You did take a s…

  • Another FreeGuide release candidate

    I screwed up the RPM, so if you tried that, try the latest one from here: freeguide-tv.sf.net/rc

  • FreeGuide 0.10.4 release candidate

    Lots and lots of bug fixes, and some cool features sneaked in by people who obviously didn’t read my TODO list 😉 means that FreeGuide 0.10.4 is nearly ready. You can test it by downloading the relevant installer from freeguide-tv.sf.net/rc. I’ve put u…

  • A Quick and desperate introduction to data recovery

    No, I did not just develop a passing interest in data recovery as a leisure activity. Presumably like everyone else, I learnt about it because it was necessary. A year or two ago my friend’s computer was packing up, and he asked me to extract and store…

  • FreeGuide fan mail

    Really encouraged to receive this: Hello Mr Balaam, A quick email to thank you for giving the world the brilliant Freeguide. (I saw in your blog that you have a high volume of email – no reply needed). I tried Digiguide for a while, loved the principle…

  • Over-engineering gone mad

    Picture the scene: you are writing a Java application and you’re trying to do things right, so you use the java.util.logging code to do your logging. To create a logger you do this: Logger log = Logger.getLogger( “name” ); Everything goes fine until yo…

  • Keyboard layout change in Ubuntu

    I’ve had this problem a couple of times in my Ubuntu machine. I installed it with US keyboard layout, and then changed it to UK later (for my user). Even when I select the correct keyboard model (Generic 105-key (Intl) PC), and layout (United Kingdom I…