The hard drive died in the MythTV at my parents’ house today. Bad.
The 4GB memory upgrade from Crucial for my MacBook arrived today. Good.
These two things average out. Meh.
The hard drive died in the MythTV at my parents’ house today. Bad.
The 4GB memory upgrade from Crucial for my MacBook arrived today. Good.
These two things average out. Meh.
“If man is not governed by God, he will be ruled by tyrants.” — William Penn
Are you a Ruby developer working in the Triangle? Are you registered for the RubyRX conference next weekend? If not, hop over to the Terralien blog to find out why you should come, then get registered!
The talk I’ll be giving at RubyRX is titled “Homesteading: The New Entrepreneurial Model.” Many years ago a community would come together to help a neighbor get started building a house. They’d all pitch in, knowing that when they needed help, those same friends would come to their aid as well. This model of community self-sufficiency has been recycled in the software world.
In this talk we’ll discuss how I’ve been using the homesteading model to build products with Ruby, and how others are doing the same. You’ll get enough of a grounding to move forward on your own, or help someone else while you learn more.
We’re going to have a great time at RubyRX. If you’re not planning on attending RailsConf or RubyConf this year, this may be your only chance to experience some expert teaching on Ruby. Best of all, it’s right in your backyard. Don’t miss it!
“When after having thus successively taken each member of the community in its powerful grasp and fashioned him at will, the supreme power then extends its arm over the whole community. It covers the surface of society with a network of small complicated rules, minute and uniform, through which the most original minds and the most energetic characters cannot penetrate to rise above the crowd.
“The will of man is not shattered but softened, bent, and guided; men are seldom forced by it to act, but they are constantly restrained from acting. Such a power does not destroy, but it prevents existence; it does not tyrannize, but it compresses, enervates, extinguishes, and stupefies a people, till each nation is reduced to nothing better than a flock of timid and industrial animals, of which government is the shepherd.
“I have always thought that servitude of the regular, quiet, and gentle kind which I have just described might be combined with some of the outward forms of freedom and that it might even establish itself under the wing of the sovereignty of the people.”
— Alexis de Tocqueville, Democracy in America (1835)
“In the first place, we should insist that if the immigrant who comes here in good faith becomes an American and assimilates himself to us, he shall be treated on an exact equality with everyone else, for it is an outrage to discriminate against any such man because of creed, or birthplace, or origin. But this is predicated upon the person’s becoming in every facet an American, and nothing but an American… There can be no divided allegiance here. Any man who says he is an American, but something else also, isn’t an American at all. We have room for but one flag, the American flag… We have room for but one language here, and that is the English language… and we have room for but one sole loyalty and that is a loyalty to the American people.” — Teddy Roosevelt, 1907
Can Sphinx and foxy fixtures place nicely together? Due to the way Sphinx indexing works, foxy fixtures will often slow down the indexing process drastically. This article explains how to overcome this limitation.
<% @categories.in_groups_of(2).each do |group| %>
<tr>
<% group.each do |category| %>
<td><%=h category.name %></td>
<% end %>
</tr>
<% end %>
What are you staring at? Move along, move along.
Many Rails plugins require that certain files like images, CSS, and JavaScript get copied to the public folder during installation. The typical way to do this is add code to install.rb, which then gets executed when you first install the plugin in your Rails project. What happens when the assets in a plugin you’re using change, though? You end up having to manually copy files around anytime the plugin gets updated, which is an extremely error-prone process.
I extracted asset_copier from an existing Terralien project. It fixes this problem beautifully. Once installed, it keeps the assets in your Rails project synchronized with your plugin. It even deletes assets from the Rails project that have been removed in the plugin.
To learn more, check out this post. If instant gratification is more your thing, install the gem directly and apply it to your target plugin:
sudo gem install pelargir-asset_copier --source=http://gems.github.com cd ~/some_rails_project script/generate asset_copier some_plugin
I’m in the middle of developing a Radiant extension for Terralien. Radius is the tagging language for Radiant, and today I figured out how to use a route from inside a custom tag class.
A typical Radius tag class might look like this:
module AwesomeTags
include Radiant::Taggable
tag "session:logout" do |tag|
"Logout"
end
end
You can see that the hard-coded URL isn’t exactly DRY. I’ve already defined a route for it. Why should I have to hard code it here? The solution:
module AwesomeTags
include Radiant::Taggable
include ActionController::UrlWriter
default_url_options[:host] = REGISTRY[:host]
tag "session:logout" do |tag|
"Logout"
end
end
Note that UrlWriter needs to know the host name to base its URLs off of. The host name gets set using the registry pattern. It will be different depending on whether the app is running in development or production mode.
The same method can be used to reference routes from inside ActiveRecord models.
“We have no government armed with power capable of contending with human passions unbridled by morality and religion. Avarice, ambition, revenge, or gallantry, would break the strongest cords of our Constitution as a whale goes through a net. Our Constitution was made only for a moral and religious people. It is wholly inadequate to the government of any other.” — John Adams