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 ;-)

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,

Swiftfox + Flash (under 64bit Hardy)

Posted by John
on Thursday, 02 October 2008

Swiftfox is like Firefox, but hellishly optimized for your Linux build, you can get it from...

  • Go here
  • Then download the installer right for your build (if 64-bit, download Athlon 64)

Once downloaded, navigate to the download in Terminal and do,

sudo sh install-swiftfox.sh
Flash

Now to get Flash running first check the ~/.mozilla/plugins directory exists on your machine, if not create it...

mkdir ~/.mozilla/plugins

Adobe only provide it as a 32-bit library but with the necessary dependency you can support it so run...

sudo aptitude install nspluginwrapper

Once you've got that you should be capable of handling the 32-bit Flash player,

...grab Flash from here

Download the .tar.gz version, extract it to your desktop, then move the libflashplayer.so into the ~/.mozilla/plugins directory,

sudo mv ~/Desktop/install_flash_player_9_linux/libflashplayer.so  ~/.mozilla/plugins

And finally restart Swiftfox, navigate to a flash video here and enjoy faster browsing with Swiftfox + Flash!

Aptana on Eclipse 3.2 Hardy

Posted by John
on Monday, 29 September 2008

Had some problems installing the Aptana plugin into Eclipse 3.2 on Hardy,

sudo aptitude install eclipse

Then,

sudo apt-get autoremove --purge gcj-4.2-base

Replace,

sudo aptitude install Sun-Java6-jdk

Then install remotely as normal

Fedora 9 wifi + flash on 64bit

Posted by John
on Monday, 14 July 2008

After getting back from vacation in Vegas I decided I needed to sort my laptop out once and for all. So partitioned the drive in two, one with Vista Ultimate and one with Fedora 9.

On top of this I really wanted the Fedora partition to be encrypted and using LVM so I can resize later, glad I did that.

However in all I had two problems along the way,

Fedora 9 Wifi doesn't support TKIP

The first thing which I couldn't fix was the Wifi. I was using WPA+TKIP which is available in the network configuration panel, all good but everytime I tried to connect it'd popup the password entry screen again; really annoying.

Thankfully I found the reason to this, Fedora 9 does not support TKIP even though it's available in the control panel; switching to WPA+AES clears that problem.

Just wish they documented that better ;-)

32-bit Flash on a 64-bit build

Adobe released the Flash 9 libraries to the linux community but only as 32-bit binaries, I installed Fedora using the 64-bit build so with some tweaking managed to fix that too.

In Terminal do:

su -c 'rpm -Uvh http://linuxdownload.adobe.com/adobe-release/adobe-release-i386-1.0-1.noarch.rpm'
su -c 'yum install flash-plugin'

Now specifically for 64-bit Fedora builds do:

su -c "yum -y install nspluginwrapper.{i386,x86_64} pulseaudio-libs.i386 libflashsupport.i386"
su -c 'mozilla-plugin-config -i -g -v'

Afterwards close & reopen Firefox and you should now have Flash 9 running on your Fedora 9 64-bit desktop.