ACCU World of Code

  • Victory in Europe (VE) Day in Churchill’s Toyshop

    My grandfather, Norman Angier, worked at Churchill’s Toyshop (M.D.1) as the head civilian engineer during WWII. On VE day “Norman Angier felt it was an occasion for fireworks. He therefore acquired a large batch of quite big rockets and proc…

  • Victory in Europe (VE) Day in Churchill’s Toyshop

    My grandfather, Norman Angier, worked at Churchill’s Toyshop (M.D.1) as the head civilian engineer during WWII. On VE day “Norman Angier felt it was an occasion for fireworks. He therefore acquired a large batch of quite big rockets and proc…

  • Example Android project with repeatable tests running inside an emulator

    I’ve spent the last couple of days fighting the Android command line to set up a simple project that can run automated tests inside an emulator reliably and repeatably. To make the tests reliable and independent from anything else on my machine, I want…

  • Tizen on Orange Pi PC

    Made some significant progress for running Tizen on an Orange Pi PC (and hopefully any other SBC with a similar Mali GPU). Main issue was that alignments in TBM (Tizen Buffer Manager) weren’t in sync with what the actual GPU driver expected. With that …

  • Tizen on Orange Pi PC

    Made some significant progress for running Tizen on an Orange Pi PC (and hopefully any other SBC with a similar Mali GPU). Main issue was that alignments in TBM (Tizen Buffer Manager) weren’t in sync with what the actual GPU driver expected. With that …

  • Creating a tiny Docker image of a Rust project

    I am building a toy project in Rust to help me learn how to deploy things in AWS. I’m considering using Elastic Beanstalk (AWS’s platform-as-a-service) and also Kubernetes. Both of these support deploying via Docker containers, so I am learning how to …

  • SIGCHLD si_pid Linux kernel bug

    While trying to get Tizen working on my Orange Pi PC, I noticed some strange behaviour in the Linux kernel in that SIGCHLD signals sent to the parent process don’t always set the “si_pid” field correctly. I tracked this down to a bug in the Linux kerne…

  • SIGCHLD si_pid Linux kernel bug

    While trying to get Tizen working on my Orange Pi PC, I noticed some strange behaviour in the Linux kernel in that SIGCHLD signals sent to the parent process don’t always set the “si_pid” field correctly. I tracked this down to a bug in the Linux kerne…

  • COVID-19 Lockdown Blues

    A corner of the roof of our office building. Even though the sea is just over 350m away to the left, sadly it’s currently off-limits. 2020 is not turning out to be what we expect as – like much of the world – the UK is locked down right now as a resul…

  • COVID-19 Lockdown Blues

    A corner of the roof of our office building. Even though the sea is just over 350m away to the left, sadly it’s currently off-limits. 2020 is not turning out to be what we expect as – like much of the world – the UK is locked down right now as a resul…

  • Life, the Universe and Everything

    is an excellent book by Douglas Adams (isbn 978-0-330-49120-4). As usual I’m going to quote from a few pages. He would insult the universe. That is, he would insult everybody in it. Individually, personally, one by one, and (this was the thing t…

  • Life, the Universe and Everything

    is an excellent book by Douglas Adams (isbn 978-0-330-49120-4). As usual I’m going to quote from a few pages. He would insult the universe. That is, he would insult everybody in it. Individually, personally, one by one, and (this was the thing t…

  • Keeping track of podcast times with a simple bash script on Linux

    I was recording some podcast audio tonight and wanted to be able to press a single key when I reached a significant moment, so I could add the times to the show notes. I couldn’t find anything that already did this, so I wrote a tiny bash script. I ran…

  • The Restaurant at the End of the Universe

    is an excellent book by Douglas Adams (isbn 978-0-330-49121-1). As usual I’m going to quote from a few pages. There is another theory which states that this has already happened. The story so far: In the beginning the Universe was created. Thi…

  • The Restaurant at the End of the Universe

    is an excellent book by Douglas Adams (isbn 978-0-330-49121-1). As usual I’m going to quote from a few pages. There is another theory which states that this has already happened. The story so far: In the beginning the Universe was created. Thi…

  • Can a decision tree tell us about wine categories?

    I previously wrote an overview showing how decision trees work: http://buontempoconsulting.blogspot.com/2019/07/decision-trees-for-feature-selection.html This time, let’s build a decision tree with some data. There are many freely available data …

  • Can a decision tree tell us about wine categories?

    I previously wrote an overview showing how decision trees work: http://buontempoconsulting.blogspot.com/2019/07/decision-trees-for-feature-selection.html This time, let’s build a decision tree with some data. There are many freely available data …

  • The Hitch Hiker’s Guide to the Galaxy

    is an excellent book by Douglas Adams (isbn 978-0-330-49119-8). As usual I’m going to quote from a few pages. Far out in the uncharted backwaters of the unfashionable end of the Western Spiral Arm of the Galaxy lies a small unregarded yellow sun…

  • The Hitch Hiker’s Guide to the Galaxy

    is an excellent book by Douglas Adams (isbn 978-0-330-49119-8). As usual I’m going to quote from a few pages. Far out in the uncharted backwaters of the unfashionable end of the Western Spiral Arm of the Galaxy lies a small unregarded yellow sun…

  • Custom Bash tab completion for my program

    I love Bash tab completion, and I want it for the command I am writing, so it can automatically complete parts of the command line when I run my program. Code Here is the script (install-bash-completion) I wrote to set it up (no need to be root – it in…

  • Invariants and Preconditions

    I tend to think about invariants and preconditions a lot. Pretty much every class has invariants, and most functions have preconditions. I don’t think they are complicated concepts, but somehow they seem to confuse people anyway, so I decided it was ti…

  • Struggling with Rust to figure out the right types for a function signature

    I am loving writing code in Rust. So many things about the language and its ecosystem feel so right*. * For example: ownership of objects, expressive type system, compile to native, offline API docs, immutability, high quality libraries. One of the thi…

  • Rock Pi S Review

    Got a $20 voucher code for a review of a Rock Pi S SBC. Although the cost of the board is only $13.90, with shipping at just over $8, it’s a bit over $22 in total. When the board arrived, I did actually wonder if shipping could have been made a bit mor…

  • Rock Pi S Review

    Got a $20 voucher code for a review of a Rock Pi S SBC. Although the cost of the board is only $13.90, with shipping at just over $8, it’s a bit over $22 in total. When the board arrived, I did actually wonder if shipping could have been made a bit mor…

  • React Concepts Video

    I tried to describe the main ideas that will help you write decent React code. Maybe it will help you understand the docs a bit more when you read them… Slides: React Concepts slides

  • Blog Post #300

    I signed off My 200th Blog Post in November 2014 with the following words: See you again in a few years. At the time I didn’t think it would take me over 5 years to write another 100 blog posts, but it has. Does this mean I’ve stopped writing and gone…

  • Blog Post #300

    I signed off My 200th Blog Post in November 2014 with the following words: See you again in a few years. At the time I didn’t think it would take me over 5 years to write another 100 blog posts, but it has. Does this mean I’ve stopped writing and gone…

  • Converting HTML slides to a PDF with Firefox

    I have not found an automated way to generate a nice PDF from some slides written in HTML – if you know of one please add a comment! In the meantime, if you create slides using my HTML Slides template, then you can make a decent-ish-looking PDF like th…

  • Support the Software Freedom Conservancy

    The Software Freedom Conservancy helps Free/Open Source software projects by providing infrastructure, financial structures, and legal help. It is a not-for-profit organisation that is dedicated to software freedom, something that I think is an importa…

  • Cargo Culting GitFlow

    A few years back I got to spend a couple of weeks consulting at a small company involved in the production of smart cards. My team had been brought in by the company’s management to cast our critical eye over their software development process and prov…

  • Cargo Culting GitFlow

    A few years back I got to spend a couple of weeks consulting at a small company involved in the production of smart cards. My team had been brought in by the company’s management to cast our critical eye over their software development process and prov…

  • Branching 0 – Git 1

    My recent tirade against unnecessary branching – “Git is Not the Problem” – might have given the impression that I don’t appreciate the power that git provides. That’s not true and hopefully the following example highlights the appreciation I have for …

  • Branching 0 – Git 1

    My recent tirade against unnecessary branching – “Git is Not the Problem” – might have given the impression that I don’t appreciate the power that git provides. That’s not true and hopefully the following example highlights the appreciation I have for …

  • Git is Not the Problem

    Git comes in for a lot of stick for being a complicated tool that’s hard to learn, and they’re right, git is a complicated tool. But it’s a tool designed to solve a difficult problem – many disparate people collaborating on a single product in a totall…

  • Git is Not the Problem

    Git comes in for a lot of stick for being a complicated tool that’s hard to learn, and they’re right, git is a complicated tool. But it’s a tool designed to solve a difficult problem – many disparate people collaborating on a single product in a totall…

  • Choosing “a” Database, not “the” Database

    One thing I’ve run across a few times over the years is the notion that an application or system has one, and only one, database product. It’s as if the answer to the question about where we should store our data must be about where we store “all” our …

  • Choosing “a” Database, not “the” Database

    One thing I’ve run across a few times over the years is the notion that an application or system has one, and only one, database product. It’s as if the answer to the question about where we should store our data must be about where we store “all” our …

  • Automating Windows VM Creation on Ubuntu

    TL;DR you can find my resulting Oz and Packer configuration files in this Oz gist and this Packer gist on my GitHub account.As someone who has worked almost exclusively on Windows for the last 25 years I was somewhat surprised to find myself needing to…

  • Automating Windows VM Creation on Ubuntu

    TL;DR you can find my resulting Oz and Packer configuration files in this Oz gist and this Packer gist on my GitHub account.As someone who has worked almost exclusively on Windows for the last 25 years I was somewhat surprised to find myself needing to…

  • KotlinJS: First impressions (formed by writing Snake) video

    What it was like to write a snake game in KotlinJS: Slides: Snake in KotlinJS slides Code: github.com/andybalaam/snake

  • Arbitrary Cache Timeouts

    Like many other programmers I’ve probably added my fair share of caches to systems over the years, and as we know from the old joke, one of the two hardest problems in computer science is knowing when to invalidate them. It’s a hard question, to be sur…

  • Arbitrary Cache Timeouts

    Like many other programmers I’ve probably added my fair share of caches to systems over the years, and as we know from the old joke, one of the two hardest problems in computer science is knowing when to invalidate them. It’s a hard question, to be sur…

  • Validate in Production

    The change was reasonably simple: we had to denormalise some postcode data which was currently held in a centralised relational database into some new fields in every client’s database to remove some cross-database joins that would be unsupported on th…

  • Validate in Production

    The change was reasonably simple: we had to denormalise some postcode data which was currently held in a centralised relational database into some new fields in every client’s database to remove some cross-database joins that would be unsupported on th…

  • Dependency Injection frameworks: reasons to avoid them video

    At my job we have done a great deal of work to remove Guice from our codebase. Here I try to explain why we did that, and try to apply my reasoning to dependency injection frameworks in general. Slides: Dependency Injection frameworks: reasons to avo…

  • kmscube Running on Orange Pi PC with Mainline Kernel

    Managed to get kmscube running on my Orange Pi PC with a mainline Linux 5.3 kernel and an updated mesa package from Ubuntu’s ubuntu-x-swat PPA. The amazing thing is that it’s all just mainline now, no board-specific patches needed. Interestingly, a Ras…

  • kmscube Running on Orange Pi PC with Mainline Kernel

    Managed to get kmscube running on my Orange Pi PC with a mainline Linux 5.3 kernel and an updated mesa package from Ubuntu’s ubuntu-x-swat PPA. The amazing thing is that it’s all just mainline now, no board-specific patches needed. Interestingly, a Ras…

  • CppCon 2019 Trip Report and Slides

    Having been back from CppCon 2019 for over a week, I thought it was about time I wrote up my trip report. The venue This year, CppCon was at a new venue: the Gaylord Rockies Resort near Denver, Colorado, USA. This is a huge conference centre, currently…

  • Coding workshop example worksheets

    This week we did a coding workshop exercise: 2 teams implemented the different sides of the SMPP protocol (without speaking to each other) and this morning we tried out connecting them together. We successfully sent a message and received an acknowledg…

  • Swarm algorithms

    I wrote a book about about genetic algorithms and machine learning. You can buy it here. Apart from genetic algorithms and other aspects of machine learning, it includes some swarm algorithms. Where a genetic algorithm mixes up potential solu…

  • Swarm algorithms

    I wrote a book about about genetic algorithms and machine learning. You can buy it here. Apart from genetic algorithms and other aspects of machine learning, it includes some swarm algorithms. Where a genetic algorithm mixes up potential solu…

  • More Productive C++ with TDD

    The title might read a little like click-bait, and there are certainly some nuances and qualifications here. But, hey! That’s what the article is for. Those that know me know that I have been a practitioner of, and advocate for, TDD in C++ for many …

  • More Productive C++ with TDD

    The title might read a little like click-bait, and there are certainly some nuances and qualifications here. But, hey! That’s what the article is for. Those that know me know that I have been a practitioner of, and advocate for, TDD in C++ for many …

  • Decision trees for feature selection

    I asked twitter who is using decision trees and what for. Most were using them, unsurprisingly, to make decisions. It wasn’t always clear how the trees themselves were built. If you are armed with data, so that each row has some features and a categor…

  • Decision trees for feature selection

    I asked twitter who is using decision trees and what for. Most were using them, unsurprisingly, to make decisions. It wasn’t always clear how the trees themselves were built. If you are armed with data, so that each row has some features and a categor…

  • Building an all-in-one Jar in Gradle with the Kotlin DSL

    To build a “fat” Jar of your Java or Kotlin project that contains all the dependencies within a single file, you can use the shadow Gradle plugin. I found it hard to find clear documentation on how it works using the Gradle Kotlin DSL (with a build.gra…

  • No-one knows the type of char + char

    Quick quiz! Given the following: Which overload gets called by the following? Alternatives: f(unsigned int) f(int) f(char) No-one knows the type of char + char If you answered 4), congratulations! And if you answered 2), maybe you tried the code on your own computer? Most people will get f(int) when they try this code, but … Continue reading No-one knows the type of char + char

  • Log driven development

    Everyone knows attempting to figure out what’s happening by resorting to print statements is desperation. Everyone knows you should use TDD, BDD or some xDD to write code well, don’t they? I am desperate. I suggest PDD, print driven development is slow…

  • Log driven development

    Everyone knows attempting to figure out what’s happening by resorting to print statements is desperation. Everyone knows you should use TDD, BDD or some xDD to write code well, don’t they? I am desperate. I suggest PDD, print driven development is slow…

  • Creating a self-signed certificate for Apache and connecting to it from Java

    Our mission: to create a self-signed certificate for an Apache web server that allows us to connect to it over HTTPS (SSL/TLS) from a Java program. The tricky bit for me was generating a certificate that contains Subject Alternative Names for my server…

  • ACCU Talk “How Kotlin makes your Java code better”

    Here is the live version of my talk designed to help you advocate for adopting Kotlin:

  • ACCU Talk “How Git really works”

    Here is the talk CB Bailey and I did at ACCU Conference 2019. This was the first talk I have done with someone else, and I really enjoyed it:

  • Examples of Kotlin making your Java code better video

    People at work suggested Kotlin was “just syntactic sugar”, so I set out to explain how Kotlin can really make better code, and here is the result: Slides: Examples of Kotlin making your Java code better slides

  • What is a Monad? Video

    Slightly jokey video about what a Monad is, but with a genuine explanation, all in just about 5 minutes. First given as a lightning talk at the ACCU Conference in 2019. Slides: What is a Monad? Slides

  • Build with a different Java version (e.g. 11) using Docker

    To spin up a temporary environment with a different Java version without touching your real environment, try this Docker command: docker run -i -t –mount “type=bind,src=$PWD,dst=/code” openjdk:11-jdk bash (Change “11-jdk” to the version you want as li…

  • Outdoor Maps in Galaxy Store

    My Outdoor Maps app for Samsung Gear/Galaxy watches has finally been approved in the Galaxy Store.

  • Outdoor Maps in Galaxy Store

    My Outdoor Maps app for Samsung Gear/Galaxy watches has finally been approved in the Galaxy Store.

  • ACCUConf 2019

    The ACCU conference happened in Bristol again this year. For my first time ever, I was at a workshop. In fact, I ran a work shop with Chris Simons. We talked about Evolutionary Algorithms in practice. We gave a 90 minute talk later in the week, using t…

  • ACCUConf 2019

    The ACCU conference happened in Bristol again this year. For my first time ever, I was at a workshop. In fact, I ran a work shop with Chris Simons. We talked about Evolutionary Algorithms in practice. We gave a 90 minute talk later in the week, using t…

  • Rabbit Escape t-shirts

    If you’d like to help promote Rabbit Escape, my free software Android/PC game, how about a t-shirt? Use the link below to design your shirt: Rabbit Escape t-shirt Note: there’s no profit in this for us – it’s just for promotion. If you’d like to contr…

  • Scheduling a task in Java within a CompletableFuture

    When we want to do something later in our Java code, we often turn to the ScheduledExecutorService. This class has a method called schedule(), and we can pass it some code to be run later like this: ScheduledExecutorService executor = Executors.new…

  • PowerShell’s Call Operator (&) Arguments with Embedded Spaces and Quotes

    I was recently upgrading a PowerShell script that used the v2 nunit-console runner to use the v3 one instead when I ran across a weird issue with PowerShell. I’ve haven’t found a definitive bug report or release note yet to describe the change in behav…

  • PowerShell’s Call Operator (&) Arguments with Embedded Spaces and Quotes

    I was recently upgrading a PowerShell script that used the v2 nunit-console runner to use the v3 one instead when I ran across a weird issue with PowerShell. I’ve haven’t found a definitive bug report or release note yet to describe the change in behav…

  • CI/CD Server Inline Scripts

    As you might have already gathered if you’d read my 2014 post “Building the Pipeline – Process Led or Product Led?” I’m very much in favour of developing a build and deployment process locally first, then automating that, rather than clicking buttons i…

  • CI/CD Server Inline Scripts

    As you might have already gathered if you’d read my 2014 post “Building the Pipeline – Process Led or Product Led?” I’m very much in favour of developing a build and deployment process locally first, then automating that, rather than clicking buttons i…

  • New website and chips, please!

    HOWTO: celebrate finishing a project. If you are reading this you might have noticed that the Riverblade website has undergone a bit of a redesign. This is something we’ve been working on for a little while in the background, and we think it’s probabl…

  • New website and chips, please!

    HOWTO: celebrate finishing a project. If you are reading this you might have noticed that the Riverblade website has undergone a bit of a redesign. This is something we’ve been working on for a little while in the background, and we think it’s probabl…

  • Abstraction with Database Views

    After being away from the relational database world for a few years it’s been interesting coming back and working on a mature system with plenty of SQL code. It’s been said that SQL is the assembly language of databases and when SQL code is written onl…

  • Abstraction with Database Views

    After being away from the relational database world for a few years it’s been interesting coming back and working on a mature system with plenty of SQL code. It’s been said that SQL is the assembly language of databases and when SQL code is written onl…

  • The ACCU’s Overload magazine

    ACCU is an organisation for programmers. Its original focus was C and C++, but now members use a variety of languages, talk about testing and process and how to keep learning. ACCU holds an annual conference in the UK, attended by people from around th…

  • The ACCU’s Overload magazine

    ACCU is an organisation for programmers. Its original focus was C and C++, but now members use a variety of languages, talk about testing and process and how to keep learning. ACCU holds an annual conference in the UK, attended by people from around th…

  • The Perils of Multi-Phase Construction

    I’ve never really been a fan of C#’s object initializer syntax. Yes, it’s a little more convenient to write but it has a big downside which is it forces you to make your types mutable by default. Okay, that’s a bit strong, it doesn’t force you to do an…

  • The Perils of Multi-Phase Construction

    I’ve never really been a fan of C#’s object initializer syntax. Yes, it’s a little more convenient to write but it has a big downside which is it forces you to make your types mutable by default. Okay, that’s a bit strong, it doesn’t force you to do an…

  • Rabbit Escape 0.12 out now, with water

    The newest feature of Rabbit Escape, water, has been brewing a long time, but we now think it’s ready: Water can flow, it can put out fires, and it can drown rabbits. Rabbots seem to be immune though… Check out the 20 new levels we have released! (T…

  • Convert a video to a GIF with reasonable colours

    Here’s a little script I wrote to avoid copy-pasting the ffmpeg command from superuser every time I needed it. It converts a video to a GIF file by pre-calculating a good palette, then using that palette. Usage: ./to_gif input.mp4 output.gif The file t…

  • Gradle: what is a task, and how can I make a task depend on another task?

    In an insane world, Gradle sometimes seems like the sanest choice for building a Java or Kotlin project. But what on Earth does all the stuff inside build.gradle actually mean? And when does my code run? And how do you make a task? And how do you persu…

  • Python Async basics video (100 million HTTP requests)

    I found something difficult in Python, which was a bit of a first, so I wrote a whole blog series about it, and now a whole video: Slides: Python Async Basics slides Blog posts: asyncio basics, large numbers in parallel, parallel HTTP requests, addin…

  • Code your way out of a paper bag

    I attended nor(DEV):con, a tech conference in Norwich, last week. I gave a 45 minute talk which I called “Code your way out of a paper bag”. A majority of my recent talks involve getting out of, and once into, a paper bag. I’ve used this as a vehicle…

  • Code your way out of a paper bag

    I attended nor(DEV):con, a tech conference in Norwich, last week. I gave a 45 minute talk which I called “Code your way out of a paper bag”. A majority of my recent talks involve getting out of, and once into, a paper bag. I’ve used this as a vehicle…

  • Clean git blame history

    Place the following in a command file, run it within your repo: #!/bin/sh git filter-branch –env-filter ‘ an=”$GIT_AUTHOR_NAME” am=”$GIT_AUTHOR_EMAIL” cn=”$GIT_COMMITTER_NAME” cm=”$GIT_COMMITTER_EMAIL” if [ “$GIT_AUTHOR_EMAIL” = “timp@paneris.o…

  • Clean git blame history

    Place the following in a command file, run it within your repo: #!/bin/sh git filter-branch –env-filter ‘ an=”$GIT_AUTHOR_NAME” am=”$GIT_AUTHOR_EMAIL” cn=”$GIT_COMMITTER_NAME” cm=”$GIT_COMMITTER_EMAIL” if [ “$GIT_AUTHOR_EMAIL” = “timp@paneris.o…

  • Keybase chat bot in 10 lines of bash

    I’ve been getting very excited about keybase.io recently, not least because it offers secure conversation, and you can have bots. I wrote a quick bot to simulate Arnold Schwarzenegger which I thought I’d share to demonstrate how easy it is. It is based…

  • Performance of Java 2D drawing operations (part 3: image opacity)

    Series: operations, images, opacity Not because I was enjoying it, I seemed compelled to continue my quest to understand the performance of various Java 2D drawing operations. I’m hoping to make my game Rabbit Escape faster, especially on the Raspberry…

  • Performance of Java 2D drawing operations (part 2: images)

    Series: operations, images, opacity In my previous post I examined the performance of various drawing operations in Java 2D rendering. Here I look at some specifics around rendering images, with an eye to finding optimisations I can apply to my game Ra…

  • CppOnSea

    CppOnSea 2019 Phil Nash organised a new conference, CppOnSea, this year. I was lucky enough to be accepted to speak, so attended to two conference days, but not the workshops. There were three tracks, along with a beginners track, run by Tri…

  • CppOnSea

    CppOnSea 2019 Phil Nash organised a new conference, CppOnSea, this year. I was lucky enough to be accepted to speak, so attended to two conference days, but not the workshops. There were three tracks, along with a beginners track, run by Tri…

  • Performance of Java 2D drawing operations (part 1: types of operation)

    Series: operations, images, opacity I want to remodel the desktop UI of my game Rabbit Escape to be more convenient and nicer looking, so I took a new look at game-loop-style graphics rendering onto a canvas in a Java 2D (Swing) UI. For more on images,…

  • xkcd-style plots in MatPlotLib

    Most programmers I know are familiar with xkcd, the webcomic of romance, sarcasm, math, and language. In order to create diagrams for my machine learning book, I wanted a way to create something I could have fun with. I discovered that Pytho…

  • xkcd-style plots in MatPlotLib

    Most programmers I know are familiar with xkcd, the webcomic of romance, sarcasm, math, and language. In order to create diagrams for my machine learning book, I wanted a way to create something I could have fun with. I discovered that Pytho…

  • London Python Meetup January 2019 – Async Python and GeoPandas

    It was a pleasure to go to the London Python Meetup organised by @python_london. There were plenty of friendly people and interesting conversations. I gave a talk “Making 100 million requests with Python aiohttp” (slides, Blog post) explaining the basi…