New Look
A few days ago, I posted about hating the colors and look of my site. Well, I finally sat down and made some changes. I think it looks cleaner and simpler now.
Posted on 01:41AM on 02/14/2009
Tags: rant, blog
This is just a rant. I'm not a web designer by any stretch of the imagination. When I first built this site I thought that the orange-y/red looked ok. In truth, it's that color because that's the color of the tab images! I no longer like it, though. It must (and will) be changed!
No comments have been posted.
Posted on 03:25PM on 10/23/2008
Tags: Akismet, blog
I decided today that I wanted to incorporate Akismet functionality into this site. I do currently use Captchas as a way to ensure that only real comments get submitted, but Akismet seems to provide an extra layer of security. Plus, I was bored ;)
What is Akismet? According to the site:
"When a new comment, trackback, or pingback comes to your blog it is submitted to the Akismet web service which runs hundreds of tests on the comment and returns a thumbs up or thumbs down."
Pretty cool.
There are plenty of plugins and libraries for Akismet, but not one specifically for Sinatra, which is what this site is built on. I decided to use Ruby Akismet API, by David Czarnecki. It's a nice, simple, small library that does what I need. Basically, it posts data to the Akismet API and returns true if the comment has been evaluated as spam.
So my controller action looks more or less like this now:
post "/blog/create/comment/:slug" do
@post = Post.find_by_slug(params["slug"])
raise_post_not_found(params["slug"]) unless @post
@comment = Comment.new(params[:post])
errors = @comment.validation_errors || []
unless Captcha.valid?
errors << "Invalid captcha. Please try again."
end
unless AkismetWrapper.valid?(@comment, {
:ip => user_ip, :referrer => user_referrer, :user_agent => user_agent}
)
errors << "Your comment appears to be spam. Please try again."
end
if errors.empty?
@comment.save
redirect "/blog"
else
@errors = errors.join("<br />")
erb :new_comment
end
I created a module called AkismetWrapper simply because I didn't want to use the Akismet API class directly from my controller code. Additionally, it'll help me with testing since I can just stub the method on the simple wrapper module.
So now I've got a dual layer of protection: Captchas and Akismet. Is it necessary? I don't know. Did I learn something from it? You bet! That's all I really set out to do anyway.
Posted at 04:34PM on 10/24/2008 by Matt
My bad - there was a bug in the comments submission code (how ironic) which hopefully now been fixed. Thanks to Carl Mercier for letting me know.
Posted on 09:14PM on 09/13/2008
Tags: search, blog
As per my last post, I've decided to turn on fulltext indexing on post columns within MySQL. This seems like the lowest overhead solution and appears to work well.
No comments have been posted.
Posted on 01:27PM on 08/31/2008
Tags: browser, blog
I noticed when viewing this site in IE 7 that the tabs at the top of the page were not properly aligned. They look good in Firefox (on Ubuntu) and Konqueror, but not IE 7. Big suprise, right? Anyway, the easiest thing to do is create a stylesheet specifically for IE that overrides the existing styles and is only loaded when the requesting browser is IE. The conditional code can be placed in the header section of the layout file. For example:
This seems simplest. If the browser is IE, the additional stylesheet will be loaded and the styles will be properly overriden. Is there an easier way to accomplish this?
No comments have been posted.

Posted at 07:04AM on 03/07/2009 by Matt Payne
Good job. I like this a lot better.