Archive for January, 2008

That flat Russian “a”

Wednesday, January 30th, 2008

That flat Russian “a”,
wide and flat as a steppe,
open and deep as the seas near Murmansk,
and vast and wide as the wind.

Regina Spektor, you say it in “Après Moi (2 minutes, 32 seconds)” and I want hear it on the banks of the Neva in spring. I’ve always had a bit of a thing for St. Petersburg after I read Rand’s “We The Living” ( her best or second best story in my book, like Stephen King, she does well under the 200 page mark ).

Strange, I wrote those snippets without knowing the English translation of this section. It’s apparently a poem by Pasternak:

February. Get ink, shed tears.
Write of it, sob your heart out, sing,
While torrential slush that roars
Burns in the blackness of the spring.

I guessed the right season. BTW. If you’re in a Russian sort of mood might I recommend Cronenberg’s latest “Eastern Promises” — so freaking good I can barely contain myself.

This started off as a bit of an amusement just to see if i could show the elegance of Ruby — and find a way to help me memorize the suffix-addition-heuristics that characterize inflected languages like Latin.

As usual, it quickly became much more than that.

Known Issue:

The macrons are slightly off, particularly in the 3rd person plural ( no vowel before ‘nt’ should ever be lengthened ). I’ll write a fixer routine soon.

[code lang="ruby"]
#!/usr/bin/env ruby
class Verb < Object
  attr_reader :firstpersonform, :infinitive, 
              :perfectstem, :passperfpart, :stem
  def initialize(initString)
    (@firstpersonform, @infinitive, 
       @perfectstem, @passperfpart)=initString.split(/,\s+/)
    pparts=initString.split(/,\s+/)
    @passive_endings = ["r", "ris", "tur", 
                        "mur", "min\xc4\xab", "ntur"]
    @personages = ["First Singular", "Second Singular", 
                   "Third Singular",
                   "First Plural", "Second Plural", "Third Plural"]
  end
  def stem
    # For efficiency, if the iVar @stem is defined, don't go 
    # through this structure
    return @stem unless @stem.nil?
    if @infinitive =~ /?re$/
      return @stem = @infinitive.gsub(/(.*)?re$/,'\\1?')
    end
    if @infinitive =~ /?re$/
      return @stem = @infinitive.gsub(/(.*)?re$/,'\\1?')
    end    
  end
  def to_s
    return "#{self.firstpersonform} #{self.infinitive} 
       #{self.perfectstem} #{self.passperfpart}"
  end
  def present_passive
    local_pe=@passive_endings.clone
    return [@firstpersonform + "r", 
      local_pe[1..-1].map{|x| self.stem + x}].flatten!
  end
  def imperfect_passive
    imperfect_stem = self.stem + "b\xc4\x81"
    return @passive_endings.map{|x| "#{imperfect_stem}#{x}"}
  end
  def future_passive
    fp_stem=self.stem+"bi"
    standards = @passive_endings[2..-1].map{|x| fp_stem + x}
    return [@stem + "b\xc5\x8d", @stem + "beris", standards].flatten!
  end
  def passive_system
    p_sys_hash= { :label=>@personages,
                  :present => self.present_passive,
                  :imperfect => self.imperfect_passive,
                  :future => self.future_passive}
    0.upto(5) do |index|
      printf("%-15s %-10s %-16s %s\n", 
                      p_sys_hash[:label][index],
                       p_sys_hash[:present][index],
                       p_sys_hash[:imperfect][index],
                       p_sys_hash[:future][index]
                      )
    end
    puts "\n\n"
  end
end
[/code]
    x=Verb.new("laudō, laudāre, laudāvī, laudatus")
    puts x
    x.passive_system

    y=Verb.new("moneō monēre, monuī, monitus")
    puts y
    y.passive_system

And the output?

    laudō laudāre laudāvī laudatus
    First Singular  laudōr    laudābār       laudābō
    Second Singular laudāris  laudābāris     laudāberis
    Third Singular  laudātur  laudābātur     laudābitur
    First Plural    laudāmur  laudābāmur     laudābimur
    Second Plural   laudāminī laudābāminī   laudābiminī
    Third Plural    laudāntur laudābāntur    laudābintur


    moneō monēre monuī monitus
    First Singular  moneōr    monēbār        monēbō
    Second Singular monēris   monēbāris      monēberis
    Third Singular  monētur   monēbātur      monēbitur
    First Plural    monēmur   monēbāmur      monēbimur
    Second Plural   monēminī monēbāminī    monēbiminī
    Third Plural    monēntur  monēbāntur     monēbintur

I don’t think that you have to be a Ruby guru to see that Ruby code is incredibly tight. Interestingly enough, Latin, as according to the gospel of Wheelocki, is taught in a very programmatic heuristic manner. You’re taught to carry a certain data file of critical givens on your biological hard drive ( a verb has 4 principal parts, the principal parts of “to praise” …. ) and then are taught a series of transformations to be performed on those 4 principal parts. Working those out is an exercise being a mental computer, mutating data according to heuristic and spitting it out.

Interestingly, when printing technology was much more expensive ( or, students were much more rebellion-prone when forced to pay outrageous prices for books ) Latin instruction was a few terse rules and the homework was “Write out the application of these heuristics to the following data items”. With the rules, and the given inputs, the human scribbler would write out the references he would need to be able to advance to the next chapter.

I have a certain admiration for this method.

But I also have ruby, and remembering how i applied a few map()s or flatten!() statements is just as good.

[code lang="ruby"]
irb(main):001:0> "capture to here!  leave this off".gsub(/(.*\!).*(\s+.*)$/, "\\1 and \\2")
=> "capture to here! and  off"
[/code]

I looked in my Pickaxe, I looked in various tutorials, but this simple little thing hung me up more than many other Ruby questions I’ve had over the years.

“The Zero Effect”: 10-year anniversary

Monday, January 28th, 2008

The esteemed Ransom at Chronological Snobbery has asked if I would like to make a contribution to his retrospective on the 10-year anniversary of “The Zero Effect”.

I admit, I procrastinated, I avoided the obligation and said that I, quite honestly, had nothing positive to contribute to the movie. Mr. Ransom agreed that I could take a con position. I took that offer and decided to re-watch the film and see if my perceptions had changed in the 10 years since I saw the movie. I can say they have not and I think that the movie is just as forgettable and insignificant today as I thought it was 10 years ago.

If any of the other contributors induce you to consider seeing this movie qua movie, let me be the first to say that its only merits in my book are to see the two primary protagonists give laudable acting performances of a high quality that will make you blink twice in surprise against your familiarity with the larger scope of their respective œuvres.

I speak of Bill Pullman and Ben Stiller.

Bill Pullman

Pullman executed a string of intense studies on men in very non-conventional relationships in this remarkable fecund period in the early 90’s. In fact, against several performances given between 1994 and 1998 Pullman’s role in the Summerstravaganza Crapfest “Independence Day” can be seen as an outlier.

lastseduction

Starting in 1994 he starred against the sexy “Wendy Kroy ( Linda Fiorentino )” in The Last Seduction. Having been manipulated by his scheming wife who sent him for condoms as she skips town with the proceeds of a lucky dope score, Pullman opened up a floodgate to exploring rage, fury, homicide, and seething frustration within the bounds of a relationship that was to pour over his next several films.

Lh Poster

Between “The Last Seduction” and “Zero Effect”, Pullman continued his study in relationship-bounded fury in David Lynch’s Möbius murder-mystery “Lost Highway”. “Lost Highway” was the first film that the director himself, at the time, reported as “the perfect David Lynch movie”; the movie he had always wanted to make (for the record, this same theme was explored again, and much more compellingly, I’ll assert, in 2001’s “Mullholland Drive”).

In “Lost Highway”, Pullman does the research and experimentation that makes his portrayal of Zero so effortless. The protagonist believes himself cuckolded, marvels and wonders at his potential capacity as a murderer, and generally exists in a space parallel, but outside of the social mainstream.

In the character Zero, Pullman continues the detailed study of men undergoing psychological fugue between the men they are expected to be, and the men they know they are. It is a superb moment in Pullman’s career. Pullman closes this study in 2002’s Igby Goes Down. Somewhere the raging cuckold has morphed into an alcoholic, suicidal, Zen-like approach to getting a cricket bat to the face courtesy of life.

Pullman’s portrayal of Zero’s meditation on searching for things by not searching for them is reminiscent of the farcical method of flight described by “The Hitchhiker’s Guide to the Galaxy” as well as an artful delivery into the mind of the Holmes 2.0, the detective Zero. It’s the only thing that I really remembered as being enjoyable about this movie years on.

Pullman’s not been given the best source material of late, but his performance almost makes “The Zero Effect” worth watching — if only anything else happened in it.

Ben Stiller

In 1993 there was a channel known as Fox which was favored for showing edgy and daring comedy.

In the 5 or so years previous, this network had launched “Married With Children” and “The Simpsons” and marked a decided turn in the culture wars. America, en masse disagreed with President Bush and said, effectively: “No, we think the American family should be more like The Simpsons and less like that other show you talked about”. To prove their point they elected a president who had played a notoriously difficult-to-tune woodwind on The Arsenio Hall Show.

Fox took another risk by giving Ben Stiller his own show which featured his formidable comedic talents as well as the talents of Bob Odenkirk, and pre-yakuza-arm-sleeve Janeane Garofalo. There was also this un-funny douchebag named Andy Dick on it too.

In this role we saw Ben as an edgy and intense comedic talent. Naturally, the show would be quickly cancelled as reward for such innovation. Yet in the show we saw the talent that’s there in Stiller: a wry eye for satire and a mean streak which could take the absolutely piss out the Fox network with the mockery pilot treatment “Heat Vision and Jack”.

After being kicked to the curb by Fox, Stiller found his way back to mass entertainment and landed in “The Zero Effect”. Taking the Host of the Ben Stiller show and dressing him up in a suit was the perfect chance to show off the best of Ben Stiller, man, not actor. The likable personality behind the “Ben Stiller Show” was given another chance to become familiar to the viewing public.

Yet in “The Zero Effect” we also get a brief peek at the disaster that Stiller was to come to accompany: The narcissistic, whiney, rubber-faced-angry-little-bitch that would come to define his character portfolio up to the present. Like Darwin’s finches, every role of Stiller’s that is beyond a cameo is essentially playing a character slightly more or less little-bitch than Arlo in “Zero Effect”

Consider: Arlo, Stiller’s character, is perpetually complaining about not getting his due, is perpetually obsessing about his relative import ( or lack thereof ), or is being frustrated about his situation using the same 3 stock faces:

*”disbelief/angry” Cnf

or

Eyeroll

*”disaffected/feeling that he’s not being treated like God’s special snowflake”

Polly 14

*”Grr! I’m Angry”

Furious 2

Does this not sound like pretty much every role Stiller has played since 1998?

A few traces should suffice to prove the downward trajectory.

The Arlo persona had its whiny-bitch-o-meter revved up in “Flirting with Disaster”: over-neurotic to the point of absurdity, narcissistic to the extreme, obsessed with external validation to a fault, etc. Stiller’s character’s single nuance of “unbelievable outright neediness” threatened to tank that film, were it not for Teà Leoni’s and Patricia Arquette’s balancing desperations ( Ms. Leoni’s ticking clock and Arquette’s armpit licking made Stiller’s neurotic individual stick out less ).

Stiller took the same identikit mix for the Neil LaBute squirm-fest “Your Friends and Neighbors”. Never have I enjoyed watching a character get humiliated quite like Catherine Keener’s ego-destroying “Buh” or “Should I write hold me?” to Arlo, er, Jerry in the third act.

The only addition that has come to modify the Arlo archetype is the “Stiller Rage Face” that calls to mind G.E. Smith’s What’s-that-smell? guitar style from 90’s era Saturday Night Live ( ironically a main character feature of his Mr. Furious in the utterly forgettable “Mystery Men”).

Since that time Stiller has basically played the same role with only minor deviations.

  • Sardonic cop with Gen-X cynical chic ( surely some grass-chewer in Hollywood scribbed that on the back of the head-shot ) = “Starsky and Hutch”.
  • Skew it yuppie: “Reality Bites”.
  • Skew it yuppie and neurotic and oh-so-adorably-quirky (I’m lookin’ atchu Wes)? Royal Tenenbaums.
    *Skew it to middle-class post-Thanksgiving tyryptophan high pablum? You get “Meet the Parents”.
  • Skew it for people lacking a cerebral cortex? “Meet The Fockers”.
  • Dredge up the same role from “Meet the Parents”, and “Something About Mary”, but make it ten-times less funny? “Along Came Polly”.
  • Add a tenancy in common to Polly, you get “Duplex”.
  • Too lazy to show up to play your central casting character? Madagascar.
  • Even lazier? Madagascar II: Electric pile-of-poo.
  • That one where he’s in Mexico with the girl or something and he’s angry at the mariachis

These indictments should be sufficient to show that Zero effect marked the death of Ben Stiller auteur, thinker, and risk-taker to Ben Stiller, a guy in movies. It hurts, because goddammit Ben, you have the skills, we saw them accidentally escape in your cameo in “Anchorman”, but dammit man, the penis-inflation sight-gag from Dodgeball? What the hell is that? I thought Ben was going to fight the machine and do great things. With his connections into the Apatow mafia he still could. C’mon Ben, you’ve got the cash now, make those great things you dreamt about ( although leaving Andy Dick behind is entirely acceptable).

In conclusion, if you’re looking for the genetic ancestor of all Ben Stiller roles since 1992, you can look to “Zero Effect”. If you’re writing your master’s drama thesis on the fecund period of Pullman, look to “Zero Effect”. Otherwise pick up 7% Solution, by Doyle, its conceit is much more compelling – and there’s no open-mouthed gaping Stiller freeze frame that you will need to endure.

Mr Furious

Why I think Barama has a secret weapon

Wednesday, January 23rd, 2008

I was listening to this bit of political discussion from “Meet The Press”.

Obama said something along the lines of “Reagan put America on an entirely new track, the Republicans had once been the party of ideas etc.”

At the end of that clip, it was natural to show Hillary and Edwards pillorying ( Hillary - Pillory, I like rhymes ) Obama for saying that Reagan had changed the game, had moved into new directions, had presaged a change in the zeitgeist. As Edwards wound up for his swing I mentally muted him. I didn’t care. Hillary then did the same thing winding up about, well hell, honestly, I don’t even remember anymore.

My point being is that Obama was looking gracious ( to say nothing of fresh and clean, Mr. Biden ) and, as noted in the commentary, gracious, of a superior cut of material; while Clinton and Edwards looked like cat squabbling outside of a rowdy bar where back-alley where a lit patron makes a makeshift bathroom behind a trash can.

And here is the secret, if he stays cool and collected, he may not have to get dirty in the tumble. He may turn out to have a coat of teflon or he may prove to be like Bre’r Fox: he can present a tar baby that the more mercurial can take several big old swings at, get mucked up in, and prevail in the tussle without so much as having gotten the sharp snap of the crease in his slacks weakend.

“Anonymous” strike against Scientology

Wednesday, January 23rd, 2008

…and the text had me thinking, is Horus Kewmer the scriptwriter of this piece? Unbeknownst to me, my girlfriend posted the a reference to the same content today.

No, I will not be using Facebook

Monday, January 14th, 2008

No, Marvin K. Mooney I will not Facebook
I will not use it to meet a cook
I would rather go to a bar
I would rather drive in my car
I’d rather return things at Fry’s than
read others’ ego-lies.

Please do not search for me there
for it I simply give no care.

More About Facebook’s Invasive Terms of Service

Google search was un-obvious

psql databasename
\d table_name

[Rails] Associations

Monday, January 14th, 2008

Yesterday I found out I had made a major boo-boo in setting up an ActiveRecord::Association.

Imagine a “Widget” model that is composited of serveral other fields. You might think to yourself.

“An Widget has a SKU ( housed in table ‘skus’ based on model SKU ), a widget has a color, etc.”

You then might model your code such that

    Widget < ActiveRecord::Base
      has_one :sku
      has_one :color
    end

And accordingly

    SKU < ActiveRecord::Base
      belongs_to :widget
    end

This is wrong.

You must think in terms of the most “atomic” element. What’s the relationship of a SKU? A SKU “has one” product to which it is applicable. You see, what you’ve done above is absolutely reverse of the way it should be.

Think this way:

    SKU < ActiveRecord::Base
      has_one :widget
    end

And then just add the mirror entry, for completeness

    Widget < ActiveRecord::Base
      belongs_to :sku
    end

You can see this explained in the Rails API:

class Employee < ActiveRecord::Base
    has_one :o ffice
end

class Office < ActiveRecord::Base
   belongs_to :employee    # foreign key - employee_id
end

If you find yourself using the primary key of the composite entity to find something in the the constituent table or getting into weird sorts of problems with .create() or find yourself thinking that you may need to implement something like (although it is pretty cool):

    $ irb
    irb(main):001:0> class K
    irb(main):002:1> end
    => nil
    irb(main):003:0> k1 = K.new
    => #
    irb(main):004:0> k2 = eval('K').new
    => #
    irb(main):005:0> k3 = Object.const_get('K').new
    => #

[Reference]

The real difficulty here is with how English speakers construe the transitivity of the phrase “has one”. Does this mean:

  • X is a superior containing entity i.e. “contains” (“The happy meal has one hamburger and one toy”)
  • X is uniquely assigned in a relationship (“The parolee has one parole officer”)

The word “relationship” in the second bullet is the use of “has_one” that Rails uses the phrase “has_one” to signify.

If, when getting your object model to work in Rails seems really hard and sorta backwards, you should say “this seems needlessly hard, maybe I’m doing it the wrong way” and bail out of that design. The LOLCatz rules apply here: “Using Rails to make your life easy - ur doin’ it wrong

My Christmas Present

Sunday, January 13th, 2008

On Christmas Day I opened this:

My Christmas Present

And I knew the place immediately, Roma, urbs æterna

It reminded me of the day that I with Big Nerd Ranch staffers had the opportunity to tour Rome. It specifically reminded me of the small tunnels that connect the streets through buildings, something like…

IMG_6543.JPG