More popular than stellar consumer credit you cash advance cash advance your car get your mortgage.


Archive for October, 2006

Photos on S3

Friday, October 13th, 2006

You can now see the large version of images without waiting for my slow, slow cable modem async upload. In fact, all the image loads should be blazing fast as soon as I get them all uploaded. At the rate it has been going, it will take 3 days to upload everything to S3. My script is just about though my china pictures now.

And it is so easy to use. I work at Amazon and have had pretty much constant exposure to S3, but it still surprised me how easy it was to use. I used rSh3ell to get started. I just created a bucket named ‘carrino_albums’, then started uploading things to that bucket with acl ‘public-read’.

Here is the script I used to upload my files. Its pretty hacky. I just reads from a file called input and writes the file with that key to S3 as public-read. Some exception handling is thrown in there. I intend on creating a much better script along the lines of s3sync, which behaves like rsync. S3 makes this easy, becasue it automatically stores the upload date and the md5sum in the metadata, and you can retreive that with a HEAD HTTP call. You can also do a list call on the bucket, which will get you the metadata of all the keys in that bucket.

If I upload a file named china_day2/dsc_2572.sized.jpg to bucket carrino_albums, you can find it here. It’s that easy!

#!/usr/bin/env ruby
require 'S3'

AWS_ACCESS_KEY_ID = 'public key'
AWS_SECRET_ACCESS_KEY = 'private key'
USE_SSL = false
@conn = S3::AWSAuthConnection.new(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, USE_SSL)
@bucket = 'carrino_albums'

def write_file(file_name)
    begin
        bytes = nil
        key = file_name  # NOTE: this is specific to our situation
        File.open(file_name, "rb") {|f| bytes = f.read }
        headers = {
              'x-amz-acl' => "public-read",
              'Content-Length' =>  FileTest.size(file_name).to_s
        }
        response = @conn.put(@bucket, key, bytes, headers).http_response.message
        if response == 'OK'
            puts "#{file_name} SUCCESSFULLY uploaded"
        else
            puts "#{file_name} FAILED to be uploaded"
        end
    rescue Interrupt => e
        puts "Caught Interrupt, bailing out"
        exit 1
    rescue Exception => e
        puts "#{file_name} FAILED to be uploaded and caused an exception. #{e.class.name}: #{e.to_s}"
    end
end


STDOUT.sync = true
File.readlines("input").each { |line|
    line.chomp!
    write_file(line)
}

Da Bears

Monday, October 2nd, 2006

What happened to my bears? They somehow, after all these years, manage to have a healthy QB who can get the job done. For as long as I can remember, when the bears were behind, they would run and screen pass to “3 and out” every drive. We might pick up another 3 or 6 points on field goals, but definately not through the air, an certainly not in the endzone.

Rex Grossman

We are now the only NFC team that is still undefeated. We are now +6 in turnovers (up +2 from last game with 2 interceptions by Ricky Manning). We’ve only given up 29 points in 4 games, including a shutout of favre in green bay. But we all knew that the Bears were Defensive machines. The surprise is the Offence. I think it is too soon to think that Rex will be a franchise QB, but it sure sounds nice.

Also, to top the day out, we won our final regular season kickball game to put us at a whopping 3-2-1. That last game was a nail biter. At the bottom of the last inning we were up 6-5 with 2 on and 2 away with the go-ahead runner at 2nd. I was pitching and had a pretty solid day. It was a bunt and I was able to hop on it and make the out by tagging the runner on the way to first.

Boo ya.