Author Archive

Friday, February 23rd, 2018

I haven’t used JavaScript and CSS seriously for many years now. These dinosaur-riddled posts provided good catch-up material for both:

Monday, February 19th, 2018

Category: Uncategorized  | Comments off
Thursday, February 25th, 2016

I’d better put it in Spanish too: Como enviar una carta desde España a Suecia usando sellos “Tarifa A”.
Spanish “Tarifa A” stamps don’t have a printed value. Instead their value is whatever the cost is to send a normal 20g letter within the Iberian peninsula. So in order to send a letter, one has to perform a three-step process at

  • Click “Enviar Documentos” and then “Calculador de tarifas” and select “Enviar Documentos”.  In the form that loads,
    • select “Carta y tarjeta postal internacional”, enter the weight (10g in my case),
    • do NOT tick “Normalizado” after doing some math: a C5 envelope is made for an A4 sheet (which I happen to know is 210×297 mm) folded in half, which should give 210×149, which does not fit in either “14×9 cm. y 23,5×12 cm”
    • select Destino: Suecia
    • wonder why there are two places where you pick origin, and leave both on “Península y Baleares”
    • click “Obtenga su tarifa”
    • write down “1,55″ somewhere and assume that it is Euros.
  • Enter “cuanto vale un sello tarifa A” in the search box.  This gives the helpful answer “El valor de un sello con la tarifa A, es el de la tarifa de una carta con origen y destino dentro de España, cuyo peso sea igual o inferior a 20 gramos de peso y sus dimensiones sean normalizadas”.
  • Find your way back to the calculator, and this time pick
    • Carta y tarjeta postal nacional
    • 20 g
    • “Normalizado”
    • Click, tadaa: 0,45.

Now we have all the data and all that is left is the calculation: 1,55/0,45 = 3,444444444, so no less than 4 stamps.  OK.

Redoing the calculation for a “normal” (C65?) envelope gives a price of 1.15 which is 2,555555556 stamps.

Update 2016-03-11: Finding the value of an A2 stamp is nigh impossible, but my best guess is that it’s worth 0,57€.  The guess is based on an article published by Correos Gallego.

Category: Life outside work, User experience  | Comments off
Friday, August 03rd, 2012

Really interesting article by Ian Grigg (from 2005) on how digital signatures (and third-party signatories) can take bookkeeping to the next level.

Category: Uncategorized  | Comments off
Sunday, October 23rd, 2011

[This is the error report I sent to Apple at]


While upgrading to iOS 5, the final restore of the backup taken at the beginning failed. A few days later, iTunes offered to try again, which I accepted. Unfortunately, the pictures I had taken during those days were deleted by the restore.

Steps to Reproduce:

  1. Connect an iPhone with iOS 4.3.5 to the computer.
  2. Answer “Yes” to iTunes question “There is a new version of the OS for your phone available. Do you want to upgrade?”
  3. Wait for iTunes to download iOS 5.
  4. Wait for iTunes to backup the phone.
  5. Wait for iTunes to upgrade the phone.
  6. Answer “Yes, I want to restore the phone to its previous state”
  7. See the restore mysteriously fail with an error (-35) [IIRC]
  8. Shrug and sync the phone the normal way and see all your apps end up on lots of pages instead of in the folders which apparently couldn’t be restored.
  9. Travel to Barcelona with a girl of your choice.
  10. Go on a lot of sightseeing, taking lots of pictures of each other and of La Sagrada Família, Parc Güell, and various other spectacular things.
  11. Remember to go by the house where you lived 17 years ago of which you don’t have any pictures and take a few nice shots.
  12. Come back home and plug in the phone in order to sync the photos to iPhoto.
  13. When iTunes pops up a window asking “The previous attempt to restore iPhone failed. Do you want to try again?”, answer yes.
  14. Wait for the restore to complete.
  15. Go through the “welcome to iOS 5” setup. Answer in the affirmative to everything.
  16. Start iPhoto. There should be no pictures to import.
  17. Curse. Ask friends for more cuss words. Repeat.
  18. Chat with the girl and agree that going back to Barcelona some other time sounds like a nice plan.

Expected Results:

In step 13, it would have been really nice if iTunes would have pointed out
a) that the backup to be restored was five days old
b) that anything added to the phone in the interim would be lost,
c) including those 100 or so photos you seem to have taken

Yeah, that would have been really nice. Barring that, it would have been really nice if in step 16, there had actually been a lot of pictures to import.

Actual Results:

I have no photos of my stay in Barcelona.




I blame myself more than anyone else. I know what a backup and restore means. I even thought about the few text messages that would be deleted and decided that was not a problem. But still: a little extra logic would have prevented this.

Category: Uncategorized  | Comments off
Tuesday, January 11th, 2011

I can’t pass up an opportunity like this, it’s just too bad.  I just got an SMS from FedEx.  The message says that they have a parcel for me and that I should call for delivery.  The message starts with something I can only assume is a parcel number, or whatever they prefer to call it, consisting of three letters and twelve digits.  Here’s what happens:

  1. I press the phone number in the message and my phone dials it.  The machine in the other end asks me to pick a language.  I pick the first one, which is Swedish.  TMITOE says that the office is closed, and that I can press 1 to arrange a pick-up or get tracking information.  No other alternatives, no opening hours, the message just repeats.  #FAIL
  2. I enter in my web browser.  I get a big honking box with the word “Flash” in it (I run ClickToFlash).  There is nothing to interact with outside the flash box.  #FAIL
  3. I go to which redirects to  The menus read (in translation) Send, Track, Account Mgt, Customs Tools.  I suppose that Track is the option that is least remotely connected to Deliver, which is what I want them to do.  I pull down the menu only to discover that there are two tracking options: Track with tracking number, and Track with reference number.  What’s the difference?  What do I have?  I pick the first one and enter the long string of letters and numbers from the SMS and press “Track”.  The site tells me the number is invalid and tells me to check it (it is exactly as in the SMS).  No clues are provided. #FAIL
  4. I pick the second option, Track with reference number.  I enter the same number (copy, paste) and my country and postal code.  No hits.  #FAIL
  5. I redial the number in the SMS but this time I pick English.  TMITOE tells me that the office is closed, and that the opening hours are 8 am to 7 pm.  It’s 6.30 pm.  #FAIL
  6. On a whim I go back to the web site and enter just the digits from the tracking number. Ta-daa!  Detailed information about my parcel, which apparently is in Paris.  There is a form that I can use to add email addresses.  One is labeled “From”, one “To” and there are three more without labels.  Reading the help texts (by hovering over little question marks) I get the impression that I can register email addresses to get automatic delivery notification, or an email if something gets stuck in customs.  There is nothing to even hint that I should get in touch with them about my delivery.  #FAIL
  7. I call back to TMITOE and press 1 for Swedish, 1 (the only option) for pickup-or-tracking, and 2 to “display (!) tracking information”.  I enter the tracking number.  TMITOE thinks a bit and then tells me that the parcel has been picked up by a courier, and to press if I want more information.  There’s no typo there; it didn’t tell me what to press, just to press.  #FAIL
  8. I redial and redo it in English.  ”The package has been picked up by a courier.”  Oh, press *0 for assistance!  All their lines are busy.  I wait.  I wonder if I keep my position in the queue.  I wonder how many clerks are working hard to get down to my call.  Actually, I don’t need to know the exact number, I’d just like to know that there will be someone there eventually, especially considering that their office might be closed.  After just six minutes, I get a ring tone.  And then I’m disconnected. #FAIL
  9. I’m going to use the form for registering email addresses and see if I can get a message through.  I’ll send them a link to this note.  I’ll keep you posted. #JURYSTILLOUT
Category: Life outside work, User experience  | Tags: , ,  | 2 Comments
Wednesday, October 13th, 2010

Swedish ISP Loopia offers free email forwarding for any domain for which they handle DNS.  Unfortunately, this includes a spam filter that the customer cannot turn off, unless they pay, which means it’s not free anymore.

So what’s wrong with some free spam filtering?  Well, this is what happened:

  1. A prospective client sent an email with a proposition.
  2. Loopia’s spam filter found the proposition suspect and bounced it.
  3. The client saw a bounce and thought that they had the wrong email address and gave up.

This probably lead to lost business.  I can’t blame Loopia, but I can stop using them.

Category: Server Configuration  | Tags: , , ,  | Comments off
Sunday, September 19th, 2010

To raise the max size for file uploads, it’s not enough to set upload_max_filesize to 50M.  One also has to set post_max_size to something that is at least as big.  I don’t think that’s how it used to be, or I wouldn’t have spent an hour looking for the solution.

I’m running Ubuntu now, so I put the extra settings in a separate file that I upload to /etc/php5/conf.d/ using chef.

Category: Uncategorized  | Tags: ,  | Comments off
Sunday, March 28th, 2010

[A note for casual readers: These notes are not meant to be objective representations of what different speakers said at Scottish Ruby Conference. They are my interpretations in my context.]

[Update 2010-03-29, morning: added more links. 2010-03-29, evening: re-phrased note on gender distribution and separated it from note on sexism, since I don't think of them as related and don't want others to think so. 2010-04-01: links to other summaries.]

Concurrency and real time are great to have and quite attainable if we step outside the comfort zone that Rails gives us. Thanks to Jim Weirich for the reminders and to Makoto Inoue and Martyn Loughran for valuable tips and tools: js-model, dragban, pusher demo, . Presentation here, and some background. And I really want to do some Erlang.

What we do is an art that is based on science and while the artistery has received a lot of attention lately, we can benefit from revisiting the science. Jim Weirich told us about Structure and Interpretation of Computer Programs. It’s available online and there is a mailing list to discuss the content and/or the exercises. I think Jim would have been able to sell 50 copies of the book on the spot if he had brought any.

Lifecycle management should be done with proper tools, not timestamps with funny names (approved_at, published_at, etc). And lifecycle is more than state machines, it’s also workflow and permissions. David Bock showed off Stonepath and hinted at Stonewall. He uses acts_as_state_machine but says that it should probably be really easy to use state_machine instead. (NB: A new version of state machine was released two weeks ago with a lot of important fixes!)

Ever since I read about ticgit in Scott Chacon’s Git Internals I have wanted to do something with git besides source code control but I always thought I’d need to learn 100 git plumbing commands. Scott demonstrated how to do very useful things with just four or five commands, so that’s something I’ll put in my toolbox.

Gwyn Morfey introduced a very useful image in his talk “Write Bad Code”. We may need to get into technical debt in order to avoid the area of death, just like we may need to get into financial debt in real life to avoid starving or bankruptcy. He also gave a good number of rules for classifying the situations where it is applicable and how to act in those situations.

Lots of people retweeted Tim Bray’s sentiment that “if your webapp doesn’t work on a mobile device nowadays then it doesn’t work”. I definitely think that is true in most cases, but I’m worried that it will be wielded like the Sword Of Truth in the future. It’s not black or white, and while most webapps should be written to work on a mobile device, I think there are loads of valid exceptions.

I read about CRC Cards (Class, Responsibility, Collaboration) many years ago and threw off the idea as a tool for people who needed something to hold in their hands while they learned about object oriented design and analysis. Sam Wessel ran a BoF workshop with Kevin Rutherford where we got to work through a simple analysis exercise. It was a real eye opener and the most valuable session of the conference. I learned two things:

  1. it is useful to have a class for the whole of the system and not just the parts, and
  2. I should learn about CRC. (I shall try to avoid the temptation to think that I can actually use it on my own just because I’ve sat at the feet of masters.)

I’m not a big friend of mocking and thus went to a BoF where Brian Swan and Kevin Rutherford debated mocks. Interesting debate, but according to show of hands at the end, I was the only person who changed their position to whatever slight extent. Apparently there is now a nicer syntax for setting expectations so that you can do the stubbing in the setup and the expectation checks in the actual it-clauses. And Kevin says that (contrary to Brian’s experience, and mine), he feels that he can refactor quite freely without breaking loads of mocks. I need to learn more about mocks or modelling, or both.

WebMock by Bartosz Blimke does the same thing FakeWeb, but better. It has support for regexp matching of urls, checks for POST data, and nice assertions. Worth checking out.

Redcar by Daniel Lucraft aims to be “a cross-platform programmer’s editor written in Ruby”. I couldn’t install it, probably because I have installed gems and rubies in too many ways on my laptop. Will need to clean up and try again.

Things I should check out: 12 hours to rate a rails application, Story mapper (big picture planning for Pivotal Tracker), Distributed Architectures with Rack (mentioned in Tim Bray’s blog).

Non-coding observations

  • When going to a country where it is hideously expensive to use my phone for data, I should bring an old phone that can run my normal sim card and buy a pay-as-you-go card for my iphone at the destination. Doubly so since there is really no reason to believe that anyone can ever create a wireless network that can support 300 developers at the same time, all the time.
  • RubyConf India had 28 female attendees out of 400 total; Scottish Ruby Conference had slightly less, I think.  I wonder what we can do as a community to raise that percentage.  I wonder what we can do as a society.  I wonder what I can do.
  • I also noted that a few presenters thought it appropriate to portray Ruby developers as geeky manboys and women as some kind of more or less attainable prize or decoration. That is so not cool.
  • Quality of presentations vary from marvellous and eyeopening to YOU HAVE ROBBED ME OF 45 MINUTES OF MY LIFE AND MADE ME LOSE FAITH IN HUMANITY. Unless the presenters are well known, I should always find someone who can vouch for the presenter beforehand, or at least talk to the presenter to find out what I can expect. In the choice between an interesting presentation and an interesting presenter, prefer the latter.
  • If I don’t manage to do the above, I should make sure to find a seat where I can sneak out of the room without looking rude.
  • Considering that the lack of equal opportunities for men and women is a far greater problem than my having 45 minutes ripped from my day, I’m forced to make the observation that I have grown slightly numb to male chauvinism. I don’t like that.

Links to others’ summaries:

Category: Programming, Ruby  | Tags: ,  | 12 Comments
Friday, August 14th, 2009

SQLite3 is truly dynamically typed. To a fault:

sqlite> select count(*) from posts where external_id = 199252;
sqlite> select count(*) from posts where external_id = '199252';
sqlite> select count(*) from posts where external_id = 199793;
sqlite> select count(*) from posts where external_id = '199793';

One day I suppose I will find it useful to store different data types in the same column, and without implicit conversion. I look forward to that day. Right now, I will have to spend a few hours cleaning up the mess that this caused.

Category: Programming  | Tags:  | Comments off