I did the very same thing a couple of years ago, and although the source is lost, I recall having a Python (2.4?) script of about two screens to do the download - so a hundred lines.When re-implementing the solution now that I know Python and the standard library better, I ended up with 12 lines written in just a few minutes - edited for blogging clarity it clocks in at 13 lines: When we started out doing fleet management at Visual Units, one thing was really hard to get right - distance calculations.

generating list of changesets and updating work-4

Since I'm an automation nut, when I found Travis CI, I was understandably excited - automatic running of my testcases for hgapi from the repository as opposed to a pre-push hook (as I have had it set up since the beginning of time) would avoid the oh-so embarrassing mistakes of forgetting to add a new file to the repository and having a non-working version in the repo. This, to me, is not an acceptable state of affairs.

I just have to set up some service to synch to the Git Hub mirror and all will... So last week I spent a couple of hours setting up a new service, dubbed Bit Sync Hub, that will accept POST requests from Bitbucket and synchronize a (Mercurial) repository with it's Github mirror.

A hundred advices on how to mirror using push-hooks in your local repository, but since I don't always commit from the same computer, I would need to keep all instances (including future) set up properly, and never again could I be a tad lazy and accept a pull request instead of pushing it from my local repo.

It is set up using UWSGI, hgapi with hg-git, and Celery for job control.

It's a bit rough in that it does not report errors (since it does not run synchronously), and always pushes to Github using the same certificate and user, but I've not been able to break it (recently), and it only requires a one-time setup and it will keep your branches in synch!

I'll be in Florence for Euro Python 2013 and do (more or less) a follow-up to the training session I held last year - a very hands-on venture into Python lanugage and standard library features that will allow you to implement your bad ideas in awesome hacks and good ideas with beautiful magic. Ok, so they're all looking at their screens, but that's kind of the point with a training session in my opinion, hands on keyboards as much as possible.

In other news, I have created a gist with a cleaned up version of my fetch/unpack/csvparse code incorporating some of the suggestions I got here and on Reddit.

The other day I needed to download some zip files, unpack them, parse the CSV files in them, and return the data as dicts.

The implementations that could be found were closed-source licensed version we really could not afford at that stage.

For a while we got by using a solution that relied on having a variant of Lambert conformal conic projection coordinates - it was sufficiently exact if not perfect, and our maps used the same projection, so it worked - although there was the added burden of transforming our stored (WGS-84) coordinates to Lambert every time we needed calculations done.

A couple of years ago, however, we switched to Google Maps API and so we really had no use for Lambert - and increased load and precision demands made using the current solution a worse and worse choice. Or rather, enter his implementation of the Vincenty inverse formula (pdf).