Matt Hackmann

MattHackmann

The thoughts and goings-on of some programmer dad.

Hanako in Winter

A picture that evolved from something I sketched during a long meeting at work.

So, this is the second time Hanako has made an appearance in a completed picture. And, lucky me, she decided to bundle up all nice to prevent me from having to draw limbs and digits. Arigatou, Hanako! Sadly, she did forget her hat and now the snow is piling up atop her head.

Inked in Sai and colored in Photoshop.

PHP ID3Lib 1.0 Release

Brand spanking new release of the PHP branch of ID3Lib!

[ Download ] [ Documentation ]

What's new:

  • Added support for ID3v1, older ID3v2
  • Genre now returned on all tag versions
  • Calculates song duration and average bit rate for constant (CBR) and variable (VBR) bit rate files
  • Single object instantiation can read more than one file
  • Much improved inline documentation (phpDoc style)
  • General code clean-up, bug fixes and improved compatibility

Example


include('id3lib.php');
$songs = array('song1.mp3', 'song2.mp3', 'song3.mp3');
$id3 = new ID3Lib();
for ($i = 0, $count = count($songs); i < $count; i++) {
    $id3->readFile;
    $min = floor($id3->length / 60);
    $sec = $id3->length - ($min * 60);
    $sec = strlen($sec) == 1 ? '0' . $sec : $sec;
    echo 'Title: ', $id3->title, '<br />';
    echo 'Artist: ', $id3->artist, '<br />';
    echo 'Album: ', $id3->album, '<br />';
    echo 'Track Number: ', $id3->track, '<br />';
    echo 'Disc: ', $id3->disc, '<br />';
    echo 'Year: ', $id3->year, '<br />';
    echo 'Genre: ', $id3->genre, '<br />';
    echo 'Length: ', $min, ':', $sec, '<br />';
    echo 'Avg. Bit Rate: ', $id3->bitrate, '<br />';
    $id3->savePicture($i.'_pic.jpg');
}

If you have any comments/issues, let me know!

The Revenge of Bottomembly

A few days ago I was out walking and reminiscing, as I am wont to do. While I was doing this, I recalled some of my first web related programming projects, most notably YPNgine. Considering it was my first major PHP outing, I pulled off quite a feat. Writing a message board is no small task. However, there was one part in particular that I was mulling over: the censor.

If you happen to be a former YPNer, you may recall seeing many references to "bottomembly". Carrying over the censor find/replace list that had been used on phpBB before it, all instances of the character sequence "ass" were summarily replaced with "bottom". Now I am being very choosy when I say "character sequence" and not "word" as the censor couldn't differentiate words.

This oversight was brought to my attention my young programmer self struggled to figure out a solution. Here's what I wound up doing:

// Copyright (c) 2003 Matt Hackmann
// Full copyright info in index.php

function censor_post ($body)
{

    $query = "SELECT * FROM bannedwords";
    $result = db_Query ($query);
    
    $body = " ".$body;
    
    $body = str_ireplace ("assembly", "ytrewq", $body);
    $body = str_ireplace ("assum", "asd;ljf", $body);
    $body = str_ireplace ("glass", "glss", $body);
    $body = str_ireplace ("hello", "hllo", $body);
    
    for ($i = 0; $i < db_num_Rows ($result); $i++) {
        $row = db_fetch_array ($result);
        $body = str_ireplace ($row["blocked_word"], "", $body);
    }
    
    if ($body == " ")
        $body = "Censored";
    
    $body = str_replace ("asd;ljf", "assum", $body);
    $body = str_replace ("ytrewq", "assembly", $body);
    $body = str_replace ("glss", "glass", $body);
    $body = str_ireplace ("hllo", "hello", $body);
    
    return $body;

}

As you can see, I started hard coding in a list of safe words, replacing those instances with a random (or not so random) string of characters, run the censor and then convert those strings back to the safe words. This was a list I kept expanding on as they were found during normal conversation on the forum. I giggle as I look at this list and think of what the censor was doing to those words: bottomume, glbottom and hecko.

It's just something that I, eight years later, have to look back on and chuckle about.

Could this be... progress?

Some moons ago, I had a little comic entitled Digital Double. It was terrible, but I found myself reading through it again one day not too long ago for whatever reason. One comic in particular intrigued me as I was attempting to take a stab at "anime style", an in joke to a couple of sudden character design changes I'd made. Here is the panel in question:

Now, one thing that intrigues me about this picture is that, at the time, I absolutely despised anime and all arts Japanese. That being said, I do not remember using much of anything as far as reference to even attempt to match the style. Just slap on some large, shiny eyes and a pleated skirt. DONE!

I thought it might be fun to revisit this frame and, given that I am actually attempting to draw in this style seriously, envision it as it should have been.

Continue Reading

Kate Reimagining

This is a re-imagining of a panel from a comic I drew back in the summer of '06. Proof that I have made some sort of artistic skills progress.

Little write-up with the original here