Thursday, August 19, 2010

One of my favorite show

Not that I get to watch it much with a 13 y.o. in the house but one of my favorite shows has to be "Penn & Teller: Bulls*#t"  Basically they spend the entire show debunking some pseudo science quackery of one form or another and it's hilarious.  My wife hates the language they use, and obviously I'm not allowed to let E watch it with me.   If it weren't for Penn's language and the random naked women (that's always been a P&T thing), I'd love to have him watch it.  Skepticism is good, especially in teenage minds before they're filled with so much random crap.  Anyway, this is all a lead up to one of my favorite quotes from Penn Jillette.  After the break because it's quite a bit of swearing, but with a purpose:


SQL fun

You ever have one of those days?  This one stretched out for about a week.  Over and over again, trying to solve a very odd problem.  Seems like a certain type of look up was failing, but only on a single database.  Check the stored procedure for look up, looked fine.  Replicated the process to populate the look up, worked fine, for a moment, then suddenly didn't work anymore.  WTH?!?

Here's my script to add a value to the table.  Keep in mind that I didn't have direct access to the table itself, I'd assumed the look up query was failing, and ran repeated tests against that.  Anyway, to add a value to the table:

delete from lookUpTable where AccountID = @AccountID or @LookupID = @LookupID

insert into lookUpTable (AccountID, LookupID) values (@AccountID, @LookupID)

I looked over this query (quickly, mind you, I was still convinced the look up itself was failing).  Then I asked to look at the table.  If you read the above query and said, "You found only one row, right?" cookie for you, if not, look at the above script one more time.  The first time someone who wasn't me looked at it they pointed out the problem immediately, but it was kicking me around for what felt like forever.  Always good to have another pair of eyes.

In my defense this stored procedure had been changed several times, I'd look at it and go "yep, looks right" and examine the look up s.p. again for issues.  And lookUpTable was being cleared over and over again while we tested.

Friday, August 13, 2010

From the Interwebs

Just noticed a quote I hadn't seen before from (one of) everyone's favorite Mythbuster(s):

Adam Savage: Say it with me "Do NOT try this at home!" If I find out that ANY of you tried this at home I will personally come to your house and kick your butt. You got that?!

Friday the 13th

Happy Fri the 13th!  Time to celebrate the fact that I don't believe in luck and/or watch awesome crappy movies about a masked behemoth killing learning disabled camp counselors in creative ways.

Thursday, August 12, 2010

Arrogance

Watching the newer episode of American Chopper.  (Senior vs. Junior)

I don't know if I have the unmitigated gall to do something like this.  Your Dad taught you how to make it, and do your best job, and you fail, and he gets angry with you, so you directly compete with him?

I've been extremely competitive with my Dad, but I would never have the arrogance to do something like this.

Wednesday, August 11, 2010

Earnestness

I don't even know if that's a proper word.  These days no one cares anyway, so let's just go with that.

Sitting here watching Army of Darkness (Evil Dead 3, basically) with T,  and I'm reminded of what makes the 80s so awesome.  We had the beginnings of the technology that's so widespread today, and we made the most of it.  We finally had cameras that the average (well, your well off friend's Dad, anyway) could afford, and a cheap media to use with it.  Would it surprise you to learn that a blank VHS tape in those early camcorders could cost you about 30 bucks? That was extremely cheap back then.  These days you could buy a stack of DVDs (or better) with the same amount of money, but back in the day, those 80 minutes were all we needed.

I remember Mike and Robert and I finding out that you could pause while recording (for about 30 seconds mind you, it was still physical media), and we made a bunch of "movies" where we teleported by recording you in one spot, then pausing, then running like hell to location 2, and unpausing.  It was awesome.  Once we convinced Robert's Dad that investing in a (then extremely new) SoundBlaster card, we could simultaneously listen to and add new sounds, so we got a very cool *boing* sound in the mix.

Now, don't get me wrong, but with all the technology we've come up with, and youtube and everything, I wonder if kids these days get the same kind of easy to use and hack toys, and experiment with these new toys.

Nothing much I guess, just wondering, and if you're this far into the attic of the WWW, I'm sure you run across some weird stuff.  Might be just my socially retarded way of striking up a conversation.  :d  G'night all.

What is going on?

I saw a plaque the other day.  And it reminded me of what's important:

"Writing is easy, you just open up a vein, and bleed"


The sucky part is I don't remember the teacher who had that.  The only teachers I remember are Frau Evelyn Sauchier, who taught me German and how to be a person (fucked as I was) and Vickie Tarver, my Industrial Technology/CAD teacher.  I used to stay hours after class to talk to Miss Tarver (Miss Tarver completed the Magic "Dark" expansion 3 days before I did), or Frau.  I was high strung (surprise, surprise) and left alone with my thoughts far too often.  I had 3 friends out of a class of thousands, and I was alone.  These teachers did minor things (play Magic, tutor me in cuss words, anything to get my attention) that made a major difference in me.

Why do I say this at all?  I don't know.  I'd like to remember who had that plaque, so I can thank her.
What does it matter?  Not much, but she should know.

Tuesday, August 10, 2010

Thought experiment:: Suduko Solver

So, I'm trying to teach myself Ruby, after a long hiatus in the process.  Mainly reading the pickaxe, haven't coded much yet by hand.  My Dad's one of the great programmers of this age, in my mind, so when he said one of his first experiments was a logical Suduko solver, I thought, "Hey, I should at least try to emulate him."  (Yeah, everyone loves their dad and respects him, let me tell you about a time my dad and his best friend turned a few dozen mall stands into a multinational corporation with the inventory tracking system.)

Here's where it starts to get interesting.

*Note, I'm not sitting here with the pickax in hand, just running it through my head, this is not language dependent, but a test for me as a logical person, ie, a programmer*

The first thought I had was, brute force, we can try for elegance later, after I have a good understanding of the problem.  The first thought I had after a quick glance through the doc is a hash, each key being x, y, quad (obviously not quad, whatever the nine piece equivalent is).  The values of the hash being the solved value.

My quick 5 minute run through told me I *could* use regular expressions to pull confirmed values, there is a function in Ruby to return an array of values with REs in a hash, and then use exclude (I don't think that's the right term) to do a negative match.  That is, I could go through and say "The point at x, y, in quad (nine) can exclude these values, does that leave one?  Several passes could do a lot of the puzzle.

Then I thought some more, and realize that a logic puzzle like suduko would also need me to find positive matches, that is, of a given number of cells, which one could hold the value I'm looking for?
To illustrate:

The row has the following values:  1  2  3  4  5  6  X  Y  Z

X, Y, and Z have to have the values 7,8, and 9, this is obvious.

If Y can't be 9 and Z can't be 9, this is less obvious, but just as important.  I say less obvious because I chose a simple example.  This can be extremely complex, let me choose a less obvious example:

The column (just for fun) has the values:  1  A  2  B  3  C  4  D  5

Now here's where it get's interesting.  A and B only have the option to be 6 or 7, and since they only have the option to be those values, they have to occupy that space together, and C could be 8, 7 or 6, and D could be 9, 7, or 6.   A human mind could read that and say C=8, and D=9.  How to code that though?

And that is my thought experiment, it took me longer to write it than it did for me to think it, but that's what I'm working on.

Measure twice, cut once.