Free Up Resources on Your Drupal Web Server

If you're not using the InnoDB engine in your MySQL databases, make sure its disabled in your my.conf by uncommenting or adding the skip-innodb directive. This simple change can free up some precious resources since MySQL is now only required to start up one engine.

Before I turned off the InnoDB engine my memory footprint looked like this:

             total       used       free     shared    buffers     cached
Mem:          1022       1012         10          0        133        673
-/+ buffers/cache:        205        817
Swap:         2047          0       2047

After I turned off InnoDB an restarted MySQL...

             total       used       free     shared    buffers     cached
Mem:          1022        982         39          0        133        676
-/+ buffers/cache:        172        849
Swap:         2047          0       2047

That small change saved me 33MB of memory. Thats about 3% of the 1GB I have on my small VPS.

Drupal Upgrade - 5.7 to 6.3 - Flawless!

Upgrading software, especially web-based software, has always had a negative stigma in my eyes. Working in the industry, I've seen the problems that arise, the headaches it can cause, and the many hours of sleepless nights that result. So, naturally, I've put off upgrading my 5.x install of Drupal - which runs this site - as long as possible. With the announcement of 6.x release candidates for Views and CCK, I figured the time had come.

It wasn't that long ago that it seems I was pushing to 5.x from 4.7.x, and boy did I screw that one up! I don't remember exactly what I did, but I remember it turning into a copy and paste job of my blog posts. This isn't a rag on Drupal, because I will admit I didn't RTFM. I'm sure that had I done my due diligence it would have went a lot smoother.

So, for this upgrade I decided to RTFM. And, guess what? The upgrade went off without a hitch. All my nodes, terms, blocks, and even some contrib module settings are perfectly intact. I've also found a shiny new 6.x theme which I find easy on the eyes.

So cheers to all the developers who put many tireless hours into D6, and I look forward to seeing exciting new things in D7!

Compiling PHP5 with IMAP support on OS X Leopard

This really shouldn't have been that hard, but it took quite a bit of searching and playing around to finally get this to work.

I started at PHP's IMAP web page which informed me that the first thing I needed to do was grab the c-client libraries and compile it. You can find these here: ftp://ftp.cac.washington.edu/imap/.


cd /SourceCache
curl -O ftp://ftp.cac.washington.edu/imap/c-client.tar.Z
tar -xzvf c-client.tar.Z
cd imap-2007a
sudo make oxp
sudo mkdir /usr/local/imap-2007h/lib
sudo mkdir /usr/local/imap-2007h/include
cp imap-2007a/*.h /usr/local/imap-2007a/include
cp imap-2007a/*.c /usr/local/imap-2007a/lib
cp c-client.a /usr/local/imap-2007a/lib/libc-client.a

When Apple built Leopard they forgot to include the MySQL header files, but were kind enough to offer them up for download at http://www.opensource.apple.com/darwinsource/other/. Download the MySQL binaries, untar and follow the instructions in the README. Its very simple.

Finally...

Is it Christmas?

Can't stop laughing at this...

Yes, I admit, I subscribe to icanhascheezburger.com via RSS and spend five or ten minutes a day laughing at the hilarity (IMO) that these guys come up with. But there was one post last week that I'm continually going back to that makes me laugh hysterically. So, I thought I'd share...

Horse in Car - icanhascheezburger.com

Poor kid. He'll probably never get on a horse/mule again.

Capistrano Meets Drupal

There are some very trivial administration tasks that I find myself doing over and over again in Drupal which can't currently be done from the admin interface. As of right now, these include installing a theme or module from drupal.org or adding a new site to an existing Drupal install. So, I've built a tiny Capistrano file that allows me to automate these tasks.

The tasks that I've setup are:

cap drupal:install:theme
cap drupal:install:module
cap drupal:install:site

cap drupal:install:theme

All this task requires is a path to the tar file of the theme that you want to install. What I do is browse over to the list of Drupal themes, find one that I want to try out, and copy the location of the "Download" link for the correct theme. In Firefox and Safari its as simple as right clicking the link and selecting "Copy Link Location". Make sure the version of the theme corresponds to the version of Drupal you have installed.

Once you've got the location to your theme copied, run the task with cap drupal:install:theme. It will ask you for the path to the theme location which you can then paste in. That's it. You should be able to browse to admin/build/themes and see your newly installed theme.

Rails' observe_field with :on - Rails 2.0

In a previous post I showed how to get around a bug in Prototype that was ignoring the "on" parameter of the observe_field function. The solution I originally posted no longer works with the latest version of Rails and Prototype. Although the documentation for observe_field received a facelift, somehow the Rails team still missed the fact that the :on function doesn't work with the current version of Prototype. Or maybe its the Prototype guys we should be after here. :-)

The new fix requires a change to both prototype.js and a small Rails core update.

I will start with the update to prototype.js. Search for Abstract.EventObserver (around line 3632 in my version). That should now read

Abstract.EventObserver = Class.create({
  initialize: function(element, callback, trigger) {
    this.element  = $(element);
    this.callback = callback;
    this.trigger = trigger;

    this.lastValue = this.getValue();
    if (this.element.tagName.toLowerCase() == 'form')
      this.registerFormCallbacks();
    else
      this.registerCallback(this.element, this.trigger);
  },

  onElementEvent: function() {
    var value = this.getValue();
    if (this.lastValue != value) {
      this.callback(this.element, value);
      this.lastValue = value;
    }
  },

  registerFormCallbacks: function() {

Want an iPhone for Christmas?

Integrum held their annual Christmas party this past Saturday. We all had a great time and were shocked at the end of the night by a surprise iPhone gift from Jade.

Being that I already have an iPhone, I've decided to raffle mine off and use the money from the raffle to buy clothing and supplies for HomeBase Youth Services, a non-profit agency that helps homeless and at-risk youth (under 21) in Arizona.

So, on with the sales pitch... Please join me in supporting HomeBase by visiting appleiphoneraffle.com to get details on how you can purchase your tickets to win this great phone. Its an 8GB and its still in the shrink wrap - so don't waste any time people.

The drawing will be held on Tuesday, December 18th and results will be posted on the raffle website.

Its Going to Snow ... in Phoenix!

At least according to my weather widget...

snowing in phoenix

Drupal and Ruby on Rails

Because I'm a fan of both Ruby on Rails and Drupal (yes, Drupal uses PHP), I get a surprising number of visits to my website each day from Google searches that include some combination of the two as keywords. I find this strange because if you know either of the two, you know that they're in two totally separate worlds.

Drupal doesn't expose any kind of API (besides RSS feeds) that Rails could take advantage of, nor does it make sense to create one.

Since Drupal uses PHP, you can't create module for it in Rails. The only way I could possibly think to marry the two would be to create a module that simply puts an iframe on the page and loads it with your Rails app. In fact, it doesn't even have to be a module. It could be a simple page you create with an iframe pointing to your Rails app.

But why in the hell would anyone want to do this? I guess I'm a little short sighted on this issue right now as its hard to see where the two would play nicely with each other, or why you would want them to. If you want to extend Drupal, use PHP. If you want to use Rails, look at Mephisto or Radiant CMS and extend either of those.

Syndicate content