inside Habbie's mind

Archive for June 2010

cron considered harmful

written by peter, on Jun 22, 2010 7:19:00 AM.

On numerous occasions I have lamented both the design and the typical usage of cron to friends and other geeks. My main gripes:
  • jobs are not protected against running concurrently (design issue)
  • intervals are fixed (design issue)
  • people tend to schedule the same job at the same time on whole clusters of machines (typical usage issue)
The first issue can be fixed with tools like lockfile and setlock — a lot of red tape for something that should be a default feature.

The second and third issue are closely related in that both cause undesirable load spikes because many things happen at the same time, either because of intervals phasing up or because of similar jobs running on a bunch of machines at the same time, perhaps hammering the network.

A specific pet peeve is Mailman Reminder Day. Firstly, I just don’t see the point; if my address is on a mailing list and that list is practically dead, I just don’t care. Secondly, it means every first of the month I have tens of reminders that I just delete. Some of these lists are busy — for those, the reminder is a minor nuisance. But many lists are extremely quiet (think software release announcements) and for some of these lists, the reminders are over 50% of the total mail volume. It’s so wasteful. Also, I can’t help but think that all those reminders being sent out at the same time (well, divided over 24 hours because of time zone differences) cannot be good for the mail ecosystem as a whole.

For issues two and three, Colm MacCárthaigh wrote a few great posts detailing why cron is bad, and showcasing one potential solution to the issues at hand. I suggest reading these posts fully, they are very insightful:

This post was inspired by my pet peeve about Mailman and about jobs running in parallel unintendedly; this post was triggered by Job Snijders pointing me to another interesting post; Colm’s posts above were referred to in the comments.

silly Python unicode mistake

written by peter, on Jun 12, 2010 7:58:00 AM.

For a simple blog-to-twitter posting gateway (source code) I’m relying on the excellent feedparser and twitter modules, and I am trusting them to handle unicode strings without trouble. With most well-written Python modules (and these two are no exception!) methods will return unicode strings as they see fit, and other methods will accept these unicode strings and handle all the nitty gritty encoding details for me.

A simplified version of my workflow would look like this:

def post(entry):
  title = entry.title
  print "posting [%s]" % title
  api.PostUpdate(title) # api is a twitter Api object

feed = feedparser.parse(config["feed"])
for e in reversed(feed.entries):
  if not e.id in seen:
    post(e)
This code bombed out with an exception on the first post that had a non-ASCII title. Can you spot why?

It’s the print statement. All the APIs I’m using have zero trouble with unicode, but print wants to encode for your terminal and it’ll usually assume that that is ASCII. My ‘debugging’ output actually broke the program. My workaround is to say title.encode("ascii","replace")

Brend on #python pointed out to me that the issue is not, exactly, print. The issue is interpolating title into a non-unicode string. Depending on environment, using print on the unicode object might in fact work. For those environments, saying print u"posting [%s]" % title could help. In my case however, I ran into the issue from cron with no locale set at all, so dumbing the string down to ascii is still the right thing to do.

Mac desktop Twitter client roundup

written by peter, on Jun 11, 2010 1:10:00 PM.

I’ve been a Tweetie 1/Mac user for a long time now, and it has suited my needs well. However, there are minor annoyances. After Twitter acquired Tweetie developer Atebits, posts from Tweetie/Mac started showing up as posted from ‘Twitter for iPhone’. Also, Tweetie has semi-excellent keyboard navigation support but it’s too buggy, making me grab my mouse/touchpad in annoyance very frequently. Given the sheer amount of Twitter clients available, I asked my friends on Twitter and Facebook to suggest some options. Here are my biased opinions on the suggestions. I would like to thank all who contributed!

Kiwi

Kiwi looks and feels like it really wants to be Tweetie - but it’s nowhere close. Scrolling is jerky and the free version is much more annoying than the occasional ad in Tweetie.

Echofon

Echofon was recommended to me as ‘very minimal yet complete’ and it is. For single account usage, Echofon is basically on par with Tweetie for usability, including keyboard navigation. However, multiple account support seems hackish - events in one account are very hard to notice when focused on another account. This is one thing Tweetie gets absolutely right.

If I only had one account to manage, I could seriously consider switching to Echofon.

Nambu

Nambu is a bit fuller-featured in the UI department than the clients above, including Tweetie. Keyboard navigation is better than Tweetie (although it lacks some shortcuts) and about as buggy. Like Echofon, single account usage is great, and Nambu has some features I really dig, like thumbnails on twitpic-posts. Multiple account support in Nambu is excellent, with a choice between combining all timelines, and having them separated with use of a sidebar. Enabling the sidebar pops out an interface that resembles a cross between Tweetie and Mail.app, very clean.

If Echofon or Tweetie seem limited or minimal, Nambu is a great choice.

Note that adding an account to Nambu means you suddenly follow two extra accounts (@nambu and the developer). The checkbox to disable this behaviour doesn’t seem to work. Spammy if you ask me.

TweetDeck

On first startup, TweetDeck is very daunting. It more than fills my 13″ MacBook screen which is too much. I know that TweetDeck is -very- configurable but I did not feel up to the task. Additionally, TweetDeck notifications are not handled via Growl.

Yoono

Yoono, like TweetDeck, immediately took over my screen with absolutely nothing, asking me to configure my ‘columns’ from scratch. Too much hassle.

Conclusion

After trying all these clients I went back to Tweetie. It may not be perfect but I’m too used to it. I’ll probably switch to Nambu sometime soon. Both Echofon and Nambu I will recommend to people when asked for Twitter client advice.

Update July 12th: I’ve switched to Nambu and I’m not switching back. Keyboard navigation is excellent (although a bit buggy at times). I do miss Tweetie’s Command-U to look at a specific user, but otherwise Nambu seems superior in many ways. I’ve updated the Nambu review above to account for bugfixes they made since.