Politics, Programming and Possibilities
28 Sep
The effects of government-sponsored deception and terror are starting to affect me personally now.
The Military Commissions Act that was passed by congress yesterday, and which is about to be passed—without ammendment—by the Senate today or tomorrow will strip me of what I thought were inalienable rights to me in this country, the United States of America. In the words of Senator Patrick Leahy, who tried valiantly to strike out the offending section 7:
Imagine that you are a law-abiding, lawful permanent resident. In your spare time, you do charitable fundraising for international relief agencies that lend a hand in disasters. You send money abroad to those in need. You are selective in the charities you support, but you do not discriminate on grounds of religion. Then one day there is a knock on your door. The Government thinks that the Muslim charity you sent money to may be funneling money to terrorists, and it thinks you may be involved. And perhaps an overzealous neighbor who saw a group of Muslims come to your house has reported “suspicious behavior.” You are brought in for questioning.
Initially, you are not too worried. This is America, you are innocent, and you have faith in American justice. You know your rights, and you ask for a lawyer. But no lawyer comes. Once again, since you know your rights, you refuse to answer further questions. Then the interrogators get angry. Then comes solitary confinement, then fierce dogs, then freezing cold that induces hypothermia, then waterboarding, then threats of being sent to a country famous for its torture techniques, then Guantanamo. And then nothing, for years, for decades, for the rest of your life.
This is the New America. I am a “law-abiding, lawful permanent resident” of the United States. Do you suspect me of being a terrorist? If so, your inalienable rights are better than my inalienable rights—the law still upholds yours.
Have you noticed the decline in academic freedom since September 11th, 2001? Have you observed that America exhibits or is beginning to exhibit the historical 14 characteristics of fascist states? Is it really possible we’re becoming a fascist state?
Update: Here’s an opinion article published in the New York Times that brings the dangers of this bill in to the light, point by point. In addition, there is an article in the Washington Post about a Canadian who was whisked away and tortured by the CIA in secret off-shore prisons. He was later able to prove his innocence in Canada.
Update #2: Another article from a progressive newspaper, Habeas Corpus, R.I.P. (1215 - 2006).
28 Sep
Update: The repository has moved slightly, since the Rails.tmbundle got renamed to “Ruby on Rails.tmbundle”. The URL looks like this (no newlines):
http://macromates.com/
svn/Bundles/trunk/Bundles/Ruby on Rails.tmbundle/
Support/plugins/footnotes
This release of the TextMate Footnotes plugin has several new and helpful features:
I’ve also moved the project in to the TextMate Repository, so you can either get it with TextMate, or use subversion to get it directly here:
svn --username anon --password anon co http://macromates.com/
svn/Bundles/trunk/Bundles/Rails.tmbundle/
Support/plugins/footnotes footnotes
(Note: the subversion checkout command above should all be on one line.)
23 Sep
ActiveRecord gives a lot of flexibility with its 16 callbacks. I’ve never needed anything more granular than that flexibilty until today.
In trying to automate the process of saving files on Amazon S3, I needed a callback that would be triggered after the creation of my “Photo” record, but before the creation of several associated objects. (These ActiveRecord objects were being held in memory via the association “build” method, and thus had not yet been inserted in to the database.)
Delving deep in to ActiveRecord to figure out how those build-associated objects were being automatically inserted in to the database when calling “save” on my Photo object, I found out it’s a lot easier than it might seem.
Just define your “after_create” callback before the call to “has_many” in your class. For example:
class Photo < ActiveRecord::Base
# This callback must be defined before "has_many :versions" so
# that it gets called *after* the Photo is created, but *before*
# the versions are inserted in to the DB.
after_create :send_id_to_versions
has_many :versions
def send_id_to_versions
...
end
end
If you switch the order of the after_create and the has_many above, the “Version” objects will be inserted to your database before the call to “send_id_to_versions”.
Hope that saved you an hour or two! ![]()
21 Sep
It appears that Christopher Hood, a Diebold consultant during the 2002 Georgia election, has blown the whistle with regard to massive election fraud (on the order of 5000 machines patched with potentially unlawful software).
The booman tribune has a nice write-up on the significance of this.
20 Sep
UPDATE: In the comments, Kent has provided a complete solution to this problem:
hash = Hash.new(&(p=lambda{|h,k| h[k] = Hash.new(&p)}))
I would love to see this integrated in to the Hash class at some point, but if not, we can (with Ruby’s kind acceptance) do it ourselves:
class Hash
def self.arbitrary_depth
Hash.new(&(p=lambda{|h,k| h[k] = Hash.new(&p)}))
end
end
Thus,
hash = Hash.arbitrary_depth
h = Hash.new
h[:one][:two] = “uh-oh!”
# NoMethodError: undefined method `[]=’ for nil:NilClass
The solution? Pass in a proc that will tell Hash to create a second hash by default for each key that is not found:
h = Hash.new { |h,v| h[v]= Hash.new }
h[:one][:two] = “uh-oh!”
# => “uh-oh!”
h
# => {:one=>{:two=>”uh-oh!”}}
Much better. But that’s only two-deep. What about n-deep? The solution I found isn’t fully “arbitrary” on demand, but it should work for most cases:
class ArbitraryDepthHash
def self.arbitrary_depth_proc(depth = 1)
proc { |h,v| h[v] = Hash.new(&arbitrary_depth_proc(depth-1)) }
end
def self.[](depth)
Hash.new(&arbitrary_depth_proc(depth))
end
end
h = ArbitraryDepthHash[5]
h[:one][:two][:three][:four][:five] = “wow!”
# => “wow!”
h
# => {:one=>{:two=>{:three=>{:four=>{:five=>”wow!”}}}}}
9 Sep
Kristen Breitweiser, Patty Casazza, Lorie Van Auken, and Mindy Kleinberg. I hadn’t heard of the Jersey Girls until watching the 9/11 Press for Truth documentary released today–and yet, I now count them as heroes among women.
This is the story of 4 courageous widows of 9/11 who would not take “just so” for an answer. They pressed hard for truth, and were instrumental in applying the pressure that was necessary to get us the 9/11 Commission. And after having been sleighted by that commission, and their questions sometimes wholly ignored, they are still fighting for truth. God bless these patriotic women.
If you haven’t seen this hour-and-a-half documentary yet, you might be missing out on one of the biggest truth bombs to hit America since Watergate. Watch it at Google Video, visit a participating theatre, or download the torrent here.
1 Sep
Gerardo Lisboa recently enquired about the ColumnComments plugin, noting that comments can not be added to columns during the creating of a table (usually the most useful time to add comments!) He is, of course, absolutely right–the comments option did not work in version 1.1. In response, I wrapped up a zip file of my current implementation and sent him the update.
For anyone else who is using ColumnComments, I recommend using this upgrade (MySQL only).
Download the zip file here, and then unzip it in to your Rails app’s vendor/plugins directory.