- had hella fun at ‘cross practice this evening. #
Author Archive for Wyatt
Note: I would have posted this way back on the 19th, but iPhone 3G won’t mount on Ubuntu any more. Then there were permissions problems with my WordPress installation on WebFaction.
“”"Instructions: Take a picture of yourself right now. Don’t change your clothes, don’t fix your hair - just take a picture. Post that picture with NO editing. Post these instructions with the picture.”"”
- Pearl Izumi Cyclone full-fingered gloves get two thumbs up (from me, as of yesterday). #
- It’s a mystery to me why more cyclists don’t ride with a rear view mirror. Maybe they don’t know about them? #
- I can barely ride without a rear view mirror any more. I feel that it’s more a necessity than a helmet. #
- Don’t get me wrong, though–helmets, while not a magical shield, are, IMO, essential. #
- It’s just that a mirror is used very often and is an effective tool of prevention. Hopefully, that helmet never gets used. #
- I can recommend the “Take a Look” mirror for eyeglasses. Don’t get the plastic one that’s similar. It WILL break. #
- @philipmorg I’m looking for my BLACK sneaks, dog. #
- Thanks to @bike4mylife for keeping up with The Politics. Twitter is my main gateway to political news these days. #
- Guess what? byCycle is now open source (GPLv3). Get it here: http://guest:guest@code.bycycle.org/ #
- http://tinyurl.com/454ch7 #
- Have you seen my black New Balance sneakers? #
- Paradox Cafe has expanded; got rid of old booths; replaced w/ tables. #
- “Rational self-interest.” Talk amongst yourselves. #
I’m working on a project where the client wants a cool sliding navigation effect. We’re implementing this with JavaScript/AJAX/DHTML.
One of the constraints is that pages can only be reached via certain other pages. For example, if you’re on the /portland/contact page and want to go to the /seattle/contact page, you’ll first slide up to /portland, then over to /seattle, then finally down to /seattle/contact.
After a while, it occurred to me that there were some similarities with another project I’ve been working on off and on for the last few years, byCycle.org, which is a bicycle trip planner ala Google Maps.
I had written a Python version of Dijkstra’s Single-Source Shortest-Paths (SSSP) for byCycle.org. That’s available on PyPi as Dijkstar (so named because it also does has the potential to do A*). I figured it wouldn’t be too hard to port the Python version to JavaScript, and it wasn’t.
There were a few snags, though. Most of it was just syntactic and semantic differences between the two languages. The biggest issue was that I use “heapq“ in the Python version to maintain the costs to previously visited nodes in sorted order. JavaScript has no priority queue implementation that I could find, so I came up with a different solution that involves updating an Object (AKA “dict“) with costs to newly visited nodes and sorting the keys to pick the next node to visit. I’m assuming/hoping the underlying sort implementation is highly optimized.
Interestingly, I think I found at least one bug in the Python version, although I’ve been using that version for a couple years now with no known problems, so it must only be applicable in certain edge (no pun intended) cases (or maybe it’s due to some difference in the languages–need to take a closer look). I think the JS version came out cleaner, too.
If anyone’s interested, I’m releasing this under an MIT license. For now, you can get it from here. Note that it depends on the util module that you can get from here. The util module contains some other Python-inspired JavaScript, in particular a couple of functions for generating namespaces and classes. I might write another post about that at some point.

Recent Comments