Category: Software

I love working at Google. It’s absolutely one of the most inspiring and creative places for a software engineer to be working. One of the coolest things we’ve done in my opinion is Google Chrome.  It’s fast.  It’s not just speedy.  It’s not just quick.  It’s really freaking fast, kind of precognition fast.  If you don’t have ESP, check out this really cool video put together by the Chrome team.  Using some clever visual metaphors, they really show you just how fast Chrome can be.

So with that said, “What are you waiting for?”  Experience the Internet the way it’s supposed to be experienced.  See it secure, see it simple, and see it blazingly fast.  Go Get Chrome!

I should state the obvious here by saying that I work for Google and the views I express here are my own and are not those of my employer.  That said, Chrome is still really fast.

So a silly little note, but I updated my main website at http://mikewiacek.com. Nothing drastic, but I made the images much bigger and changed the navigation bar somewhat. If it doesn’t work in your browser, please let me know.

I drove down to Big Sur today.  Right around sunset I grabbed a 7 shot handheld panorama at the edge of a cliff near the Bixby Creek Bridge.  I used the CS5 Photomerge functionality to automatically align and then stitch the images together.  It did an amazing job, don’t you think?

One problem with making panoramas is that the the corners are usually too short due to automatic distortion correction, but that’s not a problem with Photoshop CS5. I cropped the image above leaving some of the corner(s) natural and used the Content Aware Fill feature to fill in the missing pieces.  Can you tell which is which?  I can’t.  It’s like magic. It’s just amazing!  Way to go Photoshop team, CS5 is going to change the game big time.

Tomorrow I head over to Yosemite.  Hopefully it’s a good day for that too.

P.S. Check the photo out at Flickr “Sunset Through a Break” and see it bigger over there.

Like many relatively young people, my wife and I have the hope of one day owning a house of our very own.  One of the wonderful things that tries to make it more affordable is that mortgage interest is tax deductible each year.  However, figuring out exactly how much money a mortgage interest deduction puts into your pocket is somewhat tricky.  For a long time I heard different formulas for trying to figure it out.  Last week, I got fed up with it, and I sat down with the IRS 1040 instructions and tried to come up with something.

I wrote a small python script to do the work for me.  It’s not perfect, and it might be entirely wrong, but as far as I can tell, it provides a reasonably good estimate of how much money a mortgage interest tax deduction could be worth.

So, to share my work with everyone, I threw this little app together today.  It takes your expected AGI, loan amount, number of payments, interest rate, and tax filing status, and gives you a reasonable idea of what your deduction will be worth.  Again, note that I’m not a CPA and this is provided as a free service without warranty.  Please check with a real CPA before making any major financial decisions.  In the meantime, if you feel like getting an idea of what you can expect, head on over and check it out.  (http://taxsavr.appspot.com)

Hey everyone! I’m psyched to see Google Buzz taking off. If you’re interested in following me, head over to my Google Profile, and follow me.  I hope to see you soon! (And I promise I’m going to try and start writing on this blog more often.)

One of the things I’ve long wanted to do with Lightroom is get a graph of my lens usage.  You know, I’d like to see the focal lengths with which I spend most of my time shooting .  Unfortunately, getting this information out of Lightroom has been practically impossible.  Knowing that Lightroom stores its catalogs as SQLite databases, I tried to use some SQLite knowledge to pull this information out of Lightroom.  You know what? It possible.  If you’re not comfortable with terminology such as DOS/Command prompts on Windows and/or Terminals on OSX, you might want to turn back now, otherwise, keep reading.

First I must say something very important!!!

Doing this may break Lightroom for you. While I don’t believe it will, I take no responsibility for what may happen. To be safe, work on a COPY of your Lightroom Catalog, and delete the copy when you are finished.

Here are the steps you need to pull data out of Lightroom.  I’ve tested this with Lightrom 2.5 and it worked perfectly.  It’s unlikely this will work with Lightroom 1.x or the Lightroom 3.0 Beta. (UPDATE: Troy Gaul, engineering lead for Lightrom dropped me a line and said that this will likely work for Lightroom 3 Beta and Final as this part of the catalog isn’t scheduled to be modified.) Let’s get to it!


  1. Make sure you quit Lightroom. Don’t have it running while you do this.
  2. Open a window and go find your <catalog name>.lrcat file on your disk.
  3. Copy your <catalog name>.lrcat file to another folder.  We’ll be working from this copy.  I will assume you put this file in c:\catalog.lrcat
  4. Go over to the SQLite download page and download the precompiled binaries for your OS. (i.e. Mac, Windows, etc.)
  5. Open the downloaded file, and you’ll be looking for sqlite3.exe on Windows or sqlite3 on OSX.
  6. Copy sqlite3.exe (or on OS X just sqlite3) to the same location where you put the copy of your Lightroom catalog. For me, that’s just inside c:\.
  7. On Windows you need to open a DOS prompt. Goto the Start Menu, goto Run, and type: cmd.exe and press <enter>.
  8. On OS X, you’ll want to goto Applications -> Utilities -> Terminal.
  9. At this point you’ll want to go to the directory where you put sqlite3.exe (just sqlite3 on OSX) and your catalog.lrcat.  Since I put it in c:\, I’ll type: “cd c:\“.
  10. Now, you’ll want to copy and paste the following command, note the bolded text.  You’ll want to replace the text in bold with the name of your catalog copy.  Here we’re using catalog.lrcat:
  11. sqlite3.exe -csv “catalog.lrcat” “SELECT focalLength, COUNT(focalLength), AgInternedExifCameraModel.value, AgInternedExifLens.value from AgHarvestedExifMetadata, AgInternedExifCameraModel, AgInternedExifLens WHERE cameraModelRef = AgInternedExifCameraModel.id_local AND lensRef = AgInternedExifLens.id_local GROUP BY focalLength, AgInternedExifCameraModel.value, AgInternedExifLens.value ORDER BY focalLength ASC;” > analysis.csv
  12. Now, the results are stored in a file called analysis.csv.
  13. You’ll need to do some of your own processing of the data using Excel or Google Docs, but that’s beyond the scope of this tutorial.

The lines of the file analysis.csv will look something like this:

13,9,”Canon EOS 40D”,”EF-S10-22mm f/3.5-4.5 USM”
13,5,”Canon EOS DIGITAL REBEL XTi”,”EF-S10-22mm f/3.5-4.5 USM”
14,21,”Canon EOS 40D”,”EF-S10-22mm f/3.5-4.5 USM”

13,9,”Canon EOS 40D”,”EF-S10-22mm f/3.5-4.5 USM”

13,5,”Canon EOS DIGITAL REBEL XTi”,”EF-S10-22mm f/3.5-4.5 USM”

14,21,”Canon EOS 40D”,”EF-S10-22mm f/3.5-4.5 USM”

The first number is the focal length in mm, the next number is the number of photos that were taken at that focal length, using the camera and lens specified.  From this, you’re own your own.  Perhaps some enterprising person will write a tool to extract and generate the graph automatically, but I don’t have the time right now.  Hopefully you found this useful!

If you’re curious to see what I was able to make, take a look:

My Focal Length Usage

This is a graph of what focal length’s I’ve used over the previous 2 years.  It is interesting  I tend to use the extremes on my zoom lenses more than anything else.  Note the position of 10mm & 22mm, coinciding with my use of the Canon EF-S 10-22mm ultra-wide angle lens.  The same thing occurs for my use of the Canon 24-105mmCanon 17-40mm, and the 70-200mm lenses.

Lightroom 3.0 Beta is now available for download. Go give it a try and see what you think? More thoughts coming later, but right now, it’s time to play. Let me just say the new import tool rocks! And check out that noise reduction, it’s like magic! Fancy stuff, good times ahead for all of us Lightroom users.

Go Get Lightroom 3.0

..mike

A few weeks ago I put together a small but very useful python library to interact with ZenFolio. I don’t normally open source code I write, not because I don’t want to, but because I’m usually lazy, haha. However in this case, I didn’t see anything out there that did what I needed, so I figured someone might find this useful. The code is available at Google Project Hosting (http://code.google.com/p/lib-pyzenfolio/) under an MIT License. Let me know if you find this useful!

The other day I decided that I would add Zenfolio support to my photo tagging site, smark.us.  (I’m sill working on that, btw.) However, I was unable to find any Zenfolio Python libraries, so i wrote one.  Since Zenfolio supports JSON-RPC, it was quite easy, however I found their authentication documentation to be a little vague on how to generate a valid response to a provided challenge.  After poking at it for a bit, I got it working.  To help other folks save time, here is a code snippet that you can use to generate a valid response to a challenge issued by GetChallenge().  Note that this is only for JSON-RPC.  Other protocols such as SOAP use different encodings.

def GenerateAuthenticateProof(auth_challenge, password):
  """Generate proof for calling Zenfolio's Authenticate() method via JSON-RPC.

  Args:
    auth_challenge: Dict like object containing the result of a call to Zenfolio's
      GetChallenge().  It must contain key values PasswordSalt and Challenge.
      Both of which should represent lists of integers.
    password: User password as a string

  Returns:
    A list of integer values that should be serialized and passed as the proof
    argument when calling Zenfolio's Authenticate method."""

  # Convert the numeric salt and challenge arrays into binary strings.
  salt = ''.join([chr(x) for x in auth_challenge['PasswordSalt']])
  challenge = ''.join([chr(x) for x in auth_challenge['Challenge']])

  # Calculate a hash of the binary salt and the password as utf-8
  combo = salt + password.encode('utf-8')
  h2 = hashlib.sha256(combo)

  # Calculate the proof digest
  combo = challenge + h2.digest()
  h1 = hashlib.sha256(combo)
  proof = h1.digest()

  # Return the proof digest as a list of integer values.
  return list(struct.unpack('B'*32, proof))

About a month ago I wrote a tool that I called the Lightroom Preset Extractor.  Recent versions of Lightroom have started embedding xmp sidecar data into the EXIF of images that are exported.  Flickr has started recognizing this data and makes it available via the Flickr API.  Check out this page to see an example: http://www.flickr.com/photos/mjwiacek/3636420436/meta/. You’ll see values for Clarity, Exposure, Vibrance, etc.  What the Preset Extractor does is grab this data and convert the EXIF info into a Lightroom preset file for you to download.

If there is a photo on Flickr that makes you ask, “How’d they post process that?” and it’s  licensed in the Creative Commons or is part of our Lightroom Preset Flickr Group, the tool should be able to extract a Lightroom Preset.  The intention of this tool is to help you learn about post processing and demystify Lightroom sliders.  It doesn’t work with every photo on Flickr (only about 15%), as not everyone is using the latest version of Lightroom.  However, when you find a photo that does it does work with, it’s a lot of fun!  Use the presets as a starting point for coming up with your own style.  As always, do the right thing and give credit where credit is due!

Try it out!  All of the photos in our group should work fine with the Preset Extractor.  Share your thoughts!!