Archive for January, 2004

Travels

Friday, January 30th, 2004


create your own visited states map

[red is visited, “green” is not]

Sadly, if I were to create the world map version, it would be rather devoid of visited countries (UK, Canada, Grand Cayman, Bahamas, pfffft…). It is on the todo list to fix that.

Subversion as a Finder context Menu (CVS, too)

Friday, January 30th, 2004

Chris Pavicich has put together a very cool little Finder CMM (contextual menu) that adds Subversion and CVS support to the context menus popped up within the Finder. It is open source and available for checkout/browsing. A prebuilt binary is also available.

Installation Notes.

I have had a look at the code and there is some neat stuff going on (beyond that it “just works). In particular, Chris is using both Objective-C and Cocoa within a Finder plugin. I didn’t know that was possible, but am ultimately not surprised given the work that was put into Cocoa/Carbon interoperability.

Still needs a bit of refinement, but is already quite useful. I will certainly be tracking the devleopment of this and will keep a fresh copy built in ~/Library/Contextual Menu Items!

screen shot.

Memory leak debugging on OS X

Tuesday, January 27th, 2004

Eric Peyton wrote a brilliant post that summarizes the use of leak and the malloc debugging tools built into OS X to track down memory leaks.

To summarize:

In a Terminal window….

setenv MallocStackLogging
/path/to/foo.app/Contents/MacOS/foo

… you should see a diagnostic message like …

malloc[PID]: recording stacks using standard recorder

… then, in another Terminal window…

leaks PID

… do whatever it is in the app that you suspect causes leaks. The leaks process will print detailed information about the leak, including the backtrace of the appropriate thread within the application at the time the memory was allocated.

As Eric points out in a later post, if you find a leak in the AppKit or other library code, make sure it isn’t a code path through your own code that is the real cause of the leak. Apple is generally very good about making sure the various frameworks don’t leak memory, but that assumes that the API is being called in the proper fashion.

Some useful man pages:

leaks – Search a process’s memory for unreferenced malloc buffers
heap – List all the malloc-allocated buffers in the process’s heap
malloc – memory allocation
malloc_history – Show the malloc allocations that the process has performed
MallocOptions – Malloc options release notes
Memory Performance – Memory Management & Memory Optimization guide

Mother Goose & Grimm

Sunday, January 25th, 2004

Mother Goose & Grimm has always been a funny and often slightly irreverent cartoon.

Lately, the humor has been very much akin to the Far Side. I’m referring to the Jan 11, 2004 cartoon specifically. Unfortunately, there is no way for me to provide a perma-link to the cartoon.

My eyes are going to explode

Saturday, January 24th, 2004

Here is a collection of images designed to make your eyes bleed or explode (or some combination of the two).

Some are more effective than others.

I found that this one breaks my head.

Other interesting RSS Feeds

Thursday, January 22nd, 2004

RSS: It isn’t just for weblogs and geek pubs anymore…

Google reveals a number of interesting RSS feeds. Some that I have found (so far):

The USGS has RSS feeds for World Earthquake Activity.

Xicons has an RSS feed via which they announce new icon sets.

No mention of RSS would be complete without a pointer to Dave Winer’s weblog. He has recently focused upon the pending Indecision 2004 presidential race and, in so doing, has compiled a tremendous number of related RSS resources.

BBC News has a plethora of RSS feeds ranging across many sections of their site. Look for the RSS version mark. Yahoo! News also has rss feeds.

The National Weather Service has RSS feeds for all state weather, national weather, and hurricanes.

Did you know that the US Government has an entire site devoted to XML (including RSS)?.

Update: Mark Carey has a feed of Mars rover photos Spirit Imagery also has an RSS feed of news and images from the rover. The feed does not include images, but tends to be a more complete/scientific feed than Mark’s. I subscribe to both, now. Thanks to Eric for the link.

iTunes Music Store RSS Feeds!

Wednesday, January 21st, 2004

The iTunes music store now has RSS feeds!

Not only does it have RSS feeds, but you get to create personalized feeds that can have custom quantities, genres, and whether the feed is focused on New Releases, Just Added, Top Songs, Top Albums, or Features & Exclusives.

I have already received notices of new releases via my NNW iTMS subscription that I never would have seen otherwise. This could be very dangerous.

Python, Readline, and Mac OS X

Wednesday, January 21st, 2004

New system. New Python installation. Need readline. Now!

Because of the weblog ‘refresh’, this has fallen out of cache. Python’s interactive interpreter supports readline style command line editing. That is, a good chunk of the basic emacs text editing/navigation commands will work at the interpreter prompt if the readline module is available. Because it is tainted by the GPL, Mac OS X does not ship with the readline library.

Building libreadline is trivial. It can be downloaded from GNU’s ftp site. If you do decide to build libreadline, consider building it as a statically linked library via ./configure –disable-dynamic –enable-static. Subsequently, any applications linked against readline will not require the readline dynamic library to be preinstalled on the target system.

That is exactly how I built the readline.so module for Python. To install (this is one command):

curl -s http://www.pycs.net/bbum/2004/1/21/readline.so.gz |\
	gzip -d -c |\
	 sudo cat > /Library/Python/2.3/readline.so

The source to the module is also available. It isn’t very interesting in that it just contains the readline.c module extracted from the Python 2.3.x source tree and bundled up into a standard distutils managed module.

Ahh…. readline at the Python interpreter. One more bit of sanity restored to my computing environment.

Update: Bob Ippolito pointed out that everything is included in Panther to install the readline module without preinstalling the MacPython Panther extensions. Not only that, but can be done with a one liner:

python `python -c "import pimp; print pimp.__file__"` -i readline

Shortly, it will be “google-able”, making it the best solution yet.

Thanks Bob!

iDisk syncing tip

Wednesday, January 21st, 2004

I just noticed that selecting the iDisk icon in the Finder’s sidebar displays the current sync status in the status bar area at the bottom of the Finder window.

“It just works!”

Tuesday, January 20th, 2004

I upgraded from a TiBook 667 to an AlBook 1.25ghz (15″). Quite the upgrade. It was also an entertaining experience.

My home directory is about 10GB and it is encrypted using FileVault. My first thought was that I shoudl be able to configure the new powerbook appropriately, copy over the sparse disk image containing my home account, log in and everything should “just work”.

My TiBook doesn’t have firewire any longer. The magic smoke in the FW controller chip escaped in a rather cataclysmic event some time ago. Once you let the magic smoke out, electronics just never work quite the same, if at all, afterwords.

So, I was faced with copying a 10GB disk image through ethernet. As I didn’t have enough cabling to have all of my machines connected at the same time, I decided to try something radical.

I simply dropped an ethernet cable between the two powerbooks. I knew that would work because the powerbook ethernet ports are smart enough to figure out when a crossover connection is needed vs. a normal connection.

Not only did it work, but it turned out that I didn’t need to turn on internet sharing or give either machine IP addresses. Rendezvous just worked and I was able to share files and, even, ssh between the two machines by using their sharing name.

As well, because I was using direct cabling both machines automatically used the highest speed setting available on the port; 1 gigabit. Nice and speedy!

Once copied, I simply created a user account with the same username and with filevault enabled on the new machine. I then logged out of the new account (you have to log in ot the account to turn on FileVault) and simply replaced the new sparse disk image with the old sparse disk image.

Upon logging back in, my entire account was now on the new machine and everything “just works”.

Nice!