Posts

Showing posts from September, 2008

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