beyondmac.com|comments, answers, etc.

Home Contact About Subscribe(RSS)

The Book:

Buy Mac OS X Leopard: Beyond the Manual from Amazon, or check out the Apress website for more information.

Categories:

Bookmarks:

Powered by WordPress

Advanced Account Options | October 31, 2007

You can access some hidden advanced account options for users (using an account with administrative privileges) by unlocking the the System Preference’s Accounts pane and then “right-clicking” on the user’s name to bring up the contextual menu with only one item: “Advanced Options…”. Many of the options in the resulting “Advanced Options” panel are ones that are best left untouched, but some of these things (Group ID, Login Shell and Aliases) can be particularly useful in some circumstances.

Stupid Hint of The Day | October 31, 2007

Hold the [shift] key when opening a stack and it will open  v e r y   s l o w l y.

Actually, holding the shift and selecting “open” from an item contextual menu will cause many Finder items to open in slow motion as well.

PC Mag Leopard Review | October 31, 2007

What’s going on here? First PC World declares the a Mac Book Pro the fastest Vista laptop! Now PC Magazine claims that Leopard is “by far the best operating system ever written for the vast majority of consumers.”

What’s next? Will John “I have no plans to move to the Mac platform for my personal use” Dvorak start using a Mac for personal use? …maybe after the Apple-Sun merger.

PHP & MySQL on Leopard: mysql.sock Location | October 30, 2007

One thing I noticed setting up PHP and MySQL on Leopard, is that the default PHP build looks for the MySQL socket in /var/mysql/mysql.sock which doesn’t exist and isn’t the location that MySQL would use if it did (by default anyway). By default the MySQL socket is: /tmp/mysql.sock.

There are four ways to fix this:

  1. Create the /var/mysql directory (sudo mkdir /var/mysql) and then create a symbolic link from /tmp/mysql.sock to /var/mysql/mysql.sock (with: sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock).
  2. Edit the /etc/php.ini file (it may not exist in which case just sudo cp /etc/php.ini.default /etc/php.ini) so that the mysql.default_socket = /tmp/mysql.sock (by default line 760) and mysqli.default_socket = /tmp/mysql.sock (by default line 795).
  3. Edit /etc/my.cnf adding the following lines:
    [mysqld]
    socket=/var/mysql/mysql.sock
    [client]
    socket=/var/mysql/mysql.sock

    This will tell MySQL to create its socket where Leopard’s default PHP is looking for it. Next, you also need to create the /var/mysql directory and sudo chown mysql /var/mysql it or MySQL won’t start since it wont be able to create the socket.
  4. Recompile php for your version of MySQL (a PIA, but not a terrible idea at all).

Of these #1 is easiest, but a bit of a hack. #2 is the easiest real way. #3 isn’t to bad, but could cause issues with other MySQL clients that look for the socket in /tmp/mysql.sock. #4 is ultimately the best fix, but is clearly neither very fast nor particularly easy

Renaming Images Using EXIF Data | October 30, 2007

For years I’ve been using the excellent ExifRenamer to rename my digital photos when I imported them by setting it up as the Automatic Task in OS X’s Image Capture application. When Aperture came out I tried using its built in renaming feature, but found it to be inflexible (and while subsequent updates have improved this feature, the “Time” value still adds unnecessary, unwanted “-”’s). Rather then start a whole new naming scheme after years and years I continued to use ExifRenamer with the Image Capture application.

Note: Until recently I never really used iPhoto. Prior to Aperture I would use iView Media Pro, which has subsequently been gobbled up by Microsoft and is now known as Expression Media , to manage all my photos. So the extra step involved using Image Capture rather then importing directly into Aperture never bothered me that much.

The thing is ExifRenamer hasn’t been updated since 2002, so I’ve been looking for a way to duplicate this function without added steps in my workflow. Other then ExifRenamer, I’ve found that most GUI based utilities tend to do more then I’d like, the thing about ExifRenamer is it did one thing very easily and extremely well, everything else I’ve found suffers from feature creep (though if you want to rename you images to something other then  just EXIF timestamps, then A Better Finder Rename is definitely worth a look). Anyway after much searching, I realized that the answer was already right under my nose: ExifTool by Phil Harvey.

ExifTool is a Perl Module (Image::ExifTool) which comes complete with a command line tool (exiftool) that can do almost anything you want done with EXIF data. I had to use this once a while ago when I realized that the new (at the time) editing tools in iView Media Pro were overwriting the original EXIF dates (which nothing should ever do, no matter what the developer says) and I needed to change them back and this tools fit the bill. Turns out, that this tool is perfect for renaming files based on EXIF data too (in fact it can rename files, and move them in directories based on *any* EXIF data).

For my purposes, the exact exiftool command I want to run on each image is:
exiftool ‘-filename<CreateDate’ -d %Y%m%d_%H%M%S%%+c.%%e $x
In this command, ‘-filename<CreateDate’ actually does the renaming (passing the CreateDate to the filename). -d %Y%m%d_%H%M%S%%+c.%%e defines the format of CreateDate using strftime (see man strftime for info).  (The %%+c.%%e (which add a file counter and the proper file extension) however are part of exiftool, not strftime (which is why they get two %’s, if you just used one % then you would use strftime‘s %c and %e which is not what we want).) $x is a variable which represents the original image file.

To be able to execute this command from Image Capture, I need to wrap this command inside of an Automator Application. So I open Automator and create a new workflow. My first action is simply “Get Selected Items” which will take the Finder items passed to the workflow and pass it to the next action. My second (and last) action is “Run Shell Script.”

For the Run Shell Script action set the Shell: to /bin/bash and Pass input: “as arguments.” Then in the script area input the following script:

for x in "$@"
do
exiftool '-filename<CreateDate' -d %Y%m%d_%H%M%S%%+c.%%e $x
done

Now save your Automator workflow as an Application and use it in Image Capture or on it’s own (By dragging images on it to use).

And That’s it.

How do you run Time Machine “Manually”? | October 30, 2007

With Apple’s note running a Time Machine backup during an Aperture session could lead to “inconsistencies” and suggesting that Aperture uses run Time Machine manually. The big question I hear, is how does one run Time Machine manually?

Option #1 is to select the “Back Up Now” item from Time Machines the contextual menu from the Dock, this of course only works if you have Time Machine on your dock though, but if you are manually managing it, this isn’t a bad idea since the icons presence may remind you to use it every once in a while.

The other option is to simply toggle Time Machine on and off in the Time Machine pane of the System Preferences, when you want to do a backup. This option is not a very useful solution IMO, but it works.

A few things I’d like to see changed…

Currently there is no immediately noticeable way to Automate or Apple Script this to make it a bit easier (Time Machine has no Automator actions or even an AppleScript dictionary attached to it.) I’d really like a way to hook into Time Machine to start backups through the scripting system.

It would also be nice to allow more flexibility in scheduling when Time Machine backs stuff up when it is on. A hint at macosxhints.com shows you how to change the backup interval of Time Machine manually. I’m not sure this is something I’d recommend since I feel it’s a very bad idea to mess around in the System folder. But this does illustrate how easily this feature could be added.

« Older Entries