Datetime in habari

Right now I am reading the most excellent book by the esteemed Bruce Lawson and his partner in crime Remy Sharp. I must say, to start with, that is a great read, which has me whipping out my laptop. Even on a sunday morning, before my 2nd breakfast, which is really uncommon. I even started to hack away at this site, just for the heck of it...

And that is the small thing that I wanted to share with you. I don't know why but I haven't gotten around to properly adding the time attribute to this site, even though I got it in #html5 for quite some time now. Somehow it didn't happen, but anyway, here is the code to add it in habari.

<time 
datetime="<?php echo $post->pubdate->text_format('{Y}-{m}-{d}'); ?>"
pubtime>
<?php echo $post->pubdate->
text_format('<span>{M}</span>
<span>{d}</span>,
<span>{Y}</span>');
?>
</time>

It's just a small bit, but I hope it is of help to someone who uses habari...

It's visible content is in dutch / european order, but I'm sure you can change that to suit yours...

Ad agencies are the new music industry

True, true.Peter Merholz

"Ad agencies, in particular, are soulless holes, the precepts of whose business runs wholly contrary to good user experience practice."

(Via adaptive path » blog » Peter Merholz.)

What Happened to Yahoo

Aug 18, 2010 0 Comments
Tagged:

So very, very true...

"In technology, once you have bad programmers, you're doomed. I can't think of an instance where a company has sunk into technical mediocrity and recovered. Good programmers want to work with other good programmers. So once the quality of programmers at your company starts to drop, you enter a death spiral from which there is no recovery."

What Happened to Yahoo

Via: Krijn Hoetmer

concatenate your scripts kids.

Aug 06, 2010 1 Comment
Tagged: , and

And here is why...

HTTP/1.1: Connections: "Clients that use persistent connections SHOULD limit the number of simultaneous connections that they maintain to a given server. A single-user client SHOULD NOT maintain more than 2 connections with any server or proxy. A proxy SHOULD use up to 2*N connections to another server or proxy, where N is the number of simultaneously active users. These guidelines are intended to improve HTTP response times and avoid congestion."

Javascript coding suggestions

crockford I am now working on some coding conventions for use at one of my clients. Having done some work on the HTML and CSS ones, I recently started with the javascript one. As I was working on it, I looked at the work done by others, like Douglas Crockford. Some of my co-workers suggested that we did this:

var nameSpace = (function () {
// declare all of your var's before using them..
var config, init,x,doStuff;
config = {
a : 'a'
};
init = function ( arg ) {
doStuff( arg );
};
x = '36';
doStuff = function ( arg ) {
// dostuff
};
return {
init:init
};
}());

While I initially agreed with this, as it seems nice and neat, I spotted a problem with it when it gets big. As you get a really big script and more people working on it, chances are that you will get someone to forget to declare a var in the beginning of the function, hence making it global.
Like this:

var nameSpace = (function () {
// declare all of your var's before using them..
var config, init,x,doStuff;// we forgot to add doMoreStuff
config = {
a : 'a'
};
init = function ( arg ) {
doStuff( arg );
};
x = '36';
doStuff = function ( arg ) {
// dostuff
doMoreStuff();
};// doMoreStuff is global
doMoreStuff = function () {
alert( config.b );
};
return {
init:init
};
}());

So I came up with a (not so revolutionary) way of avoiding this and I am curious what you think of it?
It goes like this:

var nameSpace = (function () {
// start with var to avoid global variables
var config = {
a : 'a',
b : 'b'
},
// continue with a comma to stay in the same var declaration.
init = function ( arg ) {
doStuff( arg );
},
x = '3',
doStuff = function ( arg ) {
// dostuff
};
// end with a semi colon.
return {
init:init
};
}());

I think that this has the advantage that when someone else continues with this code he can extend it easily, while not accidentally introducing globlal variables...

var nameSpace = (function () {
// start with var to avoid global variables
var config = {
a : 'a',
b : 'b'
},
// continue with a comma to stay in the same var declaration.
init = function ( arg ) {
doStuff( arg );
},
x = '3',
doStuff = function ( arg ) {
// doStuff
},// if you add a new var it's not global
doMoreStuff = function (){
// do more stuff
}
;
// end with a semi colon.
return {
init:init
};
}());

What do you think, is this a good way to structure your code or am I missing something?