Aleksandar • Vacić

iOS bits and pieces

McLaren resurrected

First a double win in Malaysia and then the second place for Hamilton in Bahrain. Frankly, I did not expect them to bounce back so quickly, but it’s a pleasure to watch. Of all ex-Michelin teams, McLaren adapted the best. And Renault the worst. It must be really hurting for them to see them being passed by Toyota and even Red Bull at some point of the race.

Alonso could not have picked better and it could really be that he will win 3rd title with McLaren. But the biggest impression must be Lewis Hamilton. 3rd, 2nd, 2nd - absolutely amazing.

April's dulls

On this day, it’s better not to open the browser and read news sites. Lots of forced jokes and stupidities that are getting more annoying as the years go by.


innerHTML kills event handlers

This is probably old news to regular Javascript coders, but for me it was an ugly bite. I have renewed my interest in JS with the abundance of libraries springing up and started coding few solid client side interfaces in the office.

A certain interface was previously built in a hurry and HTML code was littered with plenty onclick="somefunction()" code. I re-factored all of that so that handlers were added on DOM.load; however, there was one nasty feature left in the code.

I had a table of 6 rows and button which that says “Add line”. Adding lines is easy: create the whole table row HTML on server, fetch that with XHR call and do tbody.innerHTML += sRow. Actually, this was the code I used for IE and as soon as this is done, all the previously set event handlers went missing. Like they never existed.

Bottom line: changing innerHTML property removes all late-bound event handlers and script on that piece of the page.

Solution was to get off my lazy fingers and type in proper DOM calls: insertRow and insertCell. Clean code and no browser branching. :)

Sony SZ1XP/C: battery problem resolved

In my review of this notebook, I mentioned that battery died rather quickly after being purchased, which was very unfortunate for me as my warranty was not valid in Serbia (Sony is not selling notebooks here).

At the end of January, I finally had a chance to go to UK, for four days. As soon as I got there, I called Sony support numbers and got online with CS guy who was a pleasure to talk to. After hearing reports that other companies are using off-shore CS, it was nice hearing a person speaking excellent english.