San Antonio Here We Come.

Finally got two quotes for movers, complete pack and move and my wife should be scheduling the final dates soon. Tomorrow we leave for DC for a conference and to celebrate the 4th at our nation's capital. I don't expect to have a lot of time to post here, and won't have any time to play with gadgets or projects for about a month.

It doesn't look like I'll get unpacked in TX in time to build something for the Altoids Contest.

The Cat’s Out.

I let the cat out of the bag today by resigning my job postion of 4 years. My last day will be July 12th, 2005.

I've had my resume active on Monster.com for about a year now with very few hits and no interest. That all started to change about 2 months ago. The hit counter started moving and I started getting emails from head hunters. Most of them were looking for short term contracts in expensive cities.

I didn't really expect anything, nor was I really that serious about moving. I put in my resume that I wanted to relocate to Texas to be closer to my family, naming Dallas, Austin, San Antonio, and Houston as prefered locations. I added a generous salary requirement and left it at that.

The first contact came about 4 weeks ago. Just a few emails with the HR department, then a phone interview with the manager, and ultimately a trip down and a face to face with 4 people, including one of the founders of the company. We ate good Mexican food for lunch with about half the development team. I enjoyed myself immensly and was impressed with the people and their goals. Apparently the feeling was mutual because they made an offer Monday that I couldn't really refuse. It's not much more money, but it is an opportunity to work for a company with clearly defined goals and a profitable track record. I'll be sure to post the name of the company once I'm onboard and understand their policy on blogging.

If posts here are scarce it'll be because I'm getting ready for a long 4th of July weekend in DC, house-hunting and preparing for the move. Should be an exciting month.

I’m not dead.

.!.
.!.

Just a quick post to let any readers know that I haven't fallen off the face of the earth. I've just had a lot happening lately. I will make a post tomorrow with more information.

Flickr Rocks!

.!.

Thanks to Brandon I now have a pro Flickr account. I'm writing a quick bash script to upload images to Flickr.

Here's the finished script:
flickr.sh

Put in your path somewhere (~/bin/flickr.sh).
# cd /path/to/pictures
# flickr.sh tag1 tag2 tag3

You can add any tags you want to the command line as long as they don't contain spaces.

functions and error handling

.!.

Last time I tweaked the parser, tonight I'm going to move some of the code into functions. Many people think of functions as a way to reuse the same code, but they can also be used to seperate logic into bite sized chucks. This can often lead to code that's easier to read, and makes modifying things later easeir, both for you, and anyone else who wants to enhance the script.

#!/bin/bash shopt -s nocaseglob BASEDIR="/mnt/usb0/mp3/podCast" FEEDS="${BASEDIR}/feeds.lst" CACHEDIR="${BASEDIR}/cache" LOGFILE="${BASEDIR}/log"

Not much change here except I've added two config variables, CACHEDIR, and LOGFILE. The former will be used for caching the feed XML to help minimize network transfers, both for us and more importantly the feed provider. The later is for reporting errors, some of the functions will output lists of things to be piped into a loop, we can't just echo the errors.

Continue reading

updated parser

.!.

In my last post I was using if and else to look for each tag, and act on it. Tonight I'm going to convert that ugly mess to a case statement. It's easier to read, and doesn't have the hackish feel of if then, else.

I also learned a new trick that will help in parsing tags if the author mixes case. We'll add a 'shopt -s nocaseglob' to the top of the shell script. This causes wildcard and regexp matches to be case insensitive. It does not, however, change the behaviour of commands like sed and grep. I've already seen a couple feeds there the tags were all upper case, and was worried about having to write some ugly regexp to match the tags.

#!/bin/bash shopt -s nocaseglob

Continue reading

podCastTorrent.com – My latest project.

.!.


podCast Torrent

I'm starting a new site for podcasters in need of some bandwidth relief. podCastTorrent.com will offer free BitTorrent Tracker services to podcasters. Right now we've only got the 17 episodes of The Roadhouse online, but hope to add more as podcasters sign up.

We are testing the tracker. (Yeah!)

If you want to hear an episode of The Roadhouse, click the torrents link, download a torrent and load it up in your favorite BitTorrent client.

process substitution in bash

.!.

The internets are slow tonight, and I'm tired, so I'll just leave you with something quick. Tommorrow I'll pick back up on the podcast script.

Let's look at this short script:


#!/bin/bash
LIST=""
ls | while read FILE ; do
   LIST="${FILE} ${LIST}"
done
echo $LIST

You may be suprised to find that LIST is empty after all that looping. This problem always mystified me until I learned about subshells. The pipe creates another shell, a subshell, where the loop executes. When the pipe ends, so does the subshell and all of it's variables.

Fortunately there is a simple way around this. We need to execute the loop in the current shell, and redirect the command back into the loop from a subshell.


#!/bin/bash
LIST=""
while read FILE ; do
   LIST="${FILE} ${LIST}"
done < <(ls)
echo $LIST

<(ls) creates an un-named pipe from the subshell into this shell. We can now redirect that pipe into the loop with another <.

If that got too confusing, try reading the Process Substitution chapter in the Advanced Bash-Scripting Guide.