Tag Archive for 'OSX'

Using Mac VPN Clients with Virtual Machines

If you use Parallels or VMware Fusion and a Mac VPN client such as VPN Tracker, you can share your VPN connection between the host Mac and the guest PC by setting the network adaptor to share the host’s Internet connection via NAT.

This connection method also has other advantages, as the VMware Fusion Release Notes explain:

“VMware Fusion’s default network connection type for new virtual machines is NAT, which will prevent the spread of viruses over the network into the virtual machine, and will only expose the virtual machine to external viruses through browser security flaws when you browse the Internet.”

The idea of sharing VPN connections with Windows applications via Parallels is touted as a VPN Tracker feature and explained in detail in a how-to PDF, but it works equally well with VMware Fusion.

The key is setting the network adaptor to shared networking (NAT) as opposed to the bridged or host-only options shown in the VMware settings screenshot below.

screenshot

With this approach, network traffic from your virtual machine is routed through the existing VPN connection on the host Mac, so there’s no need to install a separate VPN client application on the guest PC.

Sharing DITA-OT in OS X & Boot Camp

If you’re using the DITA Open Toolkit on Mac OS X, you can’t generate compiled HTML Help (CHM) files directly, since Microsoft only offers the HTML Help Workshop for Windows.

But if you also run Windows on your Mac via Boot Camp, you can set up a single installation of the Open Toolkit on your Windows partition and use it to generate output from either operating system environment.

Essentially, you boot into Windows (via VMware, Parallels, or directly) and set up the toolkit there as usual.

Once you have the toolkit running under Windows, create a copy of the Ant build file for your project, adjust the paths for access from Mac OS X and save it under a new name in the DITA-OT directory on your Windows partition. (You’ll call this file later from the Terminal to build your project output on the Mac.)

Back on Mac OS, set up the environment variables required by the toolkit.

You can do this by editing the .bash_profile file in your home directory, or if you don’t like editing hidden UNIX files by hand, you can use freeware such as RCEnvironment or SSHKeychain, which provide a simple dialog that allows you to define environment variables like in Windows.

(In the background, both tools simply write to the ~/.MacOSX/environment.plist file. SSHKeychain also serves as a nice Mac equivalent to PuTTY, but that’s another story…)

The key here is to use the absolute path to the toolkit installation on the Boot Camp partition. For example, if your Windows partition is named BOOTCAMP and the toolkit lives there at C:\DITA-OT1.4.1, you might set the DITA_HOME variable like this:

DITA_HOME=/Volumes/BOOTCAMP/DITA-OT1.4.1  

You can then define the other variables relative to the toolkit directory with entries like this:

ANT_HOME=$DITA_DIR/tools/ant

Note: If you use either of the aforementioned tools to edit ~/.MacOSX/environment.plist, you’ll need to use the full paths for the remaining variables, as $VARIABLE values are not expanded when this file is read.

Once the variables are all set, you’ll need to log in to OS X again to activate them.

Then with a command like this, you can build output from the Terminal using the Mac version of the build file you edited above:

ant -f your-mac-build-file.xml html 

To build CHM output, switch to Boot Camp, run startcmd.bat in the DITA-OT directory, and enter something like this on the command line:

ant -f your-windows-build-file.xml chm

If both your build files are set to share an output folder on your Mac, your files will land in the same place, no matter which operating system you build them on.

CHM Viewers for Mac OS

A quick search for Mac CHM viewers yields a handful of open source & shareware apps which provide Mac users access to Windows help files in the Compiled HTML Help (CHM) format.

A few older shareware apps such as Chimp and CHM Viewer are only available in PowerPC versions and apparently no longer actively developed.

The remaining candidates are all free, open source software and available as universal binaries for PPC & Intel Macs. Each does pretty much the same thing–more or less successfully–though none of them quite manage to support all of the features CHMs provide in their native Windows environment.

Here’s a short list of a few pros (+) & cons (-) that appear at first glance:

  • Chmox
    + Beautiful HTML page rendering via Apple’s WebKit browser engine
    - Chokes on some large & complex pages
    - No search, index or favorites support

  • xCHM
    + Functional search, index & favorites (bookmarks)
    - Only basic HTML rendering, poor table/CSS support

  • Chamonix
    + Supposedly supports ToC, Indexing, Search and Favorites,
    - Unreliable–index shown in test file is incomplete, odd CSS background rendering quirks
    (should we read “Chamonix” as “shame on it”?)

For a more detailed–though somewhat outdated–comparison of xCHM & the now-defunct CHM Viewer, see this Mac OS X Hints article.

Automator Workflow: Set ZIP File Date

When you compress a file or folder in the Finder via the Create Archive command, a ZIP file is created using the current date as modification date.

But when you’re archiving older data, it’s much more useful for the ZIP file date to reflect the date of its contents, since a few years from now you probably won’t care when you compressed the stuff, but rather how old the files inside are.

Fortunately, the command line version of ZIP included in Mac OS X includes an option to do just this: zip -o, which according to the man page will

Set the “last modified” time of the zip archive to the latest (oldest) “last modified” time found among the entries in the zip archive

—which is just what we want.

But depending on your command line proficiency, you may find it a bit tedious to open up a terminal window and look up the command syntax every time you need to compress a file.

Enter Automator, one of the most useful (and unsung) productivity tools in OS X, which we’ll use to create a new Finder plug-in (or “workflow”).

To create the workflow, open /Applications/Automator.app and add three actions in this order:

  1. From the Finder library, drag the Get Selected Finder Items action to the workflow area on the right side of the window.
  2. Drag the Create Archive Finder action to the workflow area, placing it after the first action.

    (At this point, you can pre-specify a name and location for the archive file, or set the Options to prompt for this information when the workflow runs.)

  3. From the Automator library, add the Run Shell Script action. Leave the Shell set to /bin/bash, set Pass input to as arguments, and replace the default script in the text box with zip -o "$@".

That’s it!—Save the workflow as a Finder Plug-in, and you can run it on files & folders in the Finder by Control-clicking and choosing your new command from the Automator submenu in the shortcut menu.

HumaneText.service

Fans of John Gruber’s Markdown will appreciate HumaneText.service, a system-wide Mac OS X service that translates between markdown and XHTML with quick key-commands: Shift+Apple+{ and Shift+Apple+}. Simply beautiful!

If you haven’t heard of markdown, it’s a simple and elegant means of writing plain text that is highly readable “as is”, yet easily converted to HTML. As the author says:

The overriding design goal for Markdown’s formatting syntax is to make it as readable as possible. The idea is that a Markdown-formatted document should be publishable as-is, as plain text, without looking like it’s been marked up with tags or formatting instructions. While Markdown’s syntax has been influenced by several existing text-to-HTML filters, the single biggest source of inspiration for Markdown’s syntax is the format of plain text email.

Versions: New Mac OS X Subversion client

The interface artists at Sofa are working on a new Mac OS X Subversion client called Versions, which is due out for public beta release “any moment.”

While there are a few Subversion clients for Mac like svnX and cross-platform GUI front-ends such as RapidSVN and SmartSVN, even the names seem to suggest that none really manage to deliver the ease of use Mac users have come to expect.

No, it’s not all about eye candy—anyone that uses Subversion is typically smart enough to figure it out anyway—but even hard-core programmers benefit from good interaction design, efficiency and a solid user experience. And hey, if more programming tools had decent interfaces, maybe the applications they are used to create would be a bit more pleasant as well…

Or, as the people on the Sofa say:

To create good software, development teams should spend at least half their time thinking about what and how they want to communicate. Preferably even more. We want to create good software and collaborate with others to help make end-user experience a central focus in their development efforts.

Continue reading ‘Versions: New Mac OS X Subversion client’