Posts

My third Lidingoloppet, in 3.08.50

[fa:p:a=sport-2008,id=2896615126,j=l,s=t,l=p]Fastest ever! It just flowed. As I present I bought me an iPhone.

More memory to the MacBook!

I erroneously ordered som ram for a friend which did not work. I then tried it on my MacBook and now I'm running 3 GB instead of the officially "max 2" supported. The module I installed is named: VS2GSDS667D2 / Corsair Value Select VS2GSDS667D2 2048MB SO-DIMM DDR2 PC2-5300 667MHz . It works like a charm. More RAM to the people!

maven-script-ant and the maven.test.classpath

When using the ant-run plugin you can get references to the maven classpaths in the ant fragment Those are the ones available: maven.compile.classpath maven.runtime.classpath maven.test.classpath maven.plugin.classpat I tried to build an ant plugin for maven as explained in http://maven.apache.org/guides/plugin/guide-ant-plugin-development.html to refactor out the ant fragment and all went smooth until I needed a reference to the maven classpath. I just assumed I could use the classpath references in the maven-script-ant plugin. I took me a while to realize that the 2.0.9 version of the maven-script-ant has no support for it and that support is currently available on trunk. I had to download the source code and build 2.1-SNAPSHOT.jar by my self.

onresize event and prototype

If you need a compact way to use prototype and listen to on onresize event in a cross-browser manner, this is the way to go: [source:js] Event.observe(document.onresize ? document : window, "resize", function() {//dostuff}); [/source] As you can see, the event to listen is resize but depending on the browser, it may be fired on either the window or the document object. Quirksmode has as usual an explanation of which browser support the one or the other Of course, you should never use the apparently simpler [source:js] document.onresize = function() {}; [/source] if you want a robust solution since you will overwrite any other event listeners that can have been add by other libraries ( Bobobobo has a bad example)

Object.extend, an example of inheritance

Updated: my previous attempt to simulate inheritance in javascript using Prototype.extend did not work as I expected so I removed the example I had written. Inheritance can be defined in several ways. The definition of inheritance I will use in the following example is: A child class inherits from a parent class if all methods of parent are available to the child and the child methods override the parent's ones. The child methods which are not defined on the parent must of course be available on the child object. [source:js] function ParentObject() {} ParentObject.prototype = { commonMethod: function() { return "method defined on parent" }; methodToBeOverrridden: function() { return "you should never see me"} }; ParentObject.extend = function(subclass) { //we need a temp object to store our new prototype function T(){}; //let's copy all parents methods for (var p in this.prototype){ T.prototype[p] = this.prototype[p]; } //let's copy all child meth...

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!