Impressum / Imprint

If you can read this...

Posted on September 13, 2006

you’re looking at my brand new installation of Mephisto,

Choosing between upgrading my rather old, memory-hogging Typo installation to the latest release and trying out the hot new Mephisto blog was not that hard I must admit. Hope not much data has been lost. I didn’t transfer any files I uploaded to Typo yet, but everything else should be in place.

Integrating acts_as_ferret for full text search was dead simple, I’ll write about this later. I also use the search to handle the old, now invalid typo perma links. Just try it out!

Acts_as_ferret 0.2.1

Posted on May 23, 2006

As Kasper Weibel already pointed out, we’re proud to announce the release of the acts_as_ferret Rails plugin, version 0.2.1.

I’ve already mentioned the major new feature, the ability to run More Like This queries, in an earlier post. With those you can query your index for objects having similar contents like a given object.

Besides that, the biggest change is the switch from Ferret 0.3.2 to the 0.9 series as the suggested Ferret version to use. Until now, 0.9.x support was somewhat rough, this should be better now. Version 0.2.1 is meant to be fully compatible with Ferret 0.9 (this is valid for both the Ruby-only and the super fast C-version).

The last release of acts_as_ferret supporting Ferret 0.3.2 has been tagged as 0.2.0 in the SVN repository. Feature-wise both versions, 0.2.0 and 0.2.1, are equal.

In an effort to bring on some more documentation for acts_as_ferret, I detailed the steps I took to integrate Ferret into my Typo installation.

Nice, isn't it ?

Posted on May 10, 2006

Tired of the stock Typo layout and colors I was looking for a fresh new look for this site. I found it on openwebdesign.org. Thanks go to Luka Cvrk, the initial creator of this design. I plan to further extend it with an alternative color scheme and a liquid variant.

Besides making a custom Typo theme from Luka’s design I upgraded to Typo svn trunk, and upgraded to the latest version of acts_as_ferret.

Acts_as_ferret now can do “More like this” queries, that is, for a given document from the index it can build a query returning similar documents from the same index. I use this on the Article pages (click any article headline on the front page to go there) to display a list of articles with similar contents in the red footer box. Works very well if there are enough documents with similar content, if not, the results are somewhat random. Maybe a lower limit on the score of search results could help here…

I’ll post a howto about integrating the latest acts_as_ferret into the latest Typo, soon. Promised ;-)

Automatic expiration of cached actions

Posted on January 21, 2006

last.fm offers various Webservices to retrieve data like the most recently played tracks or your personal top ten. Nice I thought, finally there is a way to provide the three people interested in my music listening habits with the information they want :-)

To make it even easier to let people know you’re Britney Spears’ biggest fan, Typo even comes with a sidebar plugin that displays your recent tracks list from last.fm.

Unfortunately, with page caching turned on this is somewhat pointless as the list will be statically rendered into each page until the next blog post, when the page cache is flushed.

So I was looking for another solution and came up with a separate controller containing an action that only renders the recent tracks list you see at the end of the sidebar. This action is embedded into the page with a render_component call in my theme’s default.rhtml. Right after that call there is some Javascript that updates the playlist whenever somebody views a page.

Not very exciting so far. But I didn’t want to query the Audioscrobbler API on every page hit. The average audio track lasts around 3 or 4 minutes, and that’s how long I wanted to stay the cached playlist around, too.

The usual Rails solution to problems like this seems to be a cron job which regularly deletes cache files, triggering regeneration of the content. This is acceptable for wiping out cached pages once a day or every hour, but when it comes to different life times for different cached actions cron doesn’t fit. Imho.

What I wanted in my controller was something like

1
caches_action_for :audioscrobbler => 3.minutes

Acts as ferret, continued

Posted on January 10, 2006

In my last post I forgot to mention how to create the initial ferret index. I have a little script for this in vendor/plugins/acts_as_ferret:

1
2
3
4
5
6
7
8
9

require 'ferret'

index = Ferret::Index::Index.new( :path => "#{RAILS_ROOT}/index/contents", :create => true )

Content.find_published.each { |content| index << content.to_doc }
index.flush
index.optimize
index.close

Calling this with


RAILS_ENV=production script/runner 'require "vendor/plugins/acts_as_ferret/rebuild_index"'

will rebuild the index from all existing Articles, Comments and Pages in your production database.

Acts as ferret

Posted on January 10, 2006

ferret Feeling the urgent need to try out David Balmain’s Ruby port of the famous Lucene search engine I integrated Ferret into this Typo installation.

“Nice, but this works exactly like the original MySQL based search.”

Well, nearly. Thanks to Typo, all Contents (Blog Articles, Comments to Articles and so called Pages) share a common base class, Content. And that’s where we hook in Ferret. So ferret not only finds articles matching your queries, but pages and articles where only a comment matches, too. Not to mention the mighty Ferret Query Language ;-)

If you think that’s worth some minutes of work, read on.

New year, new blog or: Typo upgrade woes

Posted on January 05, 2006

To give this site some more features (say, tags and typo managed content besides blog articles), I decided it was time to give my old Typo 2.0.6 installation an update.

I intended to migrate my contents step by step and switch over after that, but after upgrading my server to Rails 1.0 the old Typo didn’t run anymore. So here it is, default skin but at least the blog content is converted.

Migrating the database from Typo 2.0.6 to Typo trunk hasn’t been as easy as I thought, because Migrations just don’t work when they use ActiveRecord model classes which are seriously refactored in later revisions. In the case of Typo some unification of pages, articles and comments into one table, contents, was introduced. This broke any Migration created before this step, since the contents table will only be created by a later Migration, but the article, comment and page classes depend on this table.

To work around this, one has to check out each single revision up to the wanted one, running rake migrate everytime. Of course this could be scripted, but nice solutions don’t look like that…

I simply didn’t feel like messing around with the migrations any longer, so I wrote a little script to transfer the contents of my Typo 2.0.6 db into the new Typo’s database.

As everybody seems to be tagging everything these days, it converts existing article categories into tags if you tell it to do so.

Greetings from Ecuador

Posted on October 21, 2005

My little sister went to Ecuador this week. Being a good brother I set up a Photo Blog for her, to make it easy keeping her friends and family up to date.

The Blog is Typo powered, of course. Thanks to the beauty of Ruby, Rails and the Typo code it wasn’t much work to hack simple image upload capabilities (including scaling/rotating with RMagick) into it.

Next will be the possibility to have english translations of articles.

Going Ruby

Posted on June 07, 2005

This site is now Ruby powered. More specifically, Typo powered.

So now I have a Blog. Nearly everybody seems to have one these days, I simply couldn’t longer resist this trend :-)

The more or less static content in the other sections is now kept in text files written using the very readable Markdown syntax . They are rendered to HTML using BlueCloth and a custom Rails controller I integrated into Typo. Nice exercise in the process of learning Ruby On Rails.