I could never do this. Not even once.

Mike Johnston has a four-minute video about Magnum street photographer Bruce Gilden on his site. I must have seen this before because I remember much of it but somehow I didn’t pay enough attention to what he is doing. But thanks to Mike’s little postscript, I watched amazed. Like Mike, there is no way I could ever do this. That kind of confrontation just isn’t in me.

Perhaps that’s why I don’t understand photos of the street. When I am in a city, it’s the buildings and the infrastructure that get my attention–roads, sidewalks, utility poles, wires, lights, ventilation, sewers, fences, rails, curbs, stairs–not the people.

Besides, buildings don’t care if you take their picture.

Custom commands in PowerShell ISE

In PowerShell V2 CTP3 (and possibly earlier CTPs but I didn’t try it), you can add a Custom menu to the PowerShell ISE that will run your own commands. Thanks to the object model that PowerShell ISE exposes, those commands can even modify the text files open in the editor.

One of the first things I missed when editing scripts in the PowerShell ISE is the ability to comment (or uncomment) a block of lines at once. It was surprisingly easy to write a function to do enough to make me happy. Yes, I know it misses a lot of edge cases but those aren’t worth the effort to me to handle. At least not yet….

There are surprisingly few things that are specific to the ISE object model that you need. The first is a command for the menu item to run. Here it is as the function named psISE_ToggleCommentCommand. I arbitrarily chose the "psISE_" prefix for all the functions I write that are specific to the ISE itself. This is one of those cases where I wish I could partition things off into namespaces but I can live with the function naming convention. And I might find that it’s not even necessary for the number of things I will be writing.

function psISE_ToggleCommentCommand {
    $curFile = $psISE.CurrentOpenedFile
    $selection = $curFile.Editor.SelectedText
    if ($selection.length -gt 0) {
        $curFile.Editor.InsertText((ToggleComment $selection))
    }
}

The first thing to notice is the $psISE variable. This is always available in the PowerShell ISE and is of type System.Management.Automation.Host.PSGHost. Everything that you would do with it is based on a set of five read-only properties: CurrentOpenedFile, CurrentOpenedRunSpace, CustomMenu, OpenedRunspaces, and Options.

For this script, we want to apply it to the CurrentOpenedFile (as opposed to any of the other opened files that you find through the $psISE.CurrentOpenedRunSpace.OpenedFiles collection). Any opened file has an Editor property that returns a Microsoft.Windows.PowerShell.Gui.Internal.ScriptEditor object with a set of interesting methods and properties. In this function, I make use of a property (SelectedText) and a method (InsertText).

The interesting stuff happens in the ToggleComment function, although it’s not interesting from the perspective of the PowerShell ISE because it just does basic text replacement that works in the command-line PowerShell as well. Here it is anyway, just so you have a sense of what it does:

function psISE_ToggleCommentText {
<#
.Synopsis
  Toggles the commented state of text passed in
.Parameter text
  The text in which to toggle comments.
#>
    param(
    [Parameter(Position=0, Mandatory=$true,
               ValueFromPipeline=$true)]
    [string]$text
         )
    Process {
        $returnedText = ""
        foreach ( $line in $text -split `
                      [System.Environment]::NewLine ) {
            if ( $line.length -gt 0) {
                if ( $line -match "^#" ) {
                    $line = $line -replace "^#", ""
                } else {
                    $line = $line -replace "^", "#"
                }
                $returnedText += "{0}{1}" -f $line, `
                    [System.Environment]::NewLine
            } #end line length check
        } #end foreach
        $returnedText
    } #end Process
}

I put both of these into my $profile (this is different than the $profile for the "main" PowerShell host. See my post about the profiles for more details).

Now to set up the menu and that goes through the CustomMenu property of $psISE.

$psISE.CustomMenu.Submenus.Clear()
$psIse.CustomMenu.Submenus.Add("_Toggle Comment", `
                               {psISE_ToggleCommentCommand}, `
                               "Ctrl+E")

CustomMenuPowerShellISE

Notice that I start out by calling the Clear method to empty out the Custom menu: as far as I can tell, there is no way to modify a menu item once it has been set up–so I clear it and start fresh, just in case.

Then there’s the Add method. The first parameter is the menu item name. Notice the underscore before the T as a keyboard accelerator. You might be used to using the ampersand ("&") in some languages. The second parameter is the script block to run. I could have put the entirety of the psISE_ToggleCommentCommand function into this script block but it makes a lot more sense to separate it. The final parameter is the keyboard shortcut.

I experimented with some different keyboard shortcuts and the object model will even let you set it to a Windows key combo (using "Win" as the name) but I couldn’t get it to respond to any of those (I even tried things like Ctrl+Win+E). If I’m missing something there, let me know.

The help file for the object model is complete but it’s sparse: it feels like there’s more work the writers have planned for this area.

One other thing: the menu’s name is "Custom" and it looks like–in CTP3 at least–that there’s nothing you can do about that.

For those few people (still) reading my blog: are these articles about PowerShell interesting?

All those PowerShell profiles

I have been playing with PowerShell a lot since V2 CTP3 was posted and will write about setting up custom menus in the PowerShell Integrated Scripting Environment (PowerShell ISE). Before I get to that, though, I wanted to say something about the profiles.

In particular: $profile and what you get back from its default ToString() method.

On my computer, $profile gives me:

"C:\Users\Tommy\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1"

I had always treated that as the base profile. But it’s not. Although the $profile variable is a string, there are four NoteProperties attached (use $profile | get-member to see them): AllUsersAllHosts, AllUsersCurrentHost, CurrentUserAllHosts, and CurrentUserCurrentHost. Turns out that the default value of $profile is CurrentUserCurrentHost.

AllUsersAllHosts $pshome\profile.ps1
AllUsersCurrentHost $pshome\Microsoft.PowerShell_profile.ps1
CurrentUserAllHosts [Environment]::GetFolderPath("MyDocuments")\WindowsPowerShell\profile.ps1
CurrentUserCurrentHost [Environment]::GetFolderPath("MyDocuments")\WindowsPowerShell\Microsoft.PowerShell_profile.ps1

Up to this point, I had been thinking of $profile as though it were CurrentUserAllHosts and didn’t understand why my aliases and functions didn’t work in PowerShell ISE.

Once I moved things to profile.ps1 from Microsoft.PowerShell_profile.ps1, I was happier. And, of course, all those customizations I want to make to PowerShell ISE go in Microsoft.PowerShellISE_profile.ps1.

I’m still not sure I agree that the default value of $profile should be CurrentUserCurrentHost but I haven’t heard many complaints about this so maybe I’m wrong. But I have always used ". $profile" to reload my profile and that doesn’t work. Now I need the more cumbersome ". $profile.CurrentUserAllHosts" followed by ". $profile"–and this assumes I don’t have anything in the AllUsers profiles.

Which of the four NoteProperties do you think $profile should return? Leave a comment and let me know.

Made use of 5d Mark II’s face-detect mode

Believe it or not, I made use of the 5D Mark II’s face-detection autofocus mode last night. We invited our next-door neighbor over for dinner and after I had been taking some pictures at the candle-lit table, she decided that someone should take a picture of me. I knew she wouldn’t be able to get the autofocus right (especially since she didn’t wear her glasses) so I turned on Live View, enabled face-detect autofocus, and let her take the picture.

It worked, although the picture was still a bit blurry due to slow shutter speeds even at ISO 3200 (I should have bumped it up to 6400).

But, still, it served a purpose. I thought I would never use it.

More snow

Lights in the snow

The snow fell all night. It was light snow, and it was dry and powdery with wind. I guess we got an additional two or three inches overnight and it has been snowing most of the afternoon. This time, though, it’s the more normal big dendritic snow that I am used to. It seems that’s what you get when the temperatures are right around freezing while the snow last night is typical of much colder areas. At least that’s what Cliff Mass says.

I am about to give up on SmugMug. This is the second time in the last three days that I have run into downtime. The SmugMug Status Updates blog doesn’t say anything about it but they’re still set to a read-only mode that doesn’t let people log in.

So I put all the snow pictures that I had been loading to SmugMug in a set on Flickr. The presentation is so much nicer on SmugMug but Flickr is far more reliable. And reliability wins over presentation every time.

But I like getting the 600-pixel pictures (I can get either 500-pixel or 1024-pixel files from Flickr) so I’m also experimenting with hosting the picture here on my blog with a link to the hosting site.

If any of you who read the blog have any preferences about SmugMug vs. Flickr, I would love to hear from you.

Why I like sidecar files

I don’t like one of the big advantages of DNG–carrying the XMP metadata in the DNG file rather than as a "sidecar" .xmp file that sits alongside the CR2 (or NEF or TIFF or JPEG or whatever format you work with).

I don’t deny that it is more robust: no problems when copying files from one place to the other and no need to keep filenames in sync between the image file and the metadata sidecar file.

Except it’s frustrating when backing up files because any change to the metadata means the whole big DNG file changes. And on my 5D MkII, those files are between 20 and 28 megabytes. It takes a lot more time every time I run my backup scripts to copy a 25MB file than it does to just copy updated XMP files that are a few kilobytes.

Those of you used to Unix machines will tell me that I just need a tool with a better file copying protocol–I should use something like rsync that copies only the parts of the file that differ rather than the whole file. And there is something to that.

But robocopy now ships with the operating system in Vista and beyond. And SyncToy is a lot easier to set up than getting an installation of rsync running for those who don’t like the command line. I used to love rsync on Unix machines but now I know robocopy like the back of my hand.

It’s just a minor annoyance and one I won’t have to worry about for much longer now that Lightroom supports the 5D MkII natively and I am back to CR2 and XMP files.

Trip to Crossroads

On our way back homeSince we were not able to get the car out the neighborhood, we walked to Crossroads Mall today to pick up a few groceries. Dawn said that I should show her these pictures in July and she will think they’re pretty. Right now, they’re just depressing.

Woke up to a beautiful snowy morning

Snowy sunrise

We woke up to a beautiful morning with some low fog over the lake and the sun shining through it as it rose over the mountains. Don’t forget that you can click on the photo above to see a larger size or other photos in the gallery. Late in the afternoon we decided to try to get out of the neighborhood. The Prius wouldn’t even begin to start up the hill outside our house–the traction control kicked in instantly. So I turned around and went the other way, figuring that I would have enough momentum to get up the hill on the other side of the neighborhood.

We got part way up and then that was it. I was able to control the slide and rotate the car 180 degrees to head back the way we came.

Then we couldn’t even get back up our driveway. Sheesh. Luckily for us, I had shoveled a walking path on the driveway earlier in the day so I got one of the wheels lined up on that and made it into the garage.

I have never driven a car that is so terrible in the snow. It’s clear that the tires that are designed for good gas mileage are terrible in the winter. I guess we need to have chains.

And after the amount of snow and ice we have had the past couple of years, I can justify some studded tires for my bike, too.

The snow finally came

Maya is deep in the snow 

The snow that we thought would come yesterday made it here today. We ended up with six-and-a-half inches and the temperature was down to 24 degrees Fahrenheit by the time the snow stopped. The forecast doesn’t call for us to get above freezing for days.

Strange weather indeed for the normally mild Puget Sound. Rest of the pictures available at SmugMug (and, as always, you can click on the picture above to get to them).

Skies threatening snow

Skies threaten snow over Lake Sammamish

The skies threatened, and so did the weathermen, but we seem to be in a snow shadow here in Bellevue so all we got were cloudy skies and a bit of snow that was still hanging around after Sunday night.

Maya wonders what Dawn is doing

Lightroom 2.2 is out. What a relief to be able to go back to my normal workflow and not have to run through the DNG Converter first.

Benefits of Live View on Canon 5D Mark II

I have always had problems taking sharp pictures of the Cascade mountains from our neighborhood. The autofocus always seem to miss just a bit and the viewfinder on my previous cameras was never big enough to let me effectively focus manually.

But Live View changes all that.

I just set my 70-200L f4 to manual focus, engaged live view, zoomed in to 10x, and twisted the manual focus ring to get it sharp. A quick press of the remote trigger and there you have it:

The wind was gusting and I discovered another benefit of Live View magnified at 10x: I could see how much the camera was shifting in the wind. I just had to wait for it to die down before pressing the shutter. Again, this is something I could not have done without Live View–and I had no idea that my tripod moved that much.

This is not a great picture, but it does show me what will be possible when the sky is on fire at sunrise.

I poo-poo’d Live View when I first heard about it but the more time I have spent using it, the more I think it might just be the biggest benefit of the latest DSLRs.

Maya’s footprints in the snow

The first snow of the winter has started to fall. Forecasts call for cold weather like we haven’t seen in years for the next several days. Should be fun.

LensAlign

Wondering how to make use of the microadjustment feature of your new Canon 5D Mark II or Nikon D700? Michael Tapes has put together the LensAlign. I have used his WhiBal for years and, based on the reviews from Michael Reichmann and the guys at Imaging Resource, it looks like a solid, accurate tool. There are videos from both Michaels on their sites showing how to set it up and use it.

Cost? US$139.95 for the LensAlign Pro that ships by 16-Dec-2008 and US$79.95 for the LensAlign Lite that will ship in January. Differences? The LensAlign Pro is assembled, has a tripod socket, and red bulls eyes for lining up the sensor plane with the target. The LensAlign Lite relies on the use of a mirror to do the alignment.

Thoughts after two weeks with the 5D Mark II

I love this camera. I don’t hear that much on the online forums and that speaks volumes to me about the state of high-end DSLRs. For several years, Canon would release new cameras that were not only leaps and bounds ahead of anything else you could buy, but were significant improvements over the models they replaced. Remember how amazing the original 5D was, coming soon after the 20D? It was like a camera taken from the future.

The 5D Mark II is a great camera. But Nikon leapt ahead of Canon in the high ISO department earlier this year with the D3 and D700. And Sony released the 24-megapixel A900 to beat Canon for the high-resolution crown.

So I think people, used to the way that Canon has set the bar for years, are disappointed that the 5D Mark II is merely as good as the competition.

And that’s just fine with me because all these cameras are capable of amazing image quality.

But I’m not going to write about the image quality–or at least not about the most-talked about aspect. Or at least not much.

Image quality
For me, this is an upgrade from the 20D. The 20D is still a good camera but it’s four years old and there are a few things that frustrated me about it: beyond ISO 800, colors wash out pretty quickly and I have discovered that I love color; the 1.6x crop factor is frustrating–I know I could just buy EF-S lenses to get wider angles but I also have primes and it’s been comfortable and satisfying to use them at the focal length for which they were intended; and the viewfinder and LCD screen on the 20D just don’t make it reasonable to focus manually.

The 5D Mark II solves all these problems and more. The two aspects of image quality that stand out the most to me are the wonderful quality of color even at absurd ISO settings and the dynamic range.

Consider this picture of Christmas lights that I took handheld at ISO 6400 the other night:

I could never get that kind of color from my 20D even at ISO 1600. A better example for me is a picture of Maya at high ISO but I doubt it would be as significant for you.

Then there’s the dynamic range: how much of a difference between the lightest and darkest parts of the picture that the camera can handle. This time of year in the Pacific Northwest, in the little slivers of time when the sun is up, the sky is usually overcast so I have learned to point the camera down and keep the sky out of the frame because, without a tripod and blending multiple exposures, I can’t take a picture that can show detail in both the sky and the foreground. And those shining white expanses of sky are just ugly.

But this isn’t a problem with the 5D Mark II. I didn’t expect such a difference but I have been able to extract enormous amounts of detail from the shadows and midtones while holding the highlights. It’s trivial with a bit of Fill Light in Lightroom to make pictures that look like terrible HDR. But it’s useful even in normal situations. Look at this picture of Dawn while we were walking Maya in the park:

There’s no way I could have kept the texture in her hat and maintained the tones throughout the rest of the picture with my 20D. I have more extreme examples like this one but it seems more artificial than art.

Physical impressions
I thought the viewfinder would be the first thing that stood out for me but it didn’t seem as big as I thought it would after the 20D. However, after spending some time with the 5D Mark II, the 20D’s viewfinder seems positively tiny.

The first thing I noticed, though, was the shutter: both the button and the sound. The 20D’s shutter button has a distinct detent when pressed halfway (for setting focus and/or exposure) and when pressed completely. The 5D Mark II’s shutter doesn’t have that detent and it feels spongy. But I haven’t had a bit of trouble with using it and when I try the 20D now it feels flimsy.

The LCD screen is magnificent with its 640×480 resolution. I finally have a camera with an RGB histogram (and the camera can show both the RGB and the luminance histogram simultaneously). The resolution is easily high enough to either judge focus from a shot in playback mode or, in Live View mode, to focus manually. The 5x and 10x zoom help even more here. In some experiments (not online yet) with the Canon 100mm f2.8 macro lens and the building in our Christmas village, the control I have over focus placement–and the quality of that focus even in the dim light cast by the decorative miniature buildings–is amazing.

By the scale, the 5D Mark II is heavier than my 20D but the difference is more than offset by the choice of lens. I find the 5D Mark II no harder to carry around than the 20D and it feels like a more rugged camera. The grip is a bit deeper, with a molded bit to go between the index and middle finger and it fits nicely in my hands. My hands aren’t quite big enough to palm a basketball one-handed but I can easily reach a tenth on the piano. So maybe that helps with the size of the camera.

I haven’t said anything yet about the movie mode. And it’s because I’m not sure what to say about it yet. I have tried it. And I can sense the power it offers. But video on the 5D Mark II is not like using a consumer camcorder. But then the results are not like those from a consumer camcorder either. So I have to experiment a lot more before I have anything useful to say about it.

Effects on my photography
The biggest thing this camera has done, though, is open my eyes to pictures I would never have considered before and it’s a change I just wasn’t expecting, no matter how much I dreamed about this camera. It doesn’t matter that it’s pitch dark outside. It’s such a novelty that I haven’t made anything worthwhile yet but it’s a wonderful experience especially, again, at this time of year. It’s dark when I wake up and dark when before I leave work. So before there were very few times when I could take pictures outside. But now I am able to do things like this, or this, or this, or this.

My apologies that this was so rambling but I have been putting off writing it and enough people are asking what I think that I figured it is better to put something out than to do nothing at all.

More later.

Canon starting to tease about the 5D replacement

This teaser from Canon was on DP Review’s news page today. Looks like those rumors about the announcement coming on the 18th of this month are gaining credibility.

If you look close, though, there’s something strange about the right side of the body of the camera, almost like it has some kind of portrait grip. But maybe that’s just a deliberate deception since it is way off in the shadows.

See the trailer at Canon’s site:

Destined EVOLUTION

Update: There are slightly different looks at the camera on the various Canon sites around the world. The Japanese site has the best silhouette and mariuss on the DP Review Forums compared the silhouette with the existing 5D to show that some of the buttons on top have moved.

Fixing problems with keywords in imported Lightroom 2 catalog

After I imported my Lightroom 1 catalog into Lightroom 2, none of the Keyword Tag Options were set.

Section of Edit Keyword dialog showing the three checkmarks are not checked

I started going through the keywords one-by-one and checking the settings (I only had a handful of keywords related to workflow that I didn’t export) but I quickly realized that I would never get through this with over 600 keywords in this one catalog alone.

But I remembered that Lightroom’s database is not in an Adobe proprietary format but it is a Sqlite database. So I downloaded the command-line utility, made a copy of my database, and fixed it up.

If you just want the one-line command I used, here it is:

update AgLibraryKeyword set
includeOnExport=1,includeParents=1,includeSynonyms=1;

I then fixed the handful of workflow keywords that I didn’t want to include on export (and I am abandoning the workflow keywords for Collections and Smart Collections anyway).

If you want a bit more detailed account, here you go. I made a copy of the Lightroom 2 catalog file and then, from the command-line, ran sqlite3 lightroom.lrcat (I named the copy lightroom.lrcat).

Once inside the sqlite3 interface, I ran a series of commands to figure out what tables existed and what columns to change. I started with the .tables command. This listed two columns of tables and I saw one that looked like what I wanted: AgLibraryKeyword. Next, I looked at the schema of this table with .schema AgLibraryKeyword. There I saw what looked like the three checkboxes:

includeOnExport INTEGER NOT NULL DEFAULT 1,
includeParents INTEGER NOT NULL DEFAULT 1,
includeSynonyms INTEGER NOT NULL DEFAULT 1

Just to be sure, I tried a couple of queries to see if I got back the keywords I had fixed and those that I hadn’t:

select name from AgLibraryKeyword where includeOnExport=1;

and

select name from AgLibraryKeyword where includeOnExport=0;

The results looked right to me. So I issued my update command:

update AgLibraryKeyword set
includeOnExport=1,includeParents=1,includeSynonyms=1;

then exited the sqlite3 tool with .quit and then checked this copy out in Lightroom. Everything looked good so I copied it back in place and have been using it since.

A new hope

Barack Obama inspires me to be a better man. He reminds me that complaining is easy while action shows character. Cynicism is an easy way to hide. Optimism requires strength. But optimism alone is impotent: power comes from working to turn hope into reality.

I was a little boy the last time a president inspired me. I asked my parents to stop leaving the hallway light on for me at night because Jimmy Carter told us to save energy.

There is no single simple clear action that I take away from tonight’s speech. But I will check myself every time I catch a whiff of cynicism or bitterness or start to think that maybe we’re just wasting our time trying to make the system better; and not just for politics but for all areas of my life.

Yes we can.

bit.ly accelerator for Internet Explorer 8

I have been playing around with IE8 Beta 2 since it was released. What were "Activities" in Beta 1 are now "Accelerators." Tim Heuer created one that shortens URLs with TinyURL. Using his example, I was able to build one for bit.ly in less than five minutes:

Install bit.ly accelerator

Canon 50D announced—but where’s the 5D MkII?

The rumors of the 50D have been popping up for the past few days and now they’re confirmed. The improvements are pretty impressive (although it looks like Mirror Lock Up is still hidden behind the Custom Function menu):

  • 15 megapixel sensor with ISO boost up to 12800 (standard range is 100-3200 and they have the Auto ISO set to go from 100-1600).
    • Canon says they have a new sensor manufacturing process and have redesigned the photodiodes and the micro lenses. Let’s hope this is the reason for the expanded ISO and not more aggressive noise reduction.
  • A 3-inch LCD with 640×480 resolution (finally catching up with Nikon and Sony). And DPReview says that the anti-reflective coating makes this better than the one used on the Nikon and Sony cameras.
  • Better weather sealing. It’s just described as better than the 40D so I’m not sure what that means: can I feel comfortable using it in a drizzle? In a downpour?
  • DIGIC IV image processor. This is the first camera to get the new DIGIC IV (will we see a pair of these processors in the 5D replacement?). It provides the now-expected 14-bit analog-to-digital conversion and fast handling of big files. For some reason, though, they only talk about the burst speed with JPEG files and not RAW. I wonder how fast it is handling the RAW files?
  • RAW, SRAW1, and SRAW2. The 40D introduced the SRAW1 format that used pixel binning (combining pixel sites) to generate a smaller RAW file with a bit less noise. The 50D has two levels of this: SRAW1 is 7.1MP and SRAW2 is 3.8MP. The rumor sites said that ISO6400 would only be available in SRAW1 and ISO12800 only in SRAW2 but the DPReview preview doesn’t mention anything about it.
  • AF microadjustments. Now the 50D can store autofocus microadjustments for 20 different lenses. This should keep the folks who shoot rulers occupied for a while.
  • Live View. It’s hard for me to get excited about Live View since I always hated shooting off the LCD with compact digicams but I can imagine Live View being interesting when shooting macros. I guess I will have to play with it to be convinced.
  • And more. Phil Askey has the summary of new features in his preview.

There is already a hands-on test available but the text is in Swedish. They’re talking about it in a thread on the DPReview Forums.

Now, let’s hope we hear about that 5D replacement in the next week or two.