Status update: 2020

Pretty sure I'm in the minority on this one, but this year was actually a good one for me! One of the best in a while, to be honest…

Server upgrade 2020

Regular readers of this blog have probably noticed that it is now served from a different IP address… Okay, okay, I'm kidding! This blog doesn't have any regular readers, of course.

Anyway, what I'm trying to say is that I recently spent quite some effort to move all my stuff — softwaremaniacs.org, highlightjs.org, their supporting databases and, most importantly, my personal email — to a new and shiny Linode instance under control of an up-to-date Ubuntu.

Here's the (heavily compressed) war story.

On Kotlin

I've been writing code in Kotlin on and off over a few months, and I think I'm now at this unique stage of learning something new when I already have a sense of what's what, but not yet so far advanced so I don't remember beginner's pain points.

Here's a dump of some of my impressions, good and bad.

Dicts are now ordered, get used to it

There were several moments over the last few weeks when I heard people discuss differences between Python lists and dicts and one of the first ones mentioned was that lists are ordered and dicts are not.

Well, not anymore. Quoting the docs referenced above:

Changed in version 3.7: Dictionary order is guaranteed to be insertion order. This behavior was an implementation detail of CPython from 3.6.

So if you want to discuss fundamental differences you can pretty much only point out that dict values are accessible by keys, which could be of any immutable type, while list values are indexed with integers. That's it :-)

Python stdlib gems: collections.Counter

Here's a toy problem. Given a corpus of phone numbers for different countries determine a most prevalent display format in each country and use it to re-format an arbitrary phone number for its country. For example, if most US numbers in our data corpus are written like xxx-xxx-xxxx then the string (206) 1234567 should be converted to 206-123-4567.

For simplicity, let's assume that all numbers are local so we don't have to deal with complexity of international prefixes.

Misconception about OSS support

You wouldn't think a free syntax highlighting library would be a strong dependency for the development process of a business, and yet I'm waking up on a Monday to a flurry of comments and even one personal email from engineers eager to ask me to work for free for their employers.

So of course I took time to scathingly turn it into a teachable moment.

Status update: 2018

Hey, I almost managed an entire calendar year without a post! Not that I was ever adhering to any notion of schedule here, but I have to admit that lately I miss blogging more and more. It was nice to have a not-insignificant voice and be able to make some difference with things I used to care about, and still do.

Let's see if I can revive some activity here. No promises, of course…

Treat HTTP status codes as strings

I usually see HTTP status codes being checked as integer numbers:

if ((status >= 200) && (status < 300)) // or `<= 299`

This is rather verbose. But if you think about it, it's the first digit in the number that has a special value, and there are only five of them:

Status update: 2016

I thought I'd post something for no reason…

Liberal JSON

Tim Bray beat me to writing about this with some very similar thoughts to mine: Fixing JSON. I especially like his idea about native times, along with prefixing them with @ as a parser hint. I'd like to propose some tweaks however, based on my experience of writing JSON parsers (twice).

Archive…