Duff O'Melia

Davy Crockett and Ron Paul

When Davy Crockett served in the United States House of Representatives, a bill was proposed appropriating money from the public treasury for the widow of a distinguished naval officer. This bill was about to be passed when Crockett arose and argued against the bill:

“Mr. Speaker – I have as much respect for the memory of the deceased, and as much sympathy for the sufferings of the living, if suffering there be, as any man in this House, but we must not permit our respect for the dead or our sympathy for a part of the living to lead us into an act of injustice to the balance of the living. I will not go into an argument to prove that Congress has no power to appropriate this money as an act of charity. Every member upon this floor knows it. We have the right, as individuals, to give away as much of our own money as we please in charity; but as members of Congress we have no right so to appropriate a dollar of the public money. Some eloquent appeals have been made to us upon the ground that it is a debt due the deceased. Mr. Speaker, the deceased lived long after the close of the war; he was in office to the day of his death, and I have never heard that the government was in arrears to him. This government can owe no debts but for services rendered, and at a stipulated price. If it is a debt, how much is it? Has it been audited, and the amount due ascertained? If it is a debt, this is not the place to present it for payment, or to have its merits examined. If it is a debt, we owe more than we can ever hope to pay, for we owe the widow of every soldier who fought in the War of 1812 precisely the same amount. There is a woman in my neighborhood, the widow of as gallant a man as ever shouldered a musket. He fell in battle. She is as good in every respect as this lady, and is as poor. She is earning her daily bread by her daily labor; but if I were to introduce a bill to appropriate five or ten thousand dollars for her benefit, I should be laughed at, and my bill would not get five votes in this House. There are thousands of widows in the country just such as the one I have spoken of, but we never hear of any of these large debts to them. Sir, this is no debt. The government did not owe it to the deceased when he was alive; it could not contract it after he died. I do not wish to be rude, but I must be plain. Every man in this House knows it is not a debt. We cannot, without the grossest corruption, appropriate this money as the payment of a debt. We have not the semblance of authority to appropriate it as a charity. Mr. Speaker, I have said we have the right to give as much of our own money as we please. I am the poorest man on this floor. I cannot vote for this bill, but I will give one week’s pay to the object, and if every member of Congress will do the same, it will amount to more than the bill asks.”

Ron Paul currently serves in the House. When a bill was proposed to offer his friend Ronald Reagan the Congressional Medal of Honor, Paul arose and argued against the bill:

Mr. Speaker, I rise today in opposition to H.R. 3591. At the same time, I am very supportive of President Reagan’s publicly stated view of limiting the federal government to it’s proper and constitutional role. In fact, I was one of only four sitting members of the United States House of Representatives who endorsed Ronald Reagan’s candidacy for President in 1976. The United States enjoyed sustained economic prosperity and employment growth during Ronald Reagan’s presidency. I must, however, oppose the Gold Medal for Ronald and Nancy Reagan because appropriating $30,000 of taxpayer money is neither constitutional nor, in the spirit of Ronald Reagan’s notion of the proper, limited role for the federal government. Because of my continuing and uncompromising opposition to appropriations not authorized within the enumerated powers of the Constitution, I would maintain my resolve and commitment to the Constitution—a Constitution, which only last year, each Member of Congress, swore to uphold. In each of these instances, I offered to do a little more than uphold my constitutional oath. In fact, as a means of demonstrating my personal regard and enthusiasm for Ronald Reagan’s advocacy for limited government, I invited each of these colleagues to match my private, personal contribution of $100 which, if accepted by the 435 Members of the House of Representatives, would more than satisfy the $30,000 cost necessary to mint and award a gold medal to Ronald and Nancy Reagan. To me, it seemed a particularly good opportunity to demonstrate one’s genuine convictions by spending one’s own money rather that of the taxpayers who remain free to contribute, at their own discretion, to commemorate the work of the Reagans. For the record, not a single Representative who solicited my support for spending taxpayer’s money, was willing to contribute their own money to demonstrate their generosity and allegiance to the Reagan’s stated convictions.
It is, of course, very easy to be generous with the people’s money.

In both cases, our government officials were deciding whether to honor an American by appropriating funds from the US treasury to do so. In both cases, there was a lone voice of reason speaking against being “generous” with other people’s money. In both cases, the lone voice was willing to put up their own money for the cause. In both cases, not one of their colleagues was willing to do the same.

At least in Davy Crockett’s day, the bill didn’t pass.

Politicians and the IRS

Why is it that there aren’t more politicians like Ron Paul who would like to abolish the IRS and eliminate federal income taxes? Do Americans love paying federal income taxes? Do Americans enjoy filling out form after form in excruciating detail every year? How it the government’s business to know how we make our money?

Some have said that we can’t eliminate federal income taxes because then the government wouldn’t have the money it needs. Ron Paul has been talking about the surprising truth of the matter – the federal government obtains only 1/3 of its budget from federal income taxes. So if we cut spending by 1/3, we could eliminate the IRS. The next logical question is, how on earth will we cut the budget by 33%? Well, if we bring spending back to the level it was at it in the year 2000, that would be a 33% cut.

I’m not sure what’s more surprising – that we’d only have to turn the spending clock back by a few years, or that government spending has increased by SO MUCH in such a short time.

Custom Mephisto

I’ve really been enjoying Mephisto, the blogging software that’s running this site.

I wanted to create another blog for some reviews I’ve written. So I started with the standard Mephisto and chose a theme from a Mephisto theme gallery and things were looking pretty nice. Then I wanted to start making some customizations. I considered using the plugin system that ships with Mephisto but I thought I’d just opt for a completely custom system and see if it would be difficult to have complete flexibility.

It turns out that it was super cinchy to do. Mephisto is open source, and it’s a well-written rails app. The technology world sure is changing in some fascinating ways. When you put some things together like ruby, rails, open source, the mac, quicksilver, and textmate, things start to get pretty exciting for developers.

I’ve made a few customizations so far and I’m not sure if I’ll ever want to customize it further. For now though, it’s much easier to mark a review as thumbs up or thumbs down and it’s easy to specify an amazon url for a review and know that it’ll show up with the correct amazon associates url.

One of the many amazing things about Rails is that you can so easily sit down and completely modify a Rails app you’ve never seen before, primarily because the framework makes it painful to step outside convention. I couldn’t even imagine doing something like this in some of the other web frameworks out there.

Here’s what Revnut looks like so far.

Its a Free Country

When I was younger, it seemed like that was a commonly used statement. I don’t seem to hear it much anymore. Perhaps it’s just a phrase that’s no longer popular. Or perhaps we’re no longer free.

Andrew Napolitano gave a fascinating and entertaining talk at the recent Future of Freedom conference. In it, he details much of our history and how the government of the United States has gradually taken away our liberty. I never realized how truly frightening the Patriot Act is. Does giving up some liberty make us safer? This was an excellent talk.

You can also watch the video on the YouTube site if you’d like.

Soapadone

One of the businesses I’ve spent a good amount of time on is Soapadoo. A few days ago, the server that Soapadoo was hosted on had some issues in that suddenly some directories were missing. In working with the hosting provider, we weren’t able to determine the cause. It’s strange because the site had been running for about a year and nothing like this issue had ever happened before.

It would probably take me about a day to recover from the server issue and institute an improved backup system taking into account the lessons learned in the incident. As I started on that work, I started to think about whether the work was worth it.

I’ve decided not to bring Soapadoo back. Some of the reasons include:

  • Soapadoo was making about $10-$30 per month in advertising revenue. This revenue doesn’t cover the hosting cost of the site.
  • The site is clearly not viral or remarkable since the traffic wasn’t steadily increasing.
  • I don’t have any ideas as to how to make Soapadoo more remarkable.
  • I’ve learned a ton of lessons about running an advertising based business. I think I’ve learned all the lessons I’m going to learn about it for now.
  • I’ve spent very little time on Soapadoo over the past few months because I’ve been working on other businesses.

It’s always a tough question about whether to persevere or change gears to work on something different. At this point, the other business opportunities I’m pursuing seem to have much more potential than Soapadoo.

For those Soapadoo users who would like a copy of their reviews, just send me an email about it and I can get you a copy in a number of different formats.

Ron Paul

I’ve never really blogged about politics before, but I must say that Ron Paul looks like an excellent candidate for President in 2008.

UPDATE: Well… I’ve now blogged a few times about politics. If you’re interested, you can check out Among These.

Rjs for Local Javascript

There are times when I need to write a local javascript function (without needing a round trip to the server) and I’d like to use RJS rather than writing the function in pure javascript. Why would I want to use RJS?

  • The syntax is clean and it’s often less code than pure javscript.
  • When writing this function, I can mix in powerful Ruby constructs.
  • It’s consistent with the other RJS in the project.
  • I automatically get the function wrapped up in a CDATA tag.
  • I automatically get exceptions handled by giving me an alert of the problem.
  • It’s easy to conditionally exclude some of the javascript.
  • My rails views look cleaner.

Here’s an example from a rails view (new.erb):

1
2
3
4
5
6
<%= define_js_function(:my_cool_local_function) do | page |
      page[:choice_entry_area].hide unless @question.multiple_choice?
      page[:add_answer_link].show
      page[:add_answer_button].hide
  end
%>

So where’d this define_js_function method come from? I added it to ApplicationHelper. Here it is:

1
2
3
4
5
6
7
8
def define_js_function(function_name, &block)
  parens = function_name.kind_of?(Symbol) ? "()" : ""
  update_page_tag do | page |
    page << "function #{function_name}#{parens} {"
    yield page
    page << "}"
  end
end

When the view is rendered in the browser, the following javascript gets generated:

1
2
3
4
5
6
7
8
9
10
11
<script type="text/javascript">
//<![CDATA[
try {
function my_cool_local_function() {
$("choice_entry_area").hide();
$("add_answer_link").show();
$("add_answer_button").hide();
}
} catch (e) { alert('RJS error:\n\n' + e.toString()); alert('function my_cool_local_function() {\n$(\"choice_entry_area\").hide();\n$(\"add_answer_link\").show();\n$(\"add_answer_button\").hide();\n}'); throw e }
//]]>
</script>

If the javascript function you’re creating takes no arguments, then you simply pass a symbol to define_js_function to specify the function name. If your function takes arguments, then you can pass in a string which contains those arguments like so:

1
2
3
4
<%= define_js_function("add_tag(tag)") do | page |
      page << "$('tag_list_str').value += tag"
  end
%>

TUAW Category Feeds

I’ve been subscribed to the Unofficial Apple Weblog for quite awhile. It’s in my NetNewsWire folder entitled “Can’t Keep Up” (the place containing feeds that have so much content that I’ll never be able to read them all.)

I’m probably the last person in the Mac universe to realize that there are category specific feeds available so that you can subscribe to a subset of TUAW. This is outstanding because there are certainly parts of TUAW that are quite interesting to me.

I started out by subscribing to the following categories: Mac 101, Hacks, Tips and Tricks, Cool Tools, Terminal Tips, How To’s, and Productivity.

Rails Plugin - cadillac_edge_deploy

Is your deployed rails application frozen to a particular revision? If so, when a new version of rails is released how easy is it for you to upgrade?

Are you living on the edge of rails? If so, how do you move to a more recent revision when you notice an enhancement you want to take advantage of?

Switching to a different version of rails should be easy.

Mike Clark described a number of ways to manage your rails versions in this blog post.

Mike wrote of a “Cadillac Edge Deploy Approach” in referring to Rick Olson’s code that makes managing rails versions quite cinchy.

This plugin is basically a rip-off of that blog post and Rick’s code.

I refactored things a bit primarily because I needed the approach to work even if Rails wasn’t installed on the server I was deploying to. I’ve also changed it since to work with git rather than svn.

To use the plugin, all you need to do is add the following to your deploy.rb:

set :rails_revision, '745359a49452da34978724144eaa318b8a363e08'

When you’d like the server to start using a different revision of rails, just adjust the rails_revision variable.

To install the plugin:

./script/plugin install git://github.com/duff/cadillac_edge_deploy.git

Prettied Up Test Output Using assert_arrays_equal

I’ve got a pretty simple test:

1
2
3
4
5
def test_relationships
  wellspring = churches(:wellspring)
  cleaning_crew = Group.create!(:name => "Cleaning Crew", :church => wellspring)
  assert_equal([cleaning_crew], wellspring.groups)
end

The problem is that when this test fails, I get a ridiculous amount of output and it’s difficult to quickly determine why the test is failing. Here’s the output I get:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
1) Failure:
test_relationships:10
<[#<Group:0x3492918
  @attributes=
   {"name"=>"Cleaning Crew",
    "church_id"=>1,
    "id"=>32,
at top level in "created_at"=>Thu Mar 01 15 at line 56
  @church=
at top level in #<Church at line 0
    @attributes=
     {"name"=>"Wellspring Community Church",
      "account_owner_id"=>"1",
      "timezone"=>"Alaska",
      "subdomain"=>"wellspring",
      "id"=>"1",
      "tz_name"=>nil},
    @groups=
at top level in #<Group at line 0
  @errors=
at top level in #<ActiveRecord::Errors at line 0
  @new_record=false>]> expected but was
<[#<Group:0x348c0a4 @attributes={"name"=>"Elders", "church_id"=>"1", "id"=>"1", "created_at"=>"2007-03-01 10:01:58"}>, #<Group:0x348c07c @attributes={"name"=>"Children's Ministry", "church_id"=>"1", "id"=>"4", "created_at"=>"2007-03-01 10:01:58"}>, #<Group:0x348c054 @attributes={"name"=>"Cleaning Crew", "church_id"=>"1", "id"=>"32", "created_at"=>"2007-03-01 15:56:38"}>]>.

1 tests, 1 assertions, 1 failures, 0 errors

This is what I’d like the output to look like:

1
2
3
4
5
6
7
8
 1) Failure:
test_relationships(GroupTest)
method assert_arrays_equal in test_unit_extras.rb at line 8
method test_relationships in group_test.rb at line 11
<"Cleaning Crew"> expected but was
<"Elders, Children's Ministry, Cleaning Crew">.

1 tests, 1 assertions, 1 failures, 0 errors

To me, that’s a bit easier to read. Here’s how I did it. The test has a small change. Instead of calling assert_equal, it calls assert_arrays_equal. So the test now looks like this:

1
2
3
4
5
def test_relationships
  wellspring = churches(:wellspring)
  cleaning_crew = Group.create!(:name => "Cleaning Crew", :church => wellspring)
  assert_arrays_equal([cleaning_crew], wellspring.groups, :name)
end

Where did assert_arrays_equal come from? You can get it by installing the plugin I just created:

1
./script/plugin install git://github.com/duff/assert_arrays_equal.git

assert_arrays_equal allows you to specify which method you’d like to be called on the objects in your arrays for the output message. It still asserts that the arrays are actually equal. The failure error message now uses the method you specify. In the test above, I specified the :name method because I want Group.#name to be called rather than Group#inspect. If you don’t specify a method, it defaults to :to_s.