Matt Hackmann

MattHackmann

The thoughts and goings-on of some programmer dad.

Crayon vs SyFy CGI

Received this message on Facebook from a buddy of mine today:

Did you see (and I am NOT making this up) OCTOSHARK on SCI-FI last night. I mean the (so called) special effects were anything but! You with a crayon and a piece of paper drawing the title creature could have made a scarier one.

I'm never one to turn down a challenge like that, so I give you the terror of the deep, Sharktopus!

Trailer for the horror in question can be seen here.

Wordpress - Related Posts Script

At my job, I currently have three Wordpress sites under my watchful eye. On one, I was tasked with creating a related posts feature. Now, there are certainly enough plug-ins that will do just that, but none of them worked how I wanted to or were generally more complex than necessary. So, I whipped up this little script:

function relatedPosts($id) {

    /* Build a query to get a list of all posts that share similar tags */
    $s = microtime(true);
    $q = "SELECT count(*) AS total, p.ID, p.post_title, p.post_date FROM wp_posts p INNER JOIN wp_term_relationships t ON p.ID=t.object_id AND t.term_taxonomy_id in (SELECT s.term_taxonomy_id FROM wp_term_relationships s WHERE s.object_id=$id) AND t.object_id != $id AND p.post_status='publish' GROUP BY p.id ORDER BY total DESC, p.post_date DESC LIMIT 5";

    /* Format the output */
    $out = "";
    $result = @mysql_query($q);
    if ($result && @mysql_num_rows($result) > 0) {
        $out = "<h3 class=\"related\">Related Posts</h3><ul class=\"related\">";
        while ($row = mysql_fetch_object($result)) {
            $perma = get_permalink($row->ID);
            $out .= '<li><a href="'.$perma.'">'.$row->post_title.'</a> - '.date("F j, Y", strtotime($row->post_date)).'</li>';
        }
        $out .= "</ul>";
    }
    
    echo($out);

}

Just drop that in the wp-content/yourtheme/functions.php file, where yourtheme is the directory of your active theme. Then add the following in your wp-content/yourtheme/single.php where you want the related posts to appear:

relatedPosts(get_the_ID());

You should now have a list of posts with similar tags. Styling is simple: one h3 and one ul, both with the class "related".

Enjoy!

Because it Provided Ample Opportunity for Practice

I've done some odd things to other people's work for my own pleasure. Editing parts I don't like out of songs comes to mind (I've done this on more than one occasion). However, the latest target of my artistic raping is the live action video for Ningyo Hime, the Chobits closer and a song I much enjoy. While I do enjoy Japan's animated fare quite a lot, I am of the mind that they really suck at live action. The video of this song suffers from a lack of vision and direction, but more importantly it looks like it was shot on an old Sony HandyCam. I sought to "correct" this issue by using it as practice for color correction. After dropping the frame rate to 24 - down from a too smooth looking 29.97 - and slaughtering the blue color channel, this is what came out:

youtube video

This is What I Think About Whilst Driving to Work

On my daily commute to work I encounter three intersections (four if you include that weird three way, round the corner thing). Of these intersections, two have lights. One of these is at the cross roads of a highway, with light poles hanging out over the streets on all four corners. The other one... well, it's messed up.

This intersection, being comprised of two smaller roads, has two lights dangling over a singular wire running diagonally across the streets.

This is all well and good, but if you happen to be stopped heading east/westbound (as denoted here by the green lights - illogical on two counts now that I think about it), you find yourself an annoying predicament.

The yellow cone represents one's field of vision. As you can see, the driver of this fancy white car is completely unable to see the light. He would have to hunch down and angle his neck upward at an uncomfortable angle to correct this problem. This can be made doubly worse if the driver is A) tall or B) driving in a tall vehicle. I myself have met both conditions in the past.

You might be looking at that diagram and be thinking to yourself "Okay, there are two lights. Just use the one farther away." Which would be great, except it's positioned just so that it is obstructed by the upper left corner of the car.

There is a solution that could not only solve our issue but come with another small perk as well:

By placing a single light over the center of the road, all drivers now have an equally decent view and there's the added bonus that you are now drawing half the amount of power than before.

So, City of Bartlesville street planners, take my logically thought out rant to heart and save my poor neck from this treacherous evil I must face every morning. And if I find out you all have shares in local chiropractors and this was all on purpose, then may you forever sit at a red light in the westbound lane of Price and Silver Lake down in Hell!