Installing Memcached on Debian Etch

Posted by John
on Tuesday, 02 December 2008

Unfortunately this takes a bit of work, the one in the etch repositiories is too old so you're going to have to build you're own sources and install manually.

Add Repository / Increase Cache Limit

So first off add the testing repository to your list of sources

cd /etc/apt
sudo nano sources.list

Then add the testing repository (here for the UK) and save the file

deb-src http://ftp.uk.debian.org/debian/ testing main

Now before you update your sources list increase the size of the package cache by,

nano /etc/apt/apt.conf

And add,

APT::Cache-Limit "16777216";

...now when you update your packages cache you shouldn't get an out-of-space error, finally update

sudo apt-get update
Build Packages

First create & move to your sources dir

mkdir /sources
cd /sources

Next grab the tools needed to compile the sources

sudo aptitude install devscripts

Next we'll check if we need anything extra for libevent

sudo apt-get build-dep libevent

And grab & build the libevent source

sudo apt-get source libevent
cd libevent-1.3e
sudo debuild -us -uc
cd ..

Then install libevent and it's development package

sudo dpkg -i libevent1_1.3e-3_amd64.deb
sudo dpkg -i libevent-dev_1.3e-3_amd64.deb

Next we'll test if there are any build dependencies for memcached

sudo apt-get build-dep memcached

Then grab & build the memcached source

sudo apt-get source memcached
cd memcached-1.2.2
sudo debuild -us -uc
cd ..

Finally install memcached

sudo dpkg -i memcached_1.2.2-1_amd64.deb

You should now have a working install of Memcached 1.2.2 on Debian Etch.

Ferreting Full Text Search

Posted by John
on Monday, 01 December 2008

Got the full-text searching working with the blogging engine, plus it's really fast using the Ferret gem and Will Paginate.

First grab the necessary gems,

sudo gem install ferret acts_as_ferret will_paginate

Then,

require 'will_paginate'
require 'acts_as_ferret'

Next up I defined the elements to search against in the target model (here app/model/article.rb)

acts_as_ferret :fields => [:title, :body, :cached_tag_list]

And then altered the search method to...

@articles = Article.paginate_search params[:search], :page => params[:page], :per_page => $blog.article_count

...you will need to add this class method to handle the pagination with Will Paginate

module ActsAsFerret
  module ClassMethods
    def paginate_search(query, options = {})
      page, per_page, total = wp_parse_options(options)
      pager = WillPaginate::Collection.new(page, per_page, total)
      options.merge!(:offset => pager.offset, :limit => per_page)
      result = find_by_contents(query, options)
      returning WillPaginate::Collection.new(page, per_page, result.total_hits) do |pager|
        pager.replace result
      end
    end
  end
end

...thanks to opensoul.org for this solution.

Works like a charm ;-)

Apple Mac Keys

Posted by John
on Wednesday, 26 November 2008

apple mac keys

  • use ALT+3 to get # (mac)
  • use Command+F12 to access FireBug in Firefox (mac)

64-bit Flash Player for Linux

Posted by John
on Thursday, 20 November 2008

A long time coming Adobe have finally released a 64-bit version of their Flash Player and it's for Linux.

It's in Alpha but reports suggest it's actually quite stable, so good news all around for us with 64-bit Ibex machines ;-)

You'll need to uninstall you're current Flash Player via either...

sudo aptitude remove flashplugin-nonfree

Or going into your ~/.mozilla/plugins directory and removing the old version.

To install simply download the tar file relevant to your distro, extract the plugin and drop it into your Firefox Plugins directory ~/.mozilla/plugins

Restart Firefox and you should be good to go,

Firefox Config

Posted by John
on Thursday, 20 November 2008

to access the Firefox Configuration area, type this into your address box and hit enter...

about:config

If you completely screw things up you can reset to the defaults by...

  • Start Firefox in Safe Mode
  • Check the Reset to Defaults box
  • Click the Make Changes and Restart button