Tuesday, May 22, 2007

We need an E4X like XML parser for Java


So we could replace the ugly code blocks like


/*Get the value of attribute "id" of the first "account" element in the document */
NodeList nodes = doc.getElementsByTagName("account")
Element account = (Element)nodes.item(0);
String id = account.getAttribute("id");

with something like

String id = doc.account[0].id;

Wouldn't that be cool?! Better than DOM, SAX, StaX or even XPath to some extent from a usability perspective. But it looks like this ease of use is reserved exclusively for the javascript developers for now :( .. Btw it looks like you can already do this in Ruby using REXML as explained in this excellent article.

Hope rest of the programming world would catch up soon...

Using Google Maps + GPS on Cingular 8125



Unlike most mobile mapping apps, Google maps app doesnt seem to provide an option to manually configure the GPS port (especially since there is no integrated GPS on 8125 and have to use an external bluetooh GPS module instead) and seem to be depending on the system GPS app to grab the info. Cingular 8125 comes with the GPS app (Start -> Settings -> System -> GPS) disabled by default. So if you want to GPS enable your Google maps, you must "unhide/enable" the GPS system app via a Registry hack. There are plenty of sites out there with the instructions, but the one at the official Windows mobile team blog seems to be most reliable and less confusing from my experience.
Just follow the instructions on the link above and you should be good - I was up and running in no time with my Belkin GPS module once I made these changes. I used the "Total Commander Registry Editor" (link available here) to edit my registry settings.

Btw I like Google maps app better than any other apps I've used before. First of all its the exact same UI and maps that you are used to on your desktop + the power of google local. Moreover you always get the latest info since this works online instead of pre-downloaded maps etc. And even though I haven't tried it out fully, the live traffic info option looks pretty cool as well.