Category Archives: Uncategorized

Nicely colour data in Google Spreadsheets

Update: Google Sheets now has conditional formatting built in, so this script is not needed anymore; leaving it here for reference.

I love a feature in Excel (never thought I’d say that!) where I can choose a range of data and have Excel colour the backgrounds of the cells from red to green or green to red based on the cell’s value in the selected range. Excel calls this “Conditional formatting” and while Google Spreadsheets has a feature that has the same name, it’s really a completely different thing and it’s driving me nuts. But it has scripting, so I had to fix this lack of functionality.

Screen Shot 2013-07-04 at 16.54.59

To install this script, open your spreadsheet, open Script editor… in the Tools menu. Paste the source in and save. Then reload the actual spreadsheet. You should now have a new menu in your toolbar called ColourTool, with two options to colour cells. Choose the range you want to colour, choose an option and tada, your cells change background colour.

Note: This has not been tested extensively. There’s no code here to change the actual data, but, use at your own risk.

(Apologies for WordPress doing things to code formatting!)

function onOpen() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
ss.addMenu("ColourTool", [ {name: "High is Green, Low is Red", functionName: "hiToLow"},{name: "High is Red, Low is Green", functionName: "lowToHi"}]);

function hiToLow() { colourCells(1); }
function lowToHi() { colourCells(2); }

function colourCells(mode) {
var s = SpreadsheetApp.getActiveSheet();
var r = s.getActiveRange();
var rows = r.getNumRows();
var cols = r.getNumColumns();

var minV = 9007199254740992;
var maxV = -9007199254740992;

for(var i = 1; i < = cols; i++) {
for (var j = 1; j <= rows; j++)
var value = r.getCell(j,i).getValue();

  if(value !== "")
    minV = Math.min(value, minV);
    maxV = Math.max(value, maxV);


for(var i = 1; i <= cols; i++) {
for (var j = 1; j <= rows; j++)

var val = r.getCell(j,i).getValue();

var percent = (val - minV)/(maxV-minV);

  if (mode == 2) { percent = 1-percent; }

  var colour = getColor(percent);



function getColor(power)
var H = power * 0.4;
var S = 0.9;
var L = 0.6;

return hslToRgb(H,S,L);  


function hslToRgb(h, s, l){
var r, g, b;

if(s == 0){
    r = g = b = l; // achromatic
    function hue2rgb(p, q, t){
        if(t < 0) t += 1;
        if(t > 1) t -= 1;
        if(t < 1/6) return p + (q - p) * 6 * t;
        if(t < 1/2) return q;
        if(t < 2/3) return p + (q - p) * (2/3 - t) * 6;
        return p;

    var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
    var p = 2 * l - q;
    r = hue2rgb(p, q, h + 1/3);
    g = hue2rgb(p, q, h);
    b = hue2rgb(p, q, h - 1/3);

return [r * 255, g * 255, b * 255];


Teaching your kid to ride a bike, the right way

The summer has arrived and I’m seeing a lot of parents teach their children to ride a bike in my visits to Victoria Park. And it’s painful, as most of them are doing it utterly wrong. Learning to ride a bike is safe, fun and easy when done the right way, as opposed to the episodes of frustrated crying I’m having to witness.

Here’s how to do it the Right Way:

* You need a bike where you can adjust the saddle to go so low, your child can have both his feet on the ground simultaneously, knees bent.
* Do not purchase stabilizers, and if the bike already has one or more, take it off. Stabilizers make it harder for your child from learning actual balance.
* Remove the pedals from the bike, which turns it into a kick bike.
* STEP 1 for your child: learn to kick yourself forward using his/her feet without falling over. When he/she is good enough to glide forward for 5+ meters without touching ground, the balance is 90% there for biking. It’s probably a good idea to spend a couple days at this level, before progressing on.
* STEP 2: Put the pedals back on. Do not raise the saddle – you kid still needs to be able to put both feet on ground comfortably. Help the kid get started with the pedaling by pre-positioning the pedal of the stronger foot to be in the optimal position (just push down!), possibly gently pushing from the back to get up to speed (remember, he can balance on the kick bike). Your kid now needs to learn to get to speed and STOP on her own. Doing this bit on the lawn might be a good idea.

How long does this take? My daughter, age 3, learned the kickbiking to perfection within two days of practice (and didn’t need much encouragement as it was so much fun), and the pedalling step took about 10 minutes, after I told her she can’t ride on asphalt before she can start and stop by herself.

So what I’m advocating as a Bad Idea is:

* Using balancing wheels – they teach your child something other than balancing on the bike!
* Aiming to save money by getting a large bike, so you don’t have to get another one the next year.

So I’d have one more list here, here’s three additional tips:

* Remember to give a boatload of praise for your kid for trying to learn. Being praised for trying works much better than being praised for success.
* Get a good helmet. Of all biking helmets for kids, the best ones I’ve seen by far, are manufactured by Bell.
* If you can afford it, I recommend getting a learner bike and the real bike from Puky. The bikes are very high quality, and the saddle is adjustable to lowest height for each wheel size, that I’ve seen on bikes from any manufacturer.

Brief history of privacy, and a projection to the future

Privacy, as people currently think of it, is a modern invention.

If you go back 20 000 years, we lived in caves, where nobody had a second of peace. If you go back 200 years, practically everyone lived in small villages, where you had privacy in your home, but in practice everyone knew what everyone was up to.

The Village Privacy Model had a strong influence on people’s behaviour. If you behave in a manner that’s unacceptable to the community, you knew everyone around you go to know it, and you still had to face them. Mess up badly enough, and your life became very hard, regardless of whether there were “official” sanctions against you or not.

Enter urbanisation. People are moving into cities, where you’re effectively anonymous. It’s very easy to go and misbehave in a manner that wasn’t possible in smaller communities, and have no repercussions on it whatsoever. You won’t see those people again. You’re in the City Model of Privacy.

What this also means is the reverse – you can assume you’re in semi private mode at all times. Not only are you safe in your home, you’re also anonymous outside. I think this is having significant influence on how people perceive the expected level of privacy you have now – while at the village level there was almost no expectation of privacy, you can now expect privacy at all times.

Even further, enter Online use. You’re even more anonymous. Go to some random site to troll and there’ll be no repercussions. Nobody will know who you are. Nobody has the resources to track people.

Except you can’t assume this anymore. Technology caught up.

We’re entering a phase where it’s sensible to assume someone sees you at all times, and is probably making a recording of it. Both online and offline.

What inspired this post is this video. Some idiot tripped and severely hurt a young hockey player. It got recorded and went viral, and effectively ruined his life.

So for whatever it’s worth, we’re now getting back to the Village Model, from the brief experiment of the City Model. It’s Marshall McLuhan’s Global Village, with all of it’s privacy implications. He didn’t personally witness the computing technology explosion and so didn’t predict the implications to the extreme, but I’m sure he’d be excited if he was living today.

A lot of people are finding this new lack of privace extremely creepy and I don’t blame them. It’ll be interesting to see how the society adjusts. Going back to City Model is not going to happen.

De-moulding an espresso machine

Screen Shot 2012-12-25 at 16.16.22I’d been lazy and not dried my Rancilio Silvia espresso machine properly during a period of not using it for a while. To my horror, we found out some mould had developed inside the machine, which obviously made the coffee taste and smell pretty horrible. I did some frantic googling and found three suggestions to get rid of the mould:

  1. Descaler with mould remover
  2. Bleach
  3. Vinegar

Of these, I couldn’t find any of the recommended brands online or in local shops. I tried a regular descaler solution and it seemed to do the trick, but the smell came back in a week. I didn’t like the idea of using bleach as it’s properly poisonous, and it seems bleaches that are pure chlorine aren’t to be found in London. So vinegar it was.

Screen Shot 2012-12-25 at 12.36.02Ocado had the pictured strong (24%!!) pickling vinegar available. The process I used that seems to have worked was:

  1. Clean the water container thoroughly, until there’s no smell left
  2. Pump a full container through the machine
  3. Make a strong vinegar solution (I put half the bottle in half a container of water)
  4. Pump the vinegar solution through the machine until you can smell the vinegar is full through the pipes. Do this to both the coffee extruder (or whatever it’s called) and the steam pipe.
  5. Switch off the machine for an hour
  6. After an hour, pump the rest of the vinegar through
  7. Clean the water container thoroughly, again, until there’s no smell left
  8. Pump five full containers of fresh water through the machine, until there’s no smell left. Remember the steam pipe.
  9. Done!

Note this process is not recommended by the manufacturers as it probably corrodes some of the internals. Do this at your own risk!

Two weeks with Roomba

I’ve been eyeing robot vacuums ever since the first Roomba came out, and when the nearby supermarket had a Roomba 521 on clearance, I splurged. Here’s the experiences this far.

Some background – we have a dog and two small kids in a 74.5 square meter flat. What this means is, the flat goes from neat to disaster area in about a quarter of an hour, sometimes faster. And that happens every day. Enter Roomba.

The kids and the dog took a few days to adjust to their new friend. Kerttu immediately named the robot wally (or wall-e) and talked to it the first couple days but then mostly lost interest. I think the dog still sometimes thinks the vacuum’s out to get her.

The algorithm the robot uses to navigate floors is interesting and watching wally do his job is strangely hypnotic. I’m noticing I’m starting to learn to predict where the robot will go next, even though I don’t know how the robot works. Subconscious pattern processing is pretty amazing, I guess.

I’m positively surprised at the efficiency of the robot. It’s not perfect and if I vacuumed by hand, the rooms would definitely be cleaner. On the other hand, I’m getting a 95% vacuumed flat with the touch of a button, which is completely awesome. I don’t think our floors have been this clean in a long time. To be fair, the real test for wally will be when Luna the dog starts dropping hair in a significant manner during the summer heat. If the results are as good then and the vacuum doesn’t choke, I’ll be pretty darn impressed.

It’s pretty clear that in order to get real value, you need to establish a routine for clearing the floors from toys & random junk every morning and turn on the robot for daily maintenance vacuuming. This seemed a bit of an effort the first few days but I’m getting hang of the routine and I’m feeling good about the results.

Two complaints this far.

First, the unit we got feels noisy. I know it’s silly to assume a vacuum would be silent, but the unit looks somewhat graceful so I somehow expected it to be quieter based on the looks. I’d definitely prefer to be out of home when wally is working, but I work from home right now, so that’s unfortunately not an option every day. It does sound like half the noise is the motors though, so I’m sure the unit could be made quieter.

Second, the dock supplied with the unit is just silly. The dock is super light weight and the bottom of it is slippery, so I can’t see how it’s supposed to really work. After wally failed to dock the 50th time due to the dock slipping away, I just put some two sided tape onto the bottom of the dock so it doesn’t move anymore, and the problem was solved. I suspect rubberised bottom with more friction would fix the problem, but Roomba decided to save costs and give me a cheap piece of slippery plastic instead.

And a couple improvements.

Firstly, I suspect the navigation system of the robots hasn’t improved hugely despite the product having been on market for a fairly long time. The robot definitely doesn’t remember the flat’s layout. Given today’s tech, I’d be very surprised if it wasn’t possible to create significantly better system that was still cheap enough to manufacture, so from this perspective it looks like Roomba is resting on their laurels, waiting for someone to come to market with a superior product and eat their lunch.

Second, it feels like the product would be greatly improved by adding some more personality traits to it. The couple little quirks the robot has are great – when you activate it from the dock, the robot makes the same warning beep sound as if it was a truck, as it backs out from the dock. And apparently you get some quirky talking when you try to steer the robot with your foot a little too much. But I’d like to hear the robot tell me about how full it is. Or maybe occasionally speak out how many meters it’s traveled in the flat. A bit of Genuine People Personalities and I think I’d love the bugger a bit more. And a talking piece of kit would probably make the product more viral. Having a switch to turn off the personality might be a good idea though, with related snarky comments when you turn it back on.

Anyway, summary. Yes, after two weeks of use, I’d say the €250 was well spent. Had I paid €500, I’m not sure if I’d be as happy. If you’re contemplating getting a robot vacuum, I suggest you only get one if you get a good deal and are willing to keep your floors clean. With those caveats, it can be a great investment. :)

Update: I’ve been informed the current models are incredibly good compared to the Roombas that first came to market. Myself assuming they’ve not improved dramatically is a testament to how good a job Roomba has done on the robots – the current model Just Works, so the user gets an impression that creating the product must have been effortless. The truth seems to be a massive amount of iteration has happened, even if the product still looks similar to the first models that came out.

Smell of clean

When you think of what clean laundry smells like, what is the smell that comes to your mind first? I’m assuming more than half the people reading this will think of the smell of their favorite detergent, which means all those ads featuring happy women smelling laundry has been extremely successful at making people associate the smell of clean with a particular mix of chemicals.

Above thought came about as I was just hanging the laundry and smelled it. What clean laundry smells like is wet cloth, an almost nonexistent but perceptible smell. And clean here means the item of clothing doesn’t have anything on it including stains and chemicals. Just water.

Fixing Readability’s business model

John Gruber doesn’t like the way Readability is doing business. I have a simple proposal for fixing what they’re doing that I think would make almost everyone happy.

Readability should hire someone to work full time in creating a database of who owns each site they owe money to, going through domains in order of how much money they ought to pay the owner of that domain. Once you reach the person who owns a domain, just tell them how much you’ll give once they’ll sign up. If the content publisher refuses the money, it’d be a conscious choice, not oversight due to not knowing Readability exists.

There, most objections to Readability’s business gone.

GDC 2012

It’s GDC time again. You know, Game Developer Conference, the biggest event for computer game professionals in the west. I’ve been coming to San Francisco for the conference for quite a few years in the row now and given around 10 talks in the conference. This year is a bit different – I’m primarily here to meet VCs as one of the founders of MakieLab.

I’m amazingly well adjusted to the 10 hour time difference this time, which is probably due to two things I did. Firstly, I fasted for about 16 hours after landing, timing it so that the first thing I ate after landing being the first breakfast. Second, I went to Walgreens and popped a melatonin pill before going to bed. It’ll be interesting to see how the sleeping goes for the rest of the trip, but I got a good uninterrupted eight hours of sleep last night timed correctly to the clock here, so I’m hoping the week isn’t going to be a massive jetlag bomb.

The conference week will be incredibly hectic with meetings, but fortunately I have tomorrow free. We’re planning to go to Muir Wood for a visit. It’s the woods where Endor scenes were filmed, and I have a Makie with me dressed in a Jedi robe, which will be a fun little photographic experiment. I’ll post some photos immediately when I can. :)

Samsung Not Worried About Apple’s TV

Techcrunch posted a piece a few days ago about a Samsung product manager saying “TVs are ultimately about picture quality”, so he’s not worried about Apple’s rumoured TV efforts. They point out correctly that it’s a dumb thing to say, but don’t discuss a few specifics related to that.

I have an Apple TV box hooked to a Sony HDTV. My dad has a pretty new Samsung “SMART” HDTV. Of these three devices, Apple’s is the only one that’s easy to use and blazingly fast. The Sony and the Samsung have annoying reboot time. The menus stop to think too often. The Samsung’s smart capabilities seem like a value add-on that wasn’t allowed to cost anything, judging by how poor the software is and how slow the UI is. The first time I set it up (because it was too obscure to use for my dad), it took about 15 minutes to download and install software updates, and the first boot of the YouTube app took something like a minute. After going through some apps, I figured the user experience is simply so poor that I’d rather go do the laundry than frustrate myself more with the confusing, slow menus.

So, based on that experience, if Apple releases a TV with iOS capabilities in the tune of the Apple TV box, I assume I’d be very tempted. What they have now is a TV add-on that’s lightyears ahead of the competition in the few things that it does. And if the iPhone taught us something, a simple but super well executed solution is better than type of a diluted crap experience the Samsung is.

Recovering from phototherapeutic keratectomy

I had a pretty significant operation done to my right eye the last week and though I’d write down about it, partially so I’ll remember how it was myself.

Little background – I noticed about three years ago that my left eye’s vision degraded quite significantly over about six months. I didn’t think it was a biggie at the time – I’d had glasses since I was a kid, and I’d figured it’s a matter of time before the eyes would turn for the worse. I got new glasses and the problem mostly went away. Then about a year ago, I noticed the right eye was getting worse, too, and that happened faster.

I went to the doctor to get a referral to a specialist, which took a couple months to arrange. In the meantime I started developing easily tiring eye which made it harder to work the way I’d used to – on days I was really tired (partially from having a baby in the house) my vision was getting way too blurred in the afternoons to be able to write fast.

When it came to seeing the specialist, he noted a couple things – the vision measurement done using one of these fancy machines opticians use, and him checking the strength of glasses I should wear using the traditional method of making me swap between lenses and looking at a Snellen chart didn’t correlate. Also, he found a fairly large range of lenses produced the same amount of correction, where nothing would make me see as well as I’d used to. He didn’t tell me what to expect really, but gave me a referral to the Haartman eye clinic, which is apparently the best Finland has to offer for corrective eye surgery.

This being public medicare, which in Finland is usually cheap but on the slow side, it took about six months for me to get the appointment. The eyes actually felt better for most of the time of the wait, so I had no idea what to expect when getting to the place. When I finally got there, two fancy laser-based machines were used to measure my eyes, after which the doctors gave the verdict – I had a form of epithelial erosion syndrome, meaning the outermost layer of the eye was uneven and hence refracting light as if I was wearing dented eyeglasses.

The good news was, the epithelium is the only part of the eye that renews itself, so the problem would be fixable with little chance of permanent effects. Bad news? It’d be massively painful. The nurse took me to the side and said some patients compare the post-operation feeling in the eye to labor pains. “You’ll be given three days of sick leave which you’ll spend in bed with crippling pain”, she said. Damned if you do, damned if you don’t, I felt. We’ll send you a letter when you can come in for the operation, I was told.

I finally got the letter three weeks ago, telling me the operation would be done in a couple week’s time. I notified my awesome business partners of the thing happening and my dear wife started to prepare mentally for nurturing me.

Once I showed up at the clinic the day of the operation, I was rescanned and met with the doctors. “It’s got a bit worse. Do you really want to do this? We don’t have to, yet”, asked the doctor. “I need to see really precisely to work” I replied and off we went. A couple pills to relax a bit and then off to the operating table.

The operation itself was amazingly quick. A few drops of effective local anestesiacs were applied to the eye, after which I had to stare at a freakishly bright light without moving the eye at all. The doctor performing the operation removed the entirety of the front epithelium with the eye using manual surgical equipment which was freakishly weird. Feeling someone cutting away parts of your eye is not what I exactly what I had in mind waking up the morning, and seeing the vision blur as the layer was lifted off was just odd. “Yup, this was in pretty bad shape allright,” the doctor said as he surveyed the piece.

Some shaving of the eye with lasers and that was it. I got prescriptions for antibiotics, two types of eye drops, tranquilizers and painkillers and a bit too generic instructions on how to take care of the eye for feeling really reassured I’d do fine. Riikka picked me up, we went to the drug store to pick up the prescribed meds and off I went to spend the next three days in bed. The last thing I did before the anestesiac started to fade was to get the Steve Jobs biography as an audio book, so I’d have a few hours of entertainment.

The pain that hit the evening was deeply uncomfortable but not quite as bad as the nurse’s description. This could be due to myself having done contact sports in the past – the SCA training sessions used to leave be with nice bruises all over the body, so I’d learned to deal with pain as something I register as happening, but which doesn’t overwhelm me. Same happened here – with the help of the strong painkillers, at worst the eye felt like something between the one time when I’d put chili into my eye accidentally and the feeling of dropping salt into an open wound. This was pretty bad, but was containable and slowly focusing the pain away worked.

In the next two days I could feel the cutting wound get better and the constant feeling of having something gone to the eye started to go away. I had the post-operation check two days after the surgery and everything was healing as planned. The two subsequent days both felt like great improvements and I indeed had a bit of an epiphany moment today morning when the eye felt almost as good as prior to the operation, despite the doctors warning it could take up to two weeks. A couple more months of eye drops and I should be sorted. But now I’ll have to hit the bed, the eye can’t take all this writing anymore. I’ll let you know how it’s worked out in a couple weeks.

Update: It’s now been 12 days from the operation and it feels the eye is fully recovered both in the sense of the optics working as expected, but also the focus having adjusted and the brain now being able to grasp the additional information flowing in. Yesterday was the first day the eye didn’t get tired, and today I feel I’m seeing things even crisper and perceiving things faster. Feels awesome, can’t wait for the the other eye to be fixed.

Interestingly, now that the right eye is ok, I’m starting to notice the little itching and occasional tiny pain in the left unoperated eye, which is apparently caused by the disease. I didn’t really notice it when both the eyes were poorly, but I can definitely notice the differences between the two now. One more reason to get operated, I guess.