Desires or daydreams?

If I am unwilling to take responsibility for the attainment of my desires, they are not really desires — they are merely daydreams. For any professed desire to be taken seriously, I must be prepared to answer, in realistic terms: What am I willing to do to get what I want?

— Nathaniel Branden

Mes héros à Paris

Ben Franklin

Thomas Jefferson

On furlongs

a furlong is 660 feet.  there are 8 furlongs in a mile.

there was one furlong in American History X.

if that same furlong had been cast in 8 Mile,  there would have been 1 furlong in 8 Mile, not 8 furlongs in a mile.

so i’m pretty sure that’s why he didn’t get the part.

Digitizing my photos with ScanCafe

For about the last 10 years, I’ve been carrying around an overstuffed shoebox filled mostly with my old-school point-and-shoot photos from the 90s.  Like my CDs and DVDs, I’ve had a longstanding ambition to digitize them once and for all.

There are some good pictures in this bunch.  Not really for their photographic quality, but I’ve got about 6-7 rolls of film representing my trip to China in ’92, and another 3-4 rolls from a trip to Italy in ’93.  There are a good 100 or so photos of my road trip with Steve out to the Grand Canyon in ’98, and there are a ton of single photos people have given me from plays and other various events I’ve been a part of.  (There’s even a handful of slides some photographer gave me from the infamous Summer of ’97 at Camp Longhorn.)  I was never really a take-pictures kind of guy, but the photos I do have, I want to save.  Obviously.

I took my first step towards doing this about 3 years ago, when I bought a semi-fancy flatbed scanner that had excellent resolution and attachments to scan my negatives slides.

Since there are a ton of landscapes and travel-type photos in the lot, I wanted to make sure I could preserve as much of the original frames as possible.  I had no idea how much would be possible to keep, but I wanted the max.  I also wanted to do whatever I could to color-correct and remove dust and scratches.  Essentially it boiled down to a simple goal: digitize to the best quality possible, and restore what’s there.

This is totally more easily said than actually done.  I took a few sample prints and scanned them in.  I tried a ton of settings, using the automatic features like dust & scratch removal and color-correction.  Cropping was supposed to happen automatically.  None of it really worked all that great.  I tried using Ross’s photo scanner from a different manufacturer.  It was better, but it wasn’t really satisfying my perfectionist ambitions.

After screwing around with the store-bought scanners for a while, I came to the conclusion that this wasn’t going to work the way I wanted it.

Even if I could find a formula for getting great results out of my dusty and fading old prints and negatives, I still would have to spend a good while on each picture in Photoshop, removing scratches and dust and probably hairs and fingerprints and whatever else most of these photos needed.  But after a couple of hours of fooling around with a couple of sample photos, I realized that even a week’s worth of experience was not going to leave me confident that I’d done a good-enough job at this.

And the way I figure it, I want to do this once, and exactly once.  At the end, I need to be satisfied, or it’s a completely wasted effort.

I realized I wasn’t going to be happy scanning them myself.  So I sought out professional help.  I did a little research at first, googling up some results for “photo scanning service” and “professional scan photos” and the like.

After several hours of poring through user reviews and articles, I’ve decided to take a chance on a company called ScanCafe.  There are a good 4-5 companies that offer services like ScanCafe’s, but they set themselves apart by promising much better quality than their competitors, for about the same price.  They use many of the same professional scanners and software that the other major players use, but they have a single technician handle your entire order, personally reviewing the quality of the scans, and correcting for dust and scratches and color, basically giving a huge leg up on quality that you can’t get from an automated process.  Which they’re able to do, of course, by outsourcing the human labor element of their work to Bangalore.

I kind of recoiled a bit when coming across that fact.  But that’s just my natural concern at the distance involved; I’ve personally worked on projects with people from Bangalore, so I know that there are a ton of technically skilled and competent people in the city who’d be capable of doing the work.  And from the reviews and articles I read, it seems like the great majority of people are really happy with the results they’re getting back.

So I’m taking a little bit of a chance by having my memories shipped off to the other side of the globe.  But what I’m going to get back ought to make the risk worth it.

Several things I like about ScanCafe, so far: 1) Their website is very clear and easy to use. 2) Their ordering process and general business model make it easy to just throw my photos into a box and send it without having to worry too much about the details.

This is really important.  I have a ton of negatives and prints, and I’m not sure which are going to end up scanned better in the end.  But fortunately, I can just throw them all in a box, and then later, I can review the results, keeping only the scans I want.  (Subject to a 50% minimum, of course, but that’s totally reasonable.)  Part of me feels a little guilty for sending them an order that I know is going to be a little on the heavy side, but they really encourage you to just throw your stuff in a box and send it on, so that’s exactly what I’m going to do.

But in the end, I expect to spend only about $200 on the whole process — something that would have taken me a week or more to do myself.  I’m thrilled that this kind of thing is possible, and I’m excited to find out how it actually works out for my stuff.

I’m sending the box out tomorrow morning.  I’ll be following up with updates as they come in.

0-day

Advice

  • Bust your ass.
  • Pay attention.
  • Fall in love.

Django tip: URL redirect shortcut

Bottom Line Up Front: Here’s a succinct, elegant way to do simple redirects in Django.

Sometimes in a web app, you need to perform a simple redirect, pointing one URL to another. For example, in a current project, I need the / URL to redirect to /shop.  I don’t need any complicated routing; I just need to rewrite one URL to another. (And, as happens sometimes, I don’t want to fiddle with the web server conf to do it.)

The Django docs suggest creating a custom view function that takes care of the redirection. For example:

# urls.py
urlpatterns = patterns('',
    (r'^$', views.redirect_to_shop),
    ...
)

# views.py
from django.http import HttpResponseRedirect

def redirect_to_shop(request):
    return HttpResponseRedirect("/shop/")
    ...

Writing a custom view seems like a bit of overkill here. We don’t need to parse the request or do any complicated traffic routing; we just need to point url A to url B. Also, writing a custom view means maintaining code in both urls.py and views.py. I’d rather find a solution that can handle this simple request in a simpler, more efficient way.

This simple redirect can be implemented completely within the urls.py file, right within the URL patterns, using a one-line lambda function:

from django.http import HttpResponseRedirect

urlpatterns = patterns('',
    (r'^$', lambda x: HttpResponseRedirect('/shop/')),
    ...
)

Voila. No need to write another function; no need to update your code in two places when you need to make a change. Everything is compact and in one place.

And yes, the “x” is necessary — Django will pass the request object to the lambda function, so if you don’t have something there to represent it, you’ll get a TypeError.

From MySQL to Postgres

Slowly, I’m making the transition from MySQL to Postgres.

I’m not a database expert, but I’ve had quite a bit of experience working with them and designing them. For the first eight years or so of my experience working on the Web, my exposure was mostly limited to MySQL. But as I started playing around with Django, I decided to go with its authors’ recommendations and see what all this Postgres hoopla was all about. After a while, I noticed that it was faster and much less resource-hungry on my system.

Which is awesome. I’m on a VPS. I like to know that I’m running as lightweight a setup as possible. I’m a huge fan of efficiency.

So I got curious: could I port all my existing apps over to use Postgres instead? The problem is that MySQL and Postgres don’t exactly speak the same language. It’s similar in a lot of ways, but of course, computers are finicky contraptions that demand exact translations, with the exact characters it expects, in the exact format it wants.

For many of my old personal projects, this wasn’t terribly difficult. It was just a matter of writing a few scripts to export my relatively simple data into a format that Postgres would easily understand.

The first big challenge I came across, though, was in porting my MediaWiki installation over. My first instinct was to do as I had with my own projects: dump the SQL and transform it into Postgres-digestible code.

I googled and coded and googled some more, and after several hours of trying to get this to work, I realized it was a dead end. It then dawned on me that there was no reason to even attempt to do what I was doing. It made more sense to do an export of the data, to XML, and then import it into a fresh installation of the app with a fresh Postgres database.

There were a few gotchas, but it was basically very easy at that point. One hour worth of work vs six.

So the steps were pretty easy:

  1. Use the export script to export the data from the existing MySQL MediaWiki installation:

    php-cgi /maintenance/dumpBackup.php wikidata.xml

  2. Initialize a new database in Postgres.
  3. Set up a fresh installation of MediaWiki on a new path. Follow the setup wizard, using your new Postgres database information.
  4. After installation is complete, delete the Main Page that MediaWiki sets up for you.
  5. Copy the wikidata.xml file to the /maintenance folder in your new MediaWiki installation.
  6. Run the MediaWiki script to import the data:

    php-cgi /maintenance/importDump.php wikidata.xml

And that was it. Very easy.

I have a few more challenges ahead of me that I suspect will require a lot more hands-on work than what it took with MediaWiki. The main one will be a project I’ve intended to do for a while — converting a vBulletin installation to use a different forum platform altogether. There will be a lot of custom code. It should be fun.

I suspect that it will be complicated and may even be impossible to manage the various blogs I’ve created over the years. Half of them were built in Movable Type. Half are in WordPress. I’d like to make my life just a little easier and pick one or the other. Movable Type supports Postgres natively, whereas WordPress sports an unofficial plugin. It might work, but my coder-instincts are telling me not to get my hopes up too much. If the latest versions of Movable Type are comparable enough to WordPress, I might decide to go nuts and move everything over to Movable Type instead.

We’ll see. For now, I have a few more important things to take care of before I embark on any strictly-maintenance-and-upgrades kind of work. More to come.

Dolla Tree

Dolla Tree Sign

i swear
thirteen times a day
some smart-ass jerk asks me why is there no R in your sign
so i stare them in the eyes
and i say

look
if there’s one thing i care about
one thing
it’s providing a good service
good products
to good people
and if there’s one thing i hate
it’s seeing people get ripped off
all spending their money
their hard-earned money
and getting less for it than they used to
it’s a shame
and it makes me angry
so angry

now you know and i know
that there’s an R out in that sign
but are you going to see me spend all kinds of time and money
to repair some dumb sign
that you and i both know what it’s saying?
because i could

but then you see
i’d have to raise my prices
to probably, a dollar five, dollar six

signs are not cheap, amigo

i am not
not
going to become one of those people
pissing money down the disposal
like it’s all plentiful
because it isn’t

not where i grew up anyway

i think they feel pretty bad after that
so they stop asking

i guess that’d be okay
if they ever came back

Photo by Jeff Young

Tech support

I don’t know if I’m getting better at what I do, or if technology is just getting easier, but I’ve noticed lately that it’s taking me far less time to accomplish what I set out to do, when I’m working on the computars.

Latest example:

I upgraded my server to the next full version up — sort of the equivalent of going from Vista to Windows 7.  But in the process of upgrading, postgresql — my database of choice — got bumped up a version as well, and in the process, the default character encoding was reset to SQL_ASCII.  Not UTF-8.  WTF, right?

So after a little googling, I found the remedies I needed: how to set the default locale in Ubuntu so that it uses UTF-8, and how to essentially wipe out postgresql’s default template and replace it with the one you want.

This pleases me because I got it done in about a third of the time it might have taken me two years ago.  That, my friends, is progress.

Return top