30-XII-2011.

Reposting from blog.

Long live open source

Back to my pet project. I noticed that the web form doesn't refresh after saving. Why should it refresh if it submitted successfully? Simply because for some controls I have combos and textboxes overlapping, and I show the textbox in viewing, and the combo in editing. Once submitted, the combo is hidden and the textbox comes forth.

But the combo doesn't get the value from the combo - it has to get it from the server, it's a different field. So I found that my predecessor on this project has disabled ReloadOnSave. Ahmmm... why? Because it bugs out when the listener code (in jQuery.forms) tries to find the form. Because it can't. The object passed as form is not a form, it's a xhr... why?

Firebug to the rescue. Tracing back several notches up the return stack, I find that the listener actually gets four parameters, the form being the fourth, while it only expects three, form as third. Wow - that's a surprise. In all the languages I used so far, passing extra parameters was a big no-no and is bound to give you a house sized error. JS just discards the extra parameters and goes its merry way. Interesting, never seen that.

But now, comparing this conundrum, and how fast I was able to solve it, with some equally deep shit that used to happen with m$'s apps (SQL server, IIS, Word and Excel automation)... I learned (again) to love open source. I wrote how bad can it get already. This time, it was so easy, thanks to Firebug. Its getting better and better, and updates come regularly. The script page, watch tab, shows only the local objects (and I can see any other objects in DOM tab), and so I was able to see the contents of each parameter, up and down the stack. It took only about five runs until I spotted the place where the form parameter was expected and a xhr was sent instead. One notch up the stack, I saw that it sends four parameters where three were expected. OK... let's insert a new third parameter... and voila, five minutes later it all worked.

Analysis: jQuery is open source and comes with a source. Firefox is based on Gecko, which is not only open source, but has the interface so well documented that it's easy to write plugins. Firebug is one such plugin, and it's open source. The main difference between open source and proprietary software, in my case, is that these are programmers' tools, written by programmers for programmers, with very little (if any) influence from sales department, lawyers, and company hierarchy. People add features they need, not the ones that can sell the app. No bells and whistles, no smoke and mirrors, just code which works and does what I need. Simple as that. And it's all in the open.

Hence the title.

And, for some reason, only three things in the email. Problems with Feds here and there, and rasejani and oldwave congratulating each other with the new year. All regular.

Lena let Donald in and petted him and I made a few shots. Saw Raja on skype.


Mentions: Donald, Feds, Jelena Sredljević (Lena), Majkrosoft (m$), oldwave, rasejani, Ryu (Raja), in serbian

26-III-2026 - 26-III-2026