December 2008 Archives

Xaprb is a great resource for SQL tricks, especially MySQL tricks. Here's an explanation of some techniques to delete duplicate rows with a grouped self-join. I needed this in order to add a unique index to a table.

[select/delete] bad_rows.*
from test as bad_rows
   inner join (
      select day, MIN(id) as min_id
      from test
      group by day
      having count(*) > 1
   ) as good_rows on good_rows.day = bad_rows.day
      and good_rows.min_id <> bad_rows.id;

I've been wanting to move a few of my low traffic client sites over to mod_rails/Phusion Passenger for several months now, but I worried about the hassles of switching platforms. I finally decided to go ahead with it earlier this week.

The process turned out to be far simpler than I had imagined. The Phusion guys have done an excellent job with packaging their code for developer usability. The Apache module installed automatically, without a hitch, and without damaging any configuration on my production machine. Even custom-compiling and installing Ruby Enterprise Edition was simple and quick.

I think the whole process of installing mod_rails, RubyEE, and migrating the DNS for the site took less than an hour. I fully expected to take a day or more for this transition.

I've just solved an issue with my GNU Screen setup on my new Mac for quite a while, and I thought I'd share the solution in case anyone else has this issue.

I use a shell script to initialize a customized screen session when I'm editing a Ruby on Rails application. This script launches a database console, AutoTest session, and development Mongrel instance, and organizes and titles all the screen windows.

I developed it some time ago on a MacBook Pro, and it suddenly stopped working properly on my new Mac Pro. The symptom was that all the shell-based windows worked fine, but the database console, rSpec, and AutoTest sessions all failed to boot, leaving blank screen windows.

The problem turns out to be Leopard's default screen command. It breaks the $PATH variable. The solution quoted in that post is to hard-code a shell command in .screenrc, but my solution was a little different. I just opted for installing the MacPorts version of screen instead. It's more up-to-date, and doesn't clobber the path.

sudo port install screen

With the combination of their "Red Tag Sale", my $25 off $25 coupon for being a preferred customer (whatever that means), and my end-of-year rewards, Office Depot just paid me to take home a fancy new pen.
Just stumbled across this nice, succinct gallery of the most commonly-used CSS patterns: Using CSS to Fix Anything.

Alan Kohler has some commentary over at Business Spectator that suggests a stunning ending for the global financial crisis; one that actually involves a massive windfall for the banks themselves.

It is now getting very interesting. The three Icelandic banks have defaulted, as has Countrywide, Lehman and Bear Stearns. AIG has been taken over by the US Government, which is counted as a part-default, and Freddie Mac and Fannie Mae are in “conservatorship”...

Ambac, MBIA, PMI, General Motors, Ford and a lot of US home builders are teetering.

If the list of defaults – full and partial – gets to nine, then a mass transfer of money will take place from unsuspecting investors around the world into the banking system. How much? Nobody knows, but it’s many trillions.

...

The distress among those who lose their money will be immense. It will be a real loss, not a theoretical paper loss. Cash will be transferred from their own bank accounts into the issuing bank, via these Cayman Islands special purpose vehicles.

The repercussions on the losers and the economies in which they live, will be unpredictable but definitely huge...

There will also be a tsunami of litigation, as dumbfounded investors try to get their money back, claiming to have been deceived by the sales people who sold them the products...

But for the banks, it’s happy days. Suddenly, when the ninth reference entity tips over, they will be flooded with capital. It’s possible they will have so much new capital, they won’t know what to do with it.

Who's this guy?

Aaron Longwell is Chief Web Craftsman at New Media Logic Corporation in Portland, Oregon. A professional software developer for 14 years, he occasionally has interesting things to say about software, technology, culture and politics.

Subscribe to feed Subscribe to my RSS Feed

  • View Aaron Longwell's profile on LinkedIn
  • Recommend Me