Archive for April, 2007

Apr 30 2007

SQL Alphabetical Sorting Without “The”

Published by Chris McAvoy under Python, Ruby, cranky

Hey Lazyweb, is there some clever pattern that addresses passing an ‘order by’ to a database and getting an alphabetically sorted list where “the” doesn’t factor into the sort?

Look at this gigantic list of bands. It’s annoying to have to remember that “The” screws everything up.

Do I create a field “name_without_the” and select * from bands order by name_without_the? I’m assuming this is a common alpha-issue that’s been solved millions of times, but I can’t find a best-practice suggestion via two minutes of Googling.

Please suggest clever ways to do this without sorting in-memory or some junk like that. Let’s keep it in the database folks.

6 responses so far

Apr 29 2007

OLPC Sugar Development Article

Published by Chris McAvoy under Python, olpc

Another article on developing software for Sugar, this time from IBM.

One response so far

Apr 25 2007

Hackety Hack

Published by Chris McAvoy under Ruby

Hackety Hack, a _why project. Just saw it on reddit. From the site:

In the 1980s, a language called BASIC swept the countryside. It was a language beginners could use to make their computer speak, play music. You could easily draw a big smiley face or a panda or whatever you like! But not just BASIC. Other languages like: LOGO and Pascal were right there on many computers.

In this century, you may have dozens of programming languages lurking on your machine. But how to use them?? A fundamental secret! Well, no more. We cannot stand for that. Hackety Hack will not stand to have you in the dark!!

Good stuff…_why is the perfect combination of creative & do-ative to get something like this done. Go get ‘em tiger.

3 responses so far

Apr 25 2007

OLPC Beats Classmate

Published by Chris McAvoy under Python, olpc

…so says Wired.

No responses yet

Apr 24 2007

Dashcode & Javascript

Published by Chris McAvoy under Javascript, widgets

At work, I’ve been working with Mochikit. I don’t have a huge javascript background, mostly just fidgeting with other people’s work, so this has been pretty fun. All the toying around with javascript led me to OSX Widgets and Google desktop (widgets? whatever…I can’t keep all these names for little javascript toys straight, you know what I’m talking about…), and found the OSX “Dashcode” application for building widgets.

It’s realllllly slick. So slick, that it almost makes writing a widget not-fun. Ho-hum. Regardless, I’m definitely thinking more about fun things I can do with javascript and JSON than I have in the past. I know I’m (consistently) six months behind the curve, but that’s fine by me. Let those other suckers cut the path. The guy towards the back of the wagon train typically doesn’t blunder over a cliff, right?

No responses yet

Apr 20 2007

Favorite Television Character in Recent Memory

Published by Chris McAvoy under Blog

No responses yet

Apr 18 2007

Wiki Markup.

Published by Chris McAvoy under cranky

Could someone please decide on one syntax for wiki markup? Please? I’m tired of learning how to write a f’ing pre tag.

7 responses so far

Apr 16 2007

First Pycon, now the Olympics

Published by Chris McAvoy under Python, pycon2008

Chicago got the US bid for the 2016 Olympics. I’m assuming they heard about Pycon coming here and figured that we were Olympics-capable.

2 responses so far

Apr 16 2007

Ian on Python’s Makefile

Published by Chris McAvoy under Python, Ruby

Rails uses Rake in lots of neat ways. “rake test,” “rake stats,” “rake db:test:clone_structure” are three little examples that I use constantly when I’m working on a Rails project. For whatever reason, I never considered writing my own tasks, until I started looking at Marcel Molina’s excellent Rakefile in his Amazon S3 library.

I end up writing a handful of little scripts to do common chores when I’m working on a project, I’d never thought to wrap them all up in a nice Rakefile. It would be a great tool to have in Python as well. Granted, you could just write a Rakefile and use it in a Python project. There’s nothing wrong with that (in my humble opinion). Lots of people (including me) use Capistrano for deployment, regardless of the base language of the project. The right tool for the job, right? Right.

That said, for something like “a bunch of little tasks,” it would be nice to keep them in the language you’re working on at the time, so there’s less context switching on the project, right? (I guess…I’m still sort of torn on that, I don’t know if it really makes a big difference or not.) A few ChiPy’s ago, I was talking to Ian about this exact issue, “why doesn’t Python have a good rake equivalent?” He suggested I check out distutils, I did, and didn’t like it much. Over the weekend, he wrote up a good blog entry on the topic, and it seems pretty convincing.

So, in short, I’m going to give it a shot. The next time I need to write up some sort of scripty-buildy-thing on a Python flavored project, I’ll try writing it as a distutils function. I encourage you to try it too. If you need any convincing why this is a worthwhile thing, I strongly encourage you to take a long look at Marcel’s Rakefile, that thing has “develop quick and clean” written all over it.

2 responses so far

Apr 13 2007

Partitions on Rails

Published by Chris McAvoy under Ruby

I’ve been following this whole Twitter thing off and on for a few days now, hoping to see some new idea on how to handle very large databases in rails. Not that I need to know at this point in my Rails usage, but it’s interesting.

Someone, presumably the author of the tool, linked to acts_as_partition, which seems like exactly what I think would be right up Twitter’s alley. Partition the database across multiple distinct databases, build some logic that says where things go, and you’re in good shape. Good stuff. If I’m not mistaken, this is very similar to the whole hibernate shard thing.

Good work acts_as_partition guy.

In related news, the module is attributed to the guys at geni.com, which is a pretty cool looking family tree application. It’s nice to see some Ajax-y-ness applied to not-another-to-do-list for once.

No responses yet

Next »