Space, Page Up, Page Down, Home, End Broken for Navigation in Firefox

While I initially thought I had gone crazy or were still dreaming, my fear was true – all my keyboard page navigation had stopped working in Firefox (3.6.3). I tried to move onto to the next by pressing space or page down, my hands trembled as I discovered that neither arrow keys or home / end keys worked. The friendly internet suggested that I should turn Caret Browsing (F7) off (.. so try that if you’re in this situation), but that just told me that I were turning Caret Browsing on (with a proper warning). No luck.

After a bit of tinkering I disabled all my add-ons (previously known as extensions), and voilá, everything worked as it were supposed to! Further problem hunting revealed the culprit: The Del.icio.us Bookmarks Add-on. Curse you, del.icio.us! Disabling the Add-on and re-enabling all the other addons solved the issue, and I’m now happily browsing the internet one page size at the time again.

Patch for Max Iterations for a foreach Block in Smarty

After running into a need for a max iteration count on a foreach block tonight and seeing that several others have had the need during the years, I’ve created a simple patch to add max= as an attribute to the foreach block. I tried to search the archives for a reason why this hadn’t already been included, so feel free to ignore this patch if there are proper reasons why this isn’t available as an argument. There are cases where a simple break in the loop is more efficient than making a copy with array_slice if you need the same data several places but in different slice sizes.

The patch also contains three tests to test the max attribute.

The patch is available here: smarty.foreach.max.patch. The patch is against the current SVN trunk of 2010-08-08.

Example:

{foreach item=x from=[0,1,2,3,4,5,6,7,8,9] max=5}{$x}{/foreach}

Output:

01234

I Made It Again (Again)!

It’s that time of the year again, where I spend a few saturdays out in the woods riding my bike together with a couple of thousand other interesting people. Today it was Grenserittet (“Cross Country Ride”, from Strömstad in Sweden to Halden in Norway) which I also did in 2009 and 2008.

This year’s course had to have an emergency fix after 30mms of rain on Thursday made parts of the track almost disappear. It was quite a minor change, as there was an alternative road almost parallel to the original one.

After getting up at 06:30 this morning and travelling to my parents home, my dad and me left for Strömstad and my 09:55 start. It was supposed to rain at the start, but in the late hours of last night the weather prognosis changed and promised sun with a few clouds. Spot on! As we rolled out from Strömstad light clouds covered the sky, making the temperature just right for a day out on gravel roads and forest trails!

I decided to bring along two gel packs (100g each) and one energy bar – this proved to be just about right for the trip (in addition to two water bottles, with refill at the service stations at each 20km). I also ate a piece of banana at each of the service stations and downed a cup of sports drink. The energy bar was consumed in two rounds between 30km and 50km.

The number bibs that each rider attaches to his or her bike and back had changed this year. Instead of having the contestant number as the largest feature, the organizers had decided to go with printing the first name of the rider instead. This worked great! It made the spectators cheer for you by name and made it a lot easier to keep track of people you were riding with! As Per Øyvind (.. if I remember correctly) said after 30kms, “hey, it’s Mats again! We’ve been riding together since the start!”. Getting a name attached to a person made it a lot easier to remember that you had seen these people before, if they had raced past you a couple of minutes ago, etc. Great stuff.

Anyways! Today’s result:

3:41:37

(2009: 4:45:57, 2008: 4:47:04)

A new personal best with over one hour, and just four minutes behind the cut off point for the “wow, you were fast!”-prices. Awesome. I had hopes of getting below four hours, but this was beyond my expectations.

The bike has been washed, the clothes are ready for the washing maching (and yes, I did carry one small Norwegian forest worth of mud home) and I’m feeling my muscles rebuild while relaxing on the couch writing this post.

Now we’ll have to see what I can do in this year’s Birkebeinerrittet and start planning for next year!