Archive for December, 2004

Firefox Tweak #2 ( & Slashdot)

Wednesday, December 15th, 2004

This isn’t really a tweak. It is more calling attention to a handy feature that just happens to fix a mildly annoying problem with a site I enjoy visiting. For reasons unknow, Slashdot renders poorly using Mozilla Firefox.

Stupid overlapping of text into the menu area on the side As can be seen here, the text in the main area of the page is mis-aligned so that it is crowding into the left hand side menu bar. Who is to blame? Slashdot? Firefox? Don’t know, don’t care, I am just here to help!

A really quick fix is the use to toggle the text size with the keyboard shortcuts CTRL+ + and CTRL- -. The shortcuts are also available under the menu by choosing View, Text Size, and Increase or Decrease. These controls are typically handy in the case where the text size displayed isn’t sanely sized for the screen one is viewing.
They can also be used in this instance to fix the pesky Slashdot effect we see here- not to be confused with the Slashdot Effect. To use this two step quick-fix, use the CTRL+ + to increase the text size…
go big....

then small.... Then CTRL- - to reduce it again. This cycling fixes the pesky formatting. Of course if the text wasn’t at a suitable size to begin with, adjust as needed.

There is a Firefox Extension from HardGrok that automatically fixes this behavior. I haven’t tried it out- anybody who has please comment on its performance.

mailing from unix

Saturday, December 11th, 2004

This is more work related material, and is posted as an article here for easy retrieval if and when I forget the syntax.

The background:
My SQL code runs on a remote AIX Unix box. A typical bit of code will generate some tables on the database, a log file, and a spooled file designed to be the body of an email message. After a bit of code completes, these files are an example of what may be present:

  • some_code.email
  • some_code.logfile

My first order of business is to send email about the code that has just run to the people who need to know. Inside my SQL scripts, the “!” symbol lets my SQL code know to run the next line as a shell command, then take control again. The some_code.email file has already spooled on and off, and contains a summary of the code that is has just ran- counts, table names, that sort of thing. A combinaton of pg and mailx are used to have some_code.email inserted as the body of an email message:

! pg some_code.email |mailx -s "some_code has run!" somebody_important@acxiom.com;

pg is similar to cat in that it displays the target (some_code.email). In this case the display doesn’t go to the screen, but it is piped to the mailx program. Doing so effectively inserts the contents of the .email file as the body of a new message. The -s flag signals that the next bit, in quotes in the above example, is the subject line of the message. The last part is self explanatory, it is the email address of the recipient.

If one wants to email to multiple recipients, each email address is seperated by a space:

! pg some_code.email |mailx -s "some_code has run!" somebody_important@acxiom.com also_important@acxiom.com;

This works just fine. It isn’t the best solution for all cases. For instance, I was using this method for both the email notificiations and sending myself the logfiles from the code. This method did work, but it meant that I would get the lengthy logfile as the body of an email message. To save this to my computer, I would cut and paste the body of a message into a text editor an save the logfile from there.

This method worked until I started generating very large reports. For one thing, the reports are being output in comma seperated value format. It seemed like extra effort to cut and paste the csv into a text editor, save it as a .csv text file, then open it with Excel. The other is that some of these reports are very big for being .csv- 5mb and bigger for the most complex set of queries. Try cutting and pasting that!

What I want to do is to receive the file as an attachment. An attachment that doesn’t max out my inbox quota would be nice. To accomplish this, two more tools come into play: uuencode and gzip.

In this example, instead of the files mentioned prevously, I only have 1 to deal with:

  • myfile.audit

The first step is to compress it to reduce file size:

gzip -c myfile.audit > myfile.audit.gz

This step leaves the original file alone and creates a gzipped copy (myfile.audit.gz) as well.

The next step is to transform the archive into something attachable, and stick it to an email. This is where uuencode comes into play:

uuencode myfile.audit.gz myfile.audit.gz |mailx -s "unknown dog" unknown@dog.com

Update (12/20):
I figured out how to take all my reports and getting them email to myself as a single compressed archive. In this example, my audit reports are integrated into my campaign code. Each report is generated as a comma seperated value (.csv) file.

!tar -cf my_reports.tar *.csv;
!gzip -c my_reports.tar > my_reports.tar.gz ;
!uuencode my_reports.tar.gz my_reports.tar.gz | mailx -s "My Reports!" unknown@dog.com;

The evil empire builds a better mouse(trap)

Saturday, December 11th, 2004

Microsoft is one of the evil empires and I am not a huge fan. For some diabolical reason, Microsoft mouse controllers kick ass. I have two. One is used with Jennifer’s Linux box. The other is a wireless model I use with a little PIII laptop I use to connect to work via VPN.

usb receiver fits into the bottom of the mouse when not in use The Microsoft(r) Wireless Notebook Optical Mouse works so well, I can’t help but be seduced by its mouse-ian charms. Maybe it is the receiver that folds up and snaps into the bottom of the mouse when not in use, turning off the battery at the same time.
Perhaps it is her attractive curves and the comfortable feel in either hand. When she doesn’t snag me with her vixen-like ways, she snares my heart with her cute design. She has a “hood” that opens up with a push of the chrome button to allow the changing of her battery. Too cute! she's hot, isn't she?

Is it love? I think it might be.

Curse you Microsoft! It would be easier to resist you if your mice were more like Windows ME.

Note: try hitting refresh if you don’t see product pics- they are linked in from the MS website

it’s all about the sed, baby

Wednesday, December 8th, 2004

This is a rough version of a script I am using at work. It is a search and replace script which will change all instances of one string with another in all the files in a particular directory. I am currently using it to edit SQL scripts. Newer versions of certain tables come up, and I needed an easy way to change select foo from this_table where … ” to “ select foo from that_table where … “.

If my Perl kung foo was stronger, I think it would be easier to write the script in Perl. As it stands, my Unix scripting is somewhat stronger. One complaint I currently have is that the Korn shell is different enough from the Bash shell that the syntax is enough to trip me up on simple things.

Without further ado, here is the code- please improve and comment upon:


#!/bin/ksh
# danny anderson
# sed magic monster 12.07.2004
# swaps all instances of OLD line from all files in the target directory
# with NEW line
# usage: "sed_monster (target dir)
# where target dir holds only the files that should be changed. If no
# target is specified on the command line, assume currently directory

# backup files to be changed in datestamped subdirectory
backup_dir="$1/sed_originals_`date '+%Y%m%d'`_`date '+%H%M'`"
echo "making backup directory: " $backup_dir
mkdir $backup_dir

# prompt the user for the old string & the replacement string
echo "OLD LINE: ";
read old_line
echo "NEW LINE: ";
read new_line

# loop through all the files in the target dir
for filename in ${1:+$1/}* ;
do
cp $filename $backup_dir

sed -e 's/'"$old_line"'/'"$new_line"'/g' $filename > $filename.new
mv $filename.new $filename

done

Album Review – Wilco – Yankee Hotel Foxtrot

Monday, December 6th, 2004

If David Dennis ever recommends an album to you take that she-it as gospel. David is responsible for my cd collection containing classics such as Galaxie 500’s “On Fire,” The Flaming Lips “Yoshimi Battles The Pink Robots” and now this gem. I can’t really say that this one is as good as “On Fire” or “Yoshimi” but that is by no means any kind of indictment against it. “Yankee Hotel Foxtrot” (an allusion to an old short-wave radio code) is a fine album that is Wilco’s most mature and complex offering to date.

This is not your father’s Wilco. Granted, I’m no expert on the early days of Wilco or its foundation in Uncle Tupelo, but when I think alt-country, I think catchy, jangly tunes that sometimes catch my fancy and sometimes do not. Stereotyping this album with such a label would be unfair. These tunes are a lot more sophisticated. I’ll stop short of calling it a concept album, but a certain indescribable tone is present throughout. I’m inclined to say that the album is in some ways a sad ode to America and its current state, but I think it would be a disservice to paint with a broad stroke in trying to categorize any aspect of this release.

Don’t get me wrong, as the album has its share of catchy tunes that are easy to sing along with and get pleasantly stuck in the back of one’s mind. Only one of them might be a little over the top in terms of overdoing it on the pop scale, but even that song (“Heavy Metal Drummer”) is saved by amusing lyrics about getting stoned and playing Kiss covers. Perhaps this song points to more idealistic, innocent times. Most of the other offerings that would fall into the “catchy” category appear on the first half of the album. “Kamera,” “War on War” and “Jesus, etc.” all take hold with simple chords and an easy to handle lyrical structure more typical of early Wilco, but with a more cohesive and polished feel.

While all these are worthwhile offerings, the true genius of this album lies in the other more complex tracks. Much of the album is defined by truly unique offerings such as the opening track, “I Am Trying to Break Your Heart,” the final three tracks, and what is perhaps the signature track of the album, “Ashes of American Flags.” These songs are unlike anything in my collection. Most of them start as slow anthems to concepts that I cannot pinpoint, but they convey a similar tone. The songs evolve into a cacophony of noises and a lot of distortion that somehow amplifies the tone of the album in ways that I cannot hope to musically comprehend. I get the feeling that this album is the successful culmination of a lot of ideas for Jeff Tweedy and Wilco.

That’s not to say that there is a disconnect between the songs I’m labeling as “catchy” and the second grouping. This album flows well and is a good listen from start to finish. In fact, no one song stands out enough to justify using the skip button and I almost always find myself listening to it from start to finish. To paraphrase Shrek, this album is like an onion, donkey, it has layers. It’s pleasant the first time it is played, but on each subsequent listen it seems to build new meanings and the distorted endings to some of the more complex tracks in particular, become engrained in ways that make me realize why David Dennis would like group it with the Flaming Lips and Galaxie 500 albums. Much like The Feelies “Crazy Rhythms,” I have a feeling I’ll keep coming back to this one and enjoying it and discovering it in new ways for years to come.

Note: if anyone feels adventurous the last remaining cd on David’s list of recommendations is “Sophomore Slump” by Epperly. Right now I think I’ve shot my wad on recent additions to my collection and I’ll probably take a break for a while and enjoy the handful of new albums I’ve acquired in the last month or so.

sports news

Monday, December 6th, 2004

Virgina Tech’s win over Miami, in Miami, gave the Hokies the ACC Conference title in their first season. Not bad at all considering that early polls put the #9 Hokies as low as 9th in the conference.

Virginia Tech lost to #1 USC in the season opener 24-13, and lost a squeker to NC State 17-16. They also beat (at the time) #7 West Virginia, #16 UVA, and #9 Miami, each time going in as the lower ranked team. Virginia Tech can deliver when needed, and they are going to need it come Bowl time.

Virginia Tech gets to play #3 Auburn in the Sugar Bowl. Auburn may be out for blood, but they may be like the Texas Longhorns and get the stuffing knocked out of them. I am hoping for a good game. Both teams have a lot of incentive to win big, Virginia Tech as the giant killer and Auburn as a spurned BCS championship contender.

In other news, Razorback basketball played their only game in North Little Rock last weeked, dropping the game to #3 Illinois by 8 points. Not too shabby, considering that #1 Wake Forest was taken out to the woodshed by this same team the week before.