Archive for the ‘Programming’ Category

Igniting Phoenix Developers

Developer Ignite Phoenix is an event hosted by Intel following the same format as O’Reilly’s Ignite events. Each speaker has 5 minutes to talk about the contents of their 20 slides. What’s different about this event? It’s all about the technology, baby!

Come see my partner at Flatterline, Chris Chandler, speak about cryptography.

Read the rest of this entry »

Monitoring Thin using God, with Google Apps Notifications

We’ve been using God to monitor our Thin processes on Freebootr and set it up to notify us through our Google Apps account. Thought our God config file might be useful to anyone trying to use God with Thin and Google Apps.
Thin configuration

# == God config file
# http://god.rubyforge.org/
# Authors: Gump and michael@glauche.de
#
# Config file for [...]

Read the rest of this entry »

Installing aspell and raspell for Ultrasphinx

We’ve been playing around with the Sphinx full-text search engine and Ultrasphinx, the Ruby on Rails configurator and client to the Sphinx full text search engine. Sadly, it was giving us a warning about spell checking:
ultrasphinx: spelling support not available (raspell configuration raised “uninitialized constant Ultrasphinx::Spell::Aspell”)
This is pretty easy to get rid of, though. You [...]

Read the rest of this entry »

Error after upgrading SliceHost

If you happen to see this error after upgrading your SliceHost account, be calm.

ActionView::TemplateError (Define INLINEDIR or HOME in your environment and try again)

The simple solution is to add an environment declaration to your environment/production.rb file:

ENV['INLINEDIR'] = ‘/path/to/.ruby_inline’

Once that was set, we were in business again… whew!
References
Here’s a relevant reference that took a while to [...]

Read the rest of this entry »

Quick Tip: Setting an SPF record

I recently noticed a lot of rejected emails coming from a production app that had just switched to send mail through Google Apps. For some reason Google felt we might be spammers, so it began rejecting our emails out-of-hand. We would continuously get the following error message:

Technical details of permanent failure:
Message rejected. See http://mail.google.com/support/bin/answer.py?answer=69585 [...]

Read the rest of this entry »

Quick Tip: Rails 2.1 Time Zones

My last quick tip involved setting your time zone in Ubuntu Hardy, so now, how do you set your time zone in a Ruby on Rails application? Rails 2.1 makes it much easier to manage time zone settings than it was previously.
Add the following to your environment configuration file:
config/environment.rb

config.time_zone = ‘Arizona’

Replace Arizona with your own [...]

Read the rest of this entry »

Quick Tip: Setting time zone on Ubuntu Hardy

I’ve been pretty enamored with SliceHost recently. They make it very easy to setup a slice, configure it and get your product deployed quickly (I’m down to 30 min). I hadn’t noticed until just recently that I’ve never set a time zone on any slice I’ve configured. So, here’s how you do it, simple and [...]

Read the rest of this entry »

Nginx 405 Not Allowed Error

405 Not Allowed
So, I got this error today and it took me a few minutes to track down why. Seems like the kind of thing that might be interesting to people. I’m using nginx on a project and this error was being thrown by nginx, not by Rails. What could be the cause?
Nginx configuration [...]

Read the rest of this entry »

Quick Tip: Form Partials

Partials are a great way to keep your view code separated logically. Prior to Rails 2.1 if you wanted to reuse a form partial in, for example, a new and edit view, then you needed to pass the form into the partial somehow.
Given the following form partial:
views/users/_form.html.erb

<div>
<%= form.label :name -%>
<%= [...]

Read the rest of this entry »

Quick Tip: named_scope

Have you ever found yourself writing queries like this?

User.find(:all, :conditions => ['state = ? AND created_at > ? AND created_at <= ?', 'active', start_date, end_date], :limit => 5)

I suppose you could refactor this into a custom finder that did the heavy lifting for you…

User.find_all_active_in_date_range(start_date, end_date)

But what if you need that same query where the state [...]

Read the rest of this entry »