Programming Languages - look how far we've come!

by @edent | # #
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 ~2,777 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 | # # # # | 2 comments | Read ~2,134 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 ~1,680 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 ~985 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 | # # # # # | 30 comments | Read ~82,717 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 | # # # # | 21 comments | Read ~39,310 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 →

Screenscraping Album Artwork From The Linux Command Line

by @edent | # # # # # # # | 9 comments | Read ~4,492 times.

Like many people, I've collected a fair number of CDs over the years. As hard-drives and MicroSD cards have got larger and cheaper, I've gradually been ripping them to FLAC. Most CD rippers automatically tag the music files with the correct metadata and, nowadays, they will also download and embed album artwork as well. (As…

Continue reading →

Aggressively Defensive Programming

by @edent | # # # # | 3 comments | Read ~534 times.

How much checking do we perform that our code is running as intended? I found a curious bug this weekend, which made me think about some of the assumptions that we use when programming. Imagine sorting an array using JavaScript. var arr = [10, 5, 66, 8, 1, 3]; arr.sort(); So far, so normal. Create…

Continue reading →

Use DRAKON to Generate Code from Flowcharts

by @edent | # # # # | Read ~15,894 times.

It's 1986. You're working on the Russian's Buran space programme - trying to create a re-usable space vehicle which will exceed the capabilities of the American's "Space Shuttle". There's a problem. You have very complicated real-time algorithms which you need to review, improve, optimise, and then turn into code. How do you do it? Obviously,…

Continue reading →