sun, 01-apr-2012, 14:59
Lennier

Lennier

Long before Nika and Piper died, we had planned on taking one of the dogs that Andrea’s mushing parter didn’t want, a large hound mix named Lennier (the litter was named after characters in the Babylon 5 television series). Even though we are still mourning our loss, we didn’t feel like it was a reason not to give another dog a chance in our home. He’s a yearling dog, and is a big boy, a couple inches taller than Buddy, and quite a bit longer. At the moment he is all legs, but he may still grow into his body.

Last night was a pretty taxing affair, with him too curious and excited to relax for even a minute, and a trio of cats very scared of the new resident. He has been better today, and is even sleeping on the floor at my feet right now. He appears to be mostly curious about the cats, but unfortunately, his only real experience with them so far is when they’re running away at warp speed, tails puffed.

In time, I’m sure he’ll get used to his new life, and will become part of the family. Welcome, Lennier!

tags: dogs  Lennier 
wed, 21-mar-2012, 19:20
Nika

Nika

Nika died today after fifteen and a half great years in our family. She was a Golden Retreiver / Australian Shepherd mix, which meant she was smart, aglie, and loved to swim. She had a beautiful, thick, dark coat that made people think she was a flat coat retriever. When she was a puppy, she needed a lot of exercise and entertainment to keep from getting bored, so she and I started a long tradition of daily (and often more) walks. I’d guess that in those fifteen years, she and I easily walked over 3,000 miles together. She loved running through the forest, swimming in every water body she came across, jumping high in the air after snow when we shovelled the deck, and when she was younger, fetching tennis balls. She came with us everywhere and was always willing to “go for a ride?!” even if it basically meant sitting in the truck once we got wherever we were going. I took her to work with me practially every day and walked her on campus, and later at the Peat Ponds.

She was a happy dog, eager to get up and go for a walk until the very end, when old age and declining strength meant she was prone to falling down and had a hard time getting up the stairs or up onto the couch. Eventually, it got to the point that we felt like she would probably rather not be around if she couldn’t do the things she loved.

I’ve spent so much time with her in the outdoors—on the trails around our property, walking up and down Goldstream Creek in the winter, hiking on campus and at the Peat Ponds at work—that I don’t know how I’m going to be able to go for a walk without missing her company. We used to sing, “Doo do da doo, Taiga Dog!” and she’d get all excited.

With the loss of Nika and Piper today, there’s a pair of huge holes in our family, and even though I know we’ll get over the pain of losing them, we will never forget them and all the happiness we shared together.

Nika post-fetch

Nika post-fetch

Nika bounding

Nika bounding

Nika on the Creek

Nika on the Creek

tags: Nika  dogs  memorial 
wed, 21-mar-2012, 09:40
Piper

Piper

We lost Piper today to a neurological condition that seemed to rapidly take her bright and wonderful personality from her, and from us.

We got Piper from the Fairbanks Animal Shelter in December 2002. I wasn’t too sure I was ready to adopt a new dog, but when they let her into the visiting room, she immediately came up to us and won us over with her charm. She was a beautiful orange and white husky mix with bright blue eyes, a barrel chest, and quick, graceful movements like a fox. She loved sprint mushing with Andrea, was great with kids, and always knew for sure that she was the cutest dog in any pack. She came with us wherever we went, and even slept on a bed in Andrea’s office when she worked at the Alaska Bird Observatory. As she got older, I started taking her for walks on the trails with Nika, and she enjoyed bounding through the forest exploring and chasing snowshoe hares.

Last winter she almost died from an abscess in her chest cavity, and even though she was eventually cured, she never really got all her strength back. But the neurological issue that finally claimed her life was the hardest to deal with because it seemed to drain the happiness and personality from her seemingly healthy body. Despite that, I’m not going to let this disturb my memories of what a great little dog she was. Always a wagging tail, willingess to “Ooooh” on command, and to cheer you up with her infectiously happy behavior.

I could use some of that cheer right now.

Piper and Buddy

Piper and Buddy

Piper ball

Piper ball

Piper driving

Driving

tags: Piper  dogs  memorial 
mon, 19-mar-2012, 16:35

Ouch. Well, my favorite book in this year’s Tournament of Books (The Art of Fielding) was taken out by Open City this morning. I also wasn’t too happy with Lightning Rods defeating Salvage the Bones earlier in the week. I felt like Lightning Rods was a far to simplistic (and dated) satire of work, and I had a hard time getting past that the book was almost entirely about hiring women to be prostitutes in order to alleviate sexual harassment suits and to improve male efficiency in the office. Parts of it were pretty funny, but compared against a well-written Katrina novel told from the perspective of a poor, pregnant teenager, I just don’t see it. The judge felt Salvage the Bones was too MFA, but I’d take overwrought writing and some technical errors over a book-length Porky’s movie anytime. Well, most of the time.

As for Open City, I liked it. The writing was nice. And there was a disturbing twist near the end that emphasized the same point that Barnes was making in his book: the way we view our past probably doesn’t match reality, or the way others view the things we did. But it had no plot to speak of, and only the narrator as a meaningful character. By the end, I’m not sure he was even a character I wanted to listen to. The Art of Fielding had a full story, multiple interesting characters, and I totally enjoyed the whole thing. To steal a phrase from one of the Tournament commentators, the book is in my wheelhouse: it’s about baseball, takes place at a small liberal arts college not unlike where I went to school, and there are smart people in it, saying intelligent things, but not necessarily doing them.

Here’s hoping Fielding comes back as a zombie.

Anyway, here’s what my brackets look like now:

I think 1Q84 and The Tiger’s Wife will be a close call, depending on whether the reviewer enjoys Murakami’s style of writing or not, or whether they enjoyed the stories in The Tiger’s Wife enough to look past the weak plot. I view the other brackets as pretty obvious choices, but one thing you learn by paying attention during a contest like this is that reading is a very subjective experience and if you enjoy a book, it’s really easy to ignore what other readers consider to be fatal flaws. Mentioned thus far: chewing the bark of a tree instead of just scraping it off (State of Wonder), the mechanics of operating a tractor (Salvage the Bones), failing the Bechtel Test (most of the books in the contest), MFA-ness in the writing (Tiger, Bones) how pleasant the characters or storyline was (Green Girl), and lots more.

Tomato tomahto, eh?

Update: Ugh. Lightning Rods just beat Sense of an Ending to move on. Guess I was wrong about which contests would be close.

sun, 18-mar-2012, 14:58
photolog

A week ago I set up a Tumblr site with the idea I’d post photos on there, hopefully at least once a day. Sort of a photo-based microblog. After a week of posting stuff I realized it would be really easy to set something like this up on my own site. It works like this:

  • Email myself a photo where the subject line has a keyword in it that procmail recognizes, sending the email off to a Python script.
  • The Python script processes the email, extracting the photo name and caption from the text portion of the email, rotates and resizes the photo, and saves it in a place accessable from my web server. The photo metadata (size, when the photo was taken, caption and path) is stored in a database.
  • A Django app generates the web page from the data in the database.

There are a few tricky bits here. First is handling the rotation of the photos. At least with my phone, the image data is always stored in landscape format, but there’s an EXIF tag that indicates how the data should be rotated for display. So I read that tag and rotate appropriately, using the Python Imaging Library (PIL):

import StringIO
import Image
import ExifTags

orientation_key = 274

if orientation_key in exif:
    orientation = exif[orientation_key]
    if orientation == 3:
        image_data = image_data.rotate(180, expand = True)
    elif orientation == 6:
        image_data = image_data.rotate(270, expand = True)
    elif orientation == 8:
        image_data = image_data.rotate(90, expand = True)

For simplicity, I hard coded the orientation_key above, but it’s probably better to get the value from the ExifTags library. That can be done using this list comprehension:

orientation_key = [key for key, value in \
     ExifTags.TAGS.iteritems() if value == 'Orientation'][0]

Resizing the image is relatively easy:

(x, y) = image_data.size
if x > y:
    if x > 600:
        image_600 = image_data.resize(
                (600, int(round(600 / float(x) * y))),
                Image.ANTIALIAS
            )
    else:
        image_600 = image_data
else:
    if y > 600:
        image_600 = image_data.resize(
                (int(round(600 / float(y) * x)), 600),
                Image.ANTIALIAS
            )
    else:
        image_600 = image_data

And the whole thing is wrapped up in the code that parses the pieces of the email message:

import email

msg = email.message_from_file(sys.stdin)
headers = msg.items()
body = []
for part in msg.walk():
    if part.get_content_maintype() == 'multipart':
        continue
    content_type = part.get_content_type()
    if content_type == "image/jpeg":
        image_data = Image.open(StringIO.StringIO(
            part.get_payload(decode = True)
            ))
    elif content_type == "text/plain":
        charset = get_charset(part, get_charset(msg))
        text = unicode(part.get_payload(decode = True), charset, "replace")
        body.append(text)

body = u"\n".join(body).strip()

The get_charset function is:

def get_charset(message, default="ascii"):
    """Get the message charset"""

    if message.get_content_charset():
        return message.get_content_charset()

    if message.get_charset():
        return message.get_charset()

    return default

Once these pieces are wrapped together, called via procmail, and integrated into Django, it looks like this: photolog. There’s also a link to it in the upper right sidebar of this blog if you’re viewing this page in a desktop web browser.

tags: photolog  blog  Python  email 

Meta Photolog Archives