Thursday, January 31, 2008

IPV6 fix

I had an annoying problem with firefox while testing my rails code in dev mode. It's so terribly slow! At first, I tried to reinstall mongrel and some stuff to no effect. Until I started looking for answers from the net and came across with this Firefox IPV6 issue.

Initially, I didn't expect FF was the culprit since it's running perfectly well before I tried developing apps on my new Laptop.

Why Bill Gates is Reckoned to be the Greatest Gift to Secular Humanity




Monday, January 28, 2008

Developer Environment

I recently spliced 20G out of my 160GB laptop drive so I can install Fedora 7 and work my rails app from there. After spending a week trying to look for suitable graphics and network cards, I gave up and switched back to Vista for my code writing and decided to use the Linux instead for pre-production deployment. Newer laptops almost always comes with pain when newer hardware doesn't have the linux kernel drivers yet.

Of course, there are Intel drivers out there but at this point, I would rather wait for new kernels that may support the existing graphics hardware rather than spending so many precious times doing trial and error to get my 1280x800 graphics looks cool.

Why Bill Gates is Reckoned to be the Greatest Gift to Secular Humanity

Sunday, January 13, 2008

Prototype 1.6.0

Just recently, I have tried to incorporate Prototype library into some of my old javascript source codes and I found the relative ease of using it. I used to spend a lot of time trying to have compatibility between browsers and while functions can easily be replicated in other browsers, the look and feel has always been too cumbersome.

For example, to grab the element that triggers the event, you can just call Event.element(event) and acquired the object you wanted.

Prototype provides a lot of useful functions that you don't worry much whether you are running mozilla, firefox or any others browser. If encountering some compatibility issues, you can still get quirky by running series of Try.these functions to hit a supported feature.

I got an old tree nodes that I customized for an online storage web application. Manipulating these nodes is a breeze when using the library.

Some examples:

1. Finding nodes/nodes:

To traverse allNodes array, a new array function 'find' can do the job elegantly avoiding the use of for/if statements in your code.

var allNodes = [];

function findNodeById(id) {
return allNodes.find(function(n) {
return (node.id == id);
}
}

function findChildNodes(parentId) {
return allNodes.findAll(function(n) {
return (node.pid == parentId);
}
}

2. Declaring nodes

var Node = Class.create();
Node.prototype = {
initialize: function(id, pid, name, title, open, fileType, hasChildren){
this.id = id;
this.pid = pid;
this.name = name;
this.title = title;
this.icon = '';
this.iconOpen = '';
this.fileType = fileType;
this._io = open || false;
this._is = false;
this._ls = false;
this._hc = hasChildren;
this._ai = 0;
this.indents = [];
}
}

Why Bill Gates is Reckoned to be the Greatest Gift to Secular Humanity