• Failure to check return Location Manager values

    Last night I downloaded the Bing for iPad app and it looks quite interesting. However, I ran into a problem that shows a failure for the developers to properly handle an error condition. I told it to use my current location and it said I was over 500 miles away from my home. The location was where I was a few weeks ago. I switched to the Maps app and that app said it was unable to determine the location. A quick device reset fixed everything including Bing, but the fact that Bing didn't know where I was got me thinking about what caused it. (My WiFi router is registered with Skyhook, so my iPad will always return my house's location when it asks for the location if I'm home.)

    I've worked a lot with CLLocationManager and have found some quirks with it. First, sometimes it never returns a value, so developers must set a timer and alert the user. This, however, was not the problem in the Bing app. When the app requests the location, it does something like:

        self.manager.desiredAccuracy = kCLLocationAccuracyThreeKilometers;
    

    which means it only needs to be accurate within 3 km. As the CLLocationManager updates its location using:

    - (void)locationManager:(CLLocationManager *)inManager
     didUpdateToLocation:(CLLocation *)newLocation
     fromLocation:(CLLocation *)oldLocation
    {
     	if (newLocation.horizontalAccuracy >= 0.0 &&
              newLocation.horizontalAccuracy <= 10000.0)
    	{
    	}
    }
    

    it needs to check the horizontalAccuracy to make sure it is positive and within the desired range. I believe that the Bing app isn't properly checking this and just taking the value that is immediately returned. Since CLLocationManager caches the last location for efficiency, it is instantly returned. This is the wrong thing to do without checking the result.

  • Confused AppleTV

    This evening I went to watch a show on my AppleTV as I've done every night in the last week. I used my iPad to select the show and when I hit play nothing happened. I used ezDesktop to look at my Media Center and saw that iTunes was running fine. There were 2 possibilities; the AppleTV was confused or the Mac Mini needed a reboot. I browsed the shows on my iPad via the Videos app and started a show without problems which lead to only one possibility.

    After a quick reboot of the AppleTV using the only method I could find (yanking the power plug), it came back and was able to watch the show.

    Why did the AppleTV become confused? Why isn't there a way to reboot the box without getting off the couch? I have no idea.

  • Experimenting with WordPress Caching

    In the last few days, I've read about caching WordPress blogs to improve performance. I've played with this in the past, but always gave up as it wasn't something I needed, at least not yet. However, I took another stab at it and installed W3 Total Cache to see how much good it would do.

    The plugin is amazingly easy to setup and seems to work well. However, one thing that kind of annoys me is that new blog posts don't update the home page. Of coure, I can turn off caching of the home page, but that kind of defeats the purpose of a cache. As a happy medium, I turned down the caching to 300 seconds (5 minutes). If I ever get Fireballed, I'll change things around and hope for the best. (For those out of the "know", fireballed means getting linked to by John Gruber's Daring Fireball site. Basically if you get linked from there, your site is going to get pounded with hits.)

  • WordPress SSL Admin and Twitter Tools

    For a long time, I've used WordPress for my blog hosted on my own server or virtual server. This has allowed me to experiment with plugins and play around with various settings. As I've been doing a lot of posting from my iPad using the WordPress for iOS app, I realized that the posting link was over a non-secure link, so my admin password was passing in the clear over the Internet. I set out to secure the admin portion of my blog. I read an article over on WordPress's site.

    The actual securing it wasn't that difficult. I already had an SSL certificate from StartSSL which works well and the price of free is good. In addition their certificates use a subject alternative name which lets me secure blog.gruby.com as well as gruby.com if I choose to use that in the future.

    After a few posts, I realized I had a problem. I use the Twitter Tools plugin to tweet each time I post. The URL in each tweet had https in it and I didn't need to put excess load on my server encrypting public pages. So I went about figuring out how to create my own WordPress plugin to remove the https and replace it with http. I'm not a php expert nor a WordPress plugin expert, but I came up with a plugin that appears to work.

    This plugin is free to use and maybe it will help someone.