What is Toluu?
Toluu is a free service for sharing the feeds you read and discovering new ones.
Get Invite

Brian Beck's Text Adventure

open source software hacker • cofounder of Unstoppable Rocket • web application superhero www: brianbeck.com email: exogen@gmail.com


Roomba decided to take its docking station — originally...Yesterday
MzaUlGORah0mgz1tg4PWBjtDo1_500.jpg

Roomba decided to take its docking station — originally placed in a much more sensible location — for a walk.

geopy sprint at November C³ meetingNovember 4

After suffering from over a year of poor maintenance, geopy is finally getting some love this month. A few other developers and I will be focusing on geopy at this month’s Cleveland Code Co-op meeting. We’ve come up with an ambitious todo list, including:

  • Merging pending patches (bug fixes, Python 2.3 support, accuracy support)
  • Adding unit tests
  • Reverse geocoding support (finding locations near a point)
  • Higher level Points and Locations (instead of tuples and strings)
  • Keeping up with third-party geocoder APIs (and hacks)
  • A “compound” geocoder for querying multiple geocoders (as fallbacks or for averaging results)
  • A parser module with support for geotagged documents (including the Geo microformat), ISO 6709, GPX files, etc.
  • Geohash encoding/decoding
  • A formatter module for pretty-printing coordinates, distances, and ordinal directions (think “south by southwest”)
  • setuptools entry points to support geocoder plugins and discovery

I think these features are in line with the “geocoding toolbox” goal of the project. While there are a lot of features there, I think geopy will still feel like a nice compact library.

Why does geopy deserve some developer attention? Because it’s being used in numerous interesting ways, including: directing r

Unstoppable Rocket pumpkin.October 30
MzaUlGORafpodu7eS1qVJIU5o1_r1_500.jpg

Unstoppable Rocket pumpkin.

Henry the degu. ♥October 28
MzaUlGORafmt7tgq8L6fk7G4o1_500.jpg

Henry the degu. ♥

Simple scheduled message queue (with threads)October 18

Here’s a more flexible version of the message queue in my last post. This version uses the threading module instead of processing, so it has no dependencies. See the new example after the code.

""" Simple message queue. Messages are scheduled and processed in a single worker thread spawned from the main process. Thus, events are enqueued asynchronously, but processed in a linear fashion. """ import time import sched from Queue import Queue, Empty from threading import Thread def delay_put(duration, queue, message): time.sleep(duration) queue.put(message) def run_scheduler(scheduler): scheduler.run() class Scheduler(sched.scheduler): def __init__(self, queue, handler, timeout): self.message_queue = queue self.handler = handler self.timeout = timeout sched.scheduler.__init__(self, time.time, self.delay) def delay(self, duration): queue = self.message_queue if duration > 0: # Spawn a process that will sleep, enqueue None, and exit. Thread(target=delay_put, args=(duration, queue, None)).start() try: message = queue.get(True, duration + self.timeout) # Block! except Empty: self.timed_out() else: if message is not None: