Obamamentathon ‘08

April 5th, 2008

Everybody in Missoula got a taste of big-time politics today as Barack Obama came to town. My mom, the Karf and I went to the Obama rally this morning. The line was long, the speech was great, and I took a bunch of pictures. I’ve got to say, it was quite surreal to see Obama standing in Missoula of all places, after following him on the televisions and the internets for such a long time.

I’ve been an Obama fan since seeing him on Conan a long while back. And yes, while I realize that this is a great superficial reason to start liking a political figure, it’s when I first really heard the man speak. Conan asked him a question about his family and if their view of him had changed because of his recent rise to political stardom. He said something about how his family keeps him grounded, and said that they still gather around the dinner table like any other family — except he addresses his family as “My fellow Obamas….” It made me lol and then I realized… woah… did a politician just make a witty joke that wasn’t lame? It blew my mind.

Since then I’ve learned a lot more about Obama’s policies and got myself all good and informed. Two things really stuck out for me: Obama’s knowledge of and stance on tech issues and his refusal to accept PAC and lobbyist campaign contributions. I could go into more detail… but I want to show some photos!

Obama on the Stump

Obama on the Stump

Obama on the Stump

PHP and MySQLi — destroyer of souls

March 30th, 2008

MySQL 5 has support for stored procedures, which makes me happy. I’d much prefer keeping the database and SQL wrapped up nicely than to have a bunch of SQL queries vomited all over my PHP code. In order to use these handy stored procedures, you have to use PHP’s MySQLi (improved) extension instead of the normal php_mysql.

Well, everything was going great with this PHP stored procedure-y goodness until I tried to write a page that made use of two stored procedures. I used to do this all of the time in PHP using inline SQL statements — I would just assign a different $results variable for each statement. But when I tried to do this with mysqli and stored procedures, something went horribly wrong.

Here’s what my code looked like:

$query1 = "CALL sp_SampleStoredProc($input_param)";
$results1 = mysqli_query($link, $query1);
$row = $results1->fetch_assoc();

$query2 = "CALL sp_AnotherSampleStoredProc()";
$results2 = mysqli_query($link, $query2);
$num_rows = mysqli_num_rows($results2);

Yes, yes… I am mixing procedural and object oriented PHP. Phphpthphtpt.

Anyway, when I tried to run this, I wouldn’t get the results of the second query. I stuck in a

mysqli_error($link)

to see what was going on. Here’s what it said:

Commands out of sync; you can’t run this command now

Oh, gee. Thanks MySQL. Really helpful. I started digging around in the internets for this error message, and everything I read pointed to this example in the PHP documentation:


/* Select queries return a resultset */
if ($result = mysqli_query($link, "SELECT Name FROM City LIMIT 10")) {
printf("Select returned %d rows.\n", mysqli_num_rows($result));

/* free result set */
mysqli_free_result($result);
}

The mysqli_free_result($result) was supposed to be the key. The command should do some black voodoo magic in MySQL to prepare it for another query. HOWEVER — it doesn’t work with stored procedures. You have to do a different command with stored procs: mysqli_next_result($link). It took me THREE HOURS to figure this out. There was much banging my head against the wall. Maybe I just didn’t know what to search for, but Google wasn’t very helpful.

So, hopefully somebody else can benefit from my insanity. I’ll write it one more time.

If you’re using stored procedures with MySQL and PHP — use mysqli_next_result($link) in between calls if you are going to make more than one.

Care a lot! We care a lot!

March 26th, 2008

Back when I was a wee tomfite, I was all about the Care Bears. Anything and everything Care Bear related had to be consumed. Mom would sit me down in front of the those lovable bears and I would sit for hours, eyes transfixed and jaws a-gape. Then, sadly, I turned 7 and all of the sudden Care Bears didn’t have quite the appeal that they used to. Fast forward 18 or so years. The Internet is a wonderful place, but it can uncover deep and repressed memories that one wishes were left buried. I stumbled upon the Care Bears Movie II: A New Generation on YouTube and it awakened something in me that had long been asleep: total and unfettered terror. Although I loved the Care Bears to death, that movie scared the bejeezus out of me.

This scene, in particular, sent me running out of the room screaming nearly every time. It’s where the evil “Dark Heart” goes absolutely insane and starts destroying the universe with hate. Or something to that effect. Best to witness for yourself:

Aggghhhh that voice… that horrible horrible voice. I remember the sound of that scene but not the video. I’m pretty sure this is because every time it came on I was hiding under something, scared to death. I had a hard time not covering my eyes when I watched this again today… and I’m a grown man. Oh, the shame.

011011 + 010010 = 101101

March 19th, 2008

This blog should probably be renamed to “random things tomfite finds on the interwarbs” because somehow that’s what it’s turned into.

Prepare yourself for tonight’s find, because it is really nerdy. We’re talking at least 3.65 kilonerds on the nerdiness scale. This is a video of a fully functional binary adding machine made out of wood and marbles.

If I were this guy, I’d probably set it up to throw the marbles back up to the top and feed them all through the 1 bit at a rate of 1 per second, so it would turn into a binary clock. That would be sweeeeeet. Well… I guess that would only work if a minute had 63 seconds. This should be changed, anyway.

Here’s a detailed description of the project.

Here come the nightmares…

March 18th, 2008

So, there I was, innocently surfing the interwarbs, when I happen upon the most disturbing video I’ve seen in a good long while. This is a robotic, fully autonomous quadruped. In the future these will stalk you, hunt you down and replace all of the soft tissue in your body with NIGHTMARES.

BEHOLD THE BIGDOG:

(NOTE: do not watch if you have an innate fear of robots, dogs, flies, bugs, deer, creepy noises, or kicking defenseless machines. They will not be defenseless for long.)

Somebody beat up Charlie Rose

March 17th, 2008

Yeah, that’s right. He’s on the television right now looking like he got his ass handed to him by a 200 pound midget (that can do flying ninja kicks).

He said that he fell on some pavement or down some stairs or some such nonsense, but we all know better. Where did the bad man touch you, Charlie? You can tell me. I’m an adult.

Drums and Dyhidrogen Monoxide

March 16th, 2008

This weekend was spent entirely playing the drums, give or take a few bouts of Smash Bros Brawl. I got around to rearranging my room so that I could actually make it to the dresser in the morning without toe stubbing incidents. The drum set is now safely tucked into a corner, thusly:

What was in the boxes

The drums have a hit counter on them that tells you how many times the pads have been struck. I’m over 200,000 hits. It’s pretty scary how quickly it adds up… especially considering I was only 100,000 on Friday.

Favorite song so far to play on da drums: Jigsaw Falling Into Place by the Radioheads. For some reason that rhythm and I get a long really really well.

In non-drum related news, I stuck my camera in the sink and took some high shutter speed flash pictures. I really like how they turned out.

Frozen Bubbles

Dihydrogen Monoxide

DRUMS

March 10th, 2008

I ordered a shiny new electronic drum set about a couple of weeks ago, and after a series of misadventures thought that they were back ordered until March 31st. BUT — I got word they were shipping last week and they got here today! Wheeeeeee! Yamaha DTXplorer. An insane amount of fun, especially drumming around to music. Weird thing is I can only seem to do one or two beats when I’m not playing to anything, but with music I can pick up a ton of different rhythms fairly quickly.

Here’s the aftermath of the drum’s packaging. So… many… boxes… (full of goodness (It was a bit like Christmas morning (sorry about the over abundance of parenthesis (LISP, anyone?))))

BEHOLD:
The Aftermath

Oh, Jim Davis

February 24th, 2008

After lolfing about Garfield Minus Garfield I was reminded of Lasagna Cat. Now, I found Lasagna Cat on the interwarbs a while ago, but it deserves a bloggin none the less. They are loving tributes to Jim Davis for his tireless work making America laugh every day.

Actually, they’re more like tripped-out bizzaro creations that can only described with the letters W, T and F.

Observe:

And a few more of my faaaaavorites:

Final Fantasy / Garfield mashup
Awww, poor Jon
Nightmare inducing

Can’t think of a decent title to string these two things together.

February 20th, 2008

Today, as anybody with half-a-brain knows, was the total lunar eclipse. I went out and took a bunch of pictures… they didn’t turn out *that* great, but I put a couple up on Flickr that were halfway decent.

teh m00n

DA MEWN

Also, on a (very) sad note… the family dog, Chewy (or Chewie, we spelled it both ways) passed away today. He fell ill with a blood disorder over the past few days and didn’t make it… it was really quite sudden. I’m glad I got good pictures of him last summer. Here’s one of my favorites.

Hi Chewy!