Categories
Looking glass
Navigate/Search

I can taste it now

It’s finally here!

First official hang-out-on-the-back-deck-with-my-laptop weekend.

Feels like Summer!

Yesterday we tried to make a curry …

… The house smelled great. How the food could have come out so bland, I don’t know. Even this morning the place smelled like an excellent Indian restaurant.

What a let down

I can’t believe I haven’t posted since Pittsburgh

And I’m only posting now to try out this offline blog post editor.

Pittsburgh

It’s a rainy weekend here which is bad news because when visiting a city I tend to want to walk around a lot. We’re mostly hanging around the Shadyside-Bloomfield-Lawenceville areas. They seem to be relatively poorer areas of Pittsburgh.

Much of the housing is row-housing and many of the shops are closed. Walking around the streets at night it looked like many of the houses were empty too. Many, maybe most of the houses had no lights on. Although the neighborhoods were very walkable, and it was a nice night, we saw very few other people walking around.

We went to a delicious Indian restaurant last night called “Taste of India”. Doesn’t every city have an Indian restaurant called that? Then we went to a brew pub built in an old church. Although it was impressive to see. It was large and fairly full, but I didn’t think the beer was all that good. We got a sampler and couldn’t get really excited about any of the beers.

Today we’re planning on seeing the strip district. I’m hoping to try one of those Primanti Brothers sandwiches. And tonight we’re going to see something known as OUTrageous bingo which is some kind of bingo/dragshow hybrid.

Firefox changing bookmark format

Firefox 3 will be abandoning the bookmarks.html file for the storage of bookmarks in favor of an SQLite file.

That might be cool for performance, but bad for those who occasionally tweak their bookmark file directly (say, to fix icons that Firefox gets wrong).

Anyone know of a good free SQLite browser for Windows?

I suppose I have the option of exporting the bookmarks, which will still support bookmarks.html and then re-importing.

Are you kidding me?

I save for retirement, I invest and I take a pretty active role in my savings.  However I’ve never seen a good method for determining what I will need.  I recently received an ad from Fidelity, which holds the vast majority of my retirement savings, about a retirement calculator that is supposed to tell you if your on track for a comfy retirement.

I couldn’t answer all the questions but look at this, can I be this far off?

clip_image001

They say I will need almost 6 million to retire?  And that I have to increase my savings by 10 to 12K per month – well over my take-home?  I didn’t even specify what I thought I’d need to live on, I let them estimate it for me.

Vintage Ads for New Products

Here’s a collection (click on the picture) of phony vintage ads for modern products

I’m Famous

Some travel web site, schmap, has picked up my picture of Massey Hall in Toronto from my flickr stream and is using it in their online guide.

It appears that there are dozens of photos for many locations. My guess is they include as many pictures as possible, less for illustrating their guide and more for getting the people they include to spam their site around.

As I’ve just done: My Schmap Entry

Better OnLoad handling in Javascript

The onload handler on a page’s <body> element is the place to do any JavaScript initialization that depends on the page being loaded to proceed. If you have some JavaScript and you’re sure it has no dependencies on the page structure, you can have it called earlier but generally it’s safest to call it in the onload handler. It might look like this

<body onload="ajax_subsys_init();">...

But just as you should use CSS to separate presentation from structure, you should separate behavior from structure as well. And you can do that in javascript by writing to the onload handler directly:

window.onload=ajax_subsys_init;

This is an example of when it’s OK to break the rule prohibiting execution of JavaScript before the onload handler runs. Obviously this must run before the onload handler is called.

This is great because the page’s JavaScript can then take the responsibility for initializing itself. The problem with this approach is, as pages get more complex behaviorally, you might have several overlapping bits of javascript that want to initialize themselves. Then you have

//from inside of ajax.js
window.onload=ajax_subsys_init;
....
//from inside gui.js
window.onload=gui_widgets_init;

The gui widgets initialization routine overwrites the ajax subsystem initialization routine and when onload is called the gui widgets are initialized but the ajax subsystem is not.

So, actually, you can’t let the individual subsystems manage their own initialization, because the last one that does so is the only one that gets called. Your only option is writing your own initialization routine such as

//from inside of ajax.js
window.onload=ajax_subsys_init;
....
//from inside gui.js
window.onload=gui_widgets_init;
....
//inside your page
function page_init(){
    ajax_subsys_init();
    gui_widgets_init();
}
window.onload=page_init;

Well, that works but, you need to be aware of the initialization requirements of all the javascript libraries you include. If you add a new javascript library you need to change this initialization code.

It is possible to create a javascript class that will allow each javascript subsystem to take responsibility for it’s own initialization and yet not overwrite each other. And here is that class:

function onLoadHandler(init_fxn){
    var old_init = window.onload;
    var new_init = init_fxn;
    window.onload = function(){
         if (typeof(old_init)=="function"){
            old_init();
         }
         new_init();
    }
    return this;
}

Each subsystem that wants to hook into the onload handler can use this class to add their initialization routine to a chain of initialization routines. Here’s how it can be used.

//from inside of ajax.js
new onLoadHandler(ajax_subsys_init);
....
//from inside gui.js
new onLoadHandler(gui_widgets_init);

Now each javascript library can be included and can automatically initialize itself.