January 2004 Archives

Trapping window resize in zsh

|

I just learned that zsh can catch window resizes by defining a function named TRAPWINCH. Actually, zsh can trap any signal by defining TRAPSIGNAL-NAME. Anyhow, I use this to set my right prompt. Before I learned this, I set my right prompt to:

RPS1="%30<..<%~%<<"

This would print the current directory on the right, truncating to 30 characters. This works great for 80 column windows, but for larger windows, it's not using the window size efficiently. So, now I can trap the window resize and change the right prompt based on the number of columns. Here's a snippet from my .zshrc.

# Set right side prompt to last current directory, using 3/8 the width
set_rps1()
{
    (( cols = $COLUMNS * 3/8))
    RPS1="%${cols}<..<%~%<<"
}
set_rps1

# Reset right prompt, on window resize
TRAPWINCH ()
{
    set_rps1
}

Deleting spam

|

Since I setup procmail to bounce spam, the amount of spam I have received jumped from about 100 per week to 175 per week. I don't know if it's related, but I've decided to stop doing this. One thing that isn't quite perfect about that method of bouncing, is that the MTA (Postfix, in this case) doesn't reject the mail right away. It actually successfully delivers it (the sender knows this), and then only later does procmail bounce it. Maybe spammers are onto this method and treat this the same as replying to spam, i.e. confirming the address is indeed real. So, instead of bouncing spam, I'll just put it directly into my saved spam box (for bayesian learning). The only trick is how to make the message show up already as read. Otherwise, mail programs constantly say there are unread messages. For these obvious spam messages, I really don't care to read them anymore. Since I use the maildir format, I had to use some procmail magic to set the "Seen" flag. Read on for my procmail recipes, now.

iPod mini

|

I think Apple is on to something with their iPod mini. My 12 year old cousin is so excited to get one, she couldn't stop talking about it for 5 minutes (though she's rarely short on words). Not only did she know what color she wanted (pink), she was able to rattle off all five colors available. Clearly, she had spent some time researching this topic. If Apple is seen as cool to the kids in this age group, I'd say their on the right track. I doubt a 12 year old would tell you that Dell, HP, or Microsoft is cool. And maybe these kids will be buying a Mac in a few years.

One last note: according to her, Best Buy is selling them for only $200, which if true is a huge boost for the iPod minis. The $250 price tag was really the only negative observation I could come up with, when they were first released. I haven't been able to substantiate this claim, though, and it would be surprising given Apple's usually tight control on its product pricing.

Restaurant Confidential

|

I'm trying to make an effort to eat healthier while eating out, so I checked out Restaurant Confidential from the library last week. It's been a great read. They analyze many dishes from many popular food chains, categorized by food type: breakfast, chinese, mexican, etc. I'm a very quantitative person and like to be an educated consumer, so I like to see these nutrional numbers. It's amazing how bad most restaurant food is. Tons of fat and calories and huge portions. The part I like best about the book is how the authors manage to pick out at least one or two, what they call, Best Bites from every category. So not only can you see what to avoid, more importantly, you know what to order. And the Bottom Line hints under each dish are quite helpful. The writing is not all dry, spouting out nutritional numbers everywhere. The authors have a strange sense of humor, for example, calling fettuccine alfredo "a heart attack on a plate" saying "if you are planning on ordering this ... make sure your cardiologist is on call," making for an entertaining read. Even if you're like me and don't go to these chain restaurants that much, I still recommend this book. The advice seems sound for most restaurants of the same category, since the dishes are fairly common. I think I may buy a copy for future reference.

Written by members of the same organization, the Nutrition Action Healthletter looks like a great resource, too. I've just browsed over some of the archives. There are numerous good articles, and I like reading over the Right Stuff vs. Food Porn. In fact, I liked it so much, I just subscribed for $10.

Running: I did it

|

After four and a half months, I finally completed my 8 week training program to run 20 minutes this morning. I'm still in amazement. I've never been an athlete, and I've always hated running. But man, now it feels good to run, and reaching this milestone feels even better. I used to get out of breath running for about 15 seconds. Now, I don't get out of breath running for 20 minutes. I'll repeat: I'm still in amazement.

Of course, you may be wondering why it took almost 20 weeks to complete an 8 week program. There were the occasional missed days, which just pushed out the schedule a bit. But the major setbacks were my two injuries. Twice I got a minor case of iliotibial (IT) band syndrome. Here's a Runner's World article and an about.com article about ITBS. It usually occurs because of overtraining (probably what happened in my case). And both times, rest (i.e. no running) and ice healed it. Given I probably haven't run since grade school, I should have started running at a much more gradual pace. Something more along the lines of CARA's pre-running program. When I first started training, I was too proud and stubborn to do the pre-running program. I figured that since I can walk a lot (I walk an hour every day to and from work), so I must be in decent shape. That was a wrong decision. In the end, I would have achieved my goal in less time and without injury had I started slower.

But that is all behind. Now, I need to work my way up to 30 minutes of running, and maybe even do a 5k race in spring. My goal has been to run for 30 minutes, 3 days a week to keep in shape. I really have no plan or desire to do any more, like, say, a marathon. Maybe an 8k would be fun later in the year, but that's really the most I want to run right now. Any more than that would take up too much training time, I think.

Robert C. Martin on Web Services

|

Go, Bob, go! I couldn't agree more.

iTerm

|

Finally, iTerm has taken over my default terminal application for OS X. It does tabs, and it now has sane keyboard sequences to create and change tabs. It's sort of a graphical version of screen. I've always had some sort of issue with screen, so I don't use it. The only drawback is that it doesn't seem to do bold fonts at all.

Oh, and I found a document showing how to change the tab names using xterm control sequences. I've always had a function to change the title. The settab function is the control sequence to change the icon name. Pretty sweet. I wonder what that does under konsole. Also, I prefer to use the special zsh precmd function over chpwd. This ensures the titles always get set correctly, even after terminating an ssh session that changes the title bar (I put the user and host name in the title bar). Read on for a full snippet from my .zshrc.

Hidden CD Tracks

|

Remeber those "hidden" tracks on CDs that became so popular in the '90s? They were cool the first time you heard them, and then just got annoying. They're even more annoying today when ripping these CDs to MP3s.

Generally, there are two kinds of hidden tracks. The first would put the hidden track on the 99th track with all the tracks in between as blank 1 second tracks. The other kind is where the last track is super long, like 30 minutes, with 25 minutes of silence between the final track and the hidden track. The first kind is easier to deal with, as you just don't rip the 90 blank tracks in the middle. The second kind requires manual editing. I use Audacity to make two tracks from the one super long track, cutting out the silence. Of course, you want to do this editing on the original CD file prior to conversion to MP3. Otherwise you'll end up ecoding the file twice, reducing the quality of the MP3.

About this Archive

This page is an archive of entries from January 2004 listed from newest to oldest.

December 2003 is the previous archive.

February 2004 is the next archive.

Find recent content on the main index or look in the archives to find all content.

Links

Powered by Movable Type 4.1