In the Grotto
Mitya000 and I got into this huge debate last night about the definition of a grotto whilst bumperman played the role of the armed moderator. Mitya000 defined it simply as “a place where Satanists meet”. I didn’t think that was right. So, I wikipedia’d it, and they describe it as “when it is not an artificial garden feature, is a cave, small or quite large, usually near water and often flooded or liable to flood at high tide.” The argument wasn’t about the definition so much as it was my condemnation for him defining something in terms of an uncommon use. I feel that this is equivalent to me defining a duck as “something I wear on my head while yelling the constitution backwards in my neighbor’s yard”. Yes, I could do that with a duck, but that wouldn’t really describe the essence of a duck. This debate went on and on, and ended with Mitya000 eventually claiming that all information in wikipedia was wrong because it was typed in by an overweight guy Star Wars fan living in his parents’ basement. The weird thing was, previous to that statement, he used wikipedia to lookup Satanism to prove that they do indeed meet in Grottos sometimes. Bumperman thankfully moved the conversation in the direction of old timey gingersnaps after that and kind of saved the entire evening.
rm -blah
Being the resident Unix nerd in my group, about once a year, someone asks me “How do I remove file named -blah”. The problem arises because the hyphen character is the option delimiter for the shell commands. So, typing “rm -blah” or even “rm \-blah” usually results in “rm: Not a recognized flag: b” on most systems. The solution to this problem is so amazingly stupid that the asker usually walks away with his or her pride obliterated. The answer? rm ./-blah. Ivo told me about the alternate solution of using rm — -blah to do it. I like the ./ way better though because it’s so obvious once you know it. I think Jerome might know a better way though.
File_column Problems
OK, how do I make file_column work? I did the following (after installing file_column) which seems like it could be correct, however, it doesn’t work.
1.) Added a database migration
class AddOpmlFileColumn < ActiveRecord::Migration
def self.up
create_table :opmlfiles do |table|
table.column :id, :integer, :null=>false
table.column :file_name, :string, :null=>false
table.column :created_at, :datetime
table.column :user_id, :integer, :null=>false, :default=>'0'
end
end
def self.down
drop_table :opmlfiles
end
end
2.) Created an Opmlfile model
class Opmlfile < ActiveRecord::Base file_column :opmlfile end
3.) Updated the generated controller’s constructor
class OpmlfilesController < ApplicationController
def new
if request.get?
@opmlfile = Opmlfile.new
else
@opmlfile = Opmlfile.new(params[:opmlfile])
@opmlfile.save
end
end
4.) Designed an upload form
<%= start_form_tag :action => 'create', :multipart => true %>
<p>Upload file:
<%= file_field('opmlfile', 'file_name') %>
<%= submit_tag('Upload file') %>
<%= end_form_tag %>
<%= link_to 'Back', :action => 'list' %>
</p>
OK, the thing is, it looks like it is uploading during the HTTP POST, however, I don’t get any files in my public directory. An opmlfiles directory was created, but nothing ever gets there. Also, the filename is always blank in the model and database. What the heck am I doing wrong?
Update: SOLVED!!!!
BLARGH! The last problem was that my form needed to be defined as this:
<%= start_form_tag({ :action => 'create' }, :multipart => true) %>
and NOT this:
<%= start_form_tag(:action => 'create', :multipart => true) %>
Rails was erroring with “Do not know how to handle a string with value ‘hoyhoy.opml’ that was passed to a file_column” before I made the change.
Also, dopplertx was indeed correct, I needed to have a column in my database table for the filename. It is called file_column after all. Thanks everyone.
Ideals
Ideals with BJ back at MusicLab.
Your pain is the breaking of the shell that encloses your understanding.
As I was looking up Kahlil Gibran tonight on Google, I noticed the first link was to a page of quotes with a big animated ad for a dating site. It’s interesting to me that passages from a book written in 1923 are being used as a loss leader to attract attention to an advertisement. I suppose that using a famous Lebanese-American author’s quotes to sell ads isn’t that much different than network television, but it feels wrong to me for some reason. The hidden meaning in all of this is that the majority of people who look up Kahlil Gibran on Friday nights probably need to get laid.






