Book Review: The Programmer's Brain - What every programmer needs to know about cognition by Felienne Hermans


Book cover for the Programmer's Brain.

There are some books which make you feel smarter just by having them on your shelf. This is one of them! I would consider it essential for anyone working with code - whether a wide-eyed newbie or grizzled veteran. How do human brains understand code? What neurological quirks do we all have? Which common mistakes…

Continue reading →

⩵ != ==


Lots of mechanical fingers typing on a complicated keyboard.

One of the frustrating things about computers is their limited input options. A "standard" PC keyboard only has about 100 keys. Sure, some have some bonus buttons for controlling the machine, but it is becoming clear that there simply aren't enough buttons to efficiently program computers. Most programming languages have the concept of relational operators.…

Continue reading →

Code Palindromes


Binary code displayed on a screen.

An idle thought on a long weekend. Is it possible to create an executable binary which is a palindrome? It's trivial to create a palindromic program in, say, Python: print("hello") # )"olleh"(tnirp Save that as test.py and then run cat test.py | rev | python3 and it'll work. But that's boring! You could do the…

Continue reading →

Goodbye avatars .io - hello unavatar!


A smiling pixel art face.

Given a social media user's username, how do you get a picture of their avatar? I always used avatars.io - but sadly that service has bitten the dust. So I've switched to unavatar. It's dead easy to use. https://unavatar.now.sh/twitter/edent will return @edent's avatar. You can use GitHub, Facebook, Gravatar, Instagram, Telegram, YouTube, SoundCloud, and a…

Continue reading →

Programming Languages - look how far we've come!


List of computers.

Back in the 1980s, when my family first got a micro-computer, there were only limited ways to program your machine. The Internet was basically non-existent for domestic users. You could buy thick computer manuals, swap cassettes with other enthusiasts, or build a light pen and point it at a flashing square on your TV (Really!)…

Continue reading →

Why do we have different programming languages?


Pencil protrail of William Shakespeare - as though he were a Klingon from Star Trek.

I made a little girl cry recently. "But why do I have to learn Python?" She wailed, "I like Scratch!" "I know," I said, "But there are different programming languages for different sorts of tasks." "That's stupid" she said, with all the perception of 6 weeks Code Club experience. "You can do everything in Scratch."…

Continue reading →

Falsehoods programmers believe about flags


A dropdown box showing the flag of Canada next to a plus 1.

(For more about the "Falsehoods" meme - read the big list of falsehoods programmers believe.) Do You Want To Phone A Friend? A popular website asked me to confirm my phone number. It "helpfully" pre-filled the country-code with +1. And proudly displayed the Stars and Stripes. Except, of course, the USA isn't the only country…

Continue reading →

Adjusting timestamps on images with Python


A cute penguin.

As ever, mostly notes to myself. I have a bunch of old images which don't have any timestamp associated with them. This quick Python script will add a DateTime EXIF metadata tag to an image. This uses piexif which can be installed using pip install piexif This simple script reads a photo, adds a timestamp,…

Continue reading →

Don't use negative numbers for error codes


A warning to programmers - try to understand how people will use your error codes. This morning, I was confronted with a rather bemusing error message on my WordPress blog: Ok, so this should "never happen" and yet somehow it has. I wonder what on earth the error code means? I selected the error code…

Continue reading →

Why I vertically align my code (and you should too!)


There was an interesting discussion on HackerNews last week about the Linux Kernel coding style. During the discussion, I kicked off a minor holy war about whether one should vertically align code. I'm all for it! Let me explain why. What Is Vertical Alignment? Take this trivial example: int robert_age = 32; int annalouise_age =…

Continue reading →