We don't like first-past-the-post elections. But what should we use instead?



In 2023, Toronto had a pretty interesting mayoral election. Not just because John Tory abruptly resigned after having an affair with a staffer, but also because his successor — Olivia Chow — has won the subsequent election with only 37% of the vote. Though she has been a decent mayor so far, we have no way of definitively knowing that she was really the choice preferred by most Torontonians in a 1v1 matchup against any other candidate.

It’s not hard to find even more extreme outcomes under the first-past-the-post system. Take, for example, this 2021 Canadian federal election result in the electoral district of Coast of Bays—Central—Notre Dame, where a vote split on the left has definitely produced a winner that the majority of the voters didn’t want:

Party Candidate Votes %
Conservative Clifford Small 14,927 46.89%
Liberal Scott Simms 14,646 46.00%
New Democratic Jamie Ruby 2,261 7.10%

So how can we make the system more representative?

Read more...


Canadian housing crisis: what will it take to fix it?

What exactly is the scale of the housing crisis in Canada? Fortunately, most of the data is pretty straightforward to find. You can go to the Statistics Canada website, grab the housing stock table and the population by age table (click “Add/remove data” to see more years), and pretty quickly arrive at something like this:

2016 2024
Population > 18 29,027,447 32,600,713
Units available 15,507,364 16,786,020
Units/person 0.534 0.515
Units needed to get to 2016 levels - 630,000

I.e. we need 630,000 houses or apartments just to get back to 2016 levels of housing availability. A bit over half of this number comes from Ontario; repeating the math for that province gives us a shortage of 333,000 units compared to 2016.

Read more...


The Great Time War of 2022-10-03 09:45

(Unlike the rest of this blog, this is fiction. Or is it?)

Alright, let’s do this, Daniel thought as he walked down into the basement from the kitchen, coffee cup in one hand and a small notepad in another. Walking up to his workshop in the corner, he put the coffee at the left edge of the desk, as far away from the mess of electronics and wires as possible, and sat down. The notepad went onto the desk right in front of him. Its top page showed the indentations left by the pen when Daniel wrote yesterday’s to-do list onto the previous top page, now torn out.

In front of him, occupying most of the desk, was what once used to be a microwave, before it was disassembled, modified, and reassembled most of the way back. Its inner chamber was now lined with reflective insulation, blocking the view inside; its right panel was missing because it didn’t fit over the new set of transformers and relays; and on top Daniel had bolted on a printed circuit board with the microcontroller—the new brains for the device. But the main changes, what made this no longer a microwave, were on the inside. If he was right, and several different calculations suggested that he was, these changes should let him send small amounts of matter back in time. In theory, at least. Today was the day to see if it worked.

Read more...


REST API design: lessons learned from going down the wrong (and right) paths

Recently I had a chance to participate a sort of retrospective at work on how we organize and write REST API endpoints. That made me look back at some API design decisions I’ve made (and seen) over the years and realize that some of these choices are not at all obvious and that you often don’t see the tradeoffs until you’ve done it both ways and seen the results.

So here are some of the less obvious REST API design lessons that I’ve learned over the years.

1. Do not nest objects in URL paths

Suppose you have task objects that always belong to project objects. What would should be the URL to get information about a task? Should it be this:

1
GET /api/projects/{projectId}/tasks/{taskId}

or this?

1
GET /api/tasks/{taskId}

Read more...


My lazy Wordle strategy: same words every time

TL;DR: After the analysis in this post, I started using SLANT PRICE DOUGH BALMY, but it may not be the best sequence for you.

There are lots of great videos and articles on the optimal Wordle strategy. I particularly enjoyed this YouTube video by 3Blue1Brown on using the information theory to come up with the best guesses.

But I can’t play like that. First, I’m lazy, and second, my slow human brain can’t do information theory calculations or depth-first searches.

Instead, every time I play Wordle, I enter the same sequence of words until it feels like there aren’t many solutions left, at which point I try to make more tailored guesses.

Here are a couple examples of my recent games:




Until today, my go-to words were STALE, CHIRP, MOUND, and GAWKY, picked mostly by gut feel while trying to check as many frequently used letters as possible. So far I’ve been doing alright with them.

But can we do better?

Yes! Let’s use math and programming to do better.

Read more...


Progress in neural electrodes

Suppose you want to collect some signals from neurons in the brain. What kind of wire should you stick into the brain to do that? Could it be just any wire, or do you need some special brain-grade wire?

That’s something that I’ve been curious about for a while now, so I’ve read a bunch of papers on the subject.

Metal electrodes

Surprisingly, off-the-shelf 44 AWG insulated copper wire is not a completely terrible choice. Its 51μm diameter (plus insulation) is a bit on the high end for a typical intracortical electrode, but it’s about the right order of magnitude. If you stick it in, for a short time it has a decent chance of picking up electric spikes that nearby neurons send when they get excited.

But it’s still a terrible choice. First, the copper will quickly oxidize and corrode in the brain’s electrolyte-rich fluid. And second, copper is toxic to the neural tissue. So don’t put copper electrodes into anyone you love.

Read more...


Getting started with FPGAs and Verilog

I’ve been curious about FPGAs since I first heard about them over ten years ago, and over the past month I finally gave them a try for a couple personal projects.

The FPGAs are certainly… different from any other kind of programming, and it took a bit of effort and troubleshooting to get my FPGA calculator working. If you’re interested in getting into FPGAs, here are a few tips below.

Read more...


Human vision system - a simple description

So when we see something in front of us, like a pencil, how exactly does the brain understand that yep, that’s a pencil?

Like, what is the detailed sequence of steps that happens? The eyes presumably convert the light to neural signals (how?), then these get sent to the brain (where?), and then the brain does… what?

I’ve been reading through a bunch of neuroscience textbooks and papers for the past six months, and I think I’m at the point where I’ve now got the whole picture.

So here are the core pieces of this picture, with a lot of details omitted to fit it into a short blog post.

Let’s start with the input.

Read more...


Image stabilization - in humans

As I read more neuroscience, I run into more interesting neural circuits. One of these circuits is the Vestibulo-Ocular Reflex (VOR) that helps us keep the eyes locked on a target when the head moves.

What’s interesting about it are both its simple wiring (at first glance), and the extensive hidden support circuitry that can tell us more about how the brain works.

VOR is not the only circuit that helps us keep our eyes locked on target; there are others that work in parallel. I suspect that they probably use the same underlying principles.

(Note: some links here are behind a paywall. Remember that it’s illegal to go to Sci-Hub and search for the DOI link of the article to get free access to it.)

Read more...


Neuron circuits in the retina - more than just pixels

There’s also a YouTube version of this article.

The picture above shows some (far from everything!) of what we know about the cells and neural circuits in the human retina.

What’s interesting is - the retina is not just a light detection organ. It’s a complex electro-chemical calculator with three neural layers, and it uses these layers to extract a number of useful signals from the light that hits our eyes.

Below, we’ll step through some of the more interesting features of the retina, but if you’d like to learn more, the above picture (and this article) are mostly based on this review article published in Feb 2020 in the journal Progress in Retinal and Eye Research, and on chapter 17 of the latest edition of Ryan’s Retina.

Read more...