Tuesday, September 27, 2011

I'm about to slap someone..

For the last goddamn week some fucking asshat has been parking across the street and down 2 or so houses. They pull up and about 10 people pour out of this vehicle and they proceed to test the nerves of the surrounding 2-3 blocks with wall-shaking bass. This, of course, annoys me endlessly. The passing vehicles with obnoxiously loud bass I've managed to deal with fairly well mentally.. as long as I know it will go away I can take a few deep breaths and forget it (When I first moved to Minneapolis in 1998 I thought I was going to die of panic attacks). But this lingering shit destroys my spirit.

SO -- Calling the cops is useless, they're too busy pulling people over for trivial nonsense (esp. if they're a minority)..

So what's a ginger to do?

I think I am going to buy a few Air Horns. I am going to rig something up so I can set it and leave with the goddamn thing blaring away. Leave it on the doorstep with a nice note that says "TURN YOUR FUCKING MUSIC DOWN YOU ASSHAT".

What will I really do? Nothing. I'll sit and stew in my basement while my nerves drive me to fantasize about some form of payback for my torture. ..Oh, and continue to browse for homes in first-third ring suburbs.. and wish I made more money.

~Nic

Monday, September 26, 2011

We have a problem

We have a fucking problem here:

A small town in Alabama is offering non-violent offenders the choice between doing prison time and paying a fine, or working their sentence off by going to church every week.

From TPM

~Nic

Rails 3 - Check if any possibilities exist before validation

In this work project I have a few models: contest model, submission model, and subject model. Subject is a table that belongs to contest, AND subject. Some contests don't have subjects, but if they do, I need to have the user select one. These few snips of code worked well for that situation:

class Submission < ActiveRecord::Base
  
  #Set up how the model works
  belongs_to                :contest
  belongs_to                :subject

  #Validate the field we're talking about in this post:
  validates_presence_of     :subject_id, 
                              :on => :create,
                              :if => :needs_subject?


.. And later I defined needs_subject? as follows:


  def needs_subject?
    if self.contest.subjects.any?
      return true
    else
      return false
    end
    
  end
end #End the model.


So this allowed me to only check if there's a subject if there SHOULD BE a subject.

Hope this helps someone.

~Nic