Spotlight Sort Options

While Spotlight in Mac OS X 10.5 is greatly improved, there is one area in which it has regressed to an unusable state. Sort options in Leopard's Spotlight are limited to only three fields: Name, Kind and Last Opened. Uh... This is bad, guys...

Leopard's Spotlight Sort Options: Last Opened? Lame!

For most quickie finds I'll usually turn to the Spotlight menubar item. And this usually gets the job done. But every now and then I need to create a more complex search, and for that I'll typically turn to the "command-f" Finder method. Again, there are many useful advantages in Leopard over Tiger when it comes to this sort of search, most notably the nested search properties. These allow Spotlight in Leopard to create searches of Byzantine complexity. Astoundingly, the results will only be sortable by the aforementioned criteria. Need to look at your "Date Created" search by "Date Created?" Too bad. Guess you're shit out of luck.

Smart folders never looked so dumb.

This has been posted about The Internets for some time now, mentioned recently in this fine MacOSXHints post, and now listed as one of that site's author's most glaring problems in Leopard. I must admit, I haven't needed this functionality until recently — very late in Leopard's release — which is why I'm only noticing it now. But boy, when you do need it, it's shocking to discover this constraint in an otherwise greatly improved tool.

It kills me when a company takes one step forward and another back like this. I really hope Apple fixes this shortcoming sooner rather than later.

Leopard umask

This is one of those I-keep-forgetting-how-to-do-this posts, so I'm writing it down. It's certainly been posted elsewhere, but I'm tired of going looking every time I need it. So here it is. In Tiger a simple defaults command could be used to modify a user's umask (a setting that controls the default permissions for newly created files and folders). Leopard, however, changes the way this is done. Leopard instead uses a launchd configuration file. To create a custom umask for all users of a system (i.e. all user-level processes):

  1. Create a file called launchd-user.conf.
  2. Place the file in /etc/
  3. Enter the property, then the umask setting in the file, like so: umask 002
  4. Restart the machine.

The restart may not be necessary, but if I recall it was the only way I could get it to work. If you don't want to reboot, you'll at least need to restart launchd and any application or process you want to use the new setting. Rebooting, though, is a nice catch-all.

Some additional info: if you want virtually all applications (i.e. system-level processes) to use a custom umask, you can leave the "user" off the file name. Using /etc/launchd.conf will have said affect, but it is not recommended by Apple (or me for that matter).

Setting a custom umask in general isn't something I recommend either, but it's damn handy in certain file sharing environments in which multiple users need access to the same stuff, but where ACLs — the preferred method for setting up complex file sharing permission sets — aren't an option. Creating a common group for the users and setting up their umask to create files and folders that are group-writable is an acceptable workaround in many scenarios. Which, by the way, is what the above setting will do. A umask of 002 will create files with permissions of 775 (the opposite of 002 — it's a mask, silly).

Okay then. Happy umasking!

Leopard Bugaboos

As big a fan as I am of Leopard, there's always room for improvement. And, though I've covered my major gripes already, I've recently discovered some additional buggy behavior in Leopard.

Application Switching

For some time now, Mac OS X has had the ability to switch between applications using the handy command-tab key combo. This works in Leopard as it always has, but I continually encounter a UI problem when doing this. Let me describe an example: I open an application, and, as it opens, I command-tab to another one. When the first application finishes opening, its windows are now on top of the active application's windows. That is, it's possible, through command-tab application switching, to get into a state in which the active application's windows are completely obscured by a recently opened application's windows. The easy solution is to quickly command-tab between the two apps. But it's pretty annoying when this happens: suddenly I find myself unable to work in an application I've just switched to. Is it a bug? I'd say yes.

UPDATE: I've just discovered that this happens not just when a new application has been opened, but also when switching to an app that has a recently activated process. For instance, in Firefox, I open a new window and then immediately switch to Mail, then back to Firefox again (hit command-tab twice rapidly). While Firefox attempts to open the window, it will appear to remain in the background, though the menubar will now clearly show that Firefox is, indeed, the active application. It seem like, during the time when Firefox is opening that new window (which on my aging Powerbook, takes a second), the OS can bring the app to the foreground, but is somehow unable to display the app's windows, and thus simply displays the windows of whatever app was up last. Ugliness!

Install and Keep Package

In Software Update there exists an option to "Install and Keep Package." When choosing this option, Software Update will download any selected updates, install them on your system and then save them to your hard drive for use later. I've often needed to do multiple installs of an update, and it's much faster to do so from disk, so I've used this as my preferred method of update. But this excellent feature just doesn't work for me in Leopard. In past versions of Mac OS X, these downloaded updates were stored in /Library/Packages. That folder is now gone. When I first installed Leopard, I noticed that "Install and Keep Package" downloaded updates to a different folder in /Library (perhaps /Library/Updates or /Library/Downloads, I don't recall). Then, for a time, the option downloaded updates to my ~/Downloads folder. But now choosing the option seemingly does nothing. The only way I can duplicate this functionality now is to use the "Download Only" option, and then, once the downloads are complete, choose the "Install" option. Using "Install and Keep Package" installs the software, but downloads nothing. Not a deal killer, but still frustrating.

Now I should mention that I keep my home folder on its own, separate partition. It's very possible that this is what's confusing Software Update, particularly considering the fact that Software Update now wants to download stuff to my home account (where it used to go somewhere globally accessible, i.e. in /Library). Still, given that this always worked flawlessly in Tiger, and that the "Download Only" option continues to work properly, I'd have to classify this as a bug.

Or at least a bugaboo.

Final Cut Pro and Gigantic Frames

Recently, one of our producers needed to cut a 20+ minute planetarium show down to a 3 minute trailer. So he needed a way to edit an image sequence comprised of extremely large, non-standard frames. We decided to use Final Cut Pro for the editing software, but Final Cut is decidedly not built for working far beyond the confines of its presets. Nevertheless, it is a flexible enough tool to get the job done, with a little effort and a fast computer. Here's a blow-by-blow of what we did.

  1. Make Reference Movies of Frames The first step in the process was to make reference movies of the near-30,000 or so frames. Nothing about this entire process was straightforward, and this first step was certainly no exception. Attempting to import the entire range of frames invariably crashed Quicktime. But we were able to work with a subset of frames. So we ended up breaking the frames into folders of 5000. Of course, trying to move that many large files in the Finder would overwhelm the GUI, causing it to hang for vast stretches of time, so we moved the files via the command-line. This went exceedingly quickly. The Finder still really needs some help handling large groups of files apparently. But in the end, thanks to Mac OS X's UNIX core, we had six folders full of images, and each folder was opened as an image sequence in Quicktime, then saved as a reference movie.

    Quicktime: Create a Reference Movie

  2. Make DV-NTSC Movies from Reference Movies Since we were going to be editing this material, we wanted to get it into a good, edit-friendly CODEC. We chose DV-NTSC since it looks pretty good and is really easy to work with in Final Cut. Making our DV-NTSC movies actually went pretty well. Quicktime has done better at keeping current with the latest hardware capabilities than has the Finder. And, once we'd broken our image sequence down a bit, Quicktime made relatively short work of exporting them to DV-NTSC. And, blessedly, Quicktime was able to load and export multiple movies at once and take full advantage of our eight cores to process them.

    Quicktime: DV Movie Export

  3. Import and Edit at DV-NTSC Quality Well, okay... This was the easy part... In fact, making this easy was the whole point of all those other steps.
  4. Create Custom Sequence Settings DV-NTSC was nowhere near the resolution we needed for our final product. We just bumped down to it in order to make editing more feasible. Eventually we wanted to output this puppy back out to gigantic frames once the editing was done, so we needed a custom sequence preset that matched the properties of said frames. Later we'd use this preset to create our final, high-res output.

    Final Cut Pro: Custom Sequence

  5. Create Offline Project with Custom Settings Final Cut has a nifty feature called Media Manager, which allows you to consolidate your media and get rid of unused clips in order to reclaim disk space. It also can be used to conform from an offline — or low quality — version of your project to an online — or high quality version. Which is what we did. In Final Cut, we went to the Media Manager (under the "File" menu) and chose "Create offline" in the pulldown in the Media section where it says "media referenced by duplicated items."

    Final Cut Pro: Creating an Offline Project

  6. Reconnect Media to High-Res Source Once we had our offline project, we needed to re-associate our DV-NTSC clips with the original, full-quality media, i.e. our reference movies. This was fairly easy to do: simply right-click the media and choose "Make Offline..." from the menu. Then right-click the movies again and choose "Reconnect Media..."

    Final Cut Pro: Reconnect Media

    When prompted for the clips, we chose "Locate," and then selected our high-quality material. Be sure to uncheck "Matched Name and Reel Only" when selecting the high-res clip.

  7. Export Back Out to Frames with Compressor Once the movies were reconnected to the original source material, we needed to output back out to the original source type, which in our case was a TIFF sequence. There are a few ways to do this, but we had the best luck (i.e., the fewest crashes and slowdowns) sending the job right from Final Cut to — believe it or not — Compressor. This is certainly the first time in my storied history that I can say Compressor was the right tool for the job, but indeed it was. It knocked it out of the park. We, of course, had to set up a preset in Compressor that exported TIFF frames and apply that to our job. But once that was done, Compressor did it's thing and did it well.

In the end, what we got was a virtually lossless edit of our show. Because we used the original TIFF frames to render out our final trailer cut, and because Final Cut and Compressor shouldn't need to recompress those frames unless they've been altered somehow (which they only were in spots where effects or transitions occurred), our final output looks just as good as the original, even though we edited in the edit-friendly DV-NTSC CODEC. Which is exactly what we were going for.

There were a lot of hiccups along the way. One thing we noticed is that Final Cut does not take advantage of multiple processors, though, blessedly, Quicktime and Compressor now both do. Also, the Finder is still pretty damned abominable when it comes to dealing with a very large number of large files, which is a real shame since it's main job is file management. Quicktime, too, had some performnace issues with the large number of files. These things certainly slowed us down a bit. But, with some ingenuity and tenacity we were able to accomplish a pretty difficult task in a relatively short time. It was pretty cool, and now, if something like this ever comes up again, I'll have a process for it.

I want to say, too, that this is just the sort of challenge SysAdmins look for. Or at least SysAdmins like me. It's projects like this that make me happy I am where I am in my job and my career.

Note To Self: Restart autofs

I just looked all over Hell's half acre for this (okay, I performed a perfunctory Google search) and I couldn't find a definitive answer. Now I know and I just wanted to make a quick note of it for posterity. In the olden days (i.e., a few months ago), in order to get any mounted to shares to re-mount, we would restart automount thusly:

sudo killall -HUP automount

This no longer works. Now we must restart autofs. To restart autofs on Mac, do this:

sudo killall -HUP autofsd

To be additionally thorough, though this should not be necessary, you could also restart automount, which now looks slightly different (note the "d", which is new):

sudo killall -HUP automountd

None of this is surprising, but then again, if you're not sure you're doing it right (like you run the command and nothing happens and you want to be sure you're doing the right thing) it helps to have it written down somewhere.

Enjoy!