Archive for April, 2008

Sho raps

DSC_0469

Candidates Gone Wild was a great show this year. The kids at the Bus Project did an awesome job, and the candidates stepped up to make sure there weren’t many dull moments.

Perhaps the most memorable moment was Sho Dozono’s weirdly abstract performance piece for the talent show. He dressed up, in sequence, as the following: a stripper, a superhero, and a rapper…all within 2-1/2 minutes. None of the roles were particularly deep, but it was a weirdly satisfying presentation nonetheless.

Attachment

From the ever-enjoyable Bike Snob NYC blog:

Should you treat your bike well? Yes. Should you take every precaution when it comes to theft? Absolutely. Should you treat it like a human child and invest in it a part of your soul? Only if you’re the kind of person who falls in love with strippers. In fact, it’s probably a good idea to treat your bike like a stripper. Enjoy it but don’t get too attached, put a few bucks into it now and again, and just shrug and move on when it takes up with someone else.

It’s Alive!

The new Bus Project website is finally up and running:

http://busproject.org/

We’ve switched from Drupal to WordPress for a bunch of reasons, most of which aren’t technical. The redesign and deployment also took about eight times longer than it should have, mainly because I kept waiting for other folks to jump in and do things when I should have just pushed ahead on my own momentum.

Lessons learned: 

  1. WordPress is much easier to theme and hack on than Drupal, in large part simply because there’s so much less code to deal with. It’s doesn’t try to be all things to all people, which in my opinion means that it succeeds much better at doing its job (as blog engine and light-duty CMS) much more elegantly.
  2. The WordPress developer community has many of the same problems with plugin API breakage between major releases of the platform that their counterparts in the Drupal world do. Hint to all open source CMS maintainers: updates from 1.X to 1.Y should not break your API. That’s what major release increments (1.X to 2.0) are for.
  3. I still don’t consider PHP to be a reasonable language for development in-the-large. That being said, it is easier to hack on over an SSH connection than anything requiring it’s own persistent server. I like real-time feedback on changes, and typing ‘:w’ in my Vim buffer, followed by a browser refresh, is about as quick as you can get.

Random thoughts for Apr. 18, 2008

  • The new bike is pretty sweet. Needs slick tires, fenders, and a rack, but I think I have a future with this particular piece of Italian-engineered transportation equipment.
  • Staying home on a Friday night to sling PHP code for someone else’s website is not fun. Repeat: not fun. 
  • I think Cinder Cone is one of the better ales available from “normal” grocery stores right now. Of course, the definition of “normal” in Portland is highly subjective.

That is all.

Business tip

Normally, I wouldn’t try to tell anyone how to run a business. God knows, I’m not a very good businessman myself: I’m eternally optimistic, lazy, and not really motivated by money.

That being said, I am quite experienced as a customer of other firms, and so have this one simple tip to offer anyone selling high-ticket consumer goods:

If a customer comes to you, ready to buy, do not send them away unsatisfied. Even more importantly, do not tell them that, while you can no longer sell them the product they evaluated 48 hours prior and are now itching to buy, you will happily accept 20% of the purchase price in order to motivate you, the seller, to acquire another such item so that they might buy it later.

This is an especially egregious offense if the product is neither particularly rare, nor difficult to acquire from one of your competitors.

Failure to remember this simple tip may cost you a long-term customer.

Least Helpful Error of the Week

I downloaded the much-hyped new mod_rails today, and while trying to install the Apache module that forms the “secret sauce”, was presented with the following warning:

You seem to be running MacOS X. Testers have reported that the default Apache installation, as provided by MacOS X, is broken. Passenger seems to crash for unknown reasons on OS X's default Apache installation.

Here’s a little tip: the most widely-distributed Apache build on any UNIX-like platform is, by definition, not “broken.” Your module is broken, and trying to blame Apple for your inability to deal with alternate build configurations isn’t helpful.

Apache-isms, part CCXVIII

I’ve enountered the exact same problem with a number of recent deployments of Rails apps behind Debian servers using Apache 2.2 and mod_proxy_balancer. Basically, if you use the standard recipe of simply setting top-level ProxyPass / balancer://foo (and ProxyPassReverse) directives, only top-level URLs (http://vhost.example.com/) will ever be passed through. Anything else is blocked by Apache, with an error of the following form ending up in the logs:

“No protocol handler was valid for the URL”

This is due to some weirdness in the Debian packages, and apparently just on Etch (a.k.a. Debian 4.0). On other distros/platforms, the standard directives seem to work fine. I suspect there’s a top-level default Deny policy sneaking in from the Debian-bundled Apache config files, but I haven’t manged to find a way to disable it.

In the meantime, adding the following rewrite rule seems to do the trick:

RewriteRule ^/(.*)$ balancer://housing-lottery%{REQUEST_URI} [P,QSA,L]

IMAP ‘append’ example

# imap-append-example.rb
# requires TMail library (http://i.loveruby.net/en/prog/tmail.html)

require 'net/imap'
require 'tmail'

IMAP_HOST = 'imap.example.com'
IMAP_USER = 'user'
IMAP_PASSWORD = 'password'
IMAP_MAILBOX = 'INBOX.scratch'

# Connect and authenticate
imap = Net::IMAP.new(IMAP_HOST)
imap.login(IMAP_USER, IMAP_PASSWORD)

# Create the target folder if needed
imap.create(IMAP_MAILBOX) unless imap.list(IMAP_MAILBOX, "*")

# Insure the message timestamp will be consistent
created = Time.now

# Create our email object
msg = TMail::Mail.new
msg.from = 'ruby@example.com'
msg.to = 'me@example.com'
msg.date = created
msg.subject = 'Inserted by Ruby'

# Finally, append the message to the mailbox. The line ending
# argument is needed to make sure the TMail::Mail#to_s method
# doesn't generate invalid, "\n"-terminated lines
# Also, you can remove the :Seen symbol from the flag list to
# make the message appear unread in other IMAP clients
imap.append(IMAP_MAILBOX, msg.to_s("\r\n"), [:Seen], created)