Er...somethin' like that.

Sunday, May 27, 2007

Terror! (Or is that "Terr"?)

So, even further back, an entire blog ago, in fact, I hacked together a little PHP script to display your own version of the government's terror alert level. I had it up on Dan Pourhadi's site for a while, until he switched hosts or something and lost it. It sat in the Software Projects folder on my desktop, gathering virtual dust. About a week ago, I had been playing around with regexes and rediscovered this gem, and set about to rewriting it, basically from the ground up.

The changes:
  • 1 regular expression performed, instead of 2 in the best case, and 6 in the worst case.
  • file_get_contents instead of implode()-ing a file()
  • A simple switch() construct instead of a chain of if/elseifs with regexes
  • Optimized the order of the switch cases by sorting them by how likely they are to come up
So it's optimized quite a bit, and works wonderfully. Then, just today, I made a rather interesting discovery. Some time ago, Mivox used my code (with attribution!) to produce her own version with her own graphics, and used the GD library in PHP to allow the script to output an image directly. That allows you to reference the PHP script as the src of an img tag, instead of having to include the script.
I found that to be a fabulous idea, so after downloading Xcode Tools to compile GD to test it out, I implemented that change in my new version of the script. So:

Terror.php, Include Version
  • To be included using a PHP include()
  • Runs on a server with only a PHP installation
  • May be slightly faster
Terror.php, Image Version
  • To be referenced from an HTML img tag
  • Runs on a server with PHP and the GD image library installed
  • Much easier to reference, especially from outside
  1. Download the script of your choice
  2. Upload it to the desired location on your PHP-compatible server. Remember, the Image Version requires the GD library installed on your server
  3. In the same directory, upload PNG format images:
    1. severe.png
    2. high.png
    3. elevated.png
    4. guarded.png
    5. low.png
    6. (Image Version only) error.png
Then, just reference the script in your pages:
Include Version:
<?php include("terror.php"); ?>

Image Version:
<img src="terror.php">

As the comments in the scripts say, if you use the script on your site, please email me and let me know; my email address is in the comments.

In the near future, I may be posting a few image sets for use with these scripts, since I see that Mivox is a fan of the (incomplete) Dragon Tales set.

Saturday, May 26, 2007


So, way way back, I posted about Cingular becoming AT&T again. Well, it's finally happening, and I still don't like it. There's no "AT&T Mobility" web site, just The AT&T globe is popping up everywhere, but everything's still orange, not blue. One of my professors (Hi, Prof. Clark!) got a new KRZR with a Cingular logo on it from a "Cingular is now The New AT&T" store, with a SIM card that reports AT&T on the screen.

Wouldja just hurry up and switch it, AT&T? Nobody who doesn't remember the Ma Bell thing is going to hate you more for changing everything really quick, and those who do remember aren't going to hate you any less. No loss, that I can see.

(Yes, I'm still somewhat jaded about the "baby Bells forming together like Voltron" thing. But if they gave me an iPhone, I could be persuaded to forget...)

Clearing House

Behold, the group of old/useless CDs that were purged from my CD case:

21 22 in all.

Slowly, ever so slowly, I'm getting my stuff cleaned up and organized.

Friday, May 25, 2007

Every 5 Months...

...whether I need it or not.

Remember, no promises of regular updates were made.

So, what's been going on with me...

School: Plugging along, headed toward that I.T. degree. One more semester to go. Last semester was my first non-A grades at Roosevelt--2 Bs, in Network Design and Distributed Databases. I didn't try very hard in either one, and still pulled off the B. Nice.

Work: The lab aides are now part of the Educational Technology Resource Center (read: AV department), and the labs are basically no-man's land. ETRC is "don't know", and IT is "don't care". Nothing gets fixed, lab policies go out the door. But it's $8.24/hr to sit and surf on a fat pipe. So I'm staying where I am for now.

Girlfriend dumped me: Okay, so I really screwed up big time, but she won't even talk to me about what happened between us. If she's going to be that petty about it, I don't see what else I can do. It hurt like hell, don't get me wrong-- it still does. But if she can't get over her own...pride? self-importance? feelings for me? ...enough to talk to me like an adult just once, then I don't see why I should pound me head against the wall trying to get her back.

Grandma died: Not a huge surprise-- she was 81 years old and very sick. (Emphysema and lung cancer). Man, though, when they say you can't ever be ready for it, they're not wrong. The thing that's going to haunt me is the fear in my mom's voice when she screamed to me "Are they coming!?" (the paramedics) because she knew her mother was dying.

House still isn't sold: Downturn in the market means downturn in the market, no matter the real estate agent. I think that my mom should just sel the house for whatever she can get for it, take the hit and stop the ever-mounting credit card bills. She don't listen to me, though.

Yeah, that's basically been life. I haven't gone on a shooting spree or offed myself yet, so I figure things must be going okay.

I do post musings, at least daily, on my Twitter stream. I'm going to try to not let this blog fade out, but what happens kinda happens, y'know?