Where have all the mailboxes gone?

This morning, I stopped at Almaden Plaza on the way into work to grab a cup of decaf from Starbucks and to drop a check in the mailbox there (I don’t leave checks in my mailbox at home any more for fear of theft). I failed in both missions.

The decaf of the day at Starbucks was Decaf Verona Blend; I don’t like the regular Verona Blend, and didn’t think the decaf would be an improvement.

And the mailbox across the parking lot was gone — there was still a UPS dropbox, but the mailbox vanished with no forwarding address. You’d almost think the Post Office didn’t want people to mail things any more….


Today’s technical tidbit

The following code fragment works fine in Firefox but fails in IE:

tag = document.createElement("input");
tag.name = "button";
tag.value = "Tag";
tag.type = "submit";

But reordering it to set the type before the value works fine in both browsers. To play it safe, I decided to set the type immediately after creating the element.

tag = document.createElement("input");
tag.type = "submit";
tag.name = "button";
tag.value = "Tag";

Morse Code Ringtone Generator

And now for something completely different — actual working code!

A long time ago, I decided I wanted a very distinctive ringtone for my cellphone, so I wrote a Morse Code ringtone generator in Rexx, which produced Nokia ringtones in a format suitable to cut-and-paste to AT&T Wireless’s text message sending page.

AT&T Wireless is gone now (although I wouldn’t be surprised to find the name revived once SBC…err, AT&T…buys BellSouth, and, along with it, the rest of Cingular), and so is my Nokia phone. And I find myself writing very little Rexx these days.

So I reworked the code, this time in Python, and now it creates an iMelody (.IMY) file, suitable for several brands of phone, including Motorola. Getting the file to the phone is up to the user (the easiest way, if your phone and PC support it, is Bluetooth file transfer).

One reason I haven’t posted this code before is that I thought it would be difficult to get IBM’s permission to do so — even though I wrote it on my own time, IBM has rights to it through it. But it turned out to be surprisingly simple; since it was clearly not competitive to IBM business, my manager was able to give me permission to post it, as long as I included a suitable license and made it clear that it was my personal work and not the company’s.

Cut and paste the following as morsemelody.py or download it here; share and enjoy.


# MorseMelody.py
# Copyright (c) 2006, David Singer (https://readthisblog.net)

# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:

# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.


import sys
if 1 >= len(sys.argv):
  print sys.argv[0], 'word1 [words]'
  print "Creates an IMelody file which plays its argument in Morse code."
  print "The output file is named 'word1'.imy"

code = {}

code['A']   = '.-'
code['B']   = '-...'
code['C']   = '-.-.'
code['D']   = '-..'
code['E']   = '.'
code['F']   = '..-.'
code['G']   = '--.'
code['H']   = '....'
code['I']   = '..'
code['J']   = '.---'
code['K']   = '-.-'
code['L']   = '.-..'
code['M']   = '--'
code['N']   = '-.'
code['O']   = '---'
code['P']   = '.--.'
code['Q']   = '--.-'
code['R']   = '.-.'
code['S']   = '...'
code['T']   = '-'
code['U']   = '..-'
code['V']   = '...-'
code['W']   = '.--'
code['X']   = '-..-'
code['Y']   = '-.--'
code['Z']   = '--..'
code['0']   = '-----'
code['1']   = '.----'
code['2']   = '..---'
code['3']   = '...--'
code['4']   = '....-'
code['5']   = '.....'
code['6']   = '-....'
code['7']   = '--...'
code['8']   = '---..'
code['9']   = '----.'

input = ' '.join(sys.argv[1:])
outfilename = sys.argv[1]+'.imy'
outfile = open(outfilename,'w')
outfile.write('NAME:%s \n' % (input))

note = '*5f'
song = []
for word in input.upper().split():
  for letter in word:
     if letter in code.keys():
       char = code[letter]
       for element in char:
         if element == '.':
       song[-1] = 'r1'
       outfile.write('  ')
       song = []
# We'll be left with an unwritten wordspace, but no harm done.
print outfilename, "created successfully."

Shana Tova 5767

It’s been a busy week, and, indeed, a busy year.  And although many things went well this year, I’ll always remember it as the year I lost my Mom.

I’m looking forward to 5767.  Shana Tova, and may you be inscribed for a good year!

Work is the curse of the blogging class

I barely got out of my chair today at work; I was nearly heads-down designing and coding enhancements for an upcoming project.  I didn’t even check my e-mail from noon till 5, which is almost unheard of.

But now I’m home, and the laptop is safely hidden away in my briefcase, at least until Sunday.  Good thing I have other computers.

Jeff’s at a party in Morgan Hill, and since he doesn’t drive yet, we had to schlep him.  So Diane and I took advantage of that to go to Rosy’s at the Beach, where she had Pepper-encrusted Salmon and I had Salmon Tacos.  We both enjoyed our meals; I’d go back cheerfully (in fact, we will be going back in a week and a half for my 30th service anniversary lunch, though that meal will probably be without beer or wine).

I think I know what I want for my birthday

Even though I have no real use for portable video, I want one of the new 80GB iPods.  Or maybe I want an iPod nano, because it’s small and has no moving parts.  I don’t think I want an iPod shuffle, though it is awfully cute.

I’m glad I don’t have to pick out my own present.

Limping along with USB

I didn’t have to dig out the other 3.5″ enclosure after all — I switched to a USB connection, and suddenly the Mac can see the hard disk.  I can’t boot from it, though, so I’ve had to rerun all of the updates I’d made since I switched.  But my data is back.  For now, anyway.  With luck, I’ll have some time this weekend to do some better diagnosis.

My data is on vacation

I wanted to check some stuff on my Mac mini, but when I turned on the display, I was greeted by a black screen, and nothing I could do would provoke any activity.  I also couldn’t ping it, so I decided it had died.

After hunting for the power button, which I hadn’t used in a long time, I rebooted…to no avail.  So I dug out my copy of “The Missing Manual” and tried some of the exciting power-on keystrokes.  Apple-V gave me a very short bootup console log, ending with something about being unable to find something on /sbin.  So I tried again, this time with the Option keystroke to let me choose my boot device.

When I chose the built-in disk, all was well — it was even able to mount the disk in my expansion unit.  But I didn’t leave well enough alone, since I really wanted to boot my new disk; instead, I powered off, and then powered off the expansion unit.

When I tried to turn the unit back on, I didn’t see the blue power light.  But by wiggling the power cables, I got it to come up again…but not enough to boot.  So I went back to the built-in disk, and this time around, nothing I could do would mount the external disk.  I could, however, see a USB flash drive that I connected to the expansion unit, so it’s not completely dead.

At least there’s no unrecoverable data on the external disk (or, for that matter, the internal disk) — I hadn’t gotten around to moving anything critical to the Mac, just lots of media which would be tedious to recover.

I guess the next step is to dig out the 3.5-inch USB enclosure I decided not to put on craigslist and see if the disk is the culprit.  Feh.

Jeff’s thoughts about 9/11

I’m going to turn over my blog to Jeff for his thoughts about 9/11.

I was very conflicted about whether to write about 9/11. When I was debating whether or not to [continue my] blog, one of the considerations was that I’d be writing today. It came down to whether I had anything about 9/11 that I wanted to tell people. I did.

I didn’t lose any friends or family members that day. I don’t know anyone who was near Ground Zero. I didn’t sing God Bless America on the steps of Capital Hill. Yet, the Attacks did change much of my outlook on the world. Before, I didn’t care much about the rest of the globe, outside of Israel. And why should I? I was only 11. My largest priority was surviving my first month of Middle School.

Somehow though, 9/11 changed that forever. Suddenly for me and perhaps the whole country in general, what mattered in the middle of Asia meant a great deal. The entire world slowly became important to me, whether each country had anything to do with 9/11 or not. I don’t know why: perhaps when I suddenly realized that I was interested in Afghanistan, I became interested in Italy. And here I am today, naming the capitals of countries many people know nothing about.

I suppose this led to my interest in American politics too. Oh, it didn’t exactly spring from nowhere. Even at the age of six I had hoped Clinton would be reelected; when I was ten on Election Day a few of my friends and I screamed “Bush sucks!” on the playground, only to be answered with “Gore sucks!” But after 9/11, I actually knew why I thought this way, aside from my parents thinking that.

One more way the 9/11 Attacks changed my outlook: my determination not to stereotype ethnicities. When we invaded Afghanistan, I decided that I would not judge Afghans based on the actions of the Taliban and Al-Qaeda. I don’t know what brought this on, but it carried over to Arabs and Muslims in general. I guess I have to thank my history teachers in 6th and 7th grades for making clear the difference between the terrorists and all the other Muslims and Arabs. Perhaps I should even thank President Bush: he made it clear in a speech nine days after 9/11 that most Afghans and Muslims were just regular people, not murderers or people who wanted us wiped off the globe.

Whatever the case, 9/11 affected me. The impact it had on me can’t be compared to that on the people who lost loved ones, but still, it affected me. For better or worse, much of who I am today is because of 9/11 and what happened afterwards, globally and personally.

In my CUPS

This is going to be one of those postings that my mother wouldn’t have understood. But I thought I should save what I’ve learned today about setting up printers on Mac OSX 10.4 so I’ll have them next time around.

I was trying to solve two problems when printing from the Mac:

  • When I printed to my Samsung ML-2151N, it would take minutes per page
  • I couldn’t reliably print to my Brother MFC-7820 at all

I could, of course, print just fine from my Windows XP systems.

For the Samsung, I suspected I had a bad driver. The system showed three different drivers which claimed to be for the ML-2150 family, two of which had the same name. So I went to linuxprinting.org, which pointed me to the new Gutenprint drivers. I tried installing them, but trying to print failed. I suspect the problem was that I didn’t have a proper level of Ghostscript, but while reading the site, I eventually found a claim that there was a good Mac OSX driver on Samsung’s German site. After some searching, I found this page, which contained an archive of new PPD drivers.

I uncompressed it and tried to install the English-language file. It didn’t ask for permission to run as root, so the install failed; I tried again, this time just “installing” to my desktop. Then I dug into the file to find the actual PPD file at

~/Desktop/Library/Printers/PPDs/Contents/Resources/en.lproj/Samsung ML-2150 Series.gz

I needed to copy it somewhere the system could find it, and I also wanted to get rid of the bad drivers, so I went hunting, and discovered I had Samsung printer drivers in two different locations on the system:

  • /Library/Printers/PPDs/Contents/Resources/en.lproj
  • /usr/share/cups/model

I deleted the ML21xx drivers in both locations, then copied my new driver to the first location, since that’s where the installer wanted to put it.

And it worked — I can now print to the printer at something approaching full speed.

The MFC-7820N turned out to be much easier; Brother had posted a driver on this page. The page shows a PPD file and a CUPS driver, but they both link to the same package, which expands into a self-installer, which worked just fine (although it required a system restart, which probably shouldn’t have been necessary). I also found a firmware update, but I haven’t gotten around to trying it yet.

And in the meantime, I’ve also installed a new version of Ghostscript, just in case.

I remember when I thought I was going to treat the Mac as an appliance. *sigh*