Archive

Archive for August, 2006

CentOS 4.4 Out Today

August 30th, 2006 mike Comments off

centos_logo_45.png

It’s not up on their website yet, but all of our CentOS servers just upgraded themselves to 4.4

You might want to look into that if you want to wait a while before upgrading :-)

Categories: Linux Tags:

Quick Rails Scoping by User via meantime_filter

August 30th, 2006 mike Comments off

Roman Le Negrate has written an excellent Rails plugin called meantime_filter.

In your Rails controllers, if you find yourself doing this for half of your actions you know something isn’t right:

def list
    @note = note = Note.find(:all,
       :conditions => ["user_id = ?", params[:user_id]])
end

You know you’ve been sitting there thinking “This isn’t DRYish”. Now I made this particularly simple to show the point, but it’s ugly any way you slice it as you get more complicated methods in your controllers.

The around filter is the standard way to handle this but it doesn’t work very cleanly with with_scope blocks.

meantime_filter to the rescue.

Install it by:

cd <railsproject>
cd vendor/plugins
wget http://roman2k.free.fr/rails/meantime_filter/0.1.1/\
plugin/meantime_filter-0.1.1.tar.gz
tar -xzvf meantime_filter-0.1.1.tar.gz
rm meantime_filter-0.1.1.tar.gz

Now you can do:

class NoteController < ApplicationController

    meantime_filter :restrict_note_to_user

    def list
        @note = Note.find(:all)
    end

    private

    def restrict_note_to_user
        Note.with_scope(:find =>
                    {:conditions =>
                    ["user_id = ?", session[:user_id]]}) do
            yield
        end
    end
end
Categories: How-To, Rails, Ruby Tags:

Better Japanese fonts in Firefox on Ubuntu

August 29th, 2006 mike Comments off

We know that Ubuntu Linux has great support for non english languages. I do quite a bit of Japanese work on my trusty old Ubuntu Thinkpad. The Japanese fonts have always displayed in Firefox but they lack the prettyness that Firefox on my Mac manages to produce.

After playing around for a while, I found that the fonts installed to pretty things up were in fact there, I just needed to select the ones I liked. I settled on:

shot2.jpg

This produces nice outputs like this:

shot1.jpg

Categories: How-To, Linux Tags:

What to do when you’re 7th in line…

August 16th, 2006 mike Comments off

In the next week or so (okay, like a month realistically), we’re going to be releasing some open source appliance based software and some screencast tutorials on how you can build your own. We’re using a public distributed build system which is sooo cool until on a busy afternoon you get:

7th_in_line.jpg

At 20 minutes a piece, I’ve got a couple of hours to burn. It would really suck if we had a deadline to meet or if it threw an error like:

error:
The following troves in the following groups have conflicts:

group-appliance-base:
  The following 2 troves share 3 conflicting paths:

    Troves:
      distro-release:...

    Conflicting Files:
      /etc/issue.net
      /etc/distro-release
      /etc/issue

and we had to restart the build. Not that we’d ever have errors in our code or anything. I think tutorial #2, after #1’s “how to build an appliance in 30 mins” will be “how to debug your code locally before sending it to the build system” :-)

Categories: Linux, Programming, Random Cool Stuff, Rants Tags:

What to do when you’re 7th in line…

August 16th, 2006 mike Comments off

In the next week or so (okay, like a month realistically), we’re going to be releasing some open source appliance based software and some screencast tutorials on how you can build your own. We’re using a public distributed build system which is sooo cool until on a busy afternoon you get:

7th_in_line.jpg

At 20 minutes a piece, I’ve got a couple of hours to burn. It would really suck if we had a deadline to meet or if it threw an error like:

error:
The following troves in the following groups have conflicts:

group-appliance-base:
  The following 2 troves share 3 conflicting paths:

    Troves:
      distro-release:...

    Conflicting Files:
      /etc/issue.net
      /etc/distro-release
      /etc/issue

and we had to restart the build. Not that we’d ever have errors in our code or anything. I think tutorial #2, after #1’s “how to build an appliance in 30 mins” will be “how to debug your code locally before sending it to the build system” :-)

Categories: Linux, Programming, Random Cool Stuff, Rants Tags:

What to do when you’re 7th in line…

August 16th, 2006 mike Comments off

In the next week or so (okay, like a month realistically), we’re going to be releasing some open source appliance based software and some screencast tutorials on how you can build your own. We’re using a public distributed build system which is sooo cool until on a busy afternoon you get:

7th_in_line.jpg

At 20 minutes a piece, I’ve got a couple of hours to burn. It would really suck if we had a deadline to meet or if it threw an error like:

error:
The following troves in the following groups have conflicts:

group-appliance-base:
  The following 2 troves share 3 conflicting paths:

    Troves:
      distro-release:...

    Conflicting Files:
      /etc/issue.net
      /etc/distro-release
      /etc/issue

and we had to restart the build. Not that we’d ever have errors in our code or anything. I think tutorial #2, after #1’s “how to build an appliance in 30 mins” will be “how to debug your code locally before sending it to the build system” :-)

Categories: Linux, Programming, Random Cool Stuff, Rants Tags:

If a picture is worth a thousand words…

August 16th, 2006 mike Comments off

peepcode imagethen showing something via a screencast has to be worth so much more.

Geoffrey Grosenbach of Topfunky has started a new program called Peepcode. For those who don’t know, Geoffrey is the host of the Ruby on Rails podcast.

Following the popularity and effectiveness of the Rails screencasts, Geoffrey has launched this endeavor in his usual matter of fact manner. Geoffrey excels at plain spoken explanations and his first foray into the screencast tutorial business is a great example of this.

Categories: Programming, Rails, Reviews Tags:

You want to make money don’t you?

August 11th, 2006 mike Comments off

Yesterday, a colleague, if you can call him that, approached me with a proposition. “Why don’t you sell xxxx?” He asked. I thought about it for half a second and replied

“Well because it’s boring, and doesn’t work very well. People buy it because that’s what they’ve always used.”

“But it’s easy to sell” he replied, strangely proud of his answer.

“But it really kinda sucks” I said.

“But you can make money selling it. All you need is to get certified, then you can start making money selling it”

“Did you hear what I said about the ‘it sucks’ part?”

“But who cares if it sucks if you can make money at it?”

“You seriously came all this way out here to meet with me for this?”

“Don’t you want to make more money?”

“Yes, money good, selling crap to make money—bad”

True story.

Categories: Rants Tags:

You want to make money don’t you?

August 11th, 2006 mike Comments off

Yesterday, a colleague, if you can call him that, approached me with a proposition. “Why don’t you sell xxxx?” He asked. I thought about it for half a second and replied

“Well because it’s boring, and doesn’t work very well. People buy it because that’s what they’ve always used.”

“But it’s easy to sell” he replied, strangely proud of his answer.

“But it really kinda sucks” I said.

“But you can make money selling it. All you need is to get certified, then you can start making money selling it”

“Did you hear what I said about the ‘it sucks’ part?”

“But who cares if it sucks if you can make money at it?”

“You seriously came all this way out here to meet with me for this?”

“Don’t you want to make more money?”

“Yes, money good, selling crap to make money—bad”

True story.

Categories: Rants Tags:

You want to make money don’t you?

August 11th, 2006 mike Comments off

Yesterday, a colleague, if you can call him that, approached me with a proposition. “Why don’t you sell xxxx?” He asked. I thought about it for half a second and replied

“Well because it’s boring, and doesn’t work very well. People buy it because that’s what they’ve always used.”

“But it’s easy to sell” he replied, strangely proud of his answer.

“But it really kinda sucks” I said.

“But you can make money selling it. All you need is to get certified, then you can start making money selling it”

“Did you hear what I said about the ‘it sucks’ part?”

“But who cares if it sucks if you can make money at it?”

“You seriously came all this way out here to meet with me for this?”

“Don’t you want to make more money?”

“Yes, money good, selling crap to make money—bad”

True story.

Categories: Rants Tags: