Sunday, April 15, 2007

NoVa Code Camp

A special thanks to the organizers and sponsors of the Northern Virginia (NoVa) Code Camp this weekend. It was my very first code camp and I enjoyed it thoroughly. Kudos go out to the speakers of the sessions that I attended - Bryce Covert, Blair Hall, Jonathan Cogley, and Paolo del Mundo (with assistance from Jay Flowers).

Monday, April 09, 2007

Prototype, JSON, and DHTML

I am playing around with the Prototype JavaScript library and in an ASP.NET application, as I have heard great things about these two libraries. I know, I should be using AJAX.NET, but I am not sure that it is mature enough to accomplish exactly what I need. So I downloaded's (man that's hard to type) scripts and added them to my solution - simple enough.

In an effort to see if I have a grasp of the JSON syntax, I included the Protoype.js file in the header of a simple HTML page and created a simple object. You'll note the use of "simple" in my description of the web page and the class that created. So I fired up trusty, ole IE to execute the page and nothing happened. Man was I irritated. How could I mess that up?

So I went to the Prototype website to ensure that I had the class creation syntax correct. Okay, I was missing a semi-colon at the end of my prototype definition (not the library - this can't possibly be confusing?), but I know you don't need that semi-colon as they are not required by JavaScript. I added it anway.

Now I Execute the page again. Nothing! Not even one of those helpful error dialogs that IE provides when there is a scripting problem. This story continues for about 6 hours of my Friday while I attempt to find the problem. Long story short, and a weekend's worth of rest I fixed the issue in 30 minutes of playing around this morning.

The problem: my "script" tags were self-terminating in the "head" of my XHTML (I forgot to mention that earlier). As far as I know, a self-terminating tag is legal XHTML, but apparently not where "script" tags are concerned. I could spend hours sifting through the XHTML schema, or searching online, but I am just going to document this here. "<script />" is not the same as "<script></script>. The latter works for script includes, the former breaks the HTML document in both IE and Firefox (FF). Now I am well on my way to JSON and AJAXian goodness.

Except that my boss just told me to stop spending so much time on research and "just get things done". Which is a whole other post.