Posts

Showing posts from August, 2008

how to zoom to 100% with iPhoto

Image
I love iPhoto. It just bugged me that I could not zoom to "100%" to compare my pictures at their original resolution. I just found out that if you select one or more photos, right click and "edit in a separate window" you can choose the zooming level from a scroll down menu! Great!

onmouseover / onmouseout and nested divs

I had never noticed a behavior which left me astonished If you have two nested divs and are listening for the onmousover event on the parent div, you will get a onmouseout event when entering the nested div! parent div Nested div As I see it, since the mouse has not left the area covered by the red div, I would not expected a mouseout event. How do I now know when the mouse leaves the red box and when it only mouse on a nested element? Move the mouse into the blue box passing through the red one to see the fired events: If you wan to know when you exit the parent container (and not when you are on the red box), you can listen for mouse over events on the body and detect if the element triggering the event is an contained in the parent. Just think the other way around!

jsUnit testing a method of a class with a boring constructor

Today I wanted to introduce some jsUnit testing in an old class. In particular I wanted to test a single method in isolation but I could not instantiate the object itself since the constructor had dependency on other files. [source:js] load("ClassToTest.js"); function testMyMethod() { var object = new ClassToTest(); // This does not work since //ClassToTest has a boring constructor! object.runMethod(); //do some asserts } [/source] The trick is to replace the object with a new one which has the same prototype but an empty constructor: [source:js] load("ClassToTest.js"); function NewClass() {}; // empty constructor or whatever you like NewClass.prototype = ClassToTest.prototype; function testMyMethod() { var object = new NewClass(); // This works, since // it has an empty constructor object.runMethod(); // this exists and it is the same //method living on ClassToTest //do some asserts } [/source]

I'm in

Yesterday I signed up for the Lidingöloppet and today I went for my first 15 km run of the season (smooth). I was a bit afraid I was not trained enough to make it but tonight I checked the training schedule I followed two years a go and it does not look impossible. If I follow the same schedule there should be no problems and since I have now much more experience that I had at that time it should just go fine. It feels good. I'm happy I spent time saving all my training sessions on funbeat . I just hope I'll find the same motivation I had two years ago...

Why Scrum works

I'm working as a consultant on a new project with a bunch of other collegues. Sometimes we use scrum, sometimes not, in an inconsistent way. It is so clear that during the phases in which we don't people is less involved, I spend my time merging conflicts and more than once I've been doing the work that somebody has just done. Create a scrum culture in your team, you will benefit a lot from it. And don't say that you are using scrum if you haven't at least taken part in a project with an experienced scrum master once. Just saying that your are using scrum won't help you, will just give you a false confidence.

My 3rd Midnattsloppet

Last Saturday I run my third Midnattsloppet in 50m52s (10 km). It was the fastest I have ever run I guess and since last week I did not feel very well I'm very satisfied. I had some problems after 7 km where my stomach was giving me some problems but after resting for about a minute I could start run again. If I use the results of the previous years I can see that I've been improving my running quite a lot: 2008 50.52 2007 53.05 2006 57:02 I think I can now start practising for the Lidingöloppet, which is 30 km and much harder. But at least I feel well

I'm afraid

Only few days to the midnattsloppet and I'm afraid of  starting to run again. Last week my knee was hurting a lot after a too fast sprint, it feels allright know but still I don't dare to put my running shoes on. What to do? I'm sure it will be allright to run the 10km of saturday's race, but will I be able to practise more for the Lidingöloppet this year? Should I just rest until saturday or should I try to run a bit in the following days to see how it feels?