Author: Andy Balaam

  • 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…

  • 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…

  • Vim as editor for Claws Mail

    I got sick of not having Vim as my text editor for emails in Claws Mail but GVim makes my eyes bleed so I wanted proper Vim-in-a-terminal as my editor, which was not particularly straightforward. The proper incantation was to make a script in my PATH c…

  • Using GitHub and GitLab

    Taking all the Git understanding we’ve developed through the series on Git and applying it to how to work on and contribute to projects on GitHub and similar systems like GitLab:

  • Avoiding postfix error “status=deferred (unable to look up host”

    My emails wouldn’t send when I was working from home, giving me this message in /var/log/mail.log: Nov 11 12:38:16 machinename postfix/smtp[20672]: CF5D6D41CE2: to=, relay=none, delay=14416, delays=14416/0.01/0.07/0, dsn=4.3.5, status=deferred (Host or…

  • Finding the download count of GitHub releases

    You can use the GitHub API to find out how many times the files in your releases have been downloaded. For example, to find out how many downloads there have been of my Rabbit Escape project you can do: curl -s https://api.github.com/repos/andybalaam/r…

  • Android: using a TextView to show rich text in an AlertDialog

    If you want to display a link or basic formatting in an AlertDialog on Android, you can do it by providing HTML. The key parts you need are Html.fromHtml and TextView.setMovementMethod. Make sure you pass the dialog’s context in to the constructor of t…

  • Assassination of individuals by the state

    I wrote to my MP (via writetothem.com) about the British government assassinating people they suspected of planning terrorist attacks. He replied saying that the government believes the action was legal, proportional and necessary. Part of this justifi…

  • Difficult merges in Git – don’t panic!

    A video in which I try to explain what merging and rebasing really are, to help you understand what is going on when Git presents you with scary-looking conflict messages. I also explain why you shouldn’t panic because it’s hard to lose your work, and …

  • ZX Spectrum BASIC Web Server

    Finally, you can write your web sites in ZX Spectrum BASIC, using my new project, ZX Spectrum BASIC CGI server . How it works Here’s what happens when a request comes in: Apache HTTPD receives the request, and runs the CGI script that does the magic. …

  • Letter to my MP on UK government assassination of British Citizens in Syria

    Below is a copy of the letter I sent to my MP this morning (via writetothem.com). Feel free to re-use and adapt it if you want to send a similar letter. Update: follow-up letter. Dear Philip Hammond, I was extremely concerned to hear of the assassinati…

  • Rabbit Escape out now on Android!

    Watch the video: Buy the game on the Play Store.

  • Changing the Docker daemon options in systemd on Ubuntu 15.04

    Update: now documenting the better way, as described in issue 14513. Update 2: I think this way is even better (works in Ubuntu 16.04, Docker 1.12.2, Reference: dockerd command line):sudo -s -H echo ‘{“insecure-registries”:[“myreg.example.com:5000”]}’ …

  • Docker fails to start on Ubuntu 15.04

    I installed Docker on Ubuntu 15.04 using: wget -qO- https://get.docker.com/ | sh as described at Install Docker on Ubuntu. I added myself to the docker group: sudo usermod -aG docker balaaman Then I logged out and logged in again, and ran: docker run h…

  • Preventing Audacity from crashing when using PulseAudio

    I found that Audacity would crash whenever the Playback Device in the Devices section of Preferences was set to “pulse” or “default”. This can be fixed by launching Audacity like this: Exec=env PULSE_LATENCY_MSEC=100 audacity I fixed it “permanently” b…

  • Movie podcast “The Good Robot Andys”

    My friend and I have launched a new podcast in which we discuss movies: The Good Robot Andys. Enjoy.

  • Code for detecting when you leave an Android app

    Further to Detecting whether an Android app is stopping (or starting), I implemented code to decide when you are leaving or entering my game Rabbit Escape. The relevant class is called Lifecycle2SoundEvents. (Yes, it’s a terrible name. Yes, I spent a l…

  • Mocks are Bad, Layers are Bad

    In which I argue that mocks are a code smell, and layers lead to increased coupling: Mocks are Bad, Layers are Bad (in ACCU’s Overload Journal issue 127) I also suggest some ways to avoid both mocks and layers, including Classical TDD, Selfish Object, …

  • Prediction result: corporate Linux

    Ten years ago I predicted that 30% of corporate desktops would be Linux or similar open source desktops. It’s very hard to find any accurate (or even confident) numbers, but it seems clear I was wrong. This month, NetMarketShare puts Linux usage at 1.2…

  • Detecting whether an Android app is stopping (or starting)

    I am writing an Android app (called Rabbit Escape), and I want it to start playing music when the user enters the app, and stop when the user leaves. Not as easy as it sounds because Android largely doesn’t think in apps, but Activities. Update: real-l…

  • Order of Android Activity lifecycle events

    I noticed some variation between devices so I tested various user actions on various devices and recorded the Android Activity lifecycle methods (e.g. onResume, onPause, onCreate, onStop) that got called. My results are below. [Why? I want to detect wh…

  • Snake in Dart

    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. This time, Dart, which is for people who love Java and wish they didn’t have to do JavaScript. Sli…

  • Preventing Kupfer switching to existing windows

    I am enjoying using Kupfer but I don’t like the way it switches to an existing window of an application, instead of launching a new instance. I should write a patch for a config option or similar, but for now, here are my notes on how I disabled the be…

  • Using Kupfer on MATE

    I am trying out MATE desktop and really liking it. I like to use a (GNOME-Do style) keyboard-driven application launcher, and have found Kupfer really good. Kupfer as packaged for Ubuntu MATE does not support MATE desktop, so the file manager (“Caja”) …

  • Tweetable Art Code

    Picking apart some cool code to draw pretty pictures with code that fits into 3 tweets: This comes from a codegolf question here: Tweetable Mathematical Art. Slides: Tweetable Art Code.

  • Rabbit Escape 0.3.1 – now with zoom!

    I’ve just release the latest version of Rabbit Escape, which makes things look a lot nicer because you can zoom in, getting you much closer to your rabbits: There are still 60 levels of Lemmings and Pingus -like gameplay, all downloadable for free art…

  • Treat warnings as errors in a (Gnu) Makefile

    I got hit again last night by a bug in my Makefile that meant I effectively ran rm -rf /*, which was not fun. Today I have been looking for how to make Make stop if a variable is undefined. Here’s my solution. This Makefile contains a bug (“SRCS” inste…

  • Switching Xfce to use metacity

    I am trying out Xfce and liking it. However, I’ve never found a window manager better than Metacity, so I’d like to use it. Here’s how I switched: # Install it sudo apt-get install metacity metacity-themes # Tell it how many workspaces I want gsetting…

  • Java game programming: image rendering hints make no difference to rendering time

    I am writing an Open Source/Free Software Java desktop game (Rabbit Escape) and am experimenting with allowing you to zoom in so that the images being rendered are fairly big, and I’m seeing some slow-down. [Note: Rabbit Escape is also available on And…

  • Snake in ZX Spectrum BASIC

    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. This time, the first language I ever learned: Slides: Snake in ZX Spectrum BASIC If you want to, y…

  • fetchmail complaining about GoDaddy SSL certificate

    Update: I don’t think this fixed the problem I was getting this every time I ran fetchmail. fetchmail: Server certificate verification error: unable to get local issuer certificate fetchmail: Broken certification chain at: /C=US/ST=Arizona/L=Scottsdale…

  • Encapsulation as passing on responsibility

    I recently dealt with some code that I felt was not properly encapsulated, but in a sense that I’ve not seen articulated in this way before. Please enlighten me if I missed it. Here’s a snippet: OutputThing manipulate( InputThing input ) { Processi…

  • Snake in Ruby

    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. Slides: Snake in Ruby If you want to, you can Support me on Patreon.

  • Batch-converting audio files to be louder (on Linux)

    My mp3 player is very quiet, so I wanted to make all my podcasts as loud as possible. First I ran this to get the programs I needed: sudo apt-get install libav-tools normalize-audio To convert each file I made a script that makes a “loud” directory, a…

  • Why Rabbit Escape is Open Source / Free Software

    Why I wanted to make Rabbit Escape Free Software, even though I also plan to sell it. Because I want to share it.

  • What is a good company?

    I’ve been trying to work out what I think would be a good company to work for. Here’s what I’ve got so far. Please comment pointing out what I got wrong and missed out. Be coo We believe a company should be a good place to work. We sum that up in one r…

  • How to make your own levels for Rabbit Escape

    A little video showing you how to make levels for my new game Rabbit Escape. There are more instructions on the Creating levels for Rabbit Escape page.

  • Rabbit Escape v0.1 out now for Linux, Windows and Mac video

    A little video to announce my new game, Rabbit Escape. Download it, play it, enjoy it, and let me know how I can improve it!

  • Rabbit Escape (a bit like Lemmings) v0.1 released for Linux, Windows and Mac

    Today I am releasing the first version of my new game, Rabbit Escape. It’s an arcade puzzle game inspired by Lemmings and Pingus, but intended to be simpler and easier to control on a mobile device. Your task is to guide a party of rabbits from the ent…

  • Snake in Groovy

    Series: Groovy, Ruby, BASIC, Dart, Elm, Python3+Qt5 I’m starting a series where I write the game Snake in lots of programming languages. I almost always use writing Snake as my way in to understand a new language, so I’ll share my thoughts about each l…

  • Programmatic equivalents of web.xml sections for Tomcat

    Most documentation for J2EE configuration is based on having a web.xml file, but I want to configure my Tomcat programmatically. Here are some of the things I have found out. Please use the comments below to correct what I got wrong, and mention equiva…

  • JAX-RS (using Apache CXF) in embedded Tomcat example

    I had serious trouble today firing up an embedded Tomcat server that serves up REST resources using JAX-RS via Apache CXF. Here’s minimal example, hopefully saving you the same trouble: src/HelloJaxRs.java: import org.apache.catalina.startup.Tomcat; im…

  • Vim persistent buffer list combined with saved sessions

    I like to use several saved Vim sessions to remember what files I was working on in a particular project. I also like to have a list of buffers I have open on the left-hand side of the screen that is always visible and up-to-date. Sometimes, the existe…

  • Snowflake Christmas card web page on the Raspberry Pi

    In this video I will show you how to make an electronic Christmas card for your friends or family using HTML and JavaScript, which means it will be a little web site that anyone can see by going to it in their Internet browser. I’m doing this on the Ra…

  • Snowflake Christmas card in Scratch on the Raspberry Pi

    In this video I will show you how to make an electronic Christmas card for your friends or family using Scratch. Scratch can work on most computers – you can download it from http://scratch.mit.edu/. Scratch is already installed on your Raspberry Pi if…

  • Encoding URLs in Java

    To encode a URL in Java, create a new instance of java.net.URI and then call toString() or toASCIIString() on it. DO NOT use java.net.URLEncoder. It is for HTML form encoding, not encoding URLs, despite its name. Each part of a URL must be escaped diff…

  • Books that changed my life

    Further Programming for the ZX Spectrum by Ian Stewart, Robin Jones Foundation by Isaac Asimov Crime and Punishment by Fyodor Dostoyevsky Structure and Interpretation of Computer Programs by Harold Abelson, Gerald Jay Sussman, Julie Sussman S…

  • Why I use Linux

    I have used Linux at home for quite a few years, and a couple of years ago I changed my work machine from Windows to Ubuntu Linux. It’s made life at work better for me. Better for me This move has made me much more productive, saving valuable time and …

  • LibreOffice spell check not working in Lubuntu

    I installed LibreOffice into Lubuntu, but the spell checking didn’t work. It turns out I need to install a dictionary for my locale: sudo apt-get install myspell-en-gb I needed to restart LibreOffice, and then I got spell checking as I typed.

  • Is it ok to represent dates as Unix time (seconds since the epoch) in JSON?

    Yes. If your JSON contains integer numbers that represent Unix time (seconds since the “epoch”), and you parse your JSON to JavaScript, the range of integers that can accurately be represented is -9007199254740992 to 9007199254740992 (ref: EcmaScript s…

  • Using hexdump to represent a binary file in Java source code

    To embed a binary file (e.g. a png image) into Java source code: $ hexdump -v -e ‘/1 “%3i, “‘ myfile.png -119, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72, 68, 82, … Copy and paste the output into Java code like this: private s…

  • Disabling screensaver on LXDE

    Caffeine wasn’t working for me. I got an error like this: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.ScreenSaver was not provided by any .service files Bug 1280449 contained the solution for me. …

  • Android development – saving state

    Series: Setup, Menu, Drawing, non-Android, Working, Saving state. Android apps like Rabbit Escape need to save their state when asked, and restore themselves later. This happens when you rotate the screen, and could happen at various other times. Here’…

  • Android development – Rabbit Escape really working on Android

    Series: Setup, Menu, Drawing, non-Android, Working, Saving state. Up until now, you weren’t sure to believe my promises that Rabbit Escape really was going to be an Android game, since I hadn’t actually got it running on Android. Well, the wait is over…

  • Showing urgent (flashing) windows on all desktop in LXDE’s taskbar (window list) in Lubuntu

    As it stands, lxpanel’s taskbar plugin (part of the LXDE desktop you get with Lubuntu) does not show urgent (flashing) windows if they are on a different virtual desktop from the one you are looking at. This seems wrong to me (I logged Bug 682), and th…

  • Launch an urgent window using Python and Xlib with the UrgencyHint flag

    I am trying to fix a bug in lxpanel’s taskbar plugin, and needed to launch an urgent window. Here’s how I did it in a little python. #!/usr/bin/python # urgent.py — launch an urgent window (Copyright messages are at the bottom) # To use: # sudo apt-…

  • Android programming – a non-Android, Android Game

    Series: Setup, Menu, Drawing, non-Android, Working, Saving state We’re planning to write an Android game. So why would we deliberately avoid Android while we’re writing it? To make sure we’re not overly-dependent on the Android ways of doing things, an…

  • Android programming – drawing bitmaps in a game loop

    Series: Setup, Menu, Drawing, non-Android, Working, Saving state I will be talking about how to write Android programs that share code with non-Android programs. The program I will be writing is a simple game. This time we’re writing a game loop and dr…

  • Don’t use email auto-forwarding (emails will go missing)

    I’ve been trying to chase down a mysterious problem with emails going missing. The problem with things being missing is that you can’t see them, so it has been difficult to track down exactly what’s going on, but it became clear that we were receiving …

  • Fetchmail “mda” option makes emails bypass the spamassassin filter in postfix

    I have spent several months with no spam filtering in my postfix+dovecote+spamassassin+fetchmail+procmail setup, and no idea why. I had spamassassin enabled and working when I piped emails into it manually, and I had lines like this in my postfix maste…

  • Android programming – a menu using Activities and Intents

    Series: Setup, Menu, Drawing, non-Android, Working, Saving state I will be talking about how to write Android programs that share code with non-Android programs. The program I will be writing is a simple game. This time we’re making a simple menu struc…

  • Raspberry Pi Minecraft Python summer project screenshots

    [Screenshots of Minecraft on the Raspberry Pi can’t be made with VNC or screenshot tool like scrot, but they can be made with the excellent raspi2png.] We did some Python programming in Minecraft on the Raspberry Pi for our summer projects. Child 2 m…

  • Android programming – setting up Android Studio

    Series: Setup, Menu, Drawing, non-Android, Working, Saving state I will be talking about how to write Android programs that share code with non-Android programs. The program I will be writing is a simple game. First, how to set up Android Studio:

  • What is a string?

    Most programming languages have some wrinkles around unicode and strings*. In my ficticious language Pepper, there are no wrinkles of any kind, and everything is perfect. *E.g. JavaScript, Java, Haskell, Ruby, Python. There are several key concepts. …

  • Absolute Truth in programming languages

    Is enforcing truthfulness the opposite of beauty? Can 2 + 2 = 5? Improvements, corrections, further contributions are welcome. $ cat five.cpp #include <iostream> int operator+( int x, int y ) { return 5; } int main() { std::cout << 2 + …

  • Options for code reviews with Git

    We’re thinking about switching to Git for my work, and I want to be confident we can still support good code reviews if we make the switch. I am a big fan of in-person reviews, and for that, git difftool is enough but sometimes you need to do it asynch…

  • Desktop sharing not working in Lubuntu 14.04

    On my recently-upgraded to 14.04 Lubuntu machine, desktop sharing didn’t work. Here’s how I made it work: Once (to allow some Windows clients to connect without encryption): gsettings set org.gnome.Vino require-encryption false Then every time I want t…

  • Best GCC warning flags for compiling C++

    A recent discussion on ACCU-general gave people an opportunity to share the warning flags they like to use with g++. I thought I’d write down the consensus as I understood it, mainly for my own reference: -Wredundant-decls -Wcast-align -Wmissing-declar…

  • What git server should I use?

    At work we are considering whether we can use Git for our source control. I am a big fan of Git, so I’d like to see this happen. We only need to work against a central repository most of the time, so I’m looking at what servers might work for us. Updat…

  • Renewing self-signed certificate for ejabberd

    I run an ejabberd server on an Ubuntu 12.10 box and this week I started getting notified by my IM client that the server’s certificate had expired. Here’s how I managed to generate a new certificate. WARNING: this process backs up, deletes and then res…

  • Letter to my MP on DRIP

    Sent via WriteToThem.com. More Info Dear Mr Hammond, I am writing to express my concern about the Data Retention and Investigatory Powers Bill (DRIP). I feel that forcing companies to store data on their customers is an unacceptable breach of the right…

  • What is node.js?

    Node.js is a way of writing your web applications wholly in JavaScript, which sounds like a terrible idea. However, it is also an asynchronous programming environment that has been proven to scale really well, and it’s a collection of libraries many of…

  • A mini mocking framework

    Ever wondered how a mocking framework like JMock or GoogleMock works? We’ll look at how to write a very basic example, and find out that Java is more flexible than you may have thought. Slides: A mini mocking framework.

  • Simple template programming

    C++ template meta-programming sounds harder than it is. So long as you can fight through some horrific syntax and understand recursive functions, you can write any algorithm you like and have it run at compile time in your C++ programs. Slides: Simpl…

  • Five Quines video

    A quine is a program that prints out its own source code. I will describe five examples: Slides: Five Quines Arguably the greatest program ever written: Qlobe. More info on quines: http://www.madore.org/~david/computers/quine.html https://en.wikiped…

  • OpenID security in a REST API

    Series: What is REST?, A Basic REST API, Paging, Search, Security, Token, OpenID. We are implementing a REST API. Today, using OpenID to do our authentication, instead of doing it ourselves: Slides: OpenID security in a REST API. Code: poemtube on gi…

  • avconv performance slow in Ubuntu 14.04 trusty

    I noticed that my TV conversion scripts were suddenly running very slowly after upgrading to Lubuntu 14.04. After some investigation it turned out it had started defaulting to using libx264 encoding when the output file was named *.mp4. When I ask it t…

  • Does test-driven development harm clarity?

    In a recent keynote at RailsConf called Writing Software*, David Heinemeier Hansson argues that test-driven development (TDD) can harm the clarity of our code, and that clarity is the key thing we should be aiming for when writing software. (*contains …

  • Token-based security in a REST API

    Series: What is REST?, A Basic REST API, Paging, Search, Security, Token, OpenID. We are implementing a REST API. Today, adding to the security we already have by making a security token that is stored in a cookie: Slides: Token-based security in a R…

  • Avoid mocks by refactoring to functional

    At this week’s ACCU Conference I went to an excellent talk by Sven Rosvall entitled “Unit Testing Beyond Mock Objects”. The talk covered the newer Java and C# unit testing frameworks that allow inserting mock objects even where legacy code is using som…

  • Using the final keyword in interface method parameters does nothing

    Consider the following Java code: class FinalInInterface { private static interface WithFinal { public void run( final int x ); } private static class WithoutFinal implements WithFinal { public void run( int x ) …

  • Using xscreensaver to lock the screen in Lubuntu

    Recent versions of Lubuntu seem to have broken screen locking. To get screen locking via xscreensaver do this: # Install xscreensaver sudo apt-get install xscreensaver # Start xscreensaver when you log in echo “xscreensaver -nosplash” >> ~/.conf…

  • Security in a REST API

    Series: What is REST?, A Basic REST API, Paging, Search, Security, Token, OpenID. We are implementing a REST API. Today, providing security using HTTP Basic Authorization: Slides: Security in a REST API. Code: poemtube on github.

  • Searching in a REST API

    Series: What is REST?, A Basic REST API, Paging, Search, Security, Token, OpenID. We are implementing a REST API. Today, we provide a basic search. Slides: Searching in a REST API. Code: poemtube on github.

  • Paging in a REST API

    Series: What is REST?, A Basic REST API, Paging, Search, Security, Token, OpenID. We consider some choices of how to provide paging through a list resource in a REST API. Slides: Paging in a REST API. Code: poemtube on github.

  • A Basic REST API

    Series: What is REST?, A Basic REST API, Paging, Search, Security, Token, OpenID. I’ll walk you through the code of a simple REST API I am writing to be a kind of YouTube for poetry. Slides: A Basic REST API. Code: poemtube on github.

  • Avoid backslashes anywhere in Java code (Java error “illegal unicode escape”)

    Did you know you can insert unicode-escaped characters, anywhere in a Java program? Most of us are familiar with using unicode escapes like this: String pound = “\u00A3”; but in fact constructs like \u00A3 can go anywhere, including in a comment. This …

  • What is REST?

    Series: What is REST?, A Basic REST API, Paging, Search, Security, Token, OpenID. The basic concepts of REST APIs: Slides: What is REST?. Code: poemtube on github.

  • Bash arrays

    Bash arrays are a lot like Bash Associative Arrays, but with numbers as keys. Here’s a quick reference. Basics $ declare -a MYARR # Create an array $ MYARR[3]=foo # Put a value into an array $ echo ${MYARR[3]} # Get a value out of an array foo $…

  • Using if:set, unless:set etc. with macrodefs in Ant

    In a previous post I outlined how to use if:set and unless:set to execute tasks conditionally in Ant 1.9.1. Unfortunately, this does not work with macrodefs. When I try to execute a macrodef conditionally like this: <project xmlns:if=”ant:if” …

  • Using if:set, unless:set etc. to execute a task conditionally in Ant

    I’m not sure anyone except me is still struggling on with using Ant, but just in case, here is a nice thing. In Ant 1.9.1 they added a useful feature: instead of needing to use the <if> tag and similar from ant-contrib, you can conditionally exec…

  • Vim for Fun

    I have recently got quite excited about Vim (the text editor), so here is a video showing you the basics. I use it because I enjoy learning it. Slides: Vim for Fun.

  • Working with others in git

    Series: Why git?, Basics, Branches, Merging, Remotes Now I’ve covered almost everything you need to understand the basics of how git works. In this video I discuss how to clone, pull from and fork remote git repositories, and how to send patches and ma…

  • Merging in git

    Series: Why git?, Basics, Branches, Merging, Remotes The last video covered how to make branches and simple merges. This time we look at what to do when you want just one change from another branch (cherry-picking) and how to merge two branches when th…

  • Behaviour of Java String.split() when some answers are the empty string

    Can you guess the output of this program? class SplitTest { static void split( String s ) { System.out.println( s.split( “;” ).length ); } public static void main( String[] args ) { split(“”); split(“;”); …

  • Checking the case of a filename on Windows

    Windows generally uses a case-insensitive but not case-preserving file system. When writing some code that is intended to be used on Linux as well as Windows, I wanted it to fail on Windows in the same cases that it would fail on Linux, and this meant …

  • Branches in git

    Series: Why git?, Basics, Branches, Merging, Remotes Last time we discussed starting a project and committing changes. Now we look at how to create branches, which are one of the main reasons for having source control. We’ll cover creating branches, sw…