Monthly archives for August 2008

Published on August 29, 2008

A while back I detailed how to get Hamachi VPN running on Mac OS X, but times have changed, so here’s how to go about it under Leopard. Again, it’s a bit tricky, involving some Terminal work, but it’s pretty straightforward as far as command-line software goes.

Download and Install Tun/Tap

Hamachi for Mac OS X depends on some other tunneling software, a Tun/Tap kernel extension which does the low-level work. Download the latest Tun/Tap package and install it.

Download and Install Hamachi

Next, download the latest Hamachi for Mac OS X. Installation is a bit more complicated than the Tun/Tap drivers. Unzip the archive, and open up a Terminal window, and type “cd”, followed by a space. Don’t press Return just yet… Instead, drop the Hamachi folder right into the Terminal window, which will insert the path to that folder after the prefix you just typed: cd /Users/you/Downloads/hamachi-0.9.9.9-20-osx. Press Return, and the Terminal’s new working directory will be the Hamachi folder — this is just a quick drag-and-drop shortcut to avoid typing out the path to a folder you already have available.

Once in the Hamachi folder, type sudo ./install. Enter your administrator password to perform the install.

Hamachi should now be installed, and you can initialize it for the first time by typing hamachi-init. This will generate public and private encryption keys in your Home folder, under .hamachi/ (the initial dot makes the folder hidden in regular Finder windows).

With both set-ups out of the way, it’s time to start using Hamachi!

Run Hamachi

Configure Tun/Tap by typing sudo ./usr/sbin/tuncfg

Start up Hamachi by typing hamachi start followed by hamachi login.

At this point, you should be connected to the Hamachi service, but without a VPN for your computers to join. If you already have a network, or plan to join a trusted friend’s network, you can easily join it by typing: hamachi join SomeNetwork.

Most likely, though, you’ll need to create your own network: hamachi create MyNetwork

Now you should have a virtual network in place and can go online hamachi go-online MyNetwork.

To see other parties on the network, run hamachi list

If other computers are online, you’re ready to connect to them with any higher-level software like iChat via Bonjour, the Finder’s “Connect to Server” command, Safari, etc.

To log out of Hamachi and shut down VPN connections, type hamachi stop

For more information about how to use Hamachi, you can view its manual by typing code>hamachi -h

Published on August 26, 2008

Coda iconThe developers at Panic have been very busy for the last several months preparing a major update for their one-window web development app (covered earlier), Coda, and have finally delivered. Coda 1.5 brings tons of new features like multi-file search, customizable books, “reverse publish”, and more, but the one that really takes the cake is full Subversion support. None of that bolted-on nonsense, either — Panic went out of their way to carefully weave Subversion into the interface, presenting commands as needed. The update is also free for registered owners.

If Coda is your primary tool for web development, and you already use Subversion, you’re most likely aware of Versions and Cornerstone, but now you can toss both of those apps and have your source code management built right into your leafy-green development environment. And, after reading how to go about setting up Subversion on MediaTemple, your Mac web development paradise should be complete, ready to start developing all those killer web apps you’ve been pondering. Check out Coda and get coding!

Published on August 26, 2008

While trying to order some prints from Kodak/Apple via iPhoto yesterday, I repeatedly got the pseudo-error message:

“Please review your billing information and approve it.”

After checking out my billing information twice, and still getting that error, I found the answer on an Apple Discussions thread: Make sure your credit card verification code is entered in the Account Information screen. Why iPhoto doesn’t highlight or complain about the missing required field is beyond me, but overlooking this tiny field causes problems that hardly indicate their source.

Published on August 24, 2008

I’ve been busy lately with lots of side projects (including the new theme surrounding this post), and one key tool that helps keep my work organized and sane is Subversion. A while back, I discovered that my web host of choice, MediaTemple offers two ways to host Subversion repos for your own usage alongside regular web hosting: you can make use of a single Apache webserver driven Subversion repository, or configure full-blown Subversion over secure SSH tunneling. Here’s how to get the latter up and running, complete with a hosted checkout of your work that auto-updates after your commit.

Enable SSH Access

By default, SSH remoting is disabled on MediaTemple accounts, requiring you to explicitly enable it in the Server Administrator control panel section for your primary domain:

Once there, set SSH on “Enabled”, and save your changes. MediaTemple’s easy-to-use configuration tool couldn’t make this step any simpler.

Connecting and Creating a Repository

Fire up Terminal in your Applications/Utilities folder under Mac OS X, or grab the latest version PuTTY under Windows, and connect to your MediaTemple host as serveradmin@yourdomain.com. For example, if your site were example.com, you would connect as follows:

ssh serveradmin@example.com@example.com

The domain “example.com” is in there twice, first because it’s part of your full username, and second to point SSH at the right server. (If your SSH client complains about not being able to connect, you can try replacing the first @ sign with its encoded version, “%25″.) Type “yes” to confirm adding example.com to your known_hosts, if asked, then enter your administrator password to finish logging in.

Enter the following commands to switch to your “data” directory (provided by MediaTemple), and create a basic repository for your code/information:

Change directory (cd) to your data directory: cd ../../data/ Create a “repos” directory to hold one or more repositories: mkdir repos Change directory to the folder you made in the previous step: cd repos

Create a repository (replace “tests” with your desired repository name, using underscores for spaces). Letter case is important, so if you capitalize any part of the name now, you’ll have to capitalize it later when using it. The bit about “fsfs” is to use a specific Subversion database type recommended by MediaTemple — it’s the default type for newer versions of Subversion, but it’s best to put it just to be safe.

svnadmin create tests --fs-type fsfs

You can repeat this to create as many repositories as you wish inside the “repos” folder.

Log out of MediaTemple:

logout

Checking Out Your Repository

On your local computer (not on MediaTemple), decide where you want to keep your repositories. I recommend someplace easy to get to like /workingcopies/, but a repo can go anywhere you prefer. Check out a copy of the repo you just made:

svn checkout svn+ssh://serveradmin@example.com@example.com/home/1234/data/repos/tests /workingcopies/tests

Be sure to replace “1234″ with your four-digit MediaTemple server ID number that can be found in your Service Activation email.

To verify everything drop a simple file into your new repository folder at /workingcopies/tests, such as test.txt, and do:

svn add test.txt followed by svn commit -m "Adding test file."

Auto-updating MediaTemple

If you have some code stored in a repository that you’d like to automatically be made available to the world, such as a WordPress theme or web application, Subversion provides various “hooks” that can be run at times like pre-commit, post-commit, etc. Subversion hooks are nothing more than scripts which you define, and get run when the applicable action occurs. Here’s how to set up an automatically updating WordPress theme repository:

Connect to MediaTemple again, using the initial ssh command at the start of this tutorial, then change directory to where you want to use this repository on your MediaTemple server:

cd ../../domains/example.com/html/wp-content/themes

Check out a copy of your repository elsewhere on your server, using file:// instead of svn+ssh://

svn checkout file:///home/1234/data/repos/tests tests

Again, replace “1234″ with your server ID, and also replace “tests” with your repository name (in both places). Now you have a copy of that repository on your server. Edit the hook so it gets updated automatically when you commit changes:

cd ../../data/repos/tests/hooks

Make a copy of the post-commit hook example:

cp post-commit.tmpl post-commit

Use your favorite command-line text editor the post-commit script:

nano -w post-commit

Change the entire script (below #!/bin/sh) to:

svn update /home/1234/domains/example.com/html/wp-content/themes/tests

Exit, saving changes, with Control-x, y, Enter.

Make your post-commit script executable:

chmod +x post-commit

Finally, log out of MediaTemple again:

logout

Now, after a commit, Subversion will automatically update the repo you have checked out on your server, and your changes should be reflected almost instantly.

There’s a lot more to using Subversion, so here are some hand-picked resources to keep you going:

Recommended

Published on August 2, 2008

For the past several weeks, my MacBook Pro had been occasionally waking up during periods where it was expected to be in sleep mode. Even with the lid closed, it would briefly wake up, illuminate the screen and Apple logo, then fall back asleep moments later. Seemingly random, it would sometimes happen only once every other day, and other times it would happen sequentially with only seconds in between cycles. I had no idea if the issue was hardware or software, but it didn’t seem major enough to warrant an AppleCare call.

A quick trip to the Console application in the Applications > Utilities folder reported dozens of instances of “USB caused wake event (EHCI)”, which gave me some initial Google hits. The obvious answer is that a USB device was waking up the computer, however I rarely had USB hardware plugged in when the random awakenings were occurring.

As it turns out, others have had this problem before. As indicated in the previous links, Mac OS X keeps its power schedule inside /Library/Preferences/SystemConfiguration/com.apple.AutoWake.plist, but this file didn’t exist for me, apparently “confusing” Mac OS X. Without it, it would exhibit the symptoms I was encountering.

Following suggestions, I opened System Preferences > Energy Saver > Schedule, where you can schedule system sleeps and wakes. By toggling on a scheduled wake, clicking OK, then disabling it, the com.apple.AutoWake.plist was re-created, and left with no scheduled sleeps or wakes. So far, this has cured my MacBook Pro’s insomnia!