Admittedly, this is perhaps more of an i…

Admittedly, this is perhaps more of an interesting trick rather than a needed feature; However, if you’ve ever wanted to print man pages or simply read them in a nice, anti-aliased document view instead of within the Terminal, here’s a tip you might like. The following bash script (and credit goes 100% to my friend Victor, who is sans-blog) will format and open man pages in Preview:


#!/bin/bash

cmd=$1
if [ -z $cmd ]; then
    me=`basename $0`;
    echo "Usage: $me command_name";
    exit;
fi

man $1 > /dev/null 2>&1
if [ $? -ne 0 ]; then
    echo "No man page for $cmd";
    exit;
fi

man -t $cmd|open -f -a /Applications/Preview.app

On my box, I called the script ‘manpreview’ and dropped it in ~/bin/ for easy access. Once you `chmod u+x` it (and have ~/bin/ in your path), you’ll be able to do fun things like `manpreview tcpdump` for some extended reading.

Caps Lock keymap swap on OS X

I was mucking around with the keymap on my Linux box last night, trying to make it feel a little more comfortable. I’m using an Apple Pro keyboard (I like them, and they’re cheap), which has the control key in the far, lower left corner. On OS X this normally isn’t an issue since the Command key is used more often; However, under X, Control is the primary modifier, and you start to notice how much of a stretch that key is for the pinky. I played around with a few settings, but I eventually I settled on swapping the control and caps lock keys, so that control is now to the left of ‘A’. I quickly realized why so many people use this setup — it really is less stressful on the hands.

It took a little brain rewiring to get used to this new setup, but I became comfortable with it rather quickly — that is, until I got to work in the morning and sat down at my OS X machine. Bouncing between machines with different keymaps is a pain, so I decided to try remapping the keys on my Mac as well. A few google searches found a number of kernel hacks for 10.1 through 10.3, but I noticed that they all seemed to be abandoned projects. After adding “10.4” to my search query, I quickly found out why: remapping the control keys is just a System Preference. Woo hoo!

The screenshot below shows the “Modifier Key…” dialog within the “Keyboard & Mouse” System Preference panel:

key_swap_osx

Project Mac Transplant

I picked up my trusty Dual 450 Mhz G4 Power Mac (Gigabit Ethernet) almost six years ago. At the time, this was a beefy machine, and even today it is still quite usable (though it shows it’s age when running heavy applications like Photoshop, Firefox, and Eclipse.) To keep up with changing demands, most of the components have been swapped: An OEM Apple GeForce4 Ti video card drives the Cinema Display (the original video card couldn’t handle it, much to my disappointment when I bought the monitor); The CD drive has been replaced with a Sony dual-layer DVD burner; A newer IDE controller card was added to handle larger internal drives (the original hardware could only see up to ~120’GB’ish); M-Audio hardware is used for audio capture; And a Sonnet RAID controller card drives the hot-swappable, 1.2TB RAID array (using SATA drives.)

All together, this box serves quite well as an A/V machine, so I’m not looking to get rid of it (especially since the new X86 PowerMacs are still vaporware.) However, the RAID backplane didn’t actually fit in the Apple case (as you’ll see below), and the lone 120mm case fan was starting to ask for help. Since Apple doesn’t offer larger cases, a swap to a full size ATX case was in order.

The Gigabit Ethernet Macs pre-date the elaborate case internals and “cooling zones” that the new G5’s have. Inside, the hardware is organized just like any other PC, so while I didn’t anticipate a perfectly smooth transfer, I had no doubt that the pieces could be made to fit into a modern ATX case. To give me some extra room, I went with the rather large, ThermalTake Armor case.

The new case towers over the Apple box, but it’s extremely easy to work with, and provides plenty of options for mounting hardware and fans. The entire front is a stack of 5 1/2″ bays, which leave plenty of choices for mounting the RAID backplane, the internal drive cage, and case fans.

The stripped Armor case next to the G4. (And yes, that’s really where the RAID backplane was “mounted” — I simply ran the SATA and power cables through an empty PCI slot to the chassis up above. Don’t do this at home kids!)

Image155

The Apple case popped open. You get a better view of the SATA cables here, and the limited space for hardware expansion. (NOTE: The boot drive is actually under the DVD burner now, in the space where the ZIP drive was mounted originally. I used to have a stack of drive sitting in the bottom of the case, but with the RAID, they were no longer needed.)

Image156

Before getting too far into the swap, I pulled the Apple motherboard and video card for a test-fit (show below.) The Apple motherboard lined up with one existing mounting hole, but otherwise, clearance and fit were tolerable.

Image158

The Apple power supply was probably the only OEM part that just dropped in:

Image161

Image162

Next up was a test fit that the cables would still reach, and thankfully they did:

Image164

To mount the motherboard, I needed new holes for the board stand-offs. This was a simple chore for a Sharpie marker and a Bosch hammer-drill; However, before swiss-cheesing the case, I did have to decide how the stand-offs would actually attach to said holes. Normally the holes are threaded, and the stand-offs just screw-in; So my first inclination was to tap the holes after drilling. After considering how much time I’d waste doing this, I came up with an alternate plan. Instead of tapping the holes, I would simply make the holes just big enough for the threaded stand-offs to fit through, then attach a small nut from the other side to hold the piece in place. This saved a lot of time, and the result is just as sturdy. (Unfortunately, the macro focus mode on my N90 isn’t quite as good as I’d like, so the close-up pictures of this mount didn’t come out well enough to show.)

With the motherboard secure, the next piece of the puzzle was how to mount the processor board to motherboard. On the dual G4, the processors are actually on a small board with a ZIF-like connector on the back. With the connector snug, the processor board is then bolted to steel case-mounts that poke through the actual motherboard, and the aluminum cooling fins are hung off this little board. Without a hard mount, there would be no way to hang the cooling fins, so I needed a solution for this mount.

In the picture below, you’ll see the processor board mounts sticking up in the middle of the steel side I’m holding. This piece is attached to the plastic exterior with a series of hex bolts.

Image159

After examining the original case, I noticed that the processor mounting holes were steel bits that were pressed into the side of the case. It occurred to me that if I could pull those out, I could reuse them. The extraction was quite simple: support the steel backing with some wood, and nicely ask the mounts to come out with a 5-pound mallet. They pop right out, and I was able to reuse them in the new case.

With the motherboard and processors secure, the rest was simple wiring. I put the drive cage and boot drive behind a 120mm fan up front; The DVD burner was mounted low in the case so that my cables would reach; And the RAID backplane slide right in up top.

Image169

After double-checking every mount and connection, I brought the machine back into the office for a test run. On boot-up, I was greeted with a never-before-seen startup screen:

Image171

…the machine just hung there.

I’ve been mucking around with Apple hardware since I was about 9 years old, so seeing a new boot-up error screen is both exciting and a bit concerning. Since I had a feeling the hardware was just feeling like a lost kitten in a new home, I went with the easy potential fix and zapped the PRAM. It did the trick. (Though I still don’t know what that error means.)

The finished product not only adds a little bling to an otherwise dated machine, but also pumps a pleasantly cool breeze from the back of the case. There’s still a little finishing work left to do, but overall I’m extremely happy with the outcome — and the confusion it causes for the casual observer.

Phase I complete: The ATX case swap was a success:

Image172

The remaining empty shell:

Image173

3D modeling the Earth

Google SketchUp for OS X finally released to the public this week (as did Google Earth Beta 4 for OS X, Linux, and Windows, in case you missed it.) If you’re not familiar with SketchUp, but are at least remotely interested in 3D modeling, I suggest hoping over to the Google SketchUp Tutorials and having a peek. The first few tutorials elicit a jaw-dropping “it can’t be that easy” reaction.

On first glance, Google offering a 3D modeling program seems a bit strange. I mean, what could this possibly have to do with search, right? But the key is to look at it differently. If you’ve used Google Earth, odds are high that you’ve also tried looking a major city with the “3D Buildings” option enabled for that all too futuristic, flying-through-the-world experience. But what you notice when you do this is that there aren’t enough 3D models, and they tend to lack detail. So how do we get from flat, satellite photographs to rich 3D models of every building in the world? Well, you start by giving away a free, easy to use 3D modeling program that can import/export into Google Earth… And then you let your customers (happily) do the work for you. (Co-creation at it’s best.)

For more, see:

Below: an example SketchUp model (of the University of Texas tower) geo-positioned over a Google Earth map tile