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: dogs  memorial  Piper 
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: Python  photolog  blog  email 
sat, 10-mar-2012, 14:13
New antenna

New antenna

After the digital television transition several years ago, we bought an omnidirectional antenna from RadioShack and I mounted it on the rear eave of the house. It’s plastic and is saucer shaped. As the snow collected on it this winter we started losing the signal, so last weekend I tried to clear the snow off it, as I did last year, by gently shaking the mast until the snow slid off. This time, as the snow slid toward the edge, it put too much pressure on the bottom of the disc, where it’s screwed onto an L-shaped bracket that holds it to the mast. The plastic broke, it’s now tilted about 45 degrees, and probably won’t survive another winter. And, it’s still having trouble picking up even our strongest station.

A recent post on Lifehacker about a powerful interior antenna (the Mohu Leaf) resulted in an Internet investigation of antennas and whether something like the Leaf would work for us. I didn’t think it would for two reasons: our house has foil-backed insulation and reflective glass windows, and half our stations are in the high-VHF range (7–13) which isn’t what the Leaf is designed to pick up.

Here are the details of our television stations in Fairbanks:

Station (network) Channel Frequency (MHz) Direction
KFXF (FOX/CBS) 7 174–180 44°
KUAC (PBS) 9 186–192 43°
KATN (ABC/CW) 18 494-500 44°
KTVF (NBC) 26 542–548 238°

KUAC is only three miles away, and the rest of the stations are about five miles from the house. Two stations are high-VHF and the other two are UHF.

My plan was to build either a DB-4 or M-4 style UHF antenna (lots of plans are available on the Internet if you search for those two terms) and then add a VHF dipole to improve FOX and PBS.

Before I went to the trouble of building something complex like the DB-4 / M-4, I thought I’d start with a simple folded half-loop dipole designed for the range in between channels 7 and 9. If that got me KFXF and KUAC, I’d know what I needed to add to the UHF antenna to pick them up. Magically, the dipole was all I needed.

You can read about the theory and calculations on the Internet, but the length of the dipole (in inches) can be found with the following equation: 468 / MHz * 12". For the middle of channels 7 and 9, this works out to a dipole length of 30 11/16". This could be built in a variety of ways, but I chose a folded half-loop configuration, which means a single piece of wire, bent to form a loop stretched such that it’s 30 and 11/16th inches from tip to tip. The two ends of the wire are connected to the two leads of a 300 to 75 Ohm balun transformer (RadioShack part 15-1230), which typically has a coaxial connection on the other end.

Here’s a schematic:

Schematic

I made mine from the bare wire inside a 72" section of 12-2 Romex, bending the ends around a screwdriver, which resulted in a separation of about 3/4" between the top and bottom of the loop. Each end was twisted around a brass screw, and tightened with the transformer tabs between two brass washers. The center of the dipole was screwed between two pieces of wood for support, and screwed to the roof of the arctic entryway. The photo shows the antenna and support. The main roof of the house is in the upper left corner.

I tested it in two orientations, one where each dipole was pointed at the stations, and one where it was perpendicular to the stations. Based on the signal strength numbers, I got slightly better results when it was close to perpendicular.

Surprisingly, this single loop of copper wire is all that we needed to pick up all the stations in our area. I got a signal strength of 100 for KUAC and KTVF, 84 for KFXF and 78 for KATN. Not bad for a $6 transformer and six feet of surplus wire!

tags: house  TV  antenna  HDTV 
tue, 06-mar-2012, 18:44
Nika in a blizzard

Nika in a blizzard

This morning we had five inches of new snow on the ground, and it’s been snowing pretty consistently since, with really heavy snowfall in the last hour or so. As of midnight last night Fairbanks was 12.7 inches below normal for cumulative snowfall since July 1st (last year), but if this keeps up, we may actually get to the normal amount of snowfall. It’s been many years since that happened.

Unfortunately, like last year, the blizzard of 2012 is coming at the very end of the winter. Last year we got more than a foot of snow at the end of February, and this time around it’s even later. Still, there’s at least three more weeks of good ski conditions to look forward to, and this snow may help flatten some of the bumps on the Valley trail.

It’s hard to take a photograph that captures what a blizzard looks like because the snow that’s falling just mushes the background, but take my word for it: it’s really coming down!

tags: Nika  snow  weather 

Meta Photolog Archives