Category Archives: Technology

Math Problems

I’ve noticed a few Grade 6 math problems on Facebook that I’m sure Einstein would be embarrassed to see his picture on. I’m not sure which is sadder, that people consider a problem given to 11-year olds genius-level, or that only 50% of adults got the answer right.

I’m much more interested in the problems that FiveThirtyEight has been posting for their Riddler series. This week the problem involves cars getting stuck in traffic. Thankfully, not something I normally have to deal with, but I think I figured out the answer.

The Problem:

There is a very long, straight highway with some number of cars (N) placed somewhere along it, randomly. The highway is only one lane, so the cars can’t pass each other. Each car is going in the same direction, and each driver has a distinct positive speed at which she prefers to travel. Each preferred speed is chosen at random. Each driver travels at her preferred speed unless she gets stuck behind a slower car, in which case she remains stuck behind the slower car. On average, how many groups of cars will eventually form? (A group is one or more cars travelling at the same speed.)

My solution:

f(N) <- average number of car groups if there are N cars
f(0) = 0
f(1) = 1

If we have 2 cars there is 50% chance of the first car being faster, which would create 2 groups; and 50% chance of the 2nd car being faster and merging into a single group.
f(2) = 0.5 * 2 + 0.5 * 1 = 1.5

More generally, if we just consider the first 2 cars. There’s a 50% chance of there being a solo lead car plus the groups that form behind it, and a 50% chance of the first car merging into the group behind it. We can define the average number of cars recursively, where:
f(N) = 0.5 * (1 + f(N-1)) + 0.5 * f(N-1)

that equation reduces to:
f(N) = 0.5 + f(N-1)

testing it out:
f(2) = 0.5 + f(1) = 1.5
f(3) = 0.5 + f(2) = 2
f(4) = 0.5 + f(3) = 2.5

Which is an arithmetic series that can be reduced to:
f(N) = 0.5 + 0.5 * N

or more succinctly:
f(N) = 0.5 * (N + 1) (for N >= 1)
f(N) = 0 (for N < 1)

Loving the Cloud Money

One of my favourite tech discoveries this year has been nTrust – a mobile payment app made by a local Vancouver startup. I’ve been using it to transfer money between friends (like Interac e-transfers but without any fees) and purchase lunch from local food carts.

They’ve been pushing hard to increase their user base and running a lot of lucrative promotions. If you sign up using referral code ‘chr597’ you get $10 for free. They’ve also been running deals with cloud money discounts at my favourite food carts – Arturo’s and Culver City Salads. Nothing like a free lunch.

I’ve been using their app a lot and they asked if they could feature me on their blog. The post went up today – Keep on (taco) truckin’. Somehow I mislead them into believing I was a born in Vancouver, but other than that I’m happy with how it turned out.

The pitfalls of 2 factor authentication

TL;DR: Don’t leave home without backup codes.

My cellphone is dead. It is stuck in a crashing boot loop. Factory reseting the phone hasn’t helped. It might be salvageable by flashing the ROM, but that’s not easy to accomplish while traveling (I did attempt it at an Internet cafe- epic fail).

So much for getting a local SIM card. The worst part is I’ve been locked out of many of my online accounts (Google, Dropbox, wordpress, and a few others) because they rely on Google Authenticator or the ability to receive a text message. Silly me, I didn’t print out any backup codes before I went travelling. Lesson learned.

So I can’t check my email on any machine. I can’t write blog posts either, but luckily Emily has authorship rights to this blog.

I’m now in the market for a new smartphone, but that might have to wait until we get into a bigger city. We’re traveling through small towns for the next 10 days.

In the meantime, I have 2 options for getting into my google account. Send my password to a someone in Canada that can access a trusted device (my work laptop). Or if that doesn’t work, start the process of unlocking my account with Google, which takes a week for security reasons.

I think 2-factor authentication is great under normal circumstances, but next time I go traveling I’ll likely disable it.

Living Like the Jetsons – Rosie the Roomba

Roomba and Cat
I’ve outsourced my duties as Official Floor Cleaner to Rosie, a Roomba 770 we named after the robotic maid on The Jetsons. With two cats, keeping the fur balls under control is a full-time job. Rosie is temperamental, but our floors are definitely cleaner now.

The Roomba does best with frequent, small cleaning jobs. Rosie is scheduled to clean everyday, usually when we’re out of the house. It has no problem handling hardwood floors and carpet, although it does a better job on the carpet, and excels at getting into tight spaces. It’s frightening how much dust and dirt it found under our bed.
Roomba Hair Removal Expert

I had hoped it would keep the floors clean when we were gone on vacation, but it needs daily attention. The dust bin is small and has to be emptied after almost every run. When we first ran the Roomba, it collected so much dust we had to empty it mid-run. Every week or two, I take it apart to remove all the hairs that become tangled in its rollers. Not a lot of work, but not fuss-free either.

I’m impressed with how well constructed and engineered the Roomba is. It feels like it’s designed to last and be easily repaired. I’m less impressed with the artificial intelligence. I thought it would slowly learn the layout of our apartment, but it seems to bump around in the same chaotic way today as it did on its first run. Our dining room table has become Rosie’s nemesis. She spends a lot of her time caught between between the chair legs, just wide enough for her to squeeze between before becoming trapped. She often bumps around for 10-15 minutes before frustration (or the robot equivalent) sets in and she goes back to her dock defeated.

We’ve gotten better at Roomba-prooofing the house before we leave in the morning. Often, we’ve come home to find Rosie impaled on a towel or entangled on a cord we left lying on the floor. The best was when she snagged the cord for the blinds and pulled herself a few inches off the floor. Luckily the Roomba is smart enough to know when its stuck and will shutdown before causing permanent damage.
Roomba Impaled

Rosie has worked so well at cleaning up after the cats, we’ve experimented using robots to play with them too.

Novus – Faster and Cheaper Internet

We finally ditched Shaw and moved to Novus for our internet provider – it’s faster and cheaper, and the customer service is better. What’s not to like?

novus_vancouver_availabilityNovus is a fibre optic internet provider and the only real alternative to the big telecoms (Shaw and Telus). They’ve been expanding out of downtown Vancouver, hooking up buildings to their fibre optic network. Our building was the last one in the Olympic Village to gain access, but it was worth the wait.

Now that we’ve made the switch, our internet bill has been cut in half. I ran a speed test on both Shaw and Novus while I still had access to both. The download speeds are comparable (our download speed with Shaw was double what we were paying for) but the upload speeds are 20 times faster on Novus. Uploads on Shaw are noticeable slow, especially when syncing files with Dropbox or uploading pictures to Flickr. With Novus uploads fly.

A quick comparison of our Shaw and Novus plans.
Shaw – High Speed 10
Cost: $55 + taxes
Download Speeds: Up to 10 Mbps
Upload Speeds: Up to 0.5 Mbps

Novus – Internet 25
Cost: $32.50 + taxes
Download Speeds: Up to 25Mbps
Upload Speeds: Up to 10 Mbps

Top Canadian Veggie Blog Posts of 2013

On Top of the Chief
My most popular blog posts in the past year:

Wordle 2013 Search Terms
Most common search terms: anni friesinger, the chief hike, hiking the chief, the chief vancouver, and homemade energy gel.

Complete year-end stats are available in this fancy year-end report prepared by

Developing Trex – Pulse Energy’s new Hubot

trex hubot
Every month or so at work we run a Big Idea Day where developers can work on fun projects of their choosing. For our last Big Idea Day, I paired up with one of our co-ops and integrated Hubot into our chat room. A lot of the chatter at work happens online in a chat room, it’s handy for keeping noise down in an open work environment and for keeping our remote employees engaged.

Hubot is an open-source chat bot developed by GitHub. It has some productive uses, but it’s mostly used for the inane – like pug bombing, quoting the Ferengi rules of acquisition, and littering the chat room with animated gifs. We named our Hubot Trex and in a few short weeks he’s become a fixture in our development chat room.

There’s lots to like about Hubot. It’s a free, open-source project. When I ran into a bug, it was easy to fix it myself and contribute the patch back to the community. Hubot also supports pluggable scripts. There are hundreds available online to choose from (everything from Breaking Bad quotes to hangman) or you can write your own.

I wrote a plugin to keep track of leaderboards. We play a lot of boardgames at work during lunch (King of Tokyo and Dominion usually) and Trex is now responsible for tracking the winners of every game.

On the productive side, the goal is to use Hubot to centralize some of the operational tasks we do – like deploying new versions of our software, spinning up new machines, and diagnosing problems. If tasks are done via Hubot, there’s a persistent log in the chat room that everyone can read and it’s interleaved with comments from the developers about why things are being done. It’s especially handy for our remote employees.

p.s. Pulse Energy is hiring. If you apply, mention this blog post for bonus points.