Patch Wednesday

July 15, 2009 10:30

Doing some cleanup in ~/src last night and I spotted some .diff's I've had lying around. These might be useful to you, or they might cause serious hardware failure. Only one way to know for sure though.

  • god

    kill-pgrp.diff

    Sometimes god doesn't kill a process it has daemonized. It sends a TERM signal to the process it forked but this leaves the forks child running (if you know what I mean). Since god has already forked, it's safe to send the TERM signal to the process group containing the subprocess.

  • ImageScience

    image_science_with_buffer.diff

    ImageScience is a lightweight Ruby replacement for ImageMagick built on FreeImage (and if you've ever tried resolving all ImageMagicks dependencies by hand you'll understand why someone wrote a lightweight replacement). One of the features it's missing though is the ability to load an image from a buffer already in memory. This patch adds that capability.

    Once applied, you can use ImageScience.with_buffer(buffer, buffer.length) where buffer is a plain old Ruby string.

    image_science_with_alpha_icos.diff

    Alpha channel support for ICO images why not.

  • pybeanstalkd

    pybeanstalk-osx.diff

    pybeanstalk provides a Python interface to the beanstalkd queue. This patch lets it play nicely on MacOS (OS X Python lacks select.poll but it's easily worked around here).

    Edit: oops, this patch was accepted a while ago. If pybeanstalk isn't working on your Mac, just update to the latest version.

Simple OpenStreetMap Geocoder

April 23, 2009 21:50

Just for fun I thought I'd write a very (very) basic geocoder for OpenStreetMap.org data.

OSM data is very easy to work with, I think it's a good reflection of their pragmatic approach to mapping.

The approach I've used is pretty straight forward. Place names and the search address are normalized a bit. Extra whitespace is stripped, along with non alphanumeric characters, then converted to lower case. If there's an exact match between the search address and a place name this result is returned immediately. Otherwise...

Words from place names in the map are used to build up the word frequency table used for the spelling correction algorithm (devised by Peter Norvig). This is used to correct any misspellings in each word of the search address and if a direct match is found it's returned.

Finally, if there is still no match, the address with the most words in common with the corrected search address is returned.

It's a naive approach, but still fun to write and a nice way to play around with OSM data.

You can check out the source on github.

Building Graphserver on Mac OS X

April 17, 2009 18:15

Graphserver is an excellent piece of software, especially for working with OpenStreetMap data (my latest obsession).

To get it up and running on my Mac I needed to make some very minor tweaks to the Makefile. I haven't been able to run the test suite (odd issue with nosetests on my machine), but the example scripts seem to work correctly.

Here's the Makefile patch, apply it to graphserver/core/Makefile and run make.

'09 Cat Laughs

April 01, 2009 22:45

The Cat Laughs, Kilkenny festival is coming up. I always remember too late and tickets are sold out.

This year, I've booked early: Tommy Tiernan and Dave Gorman at the same gig. There's still time (and tickets) left, go on!

If you're not familiar with Tommy Tiernan, he's a ... umm... comedian or philosopher maybe — I don't know. He's got that special kind of divilment though that'd make reading the dictionary entertaining.

Classic Tommy

1 comment

The Kingdom of Ireland

March 26, 2009 13:00

The first settlers in Ireland arrived in 8000 BC, by 431 AD we'd managed to set up some kingdoms and everyone was having a laugh. By 1922 AD the joke had worn a bit thin and we decided to give up on the feudal kings and queens (and foreign parliaments) and try running the thing ourselves.

I don't have any particularly strong feelings on the subject, but I can understand people at the time thought it was important. I'd be happiest with as little bureaucratic interference in my life as possible.

Still, it's interesting to think about these things. How far away are we from the old lords and heirs?

Here are the current Irish government ministers. All democratically elected, many have held their seats continuously since the 1980s — presumably their constituents are pleased with the job they're doing and are happy to re-elect them whenever they get the chance.

I'm not suggesting anyone inherited a seat, but how many stepped in after a family member? Brian Cowen took his first seat in the Dáil aged 24 after his father, Bernard Cowen TD, passed away. As far as I can tell, he's held that seat since, happy constituents all round.

I don't know a whole lot about politics, but here's the lineage of the first 15 people in that list. Please let me know if I've got anything wrong.

Current Ministers

  1. Brian Cowen

    Took his dad's, Bernard Cowen, seat in 1984 after he died.

  2. Mary Coughlan

    Took her seat aged only 21 after her dad, Cathal Coughlan, died in 1986.

  3. Brian Lenihan, Jr.

    Following his grandfather and his father's footsteps into the Dáil. Mary O'Rourke TD is his aunt, Conor Lenihan TD is his brother.

  4. Mary Harney

    No family seat.

  5. Noel Dempsey

    No family seat.

  6. Dermot Ahearn

    No family seat, (no relation).

  7. Micheál Martin

    No family seat.

  8. Martin Cullen

    No family seat.

  9. Éamon Ó Cuív

    No family seat.

  10. Mary Hanafin

    Daughter of Senator Des Hanafin, brother of Senator John Gerard Hanafin.

  11. Willie O'Dea

    No family seat. Just one bad-ass former accountant.

  12. John Gormley

    No family seat.

  13. Eamon Ryan

    No family seat.

  14. Brendan Smith

    No family seat.

  15. Batt O'Keefe

    No family seat. His proper name is "Bartholomew" by the way, it's not a poorly concealed secret crime-fighting identity.

4 out of 15 doesn't seem so bad, under 27% — though 3 of those 4 make up the top 3 in the list. I wonder what it's like for the entire Dáil? It'd be nice to find out if your incumbent is generational at the next election. I haven't looked very hard but this article on Families in the Oireachtas might be a start.

2 comments

servezip.py on GitHub

March 23, 2009 20:50

I've uploaded a copy of servezip.py to a new home on GitHub.

You might find it useful by itself or just as a quick reminder of how to recurse directories the Python way.

README

Run with: python servezip.py

Point your browser at http://localhost:8000/ and the contents of the directory where you started servezip.py will be made available (including any subdirectories). If you want to download the contents of any particular directory, navigate to it and add the name of the zip file you want to create to the end of the URL.

For example, to download all files and subdirectories of the directory http://localhost:8000/foo/bar enter the url: http://localhost:8000/foo/bar/foobar.zip

The zip file can have any name you want, as long as there isn't a zip file in that directory with that name already (otherwise you'll just get the contents of the existing zip file).

I'm back

March 23, 2009 16:40

It's been almost a year now since my last post. My WordPress install broke badly and I didn't have the courage to take on that much PHP. I tried a bunch of minimalist blogging engines out and rolled a few of my own, before I got to this one.

This is a very small amount of Rails with a very simple HTML template and some light background magic.

Comments

The bit I enjoyed most about posting to my old blog were the comments people would leave. I like seeing a discussion form, even if it's only to show how completely wrong I am about something. One of the designs I tried out had a similar 2 column layout with the comments displayed side by side with my post on the front page. As much attention on the discussion as the post.

I didn't like how comments worked though. I really don't want to own your thoughts on my posts, so I didn't see any reason to build and maintain another comment silo. That ruled out Disqus for me too.

Instead, I'm going to try out Twitter for comments. What makes it different from Disqus for me is how widely it's used and how easily it's mashed up to create strange, odd little apps.

First, I was going to use #hashtags to find comments on my posts.

Something like:

"I preferred your old blog #first-post"
but that keeps other people out of the conversation. What are your followers supposed to do when they see that tag? Be confused probably.

Instead, I've gone with a link back to my post using a shortcode, to identify comments on a post. So replies look like:

"I preferred the hashtags tbh http://dogg.ie/.knqtmh"

Things I like about this approach

  • All comments stay in the commenters' public timeline feed, you own your own comment.
  • A comment is linked to a commenters' twitter account, I get a free identity service. Makes blocking a spammer easier, among other things.
  • You can check out what else a commenter has to say, maybe start following them too.

Things I dislike

  • You need a Twitter account to participate. I expect most of the people who read my blog already have one, but it's still a barrier.
  • It feels a little bit too self-promoting. I'm expecting other people to put a link to my site in their public twitter timeline. I hope that's considered less as spam, more a way to keep the conversation coherent.
  • Comment length is limited. Even with shortcoded URLs, there's still a very small space for a message. I'd hope that if I've said something you really want to respond to, you'll post in your own blog and tweet a reply that links to both.

The old stuff

I've got an archive of all my old posts and comments. I've chosen not to post them yet, maybe I'll review them and repost them, maybe I'll create an archive somewhere — I'm not sure yet.

I'm a bit embarrassed by them you see, some of the stuff I posted (like short tips) came about after I noticed they got the most traffic from Google, so I started to write more short tips just for the hits. I think that was a mistake.

At the same time, they were obviously useful to some people, maybe I'll create a whole other section of tips with a separate feed. I'm open to suggestions.

Thanks

So that's the new blog introduced. Hope it stirs you up enough to get a reply. Thanks for staying subscribed.

29 comments

Hello

March 23, 2009 12:00

Hello, it's been a while since there was any activity here, nearly a year maybe.

You should know, I'm coming back soon.

Just a few more minutes.

Nedroid stuff arrived today. Same handwriting as the comics! (not sure why I was surprised by this) http://twitpic.com/121kwi
one day ago from twitter
I need to sit down.
3 days ago from twitter
A choizo burrito, the only way to start a day of slacking around Dublin.
3 days ago from twitter
Coffee and creme eggs go well together.
4 days ago from twitter
Tattoo design chosen: http://i.imgur.com/Wqcvw.png
6 days ago from twitter
WEEK-END! (on-call)¡
10 days ago from twitter
I am a rotting buffalo carcass!
11 days ago from twitter
Attempting to make coffee with my shiny new machine, trying to remember all @kgleeson's instructions.
12 days ago from twitter
Linked list loop detection.
13 days ago from delicious
13 days ago from delicious
Ok, I'm definitely all done with Ikea now. For at least 6 months.
14 days ago from twitter
igraph is a free software package for creating and manipulating undirected and directed graphs. It includes implementations for classic graph theory problems like minimum spanning trees and network flow, and also implements algorithms for some recent netw
29 days ago from delicious
Things I found out today: Brad Pitt has a younger brother called Doug. Doug Pitt.
29 days ago from twitter
Pydroid is a simple toolkit for automating and scripting repetitive tasks, especially those involving a GUI, with Python. It includes functions for controlling the mouse and keyboard, finding colors and bitmaps on-screen, as well as displaying cross-platf
29 days ago from delicious
Back in Dublin, roads weren't too bad outside of Kilkenny (this is probably always true).
29 days ago from twitter
Headed back to Dublin today, how bad have things got since Thursday?
29 days ago from twitter
Stew or chilli?
34 days ago from twitter
39 days ago from delicious
My copy of Objectified arrived! (http://imdb.com/title/tt1241325/) I knew it was worthwhile coming in to the office on Christmas Eve.
46 days ago from twitter
I have a ton of PDFs I'd like to read...maybe I *do* need a Kindle.
52 days ago from twitter
53 days ago from twitter
Late night soldering fun.
55 days ago from twitter
Car loaded up, ready to get moving tomorrow.
64 days ago from twitter
Good day. Ordered Objectified on DVD and sorted out a nice place to live. Looking forward to the 10 minute walk to work for my commute.
66 days ago from twitter
Every time I go into the kitchen, more and more decorations are appearing. I should probably not go back for a while.
67 days ago from twitter
Possibly the craziest daft ad ever (serious achievement): http://www.daft.ie/2818700
70 days ago from twitter
Geoff's for stew and Guinness. It's ok to be jealous.
73 days ago from twitter
When I read Adam Curtis' blog, I hear his voice in my head.
76 days ago from twitter
Perl: TMTOWTDI -- all of them deprecated.
76 days ago from twitter
Hoooooooaaaaaaaa it's cold.
76 days ago from twitter
Awesome video on the Python GIL from David Beazley, every Python dev should see: http://blip.tv/file/2232410 #python
77 days ago from twitter
We ken'd.
80 days ago from twitter
Woo, tweeting from a mac again. Ahhhhhhhhh.
83 days ago from twitter
Come on an Post, where's my laptop. You could at least show me it on your tracking page.
87 days ago from twitter
I know I've barely started and only know a fraction of what I need to... but I really love my job.
88 days ago from twitter