Archive — hermiene.net

"With my brains and your brawn we'll make an excellent team!"

February 13, 2005

Up until very recently, I have been using mIRC for all my IRC needs, but I've come to realize that XChat is very good. Not in the same way as having CSS3 readily available and supported everywhere would be very good, but in the same way as having CSS2.1 half-decently supported everywhere would be very good. The only complaints I have about the program is that there doesn't seem to be an option to turn angle brackets around nicks on (you have to hack them in yourself), and that there doesn't seem to be a way to remove the redundant space it appends to tab-completed nicks. And now for the good stuff. Something I've always wanted is for the logs to have a different timestamp format than the channel windows (or the private message windows, for that matter). XChat does that. Another pretty genius thing it does is grey out the nicks who are /away. And the logs are in UTF-8! Hooray! And finally, a client where marking text doesn't automatically copy it to the clipboard.

I finally managed to write some PHP code that extracts all occurrences of PHP code in a string (in particular, a string from a database), returns the evaluated code, and plugs it in at the right places. I love it when stuff works, especially when you've spent a lot of time on it and finally reach an epiphany where you understand the whole thing. Would you like to see it? I knew you would. :-)

function return_eval($code) {
  ob_start();
  eval($code);
  return ob_get_clean();
}

function return_php_output($arg) {
  $pattern = "/<?php ([^?]+) ?>/";
  preg_match($pattern, $arg, $matches);
  while ($matches) {
    $arg = preg_replace($pattern, return_eval($matches[1]), $arg, 1);
    preg_match($pattern, $arg, $matches);
  }
  return $arg;
}

Here, have a go at this puzzle. Just read the instructions, click around, and experiment. Don't worry. You'll figure it out eventually.

I have managed to muster seven Wilburers. Keep them coming.

I got a hold of another Douglas Adams omnibus, The Ultimate Hitchhiker's Guide, which, to my delight, contains Mostly Harmless, as well as all the others that are already in The More Than Complete Hitchhiker's Guide. If this book-reading thing turns into an obsession, I might make a book reviews page. Hmmm...

<< | Previous entry (February 9, 2005) | Next entry (February 16, 2005) | >>
Back to Archive