When is a PDF file not a PDF?

I decided to put the Aperture 3 manuals on my iPad. Navigated to the folder in Finder and dragged the files Aperture 3 Keyboard Shortcuts, Aperture_3_User_Manual.pdf, Aperture_Frequently_Asked_Questions.pdf, and Exploring Aperture 3 to iTunes. When I looked into the Books section of iTunes, only 3 out of the 4 were listed – Exploring Aperture 3 was missing. Tried it again to no avail. Double-clicked the file and it opened fine in Preview. And then I looked carefully...

The file certainly has the PDF icon but it says “Kind Application” and did not show the Quick Look preview of a normal PDF file.


Lightbulbs go off. This is an application bundle. So I right clicked on it and selected “Show Package Contents” and was rewarded with a tree structure starting with Contents. Drilling down I got to Resources which contained a number of .lproj folders with the name of a different language. Mac OS X developers will recognise these as internationalised resources associated with an application. So I went into the English.lproj folder and was rewarded with the real Exploring Aperture 3.pdf file. I made a copy to my Aperture documents folder and then dragged this one into iTunes and voilà – it was added to Books! So if you ever have a problem with a PDF file which doesn’t act like one – such as being unable to drag it over to iTunes, take a look - it might well be an application suitably disguised as a PDF!

Dock Fun in OS X

I found this out in Snow Leopard – if you left-click and hold down the mouse button on a Dock icon for an application, then the screen fades and shows all that app’s windows. Even the hidden ones! It’s like Exposè, but only focussing on that app. There’s a thin line near the lower third of the screen below which are displayed the hidden windows. Very nice!

RapidWeaver Local Exports

RapidWeaver has an “Export Site...” menu item which lets you export your entire site to a local directory. That got me thinking – what if I could use the Mac OS X web server (which just happens to be Apache) to preview the site and test out tweaks to the theme CSS files? Turning on the web server is really easy:
  1. Go to System Preferences
  2. Select Sharing
  3. Click on the Web Sharing checkbox
That’s all there is to it. The contents of the Site folder in your user folder are used as the root of the website. To access your local web site, simply open Safari and type in http://localhost/~your_user_name - and voilà the default web page (index.html in Sites) comes up. In fact anyone on your local home network can access your website using Bonjour in Safari. What could be simpler!

The RapidWeaver theme I’m using for Free Range Coder is Unity 2.0 from NimbleHost. It’s a really nice simple theme which automagically adapts itself for the iPhone / iPod sized devices. It also uses PHP and the default configuration file for Apache in Snow Leopard does not have PHP enabled. I found this site which walks you through the configuration file changes for Apache and setting up the PHP initialisation file. In a nutshell:

To enable PHP in Apache - uncommenting the line below in /etc/apache2/httpd.conf:

LoadModule php5_module libexec/apache2/libphp5.so

Copying the default php.ini file from php.ini.default file in /etc:

cd /etc
sudo cp php.ini.default php.ini

The article goes on to show how to fix a warning in phpinfo() by setting the timezone in php.ini.

Back to RapidWeaver... So I dilligently exported the Free Range Coder website into frc in Sites within my Home directory. Launched Safari and typed in http://localhost/~kirschen/frc in Safari’s location bar and the page came up. But... It wasn’t what I had expected – the Unity theme style had not been applied.

And then I remembered what I had heard at the end of the Nosillacast Episode 301 - I’ll just check the Console Logs! I fired up Console (which we all know lives in the Utilities folder under Applications) and switched to All Logs. I typed in “apache” in the search bar in the upper right. And I saw bajillions (and that’s a technical term) of errors, all similar, one of which read:

[Sat Mar 05 12:43:41 2011] [error] [client ::1] (13)Permission denied: file permissions deny server access: /Users/kirschen/Sites/rw_common/themes/unity_v2.0/scripts/extracontent.js, referer: http://localhost/~kirschen/index.php

Aha! The plot thickens! This told me that some files were not readable by the Apache server, and where the files resided. Yes - the Unity theme. I whipped up a Terminal window and cd’ed over to /Users/kirschen/Sites/rw_common/themes/unity_v2.0 and listed the files therein using the ls -al command. The errant files had the same Unix permissions, an example – the one referenced in the Console Log – was:

-rw------- 1 kirschen staff 217 Mar 5 2009 extracontent.js

The rw indicated that the user (myself) had read and write permissions on the file, the dashes showed that members of my group (staff) and other users had no access permissions at all. So how does one fix permissions like this? No, you cannot use the Disk Utility “Repair Permissions” as Mac OS X knows nothing about what the correct permissions for these files should be. We’ll have to make the permissions changes ourselves from the Terminal. I could change the permissions in the frc directory but the next time an export was made from RapidWeaver, the Unity theme files would be overwritten and I’d be back changing permissions again. No, I had to make the change in the RapidWeaver theme directory. So, here are the steps from the Terminal:

cd “~/Library/Application Support/RapidWeaver” – This brings us to the RapidWeaver application support directory in which the Unity theme is installed

chmod -R go+r Unity-v2.0.rwtheme – The Unity theme shows up as a file in the Finder but it’s actually a file bundle. The chmod command will change the permissions so that the group (g) and others (o) get read permission (+r) and the -R option tells chmod to recursively go down the directory structure within the Unity-v2.0.rwtheme directory.

Re-exported the Free Range Coder site into frc – and it works as advertised! So now I can tweak the CSS files to my hearts content before committing the changes to the theme directly.

Review of MailTags

Here’s the review of MailTags from indev software which I did for Allison Sheridan at the Nosillacast Podcast hosted at podfeet.com. This is a follow up to the review of their Mac OS X Mail application plug-in Mail Act-On. Mail Act-On lets you go through your e-mails and process them quickly - filing, copying, tagging. Did I say tagging? Well, here’s where their plug-in MailTags comes into the picture.

MailTags is a Mac OS X Mail application plug-in much like Mail Act-On. It’s from indev software at indev.ca. What MailTags does is it lets you add tags to your mail messages, and much much more.

So - as always, what’s the problem to be solved? more...