Wednesday, 30 November 2011

Just Buggin'

Yesterday evening I thought that I had finished making the needed changes to my photo website and could run it through the Microsoft Site Analyser tool just to make sure everything was okay this morning. But then, even before I did that, I found a problem, and then some more problems.

One thing I did do was to add <link>s to my pages for self, next, prev, last, first, and up. I hadn't heard about rel="up" before, but found out about it on this page: The WHATWG Blog — The Road to HTML 5: Link Relations - rel=first, last, prev, next, and up. Up means the category page the current page is a direct descendant of.

I spent most of the afternoon trying to debug why the javascript in my KML wasn't working properly in Google Earth. Unfortunately the lack of any debugger in Google Earth makes debugging very difficult. What I had to do was to delete the KML from the 'Temporary Places' folder in Google earth, then clear the memory and disk cache. I would make a small change in the javascript, then reload the KML file and see what difference it made. Then repeat.

Any debugging messages had to be output to the HTML of the infoBubble window, you can't do Alerts in Google Earth. Despite spending all afternoon on it, I still couldn't work out why my javascript wasn't working properly. The problem was with an AJAX request made by jquery, when it got the response it would fire the error handler rather than the success handler. But I couldn't get any info on what the error was, so I posted to the jquery forums in hope that someone there can help me.

One thing I came across while trying to solve this problem was that my server was sending a Content-Type header of text/html for the JSON response. This is because the JSON is generated by PHP, and I wasn't setting an explicit Content-Type header with PHP. So I did some research and found the correct Content-Type header for JSON is application/json. I wondered if I should also put charset=utf-8, however according to this article: Setting the HTTP charset parameter, you only need to do that for Mime types of text/x, not application/x.

In the evening I moved all the stuff (except my bed) out of my bedroom and into L's bedroom as we are currently having all the bedrooms re-carpeted, and mine is next.

No comments: