
Monday, 10. July 2006, 00:17:53
ecmascript, Opera, FireFox
Laziness is the mother of all inventions... I created a function in javascript which'd help me create DOM nodes quickly, here's the source:
/**
* Shortcut for creating a new html tag using JSON notation.
* @param JSON The tag using JSON notation. The first value of the object
* is the tag name, second child is array of parameters and third child
* is array of children elements. If the first parameter is a string, the
* node is assumed to be a text node and has no further children.
*/
function quickTag(JSON){
var elem;
if(typeof(JSON) == 'string'){
elem = document.createTextNode(JSON);
} else {
// Create the element itself
elem = document.createElement(JSON[0]);
// Add attributes
if(JSON[1])
for( attr in JSON[1] ){
elem.setAttribute(attr, JSON[1][attr]);
}
// Add child elements
if(JSON[2])
for(var j=0;j<JSON[2].length;j++){
elem.appendChild( quickTag(JSON[2][j]) );
}
}
return elem;
}
Here's a quick example of the usage, hopefully you'll see what the syntax is fairly quickly. Note that the parameter uses JSON syntax, you might want to quickly read up on that if you're not too familiar with it. It's very simple and would only take a few minutes.
var p = quickTag(['p',{'class':'test'},["This is a ",['em',,'test']," node."]]);
document.body.appendChild( p );
The first item in the array is the tag name, the second is attributes and their values given as an object and the third parameter is child elements, which means that you can start all over again with a new array, or just pass a string to use as a text node. The above example would produce the output equivalent to
<p class="test">This is a <em>test</em> node.</p>
It has been tested and works with Opera 9 and Firefox 1.5.0.4, I don't have other browsers to test with right here right now, but I suspect Internet Explorer will throw a fit if trying to set class by setAttribute. It's always a hoot with that old thing...


Wednesday, 1. February 2006, 16:37:06
insight, Internet Explorer, FireFox
I don't get why FireFox and Internet Explorer 7 place the address bar and navigation buttons above the tabs. Logically, the address bar and navigation buttons belong to the page one is at. Placing controls outside this boundary breaks the logic and makes it harder for new users to intuitively "just get it".
It's not a major point, but the design is in the details.
Tuesday, 31. January 2006, 18:20:21
Opera Mini, webapplications, Classfronter, Opera
...
I'm currently finishing my bachelor's degree. The school I attend to provide their students with a webapplication called Classfronter. The goal of the tool is that students and teachers communicate among themselves, sharing their experience and help each other out. The application provides "rooms" for each course where students may post on the forum, share documents and chat in real time.
The problem is that many "rooms" are almost as dead as the Sahara desert after a nuclear strike. One reason is of course the chicken and egg problem. Noone use it because noone use it. Another reason, and a far greater one in my opinion, is that it's not a pleasant experience using it!
The application is painfully slow, hard to navigate and during the earlier years it was only fairly usable in Internet Explorer. I run my own website,
hybelmat.com, aimed primarily at students. It's a site where users may send in simple food recipies and search the database for something to eat. My stats shows that norwegian students prefer Opera and Firefox equally well to Internet Explorer. Actually
less than 50% of my visitors use Internet Explorer.
My point with all of this is that the tool we are presented with fails in three important aspects: speed, usability and compatibility. When the tool you provide is so hard to use that it's a nuisance for its users, you've got a huge problem on your hands. When the server is so bogged down with work that it spends 12 seconds generating a page and the users have to switch pages 3 times in order to get to where they want, that is
not user friendly!
During my spare time, I'm working on my own webapplication complete with fancy Ajax, context menus, ECMAScript and dangling shiny things to dazzle the eyes. Well... except that last one

. It started out as a simple tool for my brother and I, but is currently escalating to a project with potential for future profit.
One of the criterias of my webapplication is that it should be accessible from a cellphone provided the user agent doesn't choke on XHTML. Among other things, I
cannot rely on ecmascript for critical functionality or even a display size of more than 128 pixels. Considering this, Opera Mini really came as a blessing for me.
Currently, on broadband, it takes me less than a second to refresh the page, and I would rather sacrifice a semi-nice feature before I sacrificed that.