⩵ != ==

by @edent | # # # # # | 3 comments | Read ~373 times.
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

by @edent | # # | Read ~101 times.
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!

by @edent | # # # | 1 comment | Read ~967 times.
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!

by @edent | # # | Read ~112 times.
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?

by @edent | # # | 6 comments | Read ~3,574 times.
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

by @edent | # # # # # | 3 comments | Read ~2,407 times.
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

by @edent | # # # # # | Read ~2,328 times.
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

by @edent | # # # # | 7 comments | Read ~1,697 times.

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!)

by @edent | # # # # # | 32 comments | Read ~84,121 times.

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 →

Extracting Your Own Location Information From Google - The Hard Way

by @edent | # # # # | 22 comments | Read ~40,942 times.

Update! There's a new way to do this - read my latest post to find out how. Two or three years ago, I was contacted by a recruiter from Google. They wanted to know if I'd be interested in working for the advertising giant. We played the usual game of dancing around salary and schedules,…

Continue reading →