Wednesday, February 4, 2009

Cisco and Netgear stupidity

A couple of random bits worth mentioning; both regarding stupid configuration tricks.

First to Netgear. I have a Netgear WGR614v9 Wireless router that I use as an access point. Generally it works fine for me; I don't bother the access point, the access point doesn't bother me. This all changes on the odd day that I want to go look at the configuration for some reason. Accessing the web interface for the WGR614v9 is not as simple as keying in the IP address of the unit. No, netgear thought it would be clever to make the router only respond to requests for I have no idea why they would do this, security through obscurity perhaps? IMHO, it only serves as an annoyance to me; making me go and edit the hosts file (thats c:\windows\system32\drivers\etc\hosts for you windows types) to specify the IP address for the hostname to access the router.

Next up, Cisco! Although I am pleased with my recent Cisco 678 purchase, I have found that it is not the DSL routing nirvana that I was hoping for. Once I got the thing working on my DSL line I had to go and play with the advanced goodies I found in the configuration. The first thing I set up was SNMP, using Cacti to poll the router for throughput information. I got it working and life was good; until the next morning when I got to work and connected back to the house to do some testing. I noticed that my connections to the house kept freezing. After some thinking, I put two and two together and disabled SNMP. Since then I have not experienced any problems. Way to go Cisco, add features to a product that cause the product to malfunction when used.

Sunday, February 1, 2009

Renaming files by modification date

I have been working on combining sets of photos that my brother and I shot on a recent vacation. Being the perfectionist that I am, I wanted the two sets of photos to flow chronologically. We both had the clocks on our cameras set pretty close, so I thought I could get away with sorting files by modification dates and using touch to correct the timestamps on any files I modified. Unfortunately, photo viewers seem to only organize photos by name, so I was going to have to find a better way.

I went looking for a quick and easy script to rename all the files in a directory into some common scheme.
What I found was a one liner that I used to prepend the modification date onto the name of each file. The command looks like so...

find -type f -name "*jpg" -printf "mv \"%h/%f\" \"%h/%TY%Tm%Td-%TH%TM%TS-%f\"\n" | sh

I recommend initially leaving off the sh pipe at the end of the command. This way you can preview the file name changes and make sure you are getting the result you want. This yields a filename such as 20090201-220505.0000000000-foo.jpg. Leaving the original file name at the end of each file gets around the problem of having non-unique file names if there were multiple photos shot in the same second (definite possibility with a DSLR).

I didn't come up with this trick all on my own. I borrowed from this discussion and modified the command to fit my situation.