Monday, November 14, 2011

OCI8 with Phusion Passenger/Rails 3.1 on Freebsd 8 ** UPDATED

This has been one of the most trying things I've done..  My employer uses a backend database of Oracle 9i, or the like.  I have to connect to it with Rails to simplify some queries, using oci8. 

Ruby 1.9.2 also.

Install the freebsd linux-oracle-instantclient-* ports
follow directions here: http://ruby-oci8.rubyforge.org/en/InstallForFullClient.html
(You will have to install both oracle ports)

Punch something that won't break your hand, but will be hard enough to relieve some anger

Use gems, NOT the ports collection for the gems..

gem install ruby-oci8 (Using the freebsd port fucks everything up)
gem install activerecord-oracle_enhanced-adapter

You will have to modify  /usr/local/lib/ruby/site_ruby/oci8.rb to make line 38 know where your .so file is.  replace site_ruby with your ruby install path.  I use site_ruby because of rvm (Another goddamn hassle to set up)

This got me up and running, but I am not sure if these steps are in order, or if I did anything else.  This was a fucking hassle and I  wouldn't recommend doing it.. but if you have to, and you get stuck, post a comment and I'll see if I can't help you figure out your problem

~Nic

ETA:

A ruby wrapper to set this bullshit is necessary as well:

#!/bin/sh
export LD_LIBRARY_PATH=/usr/local/oracle8-client/lib
export TNS_ADMIN=/usr/local/oracle8-client/network/admin
export NLS_LANG=AMERICAN_AMERICA.UTF8
export ORACLE_HOME=/usr/local/oracle8-client
exec "/usr/local/bin/ruby" "$@"

ETA2:

This only works on fucking i386.  If you have to use OCI8 on FreeBSD, it's only going to work on i386.  I tried and tried, and no x64.

Tuesday, November 8, 2011

God hates cigarettes?

"I don't really care what people do in their private lives," said 62-year-old communications consultant George Werl of Minneapolis. But he said marriage should be limited to heterosexual couples because it was designed to protect the children of those unions. (via)

What he means to say is:
"I don't really care what people do in their private lives.  I really care what people do in their private lives".  It's a Rick James moment.

This amendment vote is a year away.  We must all fight it.  Fuck the spin, it's homophobic, bigoted and simple minded.  Marriage is a dying arbitrary patriarchal institution anyhow, not to mention the SIBS study has all but proven that biological relationship between parents and children has no impact positive or negative on the child's "success" in life (but it's OK to use a child to force a mother or father into "calming down"/"growing up")

These are bogus issues designed to pit us against each other and ignore the reality that we're all being screwed ... by the 1%  (Thanks adbusters for making that so succinct).  If you REALLY FUCKING DON'T CARE what people do in their private lives, [then] SHUT THE FUCK UP.

Amen brother.

~Nic

**edit: than? Idiot.

Wednesday, November 2, 2011

Let there be plight

I am severely troubled by how the fox spin machine is portraying the occupy movement (but not surprised).  It's something I am afraid has been picking up steam for a while: "college education is unnecessary" (I know, this isn't news).  Of course, these people don't believe that's true for anyone in their families..

I remember something that I heard on public radio years ago that solidified my stance of pro-education for everyone (regardless of costs).. some jacknut Eichten had on his program said "Now Gary, what do I care if my car mechanic knows where Iraq is".  I got a great insight into the bourgeoisie/proletariat divide in that moment, and I drew an instant parallel to the dark ages.  This seems to me to be the definition of serfdom (After enlightenment, but before access).

I want my car mechanic to know whatever in the fuck he/she wants to know, and to be able to critically think as to properly question their government, make wise decisions on health care, child raising, etc.  They're trying to put out our sacred flame of the enlightenment.  Every bit of money taken out of education, every extra pupil in a classroom, every closed Adult Basic Education program -- they're all one more depressant on that flame.

Also, too: fuck Locke.

~Nic

**Edit I said fuck Kant: I was thinking Locke but wrote Kant.  I've got no beef with Kant's a priori (although I used to hate the concept), my beef is with Locke's private property nonsense.

Monday, October 24, 2011

Fuck city living

A drive by shooting with over 30 rounds fired from 3 different firearms at 1am (All fired within about 5 seconds) NEXT DOOR?  A desk pig that basically mocked me for calling the next day with worry about that, two cars broken into down the block, and the dude who was trying to rob my renters house?  Subwoofers?  Why do I live in the city?

Whatever weapons were used in this fucking drive-by, they were serious shit.. The walls of that home are plaster, and apparently there were rounds that made it clear through the WHOLE FUCKING HOUSE.  The fridge, which has the outside wall, and an inside wall between it and the direction of fire, has bullets lodged into the side of it.  Apparently a few strays hit the neighboring house (on the other side).  This fuckhole pig is annoyed with my concern?

I can't properly show the vibe I got from him, but here's a little excerpt:
Cop: "We don't have any information about any of those situations"
Me: "uhhhhhhh ok?  Are you a cop?"
Cop: "uhhhhh yeah I am a cop"
Me: "How am I supposed to feel about this?  There was a fucking war going on outside of my home last night.  You can't give me any information about any of it.  What am I supposed to do?  Tell me.  Give me some advice here."
Cop: "Lock your doors and windows"
Me: "Helpful.  am I going to have to keep a loaded firearm under my pillow?"
Cop: "It wouldn't be a bad idea.  Get training and a handgun."
Me: "Reassuring."

6 Months ago all I had to worry about was obnoxious subwoofers.  Now I find myself plowing my gf off the bed to the floor at 1am because HOLY FUCK WE'RE UNDER ATTACK!

At least he'll see what he can do to up the patrol time for my area.

~Nic

Friday, October 14, 2011

STNG weighs in on gender issues

Watching Star Trek the Next Generation on 'flix is probably my best time waster ever.  Anyhow, in "The Outcast" was this monolog from a person who was part of a "sexless" race, and she had feelings of being a woman her entire life, which is apparently forbidden on whatever-the-fuck planet she's from (Cut/Pasted from IMDB):

I am female. I was born that way. I have had those feelings, those longings, all of my life. It is not unnatural. I am not sick because I feel this way. I do not need to be helped. I do not need to be cured. What I need, and what all of those who are like me need, is your understanding. And your compassion. We have not injured you in any way. And yet we are scorned and attacked. And all because we are different. What we do is no different from what you do. We talk, and laugh. We complain about work. And we wonder about growing old. We talk about our families, and we worry about the future. And we cry with each other when things seem hopeless. All of the loving things that you do with each other, that is what we do. And for that, we are called misfits, and deviants, and criminals. What right do you have to punish us? What right do you have to change us? What makes you think you can dictate how people love each other?


The Judges Response: I congratulate you, Soren. Your decision to admit your perversion makes it much more likely that we can help you.

..Riker: "Did it occur to you that she might want to be like this?"
 It's a beautiful episode, one among many.

 ~Nic

Wednesday, October 12, 2011

Fuck you, homosexual!

The title is in reference to gingergate, and is intended to convey irony.

(via) "One school district bars teachers from taking a position on homosexuality."

I don't understand this concept of "neutrality" with regard to homosexuality... How do you remain neutral on a fact?  Let me hyperbolize:

Student: "Hi, I'm Billy, I am gay."
Teacher: "I can not confirm or deny the existence of homosexuality."
Student: "How about if I just say I'm straight?"
Teacher: "I CAN confirm the existence of heterosexuality."
Student: "Doesn't the acknowledgement of one infer the existence of the other, exempli gratia: darkness implies light?"
Teacher: "Why do people think I earn too much?"

Am I misinterpreting their idea of neutrality?  Perhaps I am taking them literally what they are asking for.  To remain neutral on a characteristic is to not have an opinion on its existence (See: agnostic(loosely)).  Though what's implied (and what they really mean) is that teachers ought to remain neutral on the "good" or "bad/evil" of such a characteristic, however this is not possible..  Just as some people might think Gingers are evil and should all be killed(I went there), which is highly irrational since hair color (along with skin color, sex, etc, etc) are characteristics over which the holder has no control, homosexuality fits the same bill, and is therefore transcendent of any arbitrary judgement of goodness.  The only choice a teacher has is to take a position something like:

"The fact in the matter is that this particular (or that particular) child is homosexual(or hetrosexual).  My purpose is to protect my students from hatred in any form, and therefore hatred, and/or bullying directed at any child is unacceptable.  I will not remain neutral when a child is harassed, and it follows that I will not remain neutral when a homosexual child is harassed, the harasser will be punished."

I remain neutral [and] on the moon.

These fucking haters are so GOD DAMN stupid, and nicotine withdrawal makes me that much more fucking angry about it.  Stop being a fucking hater. 

~Nic

**edit: The MIA video was supposed to be interpreted far differently than it ended up being, and is used to progress a very long and old "ginger-phobia" tradition in UK, and other parts of Europe.  This (not the video, the UK/euro issue) was an ace card I had in my back pocket during Gingergate, and didn't need to use.

Wednesday, October 5, 2011

Rails 3 - unit testing validators with check validate reflection method

I don't know if this is to best practices or not (and I really don't give a shit -- this works great). Here's the idea:

model:

class Submission < ActiveRecord::Base
  validates_presence_of     :title 
  validates_presence_of     :first_name
  <snip>
end


I load some data in with a fixture to make the model valid.... blah blah

unit test:

require 'test_helper'

class SubmissionTest < ActiveSupport::TestCase
  def setup
    @one = submissions(:one)
  end
  test "empty title invalidates" do
    assert !check_validate(@one,"title")
  end
  
  test "empty first name invalidates" do
    assert !check_validate(@one,"first_name")
  end
 .....


Now the check_validate method, and the quick check method:


def check_validate(object,field)
    #Make sure object is valid
      assert_object_valid(object)
    #set old to objects value 
      old = object.send(field.to_sym)
    #send setter to object along with nil to blank it
      object.send("#{field}=".to_sym, nil)
    #set return value to boolean of valid? on object
      return_value = object.valid?
    #send setter to object for field with old value
      object.send("#{field}=".to_sym, old)
    #Make sure we leave the object valid when we're done
      assert_object_valid(object)
    #return the value
      return return_value
  end
    
  def assert_object_valid(object)
    assert object.valid?, "test entered with invalid object"
  end



It works great.. nice and DRY, this way I don't have to blank them all out, and put them all back.. ruby's reflection is a billion light years beyond any I've used for anything else ever. (Java? what?) I plan on modifying the check_validate to simplify other checks as well, and create my own library of test for common tasks. Maybe it already exists? I looked, and didn't find one.

~Nic