Archive of June 2010

Add to Google Reader Extension for Safari 5

I’ve long envied the polished appearance of Safari from the safe distance of my Firefox usage. On several occasions I’ve tried to set Safari as my default browser, but it never stuck. There were just too many functional niceties in Firefox that I couldn’t manage to get along without. That changed last week with the introduction of Safari 5.

The web inspector has finally caught up with Firebug —at least enough so as to make it a very usable alternative—and, at long last, extensions. Extensions! The availability of extension support—I mean real support, not that goofy, half-assed SIMBL hackery that was effective, but…ugh—opens the door to solving a lot of personal workflow woes that I’ve had in the past. Throw in a customized application hot key (Cmd+K to access the search box directly the way I could in Firefox) and it’s almost just like using Firefox except faster, prettier and without the memory suck (so far).

In an effort to solve one of my major issues with Safari, I found an extension that hijacks the RSS button that appears in Safari’s address bar when a feed is detected and redirects to Google Reader. I loved that the functionality was completely unobtrusive. No new buttons, no badges. The extension took a UI element that already existed and was useful, but repurposed it to be even more useful to me. Perfect. The implementation stopped a bit short of what I was looking for, but the developer, Chupa, was good enough to make his source code available on Github. I forked his repository and made the changes I wanted.

If you’re looking for an extension that will add a feed directly to Google Reader and bypasses the iGoogle/Reader option page unless you specifically enable an option that lands you there, you might like my version of Chupa’s Add to Google Reader extension for Safari 5. You can download and install it directly or you can check out the source code in my Codaset project.

Install memcached on OSX via MacPorts

Evidently I’ve become too accustomed to MacPorts installs being just a little too easy to get working. With virtually every install I’ve done, it’s as simple as typing port install port-name (plus variants as desired). Today it wasn’t and took me far longer than it should have to track down the problem.

Having exactly zero experience with memcached, I set out to get it installed for use as a lightning quick quasi-message repository. I was a little surprised at how few instructions I found for installing the necessary components on OS X via MacPorts, but I managed to cobble together what I needed from various Linux instructions and configuration bits. I will now share the fruits of my labor with you:

 # Install the executable
 $ sudo port install memcached

# Install the bindings for PHP5 $ sudo port install php5-memcached # Verify that the executable exists in your path $ which memcached /opt/local/bin/memcached # Configure memcached to execute on startup, if desired sudo launchctl load -w /Library/LaunchDaemons/org.macports.memcached.plist # Start memcached for the current session memcached -d -m 24 -p 11211

That’s the “easy” part that I managed to get through pretty quickly. Unfortunately, it didn’t work. I wrote a simple, stupid PHP script to test and got a messaged that Class ‘Memcache’ not found. It seems that MacPorts installs all of the necessary files and even creates an Ubuntu-like, separate ini file that is included by php.ini to load the memcached extension. That file, appropriately named memcached.ini, loads the memcached extension:

This is exactly the way I’d seen it written in each of the tutorials I’d found online, so I spent some time investigating other possibilities before I came back to it.

The problem, as it turns out, is that MacPorts doesn’t install the shared object file in its extensions/ directory. Instead, it stores it in a cryptically named subdirectory.

To get memcached fully operational I suppose you could move/copy the shared object to /opt/local/lib/php/extensions/, but I chose to edit the memcached.ini file to include the full path to the shared object:


I should add that I did try creating a symlink, but that didn’t work for me. Rather than spend any time figuring out whether it was a me problem, I decided to take the path of least resistance and just identify the fully qualified file path.

Restart Apache and your simple, stupid test script should work without error. For whatever it’s worth, here’s my simple, stupid script:

$memcached = new Memcached();
 $memcached->addServer( ‘localhost’, 11211 );

echo “

Memcached version:

“; new PHPDump( $memcached->getVersion() ); exit;

I’m using the php52 package (5.2.13), but I didn’t see anything to indicate that this wouldn’t work with 5.3 as well.