Russell's Blog

New. Improved. Stays crunchy in milk.

One week in China

Posted by Russell on April 29, 2008 at 10:33 a.m.
I keep meaning to sit down and write a blog entry about what it's been like so far, but things keep happening at a break-neck pace, and I just haven't had time. I only have a few minutes to write something, so I'll write about one of the small annoyances of this crazy place: Plumbing.

As everyone knows, China is making a huge effort to modernize. For the most part, it has been quite successful. In America, we mostly experience China's modernization in the form of the ever-escalating technical complexity of Chinese imports. Not so long ago, only crappy plastic toys and knock-offs had Made In China stickers. Today, you are probably reading this post on a computer made mostly out of parts bearing the same imprint. However, the overwhelming majority of China's modernization is for domestic consumption only. The streets are jammed with cool Made In China products that you will never see in America. The electric scooters, for example. The cell phone service is better in your average one-horse Chinese village than it is in Los Angeles.

Americans tend to assume that most of China's economy is geared toward exports; it isn't. The flood of Chinese goods we see coming into the Port of Long Beach is just the oversplash of China's industrial berserker rage. Most of it stays right here.

On the other hand, they don't seem to have quite figured out plumbing. I was trying to figure out why my 17th floor hotel room always smells like a sewer. It occurred to me that maybe there was something wrong with the drain. Notice anything missing?

That's right. No trap. From the booming roar that issues from the drain every time I use it, it sounds like it's a pretty straight shot from the sink to the sewer main in the basement, seventeen floors down.

Whoever designed this fixture was clearly aware of this problem; the drain has a built-in airtight, noise insulated drain cover. They opted for a heavy rotating high pressure plug instead of a little bendy bit in the pipe.

As Mimi would say, "That's China."

Disco Bay

Posted by Russell on April 24, 2008 at 12:56 a.m.
From somewhere above the Mongolia/Siberia frontier.

I suppose it is somewhat fitting that, on my way to visit the planet's newly crowned Number One Emitter of carbon dioxide, I should get a fantastic view of the patch of the planet that all this carbon dioxide is having the most dangerous effect. I visited Greenland in 1993, so it's interesting to see what it looks like 15 years later. Normally I think out-the-window shots are pretty crummy, but I think these make up for their poor image quality and composition by being pretty damn interesting.

This is the ice pack on the Davis Straight, between the west coast of Greenland and Canada. As you can see, there really isn't any pack ice. In August of 1993, we had planned to sail across the straight to visit the Baffin Island. We had abandon those plans because the pack ice was too heavy to navigate, even for our specially equipped vessel. We had to hug the coast of Greenland, following shipping lanes kept clear with ice breakers.

This is the west coastline of Disco Island. In 1993, it was kind of impossible to tell where the pack ice ended and the island started. Now, it's pretty obvious. After we visited Disco Island, we spent a few rough days hammering our into Baffin Bay. The noise of the ice crashing against the hull was awful. Imagine being trapped in a garbage can while someone beats it with a chandelier. We gave up and turned around after a few days of it.

This is Disco Bay. In 1993, I remember standing on the Greenland side. The pack ice on the bay had ruptured, but it was very thick and clogged with icebergs. The noise of the ice grinding and grumbling on the chop was so loud that it was impossible to have a conversation without shouting. Now, it looks like the Charles River in Boston around springtime.

Here is a glacier on Disco Island, just 'cause it's awesome.

A plauge of duplicates

Posted by Russell on April 19, 2008 at 7:47 a.m.
I have a bad habit. I often open my IMAP mailbox directly on the mail host with mutt. This inevitably causes occasional complicated messes when I butterfinger something. For example, a few days ago I accidentally moved all of the read messages to a separate mailbox. I merged the message back in, but not before my desktop, which was patiently monitoring my IMAP mailbox on the other side of town, decided to synchronize a few thousand messages with the IMAP server. This resulted in lots and lots of duplicate messages.

The trouble was, the duplicate messages had different X-IDs so, their MD5 hashes would be different. After fiddling around with formail for a few minutes, I got impatient and banged out this fun little Python hack :

import email, imaplib, getpass

M = imaplib.IMAP4_SSL( '**********' )

typ, data = M.login( getpass.getuser(), getpass.getpass() )
if typ != 'OK' :
    raise Exception, 'Login failed.'

typ, data = M.select()
if typ != 'OK' :
    raise Exception, 'Selection failed.'

typ, data = M.search( None, 'ALL' )
if typ != 'OK' :
    raise Exception, 'Could not get message IDs.'

id_list = data[0].split()
mids = []
for id in id_list :
    typ, data = M.fetch( id, '(RFC822)' )
    if typ != 'OK' :
        raise Exception, 'Could not fetch message ' + id
    mail = email.message_from_string( data[0][1] )
    mID = mail.get( 'message-id' )
    print mID
    mids.append( (mID, id) )

mids.sort()

dupes = []
for i in range(len(mids)) :
    if m[i] == m[i+1] :
        dupes.append( m[i+1] )

print 'Found ' + len(dupes) + ' duplicate messages.'

for m in dupes :
    typ, data = M.store( m[1], "+FLAGS", '(\\Deleted)')

print 'Marked ' + len(dupes) + ' for deletion.'

typ, data = M.expunge()

print 'Expunged ' + len(data.split()) + ' messages.'
Duplicates begone!

It's a little annoying that imaplib doesn't have a friendly wrapper function for marking messages for deletion, but M.store( m[1], "+FLAGS", '(\\Deleted)') does the job just fine.

Going to China

Posted by Russell on April 14, 2008 at 5:02 a.m.

I'm going to China in about a week to visit Mimi. I'll be in Beijing for about twelve days, and I'll have about $500 to spend. What should I do?