Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

dws (341)

dws
  (email not shown publicly)
http://www.davewsmith.com/

Journal of dws (341)

Sunday February 13, 2005
12:03 AM

Overheard in passing

Outside the neighborhood coffee shop. Two guys in their 70's, one wearing a flannel shirt and a straw hat. The other carrying a walking stick. The fellow with the hat is speaking.

"You need a switch, not a hub."

I love living in Silicon Valley.

Saturday February 12, 2005
11:53 PM

That other kind of JOIN

I've been doing database-related work for most of the last 15+ years, yet last week was only the second time I've needed to use a FULL OUTER JOIN in production code.

We use LEFT JOIN as an interview question to gauge a candidate's knowledge of SQL, but this was one of those "we may get some from here, we may get some from there, but we need to count either as one" situations (with a few twists) were a LEFT JOIN wasn't sufficient, and I didn't want to introduce additional queries into this particular piece of code. As Holmes would say, it was a "three pipe problem." Nailing it was the high point to an otherwise good week.

Sunday February 06, 2005
06:53 PM

Weekend Archaeology

This weekend I bought a bunch of mid-sized plastic tubs from the local storage place, and went on a cleaning binge in my study. Amoung the random things uncovered were the receipts for the 300Mhz Celeron box I built in '99 "to carry me into the next century". The receipt noted $190 USD for an 8Gb Maxtor drive. Last week I picked up 160Gb for $60. That's ~$25/Gb to <$0.50/Gb in 6 years. Not bad.

The plastic tubs are clear, so it'll be easier to find stuff in the closet. So far I have one tub filled with power strips and cords, and another full of Cat5 and phone lines. I suspect I'll never need most of 'em. The SCSI cables went into the give-way pile.

Monday January 31, 2005
04:53 AM

Bit-scraping Car Talk

One of the high points of the weekend used to be listening to Car Talk while driving. My travel pattern has changed since moving, and I almost always miss the show now. I had rigged up an FM-radio to audio-in connection to let me capture .wav files to burn to CD, but this never seemed to work out quite right, and that was back before I had a USB MP3 player.

Car Talk keeps the most recent show available as a RealAudio feed. Bits. Hm...

Hypothetically, then, and with the help of a co-worker who knows the sekret of getting mplayer installed on Linux (configure yum to point to freshrpms.net, import their PGP key, use yum to install mplayer, and then figure out how to download and install the essential codecs), one could threw together a script that scrapes the Car Talk site for links to the ReadAudio files, streams them disk, converts them from .rm to .wav, and finally (via lame) to an .mp3 in a Samba directory named for the week. From there, it would be a quick copy into an MP3 player, and from there to a happier commute.

It would be a slow process (the RealAudio feed seems to be throttled), but that's what a 2 AM cron job is for. The basic incantation for ripping a segment of the show would probably look something like

$rtsp = ... link to real audio stream ...
mplayer -noframedrop -dumpfile tmp.rm \
-dumpstream  $rtsp
mplayer -ao pcm -aofile tmp.wav -vo \
-null -vc dummy --playlist tmp.rm
lame -h -b 128 tmp.wav segment$n.mp3

I'd be surpised if this same recipe didn't apply to lots of interesting feeds.

Thursday January 06, 2005
09:34 PM

A Sloooow Install

Installing and configuring Linux is something I do infrequently enough to forget a lot of little details, like "This is going to be a headless system. How do I not start X?" (Answer: Edit /etc/inittab and change runlevel to 3) and "What are all of these strange processes listening on sockets, and how to I shut them down/off?"

Moving bits off to a backup server before repartitioning (to make a proper /home partition this time) took longer than expected, largely because we discovered that the switch between the boxes was (a) 10Mbit, and (b) flakey. Crossover cable to the rescue.

Now I'm waiting while the CDs spin, after which I'll struggle through more small stuff I've forgotten, like how to set up MySQL and PostgreSql, and which settings in httpd.conf need tweaking. Then comes the fun part: Sorting out what's changed in mod_perl land between RH8 and FC3.

Part of me thinks I should do this more often.

Friday December 24, 2004
09:31 PM

Process Failures That Smell

Once you've got the pie process down, and are producing repeatably outstanding pumpkin pies, don't adjust the oven temperature after your wife has discovered that the oven has been cooking 25F° low. Stick with what works. "But the recipe says..." isn't a winning move. Trust me on this.

There are parallels here to software development, I'm sure.

Tuesday December 21, 2004
03:31 AM

Bizarre Bugs on a Monday Morning

This morning's expedition into the bizzare involved tracking down an obscure interaction between mod_perl 1.99 and CGI::Simple. Normally, these two get along just fine, though we noticed a while back that file uploads would cause later users of the same Apache process (e.g., some other browser) to lose URI arguments. (Finding this involved some fine detective work and a bit of luck.) The fix at the time was to note that a multipart/form-data post had just been handled, then rflush the request object and exit the process. File uploads were infrequent in our app, so forcing Apache to start a new process was no big deal.

Time passes, and along comes a feature that requires keeping the connection alive. Debugging ensues.

When the dust settled, it appears that there are two problems that manage to avoid each other almost all of the time. The first is that the Apache object hangs on to the request type (which is normally undefined, but will be multipart/form-data when a correctly coded file upload happens), and reports this as the type for subsequent requests, including GETs. An oops, but a mostly benign one.

The complementary problem, in CGI::Simple, is that requests with a type of multipart/form-data get special handling, regardless of the request method. If the request doesn't include arguments, nobody notices. But if there are URI arguments, they get ignored in favor of a non-existent form. An oops, and one that would occassional cause our app to squawk.

I suggested a fix in the bug report: only do the multipart/form-data handling if the request method is POST.

Debugging Apache processes isn't fun, but it beats late holiday shopping.

Monday November 29, 2004
02:15 PM

Travel Trivia Redux

New Mexico really does have an Official State Question. The question, which you'll get asked in many places when you order local food, is "red or green?" The question asks which of the two common chile pepper sauces you'd like with your food. (New Mexico offers some truly yummy chile peppers, which turn into truly yummy sauces.) The common responses are "red", "green", and "Christmas". The latter response asks for a bit of each. Countering with "which is hotter|better today?" is also acceptable.

No points awarded.

01:55 PM

Monday Morning. All Tests Pass. Blah.

I am really, really wishing that I'd left myself a failing unit test before the 4-day Thanksgiving weekend. Picking up the pieces this morning and answering "O.K., what's next?" took too long, even though I left a checklist of what to do next. A failing unit test might have jump-started the process by providing instant focus.

Friday November 19, 2004
08:05 PM

Travel Trivia Quiz

For 25 points, what is the State Question for New Mexico, and what are the three usual answers.

No googling, please.

O.K., I guess this is a hard one, so here's a hint: The question offers an alternative between two colors. 15 points for the 3 standard responses.