Hello, I’m a web craftsman with a passion for the modern web. I build web applications and play with social services and communities.

March 30, 2010 at 9:07 pm

While developing scalable web applications you will come across memcached at some point. Memcached is a free & open source, high-performance, distributed memory object caching system.

XAMPP is great for development in a local environment but does not come with a php memcached extension preinstalled. Since there are 2 good memcached php extensions in the PECL repository (memcached and memcache) it could be as easy as installing them through XAMPPs PECL installer. Unfortunately XAMPP for Mac (1.7.3) is still compiled for 32bit and the PECL installer would create a 64bit snow leopard extension. So let’s do it manually by setting some 32bit flags…

Install memcache PHP extension (2.2.5) for XAMPP (1.7.3) under Mac OS X 10.6 Snow Leopard (10.6.2)

  1. make sure Apple Developer Tools (Xcode) are installed
  2. make sure XAMPP Developer Package is installed
  3. $ cd /tmp
  4. $ pecl download memcache
  5. $ tar xzf memcache-2.2.5.tgz
  6. $ cd memcache-2.2.5
  7. $ /Applications/XAMPP/xamppfiles/bin/phpize-5.3.1
  8. This line looks just a bit complicated because it tries to deal with architecture problems between XAMPP (compiled for 32bit) and Snow Leopard (compiles everything by default to 64bit)
    $ MACOSX_DEPLOYMENT_TARGET=10.6 CFLAGS='-O3 -fno-common -arch i386 -arch x86_64' LDFLAGS='-O3 -arch i386 -arch x86_64' CXXFLAGS='-O3 -fno-common -arch i386 -arch x86_64' ./configure --with-php-config=/Applications/XAMPP/xamppfiles/bin/php-config-5.3.1
  9. $ make
  10. $ sudo make install
  11. change XAMPPs php.ini to load the extension: (in [Dynamic Extensions])

Those steps enable you to use memcached in your PHP Code. But to actually test the application and caching in your local development environment you have to start the memcached daemon. Fortunately memcached got already installed by the Mac OS X Developer Tools (Xcode).

Just go ahead and start the memcached daemon:

$ memcached -m 8 -l -p 11211 -d

-m 8 limits memcached to use a maximum of 8MB RAM to operate

-l -p 11211 is the ip and port to listen on

-d tells it to start as a daemon

(instead of -l and -p you can also use -s to use an unix domain socket)

January 26, 2010 at 5:14 pm

LocaNote LogoAbout a week ago I launched a new web service with a few friends from university. It’s called LocaNote. LocaNote is a cloud service that stores personal notes online. What’s special about LocaNote is that every note has a geographical location attached to it. Using this information LocaNote will show you only notes that are relevant to your current position. And since it is a cloud service you can take your notes with you on a mobile device. An iPhone App is in development right now and should be available on the App Store within the next few weeks. The built-in GPS receiver in the iPhone makes it the perfect mobile device for LocaNote. It will automatically use it’s current GPS-location to find notes that are really close to your actual position. Also, when you create a new note it will be placed on your current location.

The website and API is done in Ruby on Rails and the web frontend makes heavy use of the recently released jQuery 1.4.

LocaNote Screenshot

LocaNote Notes View

January 20, 2010 at 10:26 pm

Gravatar (globally recognized avatar) is an Avatar Service from Automattic, the company behind WordPress. It allows users to upload an avatar which is attached to an email address. This way developers all over the world can integrate “Gravatars” into their web services. All they need is a users email address. For the end-user this has the advantage that they have only one place for maintaining their avatars. Any change to their gravatar will immediately have an effect on all gravatar-enabled web services.

So how to implement Gravatar in your Ruby on Rails project?

One way would be to generate the URL to the gravatar manually.

Such a URL looks like this:


The long combination of numbers and letters is a MD5 hash of the users email address.
So the Rails Code in your View could look like this:

<%= image_tag “http://www.gravatar.com/avatar/” + MD5::md5(“user@email.com”.downcase) + “.jpg” %>

Or since you are using Ruby why not go straight for a Rails Gem? “Gravtastic” does a good job here.

Just install the Gem and use


in your User Model.

After that you have a new attribute “gravatar_url” available to any instance of “User”.

December 11, 2009 at 2:04 am

I spend the last couple of hours trying to get Ruby on Rails (2.3.5) to work with MySQL on Mac OS X 10.6 Snow Leopard. So far I have been using SQLite for Rails Development but a current project requires some MySQL specific functions. I didn’t expect things to be so rough but now everything works and I am quite happy. So happy that I decided to write it down and share it with the world.

First: What was the problem?

Since I’m coming from PHP/MySQL development I had XAMPP already installed on my system and I was hoping to use the same XAMPP-bundled MySQL Server I have been using for all my PHP projects for rails projects too. Forget it! Don’t waste your time here. You may get it to work somehow but you will run into trouble at some point since XAMPP’s MySQL is compiled in 32bit and Ruby on Snow Leopard in 64bit. So basically as soon as you have a Mac with a Core 2 Duo (or any other 64bit processor) and running 10.6 Snow Leopard you have to install a 64bit version of MySQL.

So the problem you will run into (or already ran in and that’s why you are here right now) while trying to install the mysql gem with sudo install mysql looks like this:

Building native extensions.  This could take a while…
ERROR:  Error installing mysql:
ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lm… yes
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lz… yes
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lsocket… no
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lnsl… no
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lmygcc… no
checking for mysql_query() in -lmysqlclient… no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

and some more I won’t bore you with.

So here comes the solution:

1. Download MySQL 5.4 beta for Mac OS X 10.5 as x86_64 version from the official MySQL website

2. Open up the downloaded .dmg and run the mysql-5.4.x-…x86_64.pkg installer, followed by the MySQLStartupItem.pkg Installer. After that you install the MySQL.prefPane which allows you to start and stop the MySQL Server comfortably from the System Preferences (for some reason the prefPane is still in 32bit but that won’t bother us now).

3. Go into terminal and install the mysqlplus gem:

sudo gem install mysqlplus

4. That’s it!

It seems a bit crazy that I spend hours figuring that out but basically the key to success is mysqlplus here. I tried all kinds of combinations with the official MySQL 5.1/5.4, XAMPP’s MySQL, MacPorts MySQL and the standart mysql gem but none worked. Sometimes I got the mysql gem to compile and install but then rails still couldn’t connect to the database… However, now it works and I’m glad things can go on!

November 12, 2009 at 6:33 pm


I have been using Google Wave for a couple of weeks now in it’s private developer preview. It’s already working quite well in most scenarios and I’m actively using it to collaborate on 4 projects I’m working on right now.

It’s really a relief to keep my email inbox a little tidier this way but on the other side it looks like it won’t take long until my Wave inbox is full of stuff. Another downside of Wave is that people you work with have to actively check their Wave Accounts regularly. Everybody is used to check their emails daily, but Wave is a whole new story. And the motivation to check Wave is quite low as long as you don’t have any serious projects going on in it. So using it to contact people you have seen on Wave once often ends up in no response until you ask the person to check his Wave via email/IM.

But all over it seems to be a great way to collaborate with people in one unified place.

Yesterday I got some new Google Wave Invites to give away. So if you want to give Google Wave a test ride give me a shout!

« Newer PostsOlder Posts »