Tommy’s Blog

Discovering and learning

Archive for August, 2008

Fixing problems with keywords in imported Lightroom 2 catalog

29th August 2008

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.

Posted in Database, Digital Darkroom | No Comments »

A new hope

28th August 2008

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.

Posted in Life | 1 Comment »

bit.ly accelerator for Internet Explorer 8

28th August 2008

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

Posted in Software, Technology | No Comments »

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

26th August 2008

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.

Posted in Equipment, Photography | No Comments »

Deliberate photography

23rd August 2008

I never have success when I set out to make pictures of something specific. This afternoon, Dawn planted a couple of bushes in some planters that we got on sale from Smith & Hawken. They are next to our front door along with a couple of wrought-iron trellises. I thought I would take a few pictures of the entryway to show how it looks now.

I am disappointed in the pictures. But then I am always disappointed when I try to make pictures of something specific. The only photos I make that I am happy with are those that I make when I have nothing in mind and no expectations. The first blip of intention or forethought, even if it’s as simple as thinking about where the sun will be or which direction the shadows might be falling, and I might as well not even bother getting out the camera.

This isn’t the case for all photographers—maybe not even the case for many—since landscape photographers talk all the time about scouting out locations when the sun is high in the sky and coming back during the golden hours (around dusk or dawn).

But it’s the case for me. And I’m not even sure I want to try to fix it.

Posted in Photography | No Comments »

Ugh.

23rd August 2008

It’s Joe Biden.

I knew there was no way any human could match the expectations we pinned on him in the spring but this goes beyond simply adjusting to reality. His campaign against Hillary was based on his superior judgment. Too bad he couldn’t find it for this decision.

Posted in Politics | 4 Comments »

Putting formatted text on the clipboard

22nd August 2008

Working with the Windows clipboard in managed code is both easy and hard. It’s easy because all you need to do in order to put a bit of text on the clipboard is this:

Clipboard.SetText("Put this on the clipboard");

It’s hard because you can’t just do something like this in order to get formatted text:

Clipboard.SetHtml('<a href="http://twwilliams.com/>A link</a>"');

The Windows clipboard requires content to be in special formats if you have anything other than text and the System.Windows.Forms.Clipboard class doesn’t provide any convenience methods for handling HTML. But writing your own isn’t too hard.

Mike Stall provides the solution.

In essence, you need to wrap your HTML fragment in a specially-formatted header and then put that on the clipboard.

One thing Mike doesn’t address in his sample is how to set the plain-text version of an HTML fragment so that you can still paste to places like Notepad that don’t support formatted output.

If you only set the System.Windows.Forms.DataFormats.Html part of the clipboard, when you go to Notepad and paste, you will get nothing. So you also need to set the DataFormats.Text part. But it gets a little bit more complicated because you can’t just do this:

Clipboard.SetText(htmlString, TextDataFormat.Html);
Clipboard.SetText(plainTextString, TextDataFormat.Text);

If you do this, you’re setting two values to the clipboard in succession and you will only have the last one (in this case, the plain text) on the clipboard. To set both formats, you need to use a System.Windows.Forms.DataObject:

DataObject dataObj = new DataObject();
dataObj.SetData(DataFormats.Text, plainTextString);
dataObj.SetData(DataFormats.Html,
                HtmlFragment.GetClipboardFormatted(htmlString));
Clipboard.SetDataObject(dataObj);

In this example, the HtmlFragment.GetClipboardFormatted(htmlString) is a method I adapted from Mike Stall’s example that returns the formatted string rather than putting it directly on the clipboard as in his example.

The last thing to remember about working with the clipboard: your program must run in single-threaded apartment mode so set the [STAThread] attribute.

Posted in .Net, Programming | No Comments »

How to change your screen resolution using C#

21st August 2008

My laptop gets confused when it goes in or comes out of the docking station and always picks the wrong resolution for the monitor. Part of this might be due to a difference in aspect ratios: the laptop screen is a widescreen model (width:height is 4:3) while the monitor connected to the docking station is 5:4.

I have gotten pretty good at Win-R, desk.cpl<enter>, Alt-R, <right> (or <right><right><right> as the case may be), <enter>, <left><enter> but I would still rather do something quicker.

So this morning I decided to write a bit of C# to handle it. I didn’t know of anything that ships in the .NET Framework to handle this directly so I went off to pinvoke.net and found what I was looking for.

The code example is formatted strangely but they link to a sample on CodeProject that presents it a bit more clearly. It is a bit strange that the class he created changes the resolution in its constructor rather than through a method. It is just a sample, after all.

Posted in .Net, Programming | No Comments »

Nuun

21st August 2008

http://www.nuun.com/

I have been looking for a good electrolyte-replacement drink for long bike rides that doesn’t have lots of sugar. I thought I would be reduced to adding salt tablets to water and trying to guess at the right balance but Nuun seems like an excellent possibility. According to the store locator, I can get it at REI so I’ll stop by the next time I am in Redmond Town Center.

Posted in Cycling, Nutrition | 2 Comments »