Wednesday, July 4, 2012

Getting the time date stamp into the file name

We just returned from a two week trip to China on which we took 3000 photos with four different cameras. Now we need select a hundred or so to put on our web page. The problem is that most image previewers sort by file name. This means the photos are each grouped by camera.


require 'rubygems'
require 'exifr'

mypix = Dir.glob(ARGV[0] +"/*.{jpg,JPG}")
    somepix = mypix.sort_by \
        { |a| EXIFR::JPEG.new(a).exif.to_hash[:date_time_original] }
    somepix.each do |pic_file| 
 regex = /[\/\.]/
 system("mv " + pic_file + " " + 
            pic_file.to_s.split(regex)[0] + "/" +
            pic_file.to_s.split(regex)[0] + "_" + 
            EXIFR::JPEG.new(pic_file).exif.to_hash[:date_time_original].strftime("%Y-%m-%d_%H%M%S") + 
            ".jpg")

end

The run the app

$ruby rename_pix.rb trip12a


And now you can sort your pix.

Fixing Mini-blinds - Fishing Supplies to the Rescue

Many of us have mini-blinds or honeycomb shades at home. These are usually special-ordered and custom cut to fit your windows. For the most part you get the same style for the whole house.

When part of the mechanism on one of our honeycomb shades broke, the left side hung lamely when I pulled the cord to let some light into the bedroom. Our shades are old, and I'm pretty sure that I wouldn't be able to find an exact match if I wanted to replace it. I thought to myself, "this is going to be a real mess to fix." Then it occurred to me that someone had to assemble these shades in the first place, and I'm at least as handy as that person.



I found the there were end caps that easily snapped off, and a plastic cover that slid away to reveal a drawstring. the drawstring had become severed after years of sliding over the bale that held the shades in the open position. The drawstring was a tough, finely braided, but small diameter cord. I took a sample of the drawstring to a craft store that sold DIY drapery supplies. They had something similar, but it was far to big to fit through the bale mechanism. Then I went to a big-box home improvement store - no dice. Where have I seen this stuff before? Fishing!

I went to a fishing supply store and showed them the cord and they said, "We've got something like that. It's a little thiner and if you don't mind the white and green color, it's 6 cents per foot".

"Yeah? Gimme a hundred feet then"!

I believe the stuff is called braided fishing line. I got a lot of it because:

a) it was cheap.
b) who knows when another shade will break?
c) it looked like really useful stuff to have at the workbench.


I pulled all the old string out of the shade. Holding the shade closed, I was easily able to thread the line through the honeycomb fabric using a rather large needle. I replaced all three lines, threaded them through the locking bale and re-hung the shade. I pulled the cord and the shade lifted smoothly and evenly. I snapped the cords to the left to latch the shade in the up position, released the cords, and the shade fell on windowsill with a bang. The cords were too thin for the locking bale! As a quick and dirty fix, I cut a strip of metal from a can and wrapped it through the bale to make it just a little thicker. I had to be careful that none of the rough edges would rub and abrade the strings. If I ever re-do this I'm going to cut some thin pieces of plastic and crazy-glue them inside the bale instead.

Now our honeycomb shades let the sun shine through again. I've used the fishing line on mini-blinds too, and even though the mechanism is quite different, I found it works quite well.