ACCU World of Code

  • HikingMaps for Tizen

    HikingMaps is now also available in the Tizen Store for Tizen 3.

  • HikingMaps for Tizen

    HikingMaps is now also available in the Tizen Store for Tizen 3.

  • Women Who Code workshop on “Write your own programming language”

    On Wednesday 28th June 2017 a group of people from OpenMarket went to the Fora office space in Clerkenwell, London to run a workshop with the Women Who Code group, who work to help women achieve their career goals. OpenMarket provided the workshop “Wri…

  • Tell, don’t ask

    More than twelve years ago Tim Joyce passed on some programming wisdom: With programs tell don’t ask, vice versa for people. This was a bit abstract for me at the time but last night it came back to me as what is wrong with the code I am currently …

  • Tell, don’t ask

    More than twelve years ago Tim Joyce passed on some programming wisdom: With programs tell don’t ask, vice versa for people. This was a bit abstract for me at the time but last night it came back to me as what is wrong with the code I am currently …

  • Running a virtualenv with a custom-built Python

    For my attempt to improve the asyncio.as_completed Python standard library function I needed to build a local copy of cpython (the Python interpreter). To test it, I needed the aiohttp module, which is not part of the standard library, so the easiest w…

  • Adding a concurrency limit to Python’s asyncio.as_completed

    Series: asyncio basics, large numbers in parallel, parallel HTTP requests, adding to stdlib In the previous post I demonstrated how the limited_as_completed method allows us to run a very large number of tasks using concurrency, but limiting the number…

  • “git what” is “git status” on steroids

    For when git status is not enough, I wrote git what: If you often have a few branches on the go, it could be useful.

  • Pride Vibes 2017: Coventry Pride

    Laura Tapp performs on Saturday evening at Coventry PridePride Vibes: As a photographer for Gay Pride Pics, I see lots of Prides across the UK every year. Each Pride has a different feel. This series will describe what each Pride was like and what the …

  • Making 100 million requests with Python aiohttp

    Series: asyncio basics, large numbers in parallel, parallel HTTP requests, adding to stdlib Update: slides of a talk I gave at the London Python Meetup on this: Talk slides: Making 100 million HTTP requests with Python aiohttp. Update: see how Cristian…

  • Python – printing UTC dates in ISO8601 format with time zone

    By default, when you make a UTC date from a Unix timestamp in Python and print it in ISO format, it has no time zone: $ python3 >>> from datetime import datetime >>> datetime.utcfromtimestamp(1496998804).isoformat() ‘2017-06-09T09:00:…

  • Pride Vibes 2017: Birmingham Pride

    Marching in Birmingham’s ParadePride Vibes: As a photographer for Gay Pride Pics, I see lots of Prides across the UK every year. Each Pride has a different feel. This series will describe what each Pride was like and what the vibe of the pride was like…

  • Berkhamsted to Tring Walk

    Went for a walk from Berkhamsted to Tring, see GPS data and some pictures: here, here and here.

  • Berkhamsted to Tring Walk

    Went for a walk from Berkhamsted to Tring, see GPS data and some pictures: here, here and here.

  • Galloway Camping Holiday

    Been to Galloway for a few days of (wild) camping (around Loch Dee, Loch Trool, Merrick, Loch Finlas, Loch Doon). Also stopped in Carlisle before returning back to London. See my digital photo album for a few pictures.

  • Galloway Camping Holiday

    Been to Galloway for a few days of (wild) camping (around Loch Dee, Loch Trool, Merrick, Loch Finlas, Loch Doon). Also stopped in Carlisle before returning back to London. See my digital photo album for a few pictures.

  • Python 3 – large numbers of tasks with limited concurrency

    Series: asyncio basics, large numbers in parallel, parallel HTTP requests, adding to stdlib I am interested in running large numbers of tasks in parallel, so I need something like asyncio.as_completed, but taking an iterable instead of a list, and with…

  • Basic ideas of Python 3 asyncio concurrency

    Series: asyncio basics, large numbers in parallel, parallel HTTP requests, adding to stdlib Update: see the Python Async Basics video on this topic. Python 3’s asyncio module and the async and await keywords combine to allow us to do cooperative concur…

  • Cotswolds Walk

    Went for a walk in the Cotswolds from Kingham to Moreton-in-Marsh, see GPS data and some pictures: part 1, part 2, part 3, part 4, and part 5.

  • Cotswolds Walk

    Went for a walk in the Cotswolds from Kingham to Moreton-in-Marsh, see GPS data and some pictures: part 1, part 2, part 3, part 4, and part 5.

  • C++ iterator wrapping a stream not 1-1

    Series: Iterator, Iterator Wrapper, Non-1-1 Wrapper Sometimes we want to write an iterator that consumes items from some underlying iterator but produces its own items slower than the items it consumes, like this: ColonSep items(“aa:foo::x”); // Prints…

  • How to write a programming language ACCU talk

    My talk from ACCU Conference 2017 where I describe a tiny programming language I wrote: Slides: How to write a programming language Cell source code: github.com/andybalaam/cell

  • C++ iterator wrapper/adaptor example

    Series: Iterator, Iterator Wrapper, Non-1-1 Wrapper If you want to wrap an iterable range with another that transforms the underlying iterators in some way and allows looping or constructing other objects: for (auto ch : Upper(“abcdef”)) { // Print…

  • C++ iterator example (and an iterable range)

    Series: Iterator, Iterator Wrapper, Non-1-1 Wrapper To make your own iterable range in C++ that you can loop over or make a vector out of (mine is called Numbers): // Prints: // 3,4, for (auto n : Numbers(3, 5)) { std::cout << n << “,”;…

  • Make Android Gradle display unit test failure messages

    By default, Gradle does not show you what happened when a unit test failed: $ ./gradlew test … MyTest > Black_is_white FAILED org.junit.ComparisonFailure at MyTest.java:6 ^^^ WHAT ACTUALLY FAILED???? … This is insane, and can be fixed (t…

  • ACCU C++ Countdown Pub Quiz

    The ACCU conference is one of the highlights of my year. I ran a brand new session, a C++ Pub Quiz with an emphasis on fun and interaction, based loosely on the popular UK TV game show Countdown. In the TV version, contestants play individually …

  • ACCU C++ Countdown Pub Quiz

    The ACCU conference is one of the highlights of my year. I ran a brand new session, a C++ Pub Quiz with an emphasis on fun and interaction, based loosely on the popular UK TV game show Countdown. In the TV version, contestants play individually …

  • Planet Code updates

    I maintain an unofficial aggregator of blogs by people who are involved with ACCU and things they might be interested in. It’s called Planet Code. Today I made it look slightly less ugly, and added several new blogs after attending the excellent ACCU C…

  • A story about magic and how we treat each other

    For a lightning talk at the ACCU Conference I wrote a little story: A story about magic and how we treat each other It describes one person’s journey towards realising that we need to act to be kind to each other, and not to expect it to happen automat…

  • Docker in Action

    is an excellent book by Jeff Nickoloff. As usual I’m going to quote from a few pages. The docker stop command tells the program with PID #1 in the container to halt. Like most Docker isolation features, you can optionally create containers …

  • Docker in Action

    is an excellent book by Jeff Nickoloff. As usual I’m going to quote from a few pages. The docker stop command tells the program with PID #1 in the container to halt. Like most Docker isolation features, you can optionally create containers …

  • Siddhartha

    is an excellent book by Herman Hesse. As usual I’m going to quote from a few pages. He learned more from the river than Vasudeva could teach him. He learned from it continually. Above all, he learned from it how to listen, to listen with a st…

  • Siddhartha

    is an excellent book by Herman Hesse. As usual I’m going to quote from a few pages. He learned more from the river than Vasudeva could teach him. He learned from it continually. Above all, he learned from it how to listen, to listen with a st…

  • The Hidden Life of Trees

    is an excellent book by Peter Wohlleben (isbn 1771642483). As usual I’m going to quote from a few pages. In forked trees, at a certain point, two main shoots form, they continue to grow alongside each other. Each side of the fork creates it…

  • The Hidden Life of Trees

    is an excellent book by Peter Wohlleben (isbn 1771642483). As usual I’m going to quote from a few pages. In forked trees, at a certain point, two main shoots form, they continue to grow alongside each other. Each side of the fork creates it…

  • Annual cost of clean water for every human

    According to a 2010 WHO-backed study the cost of safe water for every human would be about 10 billion US dollars per year. The UK government revenue for 2010-2011 was about 639 billion US dollars. I would vote for a political party proposing to raise …

  • Iterating over the lines of a file in Java

    If you’re trying to write a standard command-line tool in Java you are going to experience pain. In Python, if we want to do something with each line on input to your program, we can do something like: import sys for ln in sys.stdin: print(ln) # (…

  • the DevOps Handbook

    is an excellent book by Gene Kim, Jez Humble, Patrick Debois, and John Willis (isbn 978-1-942788-00-3). As usual I’m going to quote from a few pages. Make infrastructure easier to rebuild than to repair. The average age of a Netflix AWS ins…

  • the DevOps Handbook

    is an excellent book by Gene Kim, Jez Humble, Patrick Debois, and John Willis (isbn 978-1-942788-00-3). As usual I’m going to quote from a few pages. Make infrastructure easier to rebuild than to repair. The average age of a Netflix AWS ins…

  • Raspberry Pi Jam “Chaos Car!”

    Raspberry Pi 1 + battery pack + Bluetooth USB dongle + i-racer bluetooth car + Raspberry Pi camera + some Python code + loads of sellotape = Chaos car! Here’s the code: #!/usr/bin/env python2 import os import random import bluetooth import sys import…

  • Catch Up

    It’s been just over six years since I first announced Catch to the world as a brand new C++ test framework! In that time it has matured to the point that it can take on the heavyweights – while still staying true to its original goals of being light…

  • Catch Up

    It’s been just over six years since I first announced Catch to the world as a brand new C++ test framework! In that time it has matured to the point that it can take on the heavyweights – while still staying true to its original goals of being light…

  • NDC Does C++ Countdown!

    It was my pleasure to run a small workshop style session at the excellent NDC-London conference. I ran a fun C++ game which parodies the popular UK TV gameshow Countdown. In the TV version contestants take turns picking 9 random vowels/consonants…

  • NDC Does C++ Countdown!

    It was my pleasure to run a small workshop style session at the excellent NDC-London conference. I ran a fun C++ game which parodies the popular UK TV gameshow Countdown. In the TV version contestants take turns picking 9 random vowels/consonants…

  • Automated UI tests on Android

    I recently fought the Android emulator a lot to get my UI tests to run automatically during the build of Rabbit Escape, so I thought I’d better write down what I did before I forget. I already have tests that drive the Android UI (see e.g. SmokeTest.ja…

  • Submitting a package to F-Droid

    Here’s what I needed to get a dev environment for F-Droid up and running on Ubuntu 16.10, using F-Droid server version 0.7.0 (commit id 8147f9235), so that I could submit a package for inclusion in the F-Droid repository. Doing this is apparently the b…

  • Resources for year 6 teachers on coding and programming

    I have been introducing some year 6 (UK) teachers to coding by showing them how to lay out a simple web page by writing HTML. I promised I would find some links to resources for them, so here it is: HTML and JavaScript My examples of how to write HTML …

  • Debugging AWS Lambda functions locally using VS Code and lambda-local

    I’ve just started using AWS Lambda with node.js. I was able to develop these locally using the lambda-local npm package, e.g. with node.js installed (via brew) and lambda-local installed (using npm) then the following “hello, world” example i…

  • Debugging AWS Lambda functions locally using VS Code and lambda-local

    I’ve just started using AWS Lambda with node.js. I was able to develop these locally using the lambda-local npm package, e.g. with node.js installed (via brew) and lambda-local installed (using npm) then the following “hello, world” example i…

  • Setting up a sane Maven project

    Today I have spent hours trying to get wrangle Maven into letting me set up a sane Java project. The hardest parts were enforcing warnings-as-errors, and getting Maven to shut up a bit. Some code that warns My first problem was writing some Java code t…

  • the design and implementation of cyber-dojo

    At the excellent Agile on the Beach conference in Cornwall I did a presentation outlining some of the history, design and implementation of cyber-dojo. The video has just gone live on youtube.

  • the design and implementation of cyber-dojo

    At the excellent Agile on the Beach conference in Cornwall I did a presentation outlining some of the history, design and implementation of cyber-dojo. The video has just gone live on youtube.

  • Writing a unit test in Elm

    Series: Snake in Elm, Elm makes me happy, Elm Basics, Elm Unit Test, Elm JSON I’ve been having fun with Elm programming recently. Elm is a replacement for JavaScript that is pure functional and highly practical. Here’s how to go from nothing installed …

  • Speaking: ADC 2016

    I’ll be speaking at ADC 2016 (Audio Developer Conference), the successor to 2015’s JUCE Summit in London on the 4th November. My talk is called The Golden Rules of audio programming (and how to break them). The synopsis is: Audio programming req…

  • Speaking: ADC 2016

    I’ll be speaking at ADC 2016 (Audio Developer Conference), the successor to 2015’s JUCE Summit in London on the 4th November. My talk is called The Golden Rules of audio programming (and how to break them). The synopsis is: Audio programming req…

  • Continuous Delivery

    Is an excellent book by Jez Humble and Dave Farley. As usual I’m going to quote from a few pages… Software delivers no value until it is in the hands of its users. The pattern that is central to this book is the deployment pipeline. It sho…

  • Continuous Delivery

    Is an excellent book by Jez Humble and Dave Farley. As usual I’m going to quote from a few pages… Software delivers no value until it is in the hands of its users. The pattern that is central to this book is the deployment pipeline. It sho…

  • Building Microservices

    Is an excellent book by Sam Newman. As usual I’m going to quote from a few pages… Because microservices are primarily modeled around business domains, they avoid the problems of traditional tiered architectures. Microservices should cleanl…

  • Building Microservices

    Is an excellent book by Sam Newman. As usual I’m going to quote from a few pages… Because microservices are primarily modeled around business domains, they avoid the problems of traditional tiered architectures. Microservices should cleanl…

  • How to write a programming language – Part 3, The Evaluator

    Series: Lexer, Parser, Evaluator. Finally, we get onto the actual magic of the little language I wrote (Cell) – the evaluator, which takes in syntax trees and finds their real value, in the context of the “environment”: the symbols that are defined aro…

  • Basic Haskell project setup (unit tests, code, formatting)

    To start a programming project, we need to be able to build, format code, and run unit tests. Here’s what I have found makes a sensible starting point for a Haskell project. Full code: hunit-example. To build and run tests, just do:make setup make test…

  • How to write a programming language – Part 2, The Parser

    Series: Lexer, Parser, Evaluator My little programming language, Cell (Cell Elementary Learning Language) is designed to be simple. I want to use it to explain how to write a programming language. The parser is only 81 lines long, so hopefully it’s not…

  • Mousedown events delayed or sluggish on mobile

    I am learning about Elm and web apps by writing a little game called sootl. It’s all SVGs animated with requestAnimationFrame(), and you control your player by clicking or touch the screen. Everything seemed good on desktop browsers, but on mobile it t…

  • How to write a programming language – Part 1, The Lexer

    Series: Lexer, Parser, Evaluator I wrote a little programming language, Cell which is supposed to be simple enough to help explain how a programming language works. Here’s the explanation of the lexer, which is the first part of a compiler or interpret…

  • Simple example of Netty 4 usage

    I feel the title of this post over-promises, since I was not able to make an example that seemed simple to me. Anyway, here is a near-minimal example of how to use Netty to make a server that shouts back at you whatever you say: NettyExample.java:impor…

  • Interview: Make Software Better Magazine

    Fog Creek’s Make Software Better Magazine (Volume 1) includes an interview with me called “Go Beyond Code to Become a Better Programmer”.” You can download it for free from https://blog.fogcreek.com/make-better-software-magazine/. …

  • Interview: Make Software Better Magazine

    Fog Creek’s Make Software Better Magazine (Volume 1) includes an interview with me called “Go Beyond Code to Become a Better Programmer”.” You can download it for free from https://blog.fogcreek.com/make-better-software-magazine/. …

  • Elm resizeable SVG canvas filling the screen

    I am toying with writing an SVG-based game in (exciting-looking JavaScript-replacement) Elm, and I wanted an SVG that filled the whole screen and resized when the screen resized. I found it harder than I expected, so here is what I came up with for you…

  • Ambiguous names in Java due to non-normalised unicode – but all OK in Python

    In Java and several other languages, identifiers (e.g. method names) are allowed to contain unicode characters. Unfortunately, some combinations of unicode characters are logically identical. For example, á (one character: Latin Small Letter a with Ac…

  • Gracefully shutting down Firefox, to avoid the crash/session dialog

    I normally have several Firefox profiles open, and when I log out without closing the Firefox windows I get the “session restore” dialog on my next login. This is because of Bug 336193 which says that Firefox should shut down gracefully when it receive…

  • Snake in Python 3 + Qt 5

    Series: Groovy, Ruby, BASIC, Dart, Elm, Python3+Qt5 I’m writing the game Snake in lots of programming languages, for fun, and to try out new languages. Python 3 broke compatibility to fix some mistakes – was it worth it? Qt 5 continues to offer more an…

  • ACCU Conference 2016

    In late April we exhibited at the ACCU Conference (#accuconf), which in many ways is our conference home. The first time we went was all the way back in 2007, and believe it or not we’ve not missed a single year since then. The conference is a great ev…

  • ACCU Conference 2016

    In late April we exhibited at the ACCU Conference (#accuconf), which in many ways is our conference home. The first time we went was all the way back in 2007, and believe it or not we’ve not missed a single year since then. The conference is a great ev…

  • Writing; C Vu Magazine Columns (for January/March/May)

    Spectacularly late, but I ought to keep the records up to date: My January 2016 C Vu magazine column was Bug Hunting (Part 2), concluding my series on finding and fixing software faults. My March 2016 column was Software Development Is…, an investi…

  • Writing; C Vu Magazine Columns (for January/March/May)

    Spectacularly late, but I ought to keep the records up to date: My January 2016 C Vu magazine column was Bug Hunting (Part 2), concluding my series on finding and fixing software faults. My March 2016 column was Software Development Is…, an investi…

  • Basic Concepts of Christianity video

    Update: my ideas have changed quite a bit since I recorded this, especially about the idea that “every crime requires a punishment”. If you’d like to explore more, try this sermon by my friend Jörg. As a Christian myself I thought it might be interest…

  • Elm Basics Video

    Series: Snake in Elm, Elm makes me happy, Elm Basics, Elm Unit Test, Elm JSON A lot of the documentation about the new language I am really excited about, Elm focusses on the Elm Architecture and the ideas of Functional Reactive Programming, and while …

  • Speaking: Nordevcon

    I’ll be speaking on Friday at Nordevcon in Norwich. I’ll be giving  my Becoming a Better Programmer talk, and it should be great fun. Nordevcon has a strong line up this year, so it looks to be a great conference.

  • Speaking: Nordevcon

    I’ll be speaking on Friday at Nordevcon in Norwich. I’ll be giving  my Becoming a Better Programmer talk, and it should be great fun. Nordevcon has a strong line up this year, so it looks to be a great conference.

  • How to analyse a .phd heap dump from an IBM JVM

    If you have been handed a .phd file which is a dump of the heap of an IBM Java virtual machine, you can analyse it using the Eclipse Memory Analyzer Tool (MAT), but you must install the IBM Monitoring and Diagnostic Tools first. Download MAT from eclip…

  • Elm makes me happy (old: Elm 0.17)

    Updated version: Elm makes me happy (updated for Elm 0.19) Elm lets you write interactive web sites in a really clean and safe-feeling way, which is a contrast to the feeling I get when using JavaScript and HTML. It’s functional, but instead of that ma…

  • Swift’s defer statement is funkier than I thought

    Swift 2.0 introduced the defer keyword. I’ve used this a little but only in a simple way, basically when I wanted to make sure some code would be executed regardless of where control left the function, e.g. private func resetAfterError() throws { &…

  • Swift’s defer statement is funkier than I thought

    Swift 2.0 introduced the defer keyword. I’ve used this a little but only in a simple way, basically when I wanted to make sure some code would be executed regardless of where control left the function, e.g. private func resetAfterError() throws { &…

  • The Perils of debugging with return statements in languages without semi-colon statement terminators, i.e. Swift

    This is a pretty obvious post but perhaps writing it will stop me falling prey to this issue. When I’m debugging and I know that some code executed in a function is not to blame but is noisy in terms of what it causes to happen etc. I’ll often just pr…

  • The Perils of debugging with return statements in languages without semi-colon statement terminators, i.e. Swift

    This is a pretty obvious post but perhaps writing it will stop me falling prey to this issue. When I’m debugging and I know that some code executed in a function is not to blame but is noisy in terms of what it causes to happen etc. I’ll often just pr…

  • OAuth authentication on tvOS

    Recently I’ve just published an Apple TV (tvOS) App to view photos stored on Microsoft OneDrive. Implementing this on tvOS rather than iOS presented one unique challenge. The OneDrive REST API requires OAuth2 authentication in order to o…

  • OAuth authentication on tvOS

    Recently I’ve just published an Apple TV (tvOS) App to view photos stored on Microsoft OneDrive. Implementing this on tvOS rather than iOS presented one unique challenge. The OneDrive REST API requires OAuth2 authentication in order to o…

  • What’s new in Java 8

    Java 8 makes some functional programming ideas available to the rest of us, using Lambda, function references and a streaming style (map, filter, replace etc.): Slides: What’s new in Java 8

  • Which Raspberry Pi photo was funniest?

    We had a great day at the Egham Raspberry Pi Jam, and Rabbit Escape and our Photo Booth: seemed to go down well: But which photo was funniest? Here are some of the entries (I had to choose kids’ ones without faces to go on here, but there were some o…

  • Raspberry Pi Funniest Photo Game

    For our latest Egham Raspberry Pi Jam, we worked on a photo booth program, using the Raspberry Pi camera. Here’s how we did it. Downloads: funniest-photo-game.odp, photo-booth.zip. Update 1: fixed a bug where it tried to create a directory that already…

  • Snake in Elm

    Snake Series: Groovy, Ruby, BASIC, Dart, Elm, Python3+Qt5 Elm Series: Snake in Elm, Elm makes me happy, Elm Basics, Elm Unit Test, Elm JSON I’m writing the game Snake in lots of programming languages, for fun, and to try out new languages. Elm brings t…

  • Out-of-school education settings

    Here is the comment I sent to the Government consultation on out-of-school education settings. Feel free to re-use, modify, distribute as you like. I am writing to express my opposition to the government’s plans to regulate the content of out-of-school…

  • Git remote repos with OneDrive

    I have various public git repositories on GitHub but I like to keep some source (usually my active App Store apps) private. Whilst it’d be nice to use GitHub private repositories, given my Apps are for fun and don’t really make anything, don’…

  • Git remote repos with OneDrive

    I have various public git repositories on GitHub but I like to keep some source (usually my active App Store apps) private. Whilst it’d be nice to use GitHub private repositories, given my Apps are for fun and don’t really make anything, don’…

  • Swift Enums and Protocols

    I’m trying to clear out my inbox before Christmas and I noticed an emails to myself entitled ‘Enum question. Add protocol to enum?’. The short answer is yes. The longer one. Take the following protocol protocol Foo { func f() -> Void } …

  • Swift Enums and Protocols

    I’m trying to clear out my inbox before Christmas and I noticed an emails to myself entitled ‘Enum question. Add protocol to enum?’. The short answer is yes. The longer one. Take the following protocol protocol Foo { func f() -> Void } …

  • PC-lint Plus is coming – and with it, full support for C++ 11 and C++ 14

    Gimpel have just announced a beta of PC-lint Plus – a new product which will sit alongside PC-lint. To understand the (rather complex, I’m afraid) background and the background to why a beta of PC-lint Plus has been announced rather than one for the l…

  • PC-lint Plus is coming – and with it, full support for C++ 11 and C++ 14

    Gimpel have just announced a beta of PC-lint Plus – a new product which will sit alongside PC-lint. To understand the (rather complex, I’m afraid) background and the background to why a beta of PC-lint Plus has been announced rather than one for the l…

  • New open source project on work time – git-history-data

    Announcing a little open source project that I have built at work and been allowed to publish Freely. git-history-data analyses a Git source code repository and dumps out data in a form that is easy to analyse. I wrote an article demonstrating how to u…

  • Java HTTPS to a server with a self-signed certificate

    Nothing is easy in Java, and nothing is more disproportionately non-easy than downloading something. If you add SSL to the equation, it becomes unfeasible for any human to navigate the twisted passages of the Java API, so here is a tiny fragment of map…