Tuesday, July 26, 2005

"Why is the fan so loud on my PowerBook?"

I asked myself that a few seconds ago. I'm in bed. My 12" Powerbook is on my chest, and the fan is on full blast. Which means its running hot. Which means it's doing something processor intensive. But what could that be? I'm just browsing the web. I'm not even listening to iTunes. There is no reason for this.

Luckily, as a developer, I've installed Apple's free development tools. (If you bought Mac OS X, they are on the separate CD) and I can run the "top" utility. So I launch the "Terminal" application, and type in:

top -o cpu

And what do I see, but that Sherlock is using up half my CPU doing nothing but pausing a movie trailer:

[Lefler:/System/Library/Extensions] glenn% top -o cpu

Processes: 79 total, 6 running, 73 sleeping... 280 threads 07:52:47
Load Avg: 1.81, 0.89, 1.07 CPU usage: 62.7% user, 37.3% sys, 0.0% idle
SharedLibs: num = 238, resident = 42.7M code, 4.61M data, 4.86M LinkEdit
MemRegions: num = 15609, resident = 457M + 12.0M private, 138M shared
PhysMem: 132M wired, 416M active, 318M inactive, 867M used, 285M free
VM: 7.38G + 151M 410626(15) pageins, 308443(0) pageouts

2637 Sherlock 41.4% 0:21.33 14 235 336 15.3M+ 17.5M 25.4M+
782 DashboardC 11.8% 4:20.41 4 105 210 5.97M+ 7.52M 12.1M+

What would a typical user do in this situation? How would they know which of dozens of applications is killing the performance of their expensive toy? I know enough to feel the symptoms and run top, but what would someone else do? It might not even be an application taking up all the cycles. The installer for my HP printer installs a background process which occasionally goes crazy and uses 60% of my cycles. It's inconceivable that the typical user would know how to make their computer speedy again. They would just have a poor experience with Mac OS X.

And what is wrong with Sherlock that it can't idle a QuickTime movie properly? QuickTime does all the work for you these days making efficient use of idle time. It's not like the old days when you set your sleep time to zero and gave QuickTime idle time every pass through your WaitNextEvent loop. QuickTime can now register its own Carbon Event timer. It's very nice. It practically writes itself.

[Update: The "Activity Monitor" application under Applications/Utilities is a more user friendly, and informative, way to find out what application is soaking up cycles.]

Saturday, July 16, 2005

Remote Desktop Setup

Another how-to posting.

Out of frustration with Windows and Wintel notebooks, my brother Joe bought an iBook. Unfortunately, he still needed a few pieces of critical Windows software, thus Virtual PC, thus Window's style kludge and instability ruining his otherwise decent Mac OS X experience. He's very close to giving up and getting another real Wintel notebook, but we are experimenting with the other way to add Windows functionality to a Mac: Microsoft Remote Desktop. As long as you have an IP connection, you can keep a cheap desktop PC anywhere in the world to run Windows software natively, without destabilizing your Mac.

Things Needed:

  • A PC running Windows XP Professional. Microsoft does not give this to XP Home users.

  • A router capable of both port mapping and Dynamic DNS.

I purchased a used Netgear RT314 router from a merchant on Amazon for $27 shipped. This is an older router, and quite big, but when updated to the 3.25 firmware version does everything I want.
Netgear RT314
I created a free account at www.dyndns.com and created a host name named yoursite.homeip.net (not the actual name).

I hooked up my network in the following topology, turned off DNS serving in my Airport Extreme hub, and relied on the RT314 to handle DNS.

I logged into the router through the web interface, and configured it for Dynamic DNS using my new account.
Dynamic DNS RT314Now the DynDNS servers will know the IP address Comcast has given my router, and the yoursite.homeip.net address maps to that IP address.

But of course, I don't usually want to talk with my router, I want to log into my PC using Remote Desktop. So I have to configure the router to route port 3389 traffic to my PC. So I configure that page under "Advanced" options on the router.
Port Mapping RT314
But what IP address, should I forward it to? My PC has a local IP address that the router assigned it, but the next time I turn it on, it might get another. I need to force the PC to always have the same IP address, so I have to configure my PC.

First, find my active network connection.

Second, click on the "Properties" button of Connection Status dialog.

Third, select the Internet Protocol (TCP/IP) item of the Local Area Connection dialog and hit the "Properties" button.

Fourth, enter an IP address high in the range of local addresses will distribute, as there are only 6 networked devices in my home, and the range starts at, I went with My router ( is also the default gateway and in charge of getting DNS information.

Make sure this fixed IP address is the one in your router's port mapping page.

If all went well, you will now be able to run the Remote Desktop Connection software and log into your PC from around the world, just by typing the yoursite.homeip.net address (or whatever you chose). There is, of course a version of Remote Desktop Connection for Windows, and it's installed by default on all XP boxes.

Anywhere in the world, but your own home, however, as you have to be upstream of your router in order to have this work. (Inside your home, you can use the address). Or your ISP might filter port 3389, or any number of things could go wrong, but if your PC is running XP Professional, it's pretty cheap to try, especially if you have mission critical software to run which doesn't require lightning fast screen redraws.

If you have a .Mac account, you can even use the iDisk Utility for Windows XP to provide a shared disk to ease transferring files from the remoted XP box to your Mac. Just drag a file onto the iDisk from the PC and drag it off onto your Mac.

Of course, having done this, I noticed a security advisory against Remote Desktop. So opening up that port in the router and enabling Remote Desktop access might be dangerous, especially given my brother's typical luck with computers.

Saturday, July 09, 2005

Adding Auxiliary Inputs for my iPod in my Civic

This doesn't have anything to do with programming, but it might be of use to Googlers.

I have a 2003 Honda Civic 4 door sedan, with a 5 speed manual transmission. It would be agreeable to listen to my iPod while commuting, or allow my wife to listen to movies playing on my PowerBook, through the built in speakers of the car. Of course, the factory original stereo has no auxiliary inputs, and I'd rather not tear out a perfectly good stereo to put in some ugly after market monstrosity. So a googling, I did go.

Logjam Electronics carries a variety of converter boxes which fool OEM stereo's into thinking they have trunk CD Changers, while in fact, they have auxiliary inputs. So I ordered a Blitzsafe for my Civic. Other manufacturers were available, but this one seems to have a good following, and doesn't have the ground loop noise problem (when charging the iPod) for which other units are known.

The Blitzsafe comes with female RCA jacks, and most people use converter cabling to add a ⅛th inch mini-jack to their dashboard, but I felt it would be more flexible to put a pair of RCA jacks on my console, and converting to mini-jacks in the cable from the console to my iPod or Powerbook. I went to Radio Shack and found a wall plate with 3 RCA jacks, the jacks themselves were female/female connectors and came threaded and with nuts. I'd just have to drill some holes, and use a male/male cable (of which I have many).

I was concerned with stability, so I decided to put a metal strip on the other side of the console to give support whilst pushing cables onto the connector. I took a PCI slot blank out of my Dell and chopped it to give a metal strip (perhaps 1¼ inches long) I drilled two ⅜th holes for the RCA jacks, and one 11/64th hole for a small bolt. I wish I had a drill press, as I managed to cut up my left index finger a bit when I spun the metal, and I found my cordless drill wasn't really up to the task, so I ended up reaming out the larger holes with a flat headed screw driver. But i did get my little bracket. I didn't take a photo, but it looked something like the following, the holes were just separated enough that I could get the nuts in without overlap if they were twisted just so.

Next, I had to figure out how to get to my stereo. Cheap Honda Parts has a variety of installation manuals, and I chose the one for installing a keyless entry system. At that time, I decided to kill two birds with one stone, and I ordered a keyless entry system to install at the same time.

Unfortunately, as I have a manual transmission, the instructions were not quite accurate. For instance, it said to remove the ring around the leather of my stick shift while that was not necessary, and I ended up breaking (a thankfully invisible) area around a hidden screw. I should have known, the ring in the diagram was a round rectangle, while the ring in my car is an oval. But I was able to pop the assembly off, get into the area below the stereo, reach up and find the connector socket and plug the Blitzsafe into place. Then it was a simple matter of taking the lower console into the house and drilling out the 3 holes (2xRCA jacks and 1 bolt hole) to mount my little metal bracket. Thankfully, it looks pretty slick.

I mounted the jacks to the right of the cigarette lighter jack, as I wanted some chance of not blocking the passenger cup holder, and also because the flip top of the lighter jack would have blocked mounting it below.

I also installed the keyless entry system, and that was pretty much according to the instructions, except it was pretty hard finding the loose connector with "the blue tape." But digging around inside the console found it hiding amongst some other cables. Also, the keyless module would not click into place in it's tab..

Oh, and it works great. My iPod is on a long enough cable that my wife can use it in the back seat.

I'll be listening to podcasts on my way to work for sure.