It's time: The Blasphemy Challenge

General Fri Jun 15, 2007 @ 00:48 Pacific

I've been avoiding saying much about politics and religion in places where my name can be attached easily. After all, there's nothing that can make you unpopular like expressing your own opinion on something so very flame-worthy.

But it's time. I can no longer deny it, and I can no longer hide. I am an atheist, and have taken the Blasphemy Challenge.


[]

HOWTO: Compile a PECL extension

General Tue Feb 06, 2007 @ 15:14 Pacific

There is not a single place on the web that seems to document this procedure.

Step 1: Unzip packagename.tgz
Step 1a: cd packagename
Step 2: phpize
Step 3: ./configure
Step 4: make
Step 5: make test
Step 6: make install
Step 7: Add the extension to your php.ini


Seriously. That's it. The XML files sitting in the root of the archive are for PEAR, and can be ignored if you don't do PEAR.

[]

The PHP5 ArrayObject

Work Fri Dec 29, 2006 @ 17:20 Pacific

It's a rare time when I can actually praise PHP. As a native Perl hacker, I've come to hate many aspects of the language because they just seem so horribly wrong. That isn't to say that there aren't things that are done right, it's just that the irritations are more than the benefits.

Here's a prime example. PHP5 allows what it calls overloading of object methods and properties. It's not what I'm used to thinking of when I hear the term "overload," but it's pretty interesting.

The long and short of it is that you can have code be called whenever:
1) A method is called that has not been defined
2) A property is accessed that does not exist or has not been declared public.

There's a high degree of utility here, if it's done right. An actual example that we use at work is using __get and __set to keep track of property changes, so that when the object is saved to the database, we can log what changed without actually comparing the object to itself, or keeping revisioning within the object.

Unfortunately PHP, logically, doesn't do it right. When the property is an array, __set is never called. This is because __get (or direct access) will return the array by reference, so changing an index in the array is done directly.

I'd previously blown off the Standard PHP Library as nothing more than OO wankery that was mostly useless in day to day coding. And while I still maintain that opinion to some extent, it does contain one gem that can fix the __set problem: ArrayObject.

An ArrayObject is not unlike a Perl tied array. There are four really important methods - offsetExists, offsetGet, offsetSet, and offsetUnset. There are a handful of others, but those are the interesting ones. The object is treated as an honest to goodness array by all PHP functions, and can be accessed directly as an array. Any additional methods can also be accessed directly through the normal object syntax.

(For additional fun, you can define its own __get and __set that call offsetGet and offsetSet so you can refer to each index in the array using both object syntax and array syntax.)

So how does this solve the __set problem? Simple -- override the default offsetSet method with some variety of logging, and add a method to fetch the changelog.

class LoggingArray extends ArrayObject {

private $log = array();

function offsetSet($index, $value) {
$old_value = $this->offsetGet($index);
if($old_value != $value)
$this->log[$index] = $old_value;
return parent::offsetSet($index, $value);
} // end offsetSet

function get_log() {
$log_array = array();
foreach($this->log as $k => $v) {
$log_array[] = "'$k' changed from '$v' to '{$this->offsetGet($k)}'";
} // end foreach
return join("\n", $log_array);
} // end get_log

} // end CC_Array

class Example {
public $test;
function __construct() {
$this->test = new LoggingArray;
} // end __construct
} // end Example

$x = new Example;
$x->test[0] = 2;
$x->test["hi"] = "there";
echo $x->test->get_log();


It'll be interesting to see how or if this will work in practice, and what kind of overhead is introduced by all those method calls.

[]

The glory of the backup

General Fri Dec 22, 2006 @ 20:04 Pacific

So in my very, very slow quest to put together a Linux powered media center system, I found myself short a cable. So I went upstairs into the storage room and decided to see what I could find. I used to have a bunch of parts to build the needed cables, so I figured it wouldn't be a problem. Well, it was. I couldn't find anything I needed.

Instead, I found a source of awesome. In a box, I found a dozen CDRs, dating to 1999 and 2000. Full backups of good old CELERON, including lots of things that I thought were gone for good when his drive crashed.

I guess November and December really are great for nostalgia.

[]

If you haven't talked to Feenix lately...

General Thu Dec 07, 2006 @ 15:28 Pacific

... then head over to Startrekker and say hi. She'll appreciate it.

Both the utility bot component and the Alice component are now running here on Lobotomy, thanks to GNU Screen. She went down about two years ago after she went offline for a bit over a holiday weekend, resulting in a log gap. I was unable to import the logs, so I delayed bringing her back up until I could figure out what was wrong.

Oops. I've imported most of the missing logs, and recently found some obsolete logs from the Phoenix Chat days that I might import. If I do that, it'll mean that Feenix will then have a log of everything that happened in Startrekker from mid-2001 to the present. That's kinda scary.

[]

No quack

Linkage Sat Dec 02, 2006 @ 09:44 Pacific

The pig go. Go is to the fountain. The pig put foot. Grunt. Foot in what? ketchup. The dove fly. Fly is in sky. The dove drop something. The something on the pig. The pig disgusting. The pig rattle. Rattle with dove. The dove angry. The pig leave. The dove produce. Produce is chicken wing. With wing bark. No Quack.

[]

I hate RAM

General Sun Nov 26, 2006 @ 01:40 Pacific

I finally grabbed some of the parts Wynn was done with in Portland, so I figured I'd make sure they still worked.

Now most of you won't be familiar with the epic saga of my home computers.

Once upon a time, there was Celeron and his equally-as-mediocre-named brother, Pentium. They served me well for a very long time, and I was very happy with them.

Then along came Steph's system, Mister Happy. Mister Happy wasn't happy at all, and eventually got himself nuked and paved into Lobotomy, and he was very happy. Quick, look at the URL bar.

To replace Mister Happy, Steph got Squiggles, and the two were happy together. Well, mostly. Poor Squiggles got mangled badly to and from college.

Eventually Celeron became too old and slow, and it was time to replace him. And thus was born Scorpy.

Meanwhile, Squiggles was transplanted into the shell of what used to be Celeron, and around the same time, the original Lobotomy hardware was retired and replaced with a new system of the same name, still just as happily puttering away.

Next it was time to retire Pentium, and hardware was picked up to match Scorpy's config.. but never worked. It infuriated me to no end, and I ended up RMAing the motherboard, memory, and CPU, but to no avail. It rarely passed a POST, and always flunked out a memtest86. The partial machine was nicknamed Headcase and shoved into the boneyard in the corner, to be forgotten about. He joined Lobotomy 1.0, and CCAPPS, my old desktop machine from Infopop.

I eventually adapted from the dual box setup of Scorpy and Pentium down to just Scorpy. However Scorpy was also growing old, and just last year was replaced with Duo.

Now Scorpy wasn't slow or anything, just not as new as I wanted. As he was perfectly good still, I loaned him to Corwynnde to replace her aging system. She eventually did some hardware swaps -- the fan on the chipset went out, etc.

But Duo was flaky and annoying, and I eventually determined that one of the two sticks of RAM was at fault.

And now that you know all that seemingly useless information, allow me to actually rant about the topic of this post -- I hate RAM.

So I get the motherboard back, and I figured that I'd just put together a system, as I had recently uncovered CCAPPS in the boneyard and knew I could grab things from him if needed.

Wynn also gave me two sticks of RAM that she pulled out of Raukurk's machine. Two sticks that she knew were bad, and that I knew were bad.

So I did the motherboard swap into Headcase, and put in Rauk's RAM. It wouldn't even POST. Beautiful!

So I grabbed the memory that was in the original Headcase motherboard... and, no, it wouldn't POST either. Uhoh.

Desperately, I grabbed the one gig stick from Duo, the one known bad, the one that caused me months of hell when it was living inside of Duo... and it POSTed. And booted. And passed three memtest86 runs.

WTF?

So I stuck a stick of Rauk's memory in, along with the 1 gig stick... and it also passed. So I put the second in, and it also passed. But take out the 1 gig? No POST... in dual channel mode. Passed fine once I switched around the banks.

I'm so confused.

Those are known bad sticks, but they're testing fine. How does that even work? I've put Headcase back in the boneyard for now, as I really need to replace the chipset fan before I do anything else with him. I still trying to figure out what I'm gonna do with him.

Oh, but it gets better. I put the one gig stick here in Lobotomy, and test it... and test it... and it's fine. And I hope it'll continue to be fine, as Lobotomy isn't too happy with only 256 megs of memory.

So I dunno. I have five sticks of 256 meg memory here, all but one of which are "known bad," but all of which work in Headcase or Lobotomy.

And thus ends this evening's random rant.

[]

Space Pirate Amazon Ninja Catgirls

General Fri Nov 24, 2006 @ 12:40 Pacific

... is really far too fun. Seriously. Space Pirates are cool. Ninjas are cool. Amazons? Still coool. Catgirls? Cool. Put them together for random goodness. And catnip. Mmmm.

[]

So, yeah

Work Wed Nov 22, 2006 @ 00:40 Pacific

Quite a bit has happened since I last actually updated this thing. First and foremost, as this one is going in the work category, I left my job at Groupee. The UBB was my passion for many years, but that passion was extinguished by so many things, internal and external. In the end, I think it was the right decision for both me and the product that was eventually released. The product has little resemblance to what I was set out to build, and despite it having a little of my code, it's not me, and it's not mine. This means that I want nothing to do with it, so you guys can stop harassing me about doing code hacking for it. Please.

I'm now working for Silicon Mechanics, as part of a team constantly improving their internal management tools. I've only been there a short while, but I'm already appreciating the difference of working on software for a limited audience and in a controlled environment. Never have I been so happy to be told I can skip cross-browser compatibility testing for backend portions of the code. IE can burn in hell, muahaha.

[]

LOL, MySQL

General Wed Nov 22, 2006 @ 00:10 Pacific

>_>

<_<

So, like, I broke shit.

Like two years ago.

And only just now found the database backup.

Not that anyone READS this damned thing.

Also, what the hell was I smoking when I coded it? And OH GOD THE DATABASE. KILL ME NOW.

[]

Software, Content, and Design © 2001-2004 Charles Capps