The Lair

Do not meddle in the affairs of dragons, for you are crunchy and taste good with ketchup

parsing URLs

December 19th, 2007

There are lots of things that you’d want computers to simplify for you - but the obvious methods for simplification don’t actually work. For example, finding out if a user entered email is actually valid. The description and code involved (see here and the monstrous chunk of code here) belies the apparent simplicity of the task.

So it was for my own little task. What I wanted to do was write a general purpose method (in PHP, actually - but the language itself is unimportant) to infer the blog address, given a permalink. So, given any post URL - I wanted to find the address of the blog itself. You’d think that this was a relatively straightforward task. But, if the preamble didn’t alert you already, it wasn’t quite as simple as I first envisaged.

Read the rest of this entry »

facebook applications

June 23rd, 2007

Yes, I recently hopped on yet another bandwagon as some of you may well know. I decided to check out what the huge fuss was all about - I started poking around the Facebook API and wrote an application.

Is it a big deal? I rather think it is . There are reports of teething troubles aplenty and I discovered some limitations in the documentation - but overall, I really like the concept of being able to wrestle with the innards of a social networking application. It was fairly frustrating to figure things out, but ultimately it is an interesting experience. I’m still coming to grips with the possibilities.

Read the rest of this entry »

developers developers developers

June 18th, 2007

A bit of a nothing post, really - but I thought it would be moderately useful to document the development tools for the three four major browsers that are available in the Windows world.

Firefox - use Firebug. Nuff said. Honestly, this is pretty much all you need. It allows pretty much everything that you’d need for JavaScript, CSS and general mucking around with pages. Perhaps Web Developer comes close; but nothing else does. There are lots more development extensions related extensions for Firefox; Google should reveal the more obvious candidates.

Internet Explorer - use the Developer Toolbar for Internet Explorer. It’s by Microsoft, it’s free. Not great, but it does the job. Non-free but closer to Firebug in functionality, IE Inspector offers a couple of tools which function as Internet Explorer addons. The debugger is sort of weird, but it works. IE is still inscrutable to me though. No browser gives me as many headaches with layouts.

Opera - there are plenty of tools for developers in the Tools Section - I actually like the DOM tool implemented by Opera more than I do the equivalents in other browsers. That’s purely a matter of personal taste, though.

Safari - just enable the debug menu. It is disabled and hidden by default, but enabling is just a matter of setting the right preference. On the Mac, however - you’d need to use the defaults utility - on Windows, you’d need to edit the Preferences.plist file as explained here. The debug menu on Windows contains a user agent switcher, a JavaScript console and couple of other features (Snippets? Site Specific Hacks?) that I haven’t quite worked out yet. The JS console is pretty much essential of course - the Webkit JavaScript implementation is somewhat strange (and has never worked for me, despite targetting KHTML/Konqui).

I still think Firefox edges it for sheer breadth of development tools available, but the more you know eh?