Sunday, February 12, 2017

Cyclists: how to stay safe on London's roads

First of all, as a daily bike commuter in London town, I would encourage anyone to consider cycling to work. Yes, there are inherent risks, and I have seen many close calls since I ditched the Tube for the bike (coming up to 10 years now!). However, if you keep your wits about you, you can really enjoy a safe, stress-free experience on the road. 🚴😎

The internet is full of helpful tips on cycling in the city, so I am not going to go into details here, but it is worth reminding yourself every now and again to:

  • be seen - wear high-viz or high-contrast clothing
  • light up - don't forget your lights, especially during winter mornings
  • signal - let other road users know your intention
  • be assertive - hold your position and don't get pushed to the pavement
  • look behind you - be aware of the traffic around you 
  • not jump the lights - traffic lights are there for a reason

Instead, I would like to focus on a few scenarios that can lead to potential accidents.

Beware of slow traffic 1 (oncoming traffic turning right)

When traffic starts to slow down, watch out for gaps developing.

Imagine this: on a two-lane road, you are cycling along the left-hand-side bus lane, and to the right, cars are starting to go slow, maybe even slower than you. Suddenly a car in front stops to let another car in the opposite direction turn right. While waving "thank you" to the friendly driver, the right-turning driver step on the accelerator and drive straight into your path - they just cannot see you.

Oncoming traffic turning right

Bus lanes do not make you invincible, so be extra careful when you are undertaking slow/queuing traffic. Reduce your speed, and watch out for gaps (as well as kamikaze pedestrians).

Beware of slow traffic 2 (traffic ahead turning right)

OK, so undertaking is dangerous, what about overtaking by filtering between opposite lanes? I mean, motorcyclists do it all the time, right?

Remember, you are only fast enough to overtake traffic if cars are slowing down. Why do cars slow down? A car in front maybe waiting for an opportunity to turn right (hence holding up the traffic behind). The driver may then have spotted a gap and, without noticing you, they drive straight into you.

Traffic ahead turning right

If you want to overtake traffic, be extra careful and watch out for cars turning right. Again, reduce your speed, and do not assume that drivers will always signal.

Don't blindly go into a bike filter lane

Finally, bike lanes and filter lanes give a false sense of security. While the traffic light is red, do not automatically think you need to cycle down the left of the waiting cars to get in front of them. Yes, the filter lane is designed to help you get to the front. However, there is no guarantee that, when the light turns green, the driver next to you is going to spot you (they may want to turn left and drive straight into you).

If you don't know when the light is going to turn green, it is probably safer to stay behind the cars.

Final words

Slow traffic is a bit like the calm before the storm. One minute, you are happily filtering past traffic; another minute, a car is going to appear out of nowhere, before you can slam on those brakes.

Stay safe and ride on!

Thursday, June 30, 2016

Chromebook (+ Crouton) - first impression

I have been considering whether to buy an Android tablet with a keyboard or a Chromebook. While most of what I need to do at home on a daily basis can be done inside a browser on either a tablet or a Chromebook, two interesting Chromebook "features" swayed my decision: 1) one can supposedly run Linux on Chromebooks 2) one will soon be able to run Android apps inside ChromeOS. So I went and bought an ACER CB5-311 Chromebook. At £140, it is certainly very competitively priced.

During the first two days, I

  • used the browser heavily for GMail, GDocs, Slack, and Evernote
  • published my first Medium post
  • used Pixlr Web to do a fair amount of image editing
  • installed Ubuntu via Crouton
  • installed Heroku CLI inside Ubuntu to create a Git clone of my website
  • used Zed Code Editor for editing some of these HTML and JS files inside ChromeOS
  • pushed these changes live using Git inside Ubuntu

The physical experience of using the Acer Chromebook is a far cry from that of using a MacBook Air. E.g. the touch-pad action isn't great and why is it that only Apple can design a light-weight laptop that can be opened with one hand?! But at this low price, I am actually quite impressed.

Installing Ubuntu (without a Desktop Environment)

I will write a bit about my experience installing Ubuntu using Crouton, which is a script to generate Ubuntu/Debian chroot inside ChromeOS. I was reading quite a bit about Crouton before buying the Chromebook, and initially it all seemed a bit confusing. But as it turned out, the installation was plain sailing.

First of all, I read that 1) x86 processor 2) 32Gb storage and 3) 4Gb RAM are what are required to run Linux on Chromebooks. I understand that the x86 requirement is an architectural one. My Chromebook came proudly with a "Intel Inside" sticker, so I should be fine. On the other hand, my budget machine only had 16Gb of storage and 2Gb of RAM. But it should at least cope fine with a bare-bone installation of Ubuntu? For what I have to do, I don't really need a graphical interface.

Enable ChromeOS Developer mode

The first thing one needs to do is enable Developer mode. Refer to this page to see how to do it on various machines. Warning: switching between normal and developer modes will erase your ChromeOS account setting! One thing I found was that after pressing Ctrl-D in Recovery mode to enter Developer mode, my machine appeared to be doing nothing for up to half a minute before it finally rebooted. Just wait until it reboots by itself!

Note that, once you have committed to Developer mode, every time you boot up the machine, you will be presented with the "scary" warning message and a delay. You can bypass the delay by again pressing Ctrl-D at this point.

Download Crouton

Get it from

Open a shell

Inside ChromeOS,
  1. Ctrl-Alt-T
  2. type shell
  3. press ENTER

Install Ubuntu without a desktop environment

Inside the shell, run sudo sh ~/Downloads/crouton -t cli-extra

Instead of specifying xfce as the target to install the Xfce Desktop Environment, I chose to install Ubuntu with the cli-extra target to keep the installation small.

When asked for a new username and password, pick something sensible. You will need the password when you do sudo in Ubuntu in the future.

Log into Ubuntu

Once the installation has completed, just sudo enter-chroot to log into Ubuntu!

Proof that it has worked :)

When you are done, just type exit inside Ubuntu to log out. Your Ubuntu installation is safely saved inside your machine storage.

Final words

I am impressed with how Ubuntu runs on my Chromebook so far. I am able to have the Ubuntu session open, alongside a number of Chrome tabs, and see no noticeable performance issues. I like the fact that the ChromeOS Downloads folder is automatically mapped to ~/Downloads inside Ubuntu, and that copy-and-pasting works well between the two OS's.

However, there is one thing I still wish for, and it is the ability to run Docker. From what I have read so far, this is not going to be an easy task, as it would involve some serious kernel customisation...

Thursday, October 15, 2015

Bar-end brake lever and best bike maintenance trick ever

I decided to finally get rid of my old-skool Weinmann brake levers in favour of some bar-end brake levers, to give my single-speed a neater, more streamlined look. After some googling, I bought a pair of Dia Compe 188 Reverse Brake Levers. They are pretty reasonably priced, and well-made. My handlebar is a DIY Chop-and-Flop affair, with an inner diameter of just under 20mm. Initially I did not realise the aluminium tubes that came with the brakes were actually shims for handlebars with wider inner diameter (>20mm) - they looked to me to be parts of the brake levers. I tried to force the levers with the shims into the bar ends. Realising my mistake, I installed the levers without the shims and was happy to find that they sit very snugly inside my handlebars after some tightening.


Bullhorn with "normal" (non-reverse) brake levers mounted

Now with Dia Compe 188 Reverse Brake Levers installed

Cables neatly concealed underneath the bar tape

p.s. the levers are designed to work with BMX-style barrel brake cable nipples, but I decided to keep my original brake cables with road-style pear cable nipples. Personally, I think the levers work with pear nipples just as well.

Best bike maintenance trick ever...

So what is the best-kept secret? I had to shorten my brake cables as the cables now run from underneath as opposed to from the top of the levers. The problem with trimming brake inner cable with normal pliers is that the inner cable tends to squash under pressure, and refuses to cut cleanly. While some people would insist on buying specialist bike cable cutter, I found out that if you wrap the cable tightly with a bit of insulation tape before cutting through it, you can actually achieve a clean cut with normal pliers! Trust me, it works a treat.

Wednesday, July 15, 2015

Visualising 2015 Tour de France yellow jersey data

The Tour is here! I have always been fascinated by how GC (General Classification) contenders fight for their rights to wear the yellow jersey up in the mountains of the Pyrenees and the Alps. Names like Col du Tourmalet and L’Alpe d’Huez evoke scenes of epic battle between climbers riding out of the saddles, pushing their very limits.

So I decided to have a go at visualising the stage-by-stage times for the top yellow jersey contenders, to see how they gain and lose ground over the 21 stages.


I used the excellent (and free) tool to extract data from By creating an extractor, I was able to

I then wrote a couple of Node.js scripts to, on a daily basis,

  • fetch fresh data using the REST api and persist results from each individual stage into MongoDB
  • create and persist the json array required by the Google Charts library to render the line chart, based on the latest top 10 GC contenders

I came across the problem of having too many asynchronous operations (e.g. MongoDB queries) to manage in the second script. To avoid callback hell, I gave the q npm package a go. While I had been using jQuery promise (on the client side) for years, this was the first time I tried such technique in Node.js on the server side. Good news is the package worked a treat - below is a simple code snippet to illustrate how simple it was to use:

p.s. Today Chris Froome destroyed everyone during the climb up La Pierre-Saint-Martin to stretch his advantage to 2 minutes 52 seconds. Let's see whether he can maintain his lead all the way to Paris!

Sunday, June 14, 2015

Mapping the Lisbon Tram 28 route

Trying to figure out whether Tram 28 is going to take you where you want to visit in Lisbon? Now you can see the route on an interactive Google Map.

At some point, most visitors to Lisbon will have been on the legendary no. 28 yellow trams which run from Martim Moniz to Campo de Ourique (Prazeres), climbing many incredibly steep slopes and negotiating numerous impossibly tight street corners.

While the Transportes de Lisboa site provides information on the Tram 28 stops, the map downloadable from the page is sadly not terribly useful for visitors who are not acquainted with the maze that is the winding streets of Lisbon. For example, the map does not show easily recognisable metro stations or street names. We wanted to travel to the Campo de Santa Clara flea market (open Tuesdays and Saturdays) but the map did not really give us a good idea of how easy it would be to get there by Tram 28. So I naturally googled to see whether there was an interactive online map of the Tram 28 route, and I found none.

Coming back home, I decided to create one.

Tram 28 on Google Map

Explore the famous Tram 28 route on Google Map, where you can search for places and access Street View, etc. I hope future visitors to Lisbon will find this little map useful.

(I used to plot the route, and to extract the coordinates in KML format, before overlaying the route on top of Google Map)

Saturday, May 02, 2015

London Underground Metropolitan Line Luggage Rack

Sze Kiu and I went to the London Transport Museum Acton Depot open day last week, and we could not resist the temptation of buying a reclaimed luggage rack from the now de-commissioned London Underground Metropolitan Line "A Stock" trains.

The old "A Stock" train -

Not only is the rack a piece of iconic London history, it also proves to be an extremely practical and stylish item for our living room. Voila:

They are available from the London Transport Museum online shop (at a considerably higher cost than what we had to pay for at the open day, incidentally)

Saturday, March 28, 2015

Product management: a walk in the wild

Roadmap is often used as a tool to plan how a product gets developed and evolves. Being a keen walker and also a product manager, I was pondering today on the "map" metaphor.

Here is a series of simple analogies:

  • As a walker, you set the objective to climb to the top of a hill.
  • As a product manager, you set the objective to reach a targeted number of active users.

  • As a walker, you establish a strategy to climb the hill by taking the most direct route.
  • As a product manager, you establish a strategy to grow your active user base by developing a specific set of features to differentiate your product.

(Hopefully, you will have somehow validated your strategy!)

  • As a walker, you map out the segments and plan your walk.
  • As a product manager, you map out the features and plan the development work.

  • As a walker, you make tactical decisions during the walk on when and where to stop for food, when to put on your waterproofs.
  • As a product manager, you make tactical decisions during the project on what user stories to prioritise in the product backlog.

  • As a walker, you monitor the distance and make adjustments to make sure you make it to the top.
  • As a product manager, you monitor the product metrics and make adjustments to make sure you hit the target.