Sunday, August 30, 2015

Website rebirth, fooling around with Dart

I think I originally built it around 1998 as a way of learning HTML. It was never as awful as Cameron's World but was originally a longish page of text with links to other longish pages, somewhat focused on a wicked good Irish actor. ("Parchment" wallpaper, but mercifully, no animated gifs.) Within a few years a purchase of Macromedia Dreamweaver gave it a menu made of slices (does anyone remember those?) and a frame for content.

It stayed that way for well over a decade, getting the occasional content update, eventually dropping the Irish actor stuff and just focusing on falconry. For a while I was updating it pretty frequently with my falconry activities, but that got tedious and I doubted anyone was reading it anyway. I kept it around as an archive to the FAQ (does anyone remember Usenet?) and an article about all these little maxims my sponsor taught me.

Around May I decided I finally had enough knowledge to redo the site with JQuery and CSS. I also had motivation: a chat room frequented by escape game fans was going through a lot of drama due to an out-of-control moderator/admin, and the owner had threatened to shut it down. I had been part of the chat room for about a year and liked the vibe -- very nice people, kind and supportive to each other in trying times. If the chatroom were shut down, it would need to continue elsewhere.

So I rebuilt the website (all simple and clean looking now) and tested out a couple different chat services. None of them really had the right mix of end-user fun, storing chat history, and security. (The crazy moderator was known for sockpuppetry and allegedly had hacking skills -- although from my perspective, I take "hacking skills" with a grain of salt when the description comes from end-users. Having been IT, I know all too well how end-users like to have one simple password for everywhere they go.) After several weeks experimenting with a few of the old chat users I'd managed to rope in (I'm grateful they stuck with me, registering and re-registering as we test-drove more chatboxes), I finally settled on a nice package called Blab!Chat. Granted, it's written in PHP, so aspects of security are suspect, but I could fiddle and tweak with it myself. It's now running happily with the core group of people from the old chat, which the owner shut down about a month after his threat and ran the crazy moderator off his site.

At about the same time I learned that Sonic, a well-respected Bay Area ISP, had finally begun to offer service in my area. I leaped on the opportunity to ditch my ATT service, with its utter lack of anything useful beyond basic Internet and landline, for slightly more bandwidth, real website hosting (as opposed to ATT's "storage" which hashed the names of uploaded files, making it impossible to build a website), server side scripting, and IP phone for $30 less.

So, suddenly and finally, I've hit the 21st century ;)

A couple days ago the bf suggested a new project -- write a Minesweeper game -- using Dart or Elm. I explored Elm but the functional programming paradigm is a little too foreign for moment. Dart is a mix of Java and Javascript with some nice DOM-element functions -- recognizable and comfortable -- indeed, using true Dart functions in a Dart program seems entirely optional. I bashed this out in about four days, needing only general structural questions to the bf. Right now we're doing code review with the goal of making it more Dart-like.

Friday, May 8, 2015

Google Maps kml files are now zipped kmz files

Apparently I'm bad at keeping up to date when APIs are changed. I looked at TacoTacoTruck recently and it failed to load any map data. It seems that instead of giving a plaintext kml file as it used to, Google Maps returns the file in zip format (kmz), even if you ask for a kml file.

So it needs to be unzipped. Here's some code:

class Fetch(webapp2.RequestHandler):
    def get(self):
        # urlToUse is just a little hardcoded map of a filename as key and the url as the value
        url = urlToUse[self.request.path]
        if url is None:
            print("unexpected path: %s" % self.request.path)
        cachedData = memcache.get(self.request.path)
        if cachedData is not None:
        startDownloadTime = time.time()
        result = urlfetch.fetch(url)
        if result.status_code == 200:
            elapsed = time.time() - startDownloadTime
            print("downloaded %s in %s seconds" % (url, elapsed))
            bytes = io.BytesIO(result.content)
            zip = zipfile.ZipFile(bytes)
            # retrieve the file name of the first (and only) file in the zipfile
            firstName = zip.namelist()[0]
            print("unzipping %s" % firstName)
            # unzip it into contents
            contents =
            memcache.set(key=self.request.path, value=contents, time=cacheTime)
            print("can't fetch kml file for %s. Status=%s" % (self.request.path, result.status_code))

Friday, May 1, 2015

Donors, thank you!

In the past two months I've received several in-app purchase donations for my Napkin paint program. Thank you, kind people!

Small but useful updates to MapTag

Due to the increasing number of user-generated panorama shots being uploaded to Google, it's been harder to find a game where you can actually navigate. I was playing today and got 4 user panoramas in a row! So I added a check to look for "Google" in the copyright info. This should nearly eliminate getting a user-generated pano.

Another minor annoyance came after you got the score window. You could click it and it would close, but the map where you made your guess didn't close along with it. Now it does.

Finally, I've added a new themed game called "New to the City." It places you in a random location but within a specific city. There's currently 24 cities to choose from, so go get lost!

Happy wandering!