Code Jam 1A :/

Published

Tags: and

Well, I started off round 1A feeling good. By the 6min mark I had solutions for the small and large inputs for problem A submitted, then… everything fell apart. It was my first time in a long while writing code under live competition conditions, and I’d forgotten just how tough it can be. Time for more practice.

Ignoring my total failure to get working solutions across the finish line, the next two problems weren’t actually hard – they could fit in as medium problems in a qualification round. In fact, so many people solved them that getting a perfect score wasn’t even enough to get to Round 2.

By the way, my Python solution for problem A brings me to 9 languages in this Code Jam. Will I keep going? That depends on how jet-lagged I am for rounds 1B and 1C.

Code Jam 2016 Qualification Round

Published

Tags: , , , , , , , , and

This year’s qualification problems were all straightforward puzzles. None of them needed sophisticated implementation techniques, or advanced algorithms, or complex data structures. They just needed patient analysis and careful coding. That’s nice from one perspective, but unfortunately it’s hard to make a good comparison of programming languages when every problem can be solved with just loops and arrays. Still, I succeeded in my goal of producing every output with a different (sometimes terrible) language.

Here’s my code and commentary on the problems. Warning: spoilers ahead. If you haven’t looked at the problems yet, go do that first.

How Dirtying Pure Functions a Little Can Be Useful

Published , Updated

Tags: , , and

Functional purity is a valuable concept for writing maintainable code, though outside of functional programming languages like Haskell, it’s often treated like a nice-but-expensive luxury. But it turns out that pure functions that aren’t quite so pure can be cheap while still having concrete benefits for code in non-functional languages like C++, Java and Python. For D code, this is supported by the language itself, but there’s nothing D-specific about the overall idea.

Registered for Code Jam 2016

Published

Tags:

I’ve just registered for Code Jam, Google’s annual programming contest. Unfortunately, the schedule means I might have to do a round or two while on the road, but I’ll give it a shot.

I’m a firm believer that programming languages are tools, and using the right tool for the job matters, so I’ve always used multiple languages for Code Jam. For a bit of extra fun this year, I think I might try for a personal record for language count.

In particular, this is my first Code Jam in a few years, so it’ll be the first one where I’ll use D. D’s standard library is weak on containers (at least for now), but otherwise it’s a really good language for problems like this.

Omoide Kaeru

Published

Tags:

Today is the fifth anniversary of the 2011 Japanese Tohoku earthquake disaster. When disasters happen, news sources tend to focus on dramatic statistics like the number of deaths or the number of homes destroyed, and not so much on the very long process of recovery. In the 21st century, though, it’s much easier to find videos on the internet produced by the disaster victims themselves. Unfortunately, as in the Japanese disaster, language barriers can stop the messages reaching far beyond the disaster area.

So I thought I’d translate one of the videos. It’s about Omoide Kaeru, a non-profit organisation that’s been restoring and returning items found washed up after the tsunami hit Sendai. The video mostly talks about photos, but the group has also been handling personal documents like certificates.

By the way, the original video is from 2013, but Omoide Kaeru is still working in 2016.

Why Defensive Coding Matters - A War Story

Published

Tags: , , and

Story time.

What Difference Can Order Make When Hashing?

Published

Tags: and

I saw this thread about password hashing on the D language forums. The original post had a good question that didn’t get answered at the time: if you’re hashing a bunch of things, can it make any difference (for security) what order you do it?

The answer turns out to be yes, and it’s a neat example of the difference between theoretical ideals and real-world systems. Because I think this stuff is worth knowing if you’re using cryptographic hash functions for, you know, actual crypto, I thought I’d write up a blog post about why it can matter.