Archive for March, 2007

Truck Tops USA : Leer Camper Shells in the Bay Area

Sunday, March 25th, 2007

I purchased a Leer 22 camper shell from Terry over at Truck Tops USA this weekend. After visiting the Santa Cruz and calling the Watsonville Leer shell dealer, and hearing negative feedback from my father-in-law, I decided to go over the hill to Hayward and buy from Terry at Truck Tops USA.

Terry was upfront about pricing over the phone when I made my order. I felt he was genuinely happy to have a customer at the phone, whereas in Santa Cruz I got a bad vibe from the Santa Cruz salesmen — felt they just wanted my money and get me out of there. I was pretty sure had something gone wrong, they would’ve brushed me off and not taken responsibility as was the case with my wife’s dad.

The was a recorded error in the phone order I place, to which Terry wholeheartedly fixing it free of charge. I told him I’d “put in a good word for ya”.

Truck Tops USA carries the best Leer camper shells in the bay area. You’ll be making a mistake if you buy from someone else. I felt that Terry appreciated our business and I highly recommend him over other Leer dealers in the bay area.

But don’t take my word for it, give him a call yourself: 510-889-8100, or visit his web site. Truck Tops USA is located in Hayward, CA. Tell him “Anthony Ettinger” recommended you.

VN:F [1.8.4_1055]
Rating: 0.0/10 (0 votes cast)
VN:F [1.8.4_1055]
Rating: 0 (from 0 votes)

Learn to write “Proper Perl”

Tuesday, March 13th, 2007

Perl::Critic is an excellent way to not only validate your Perl source code, but to learn some tips from the Perl monks who have contributed to the Perl::Critic documentation.

I uploaded one of my latest CGI scripts written in Perl to see how good my Perl chops are…turns out I picked up a few tips that I was unsure about in my previous Perl scripts.

A few simple techniques can be used to make your code more standardized in the event that your are not the only person reading it.

The Perl Critic web site has a nice usable web interface for uploading source code and checking its validity — although for obvious reasons if you’re working on enterprise code you should probably download an install the Perl::Critic CPAN module on your own server.

VN:F [1.8.4_1055]
Rating: 0.0/10 (0 votes cast)
VN:F [1.8.4_1055]
Rating: 0 (from 0 votes)

Replacing a Tag Name in VIM

Thursday, March 8th, 2007

I needed to quickly replace acronym tags with abbr tag names since I read somewhere that acronym might eventually be deprecated because of its confusion and redundancy in meaning — although I fully realize the debate is still in progress.

In VIM (vi text editor for the command-line) you can use regular expressions for searching and replacing.
Although a bit confusing at first I have found that my regex chops have quickly improved simply by learning how to use them efficiently within my favorite editor — VIM.

First, if you’re not already familiar with command-mode in VI, we need to invoke the “substitute” mode (type :he substitute for documentation).

The line below will do a search and replace of ‘foo’ with ‘bar’ on the current line (g = greedy/global):

:s/foo/bar/g

To change the acronym tag to abbr we need to do the following:

:s:acronym:abbr:g

Note: I changed the regex delimiter from forward-slash to colon to avoid escaping forward-slashes used in closing HTML tags.

The above example is not good enough, as there’s no gaurantee we are acting only on the tags themselves.

:s:\(<[/]\=\)acronym\([ >]\=\):\1abbr\2:g

A simple explanation for the arcane syntax is that capturing parenthesis need to be escape in VIM: (…) becomes \(…\), and thus can be refered to in the replacement token by \1, \2, etc.

The \= forces a 0 or 1 match on any character(s) defined within the brackets []’s — in this case, we want to first match an option / forward flash to apply to opening as well as closing tags.

The second set of brackets: [ >] contains a literal space character and a closing carat to signify the end of the opening or closing tag. This will preserve other HTML attributes (ie – “title”) defined on the opening tag.

Finally, after testing it on one line first and seeing positive results, you can apply it to the entire document by invoking the substitution function in VIM with a preceding “%”.

The final regex applied to the entire document becomes:

:%s:\(<[/]\=\)acronym\([ >]\=\):\1abbr\2:g

…more VIM tricks from PixelBeat.

VN:F [1.8.4_1055]
Rating: 0.0/10 (0 votes cast)
VN:F [1.8.4_1055]
Rating: 0 (from 0 votes)