PHP5 fixed

Oh goody, the problem I was having building PHP 5.0 RC2 seems to have been fixed. I can go back to experimenting again.

FIX: Solaris compile failure.
Daniel Fahlgren reported that following Wez Furlong’s latest changes to proc_open(), PHP will no longer build on Solaris. Daniel had a quick fix for this, but Wez foresaw implications for other platforms in his workaround, and suggested areas where the Solaris build problem might be genuinely resolved. Daniel took this on board and came up with a patch that was acceptable to all, which now happily lives in the PHP source tree. This will be included in PHP 5.0.0.

Recovering MT entries from HTML archives

This script might come in handy some day. There are always posts on the MT support forum about how someone’s lost their database, hadn’t made a backup and only have the archive HTML files generated by MT to restore from. And I’m always forgetting what search terms I used to find the original post.

It won’t restore everything. You still need to rebuild your templates and modules. Not sure about the comments, but at least you can recover your entries. Still, it’s no substitute for having a good database backup or SQL dump of your MT database.

Don’t thank me, thank Jason. He wrote it.

#!/usr/bin/perl
use Date::Manip;
# mtfix.pl - parse HTML files to import into Movable Type
# usage: mtfix.pl *html > import.mt
# Note: you _will_ need to adjust the regex
while (<>) { # for each file on the command line
# read in entire file to $content, line feeds and all
# using slurp mode
{ local $/; $content = <>;}
# locate the fields we need using regex
# some matches may include newlines
($author) =($content =~ m|<div class="posted">\s+(.+?)\s+/|s);
($title) = ($content =~ m|<span class="title">(.+)</span>|);
($text) = ($content =~ m|<p>(.+)<a name="more">|s);
($more) = ($content =~ m|<a name="more">(.+)<span class="posted">|s);
($date) = ($content =~ m|<div class="date">(.+)</div>|);
($time) = ($content =~ m|Posted\sat\s(.+)<br />|);
# Read in all the comments as one big block of text
($comments) = ($content =~ m|</a>Comments</div>\n(.+)<div class="comments-head">|s);
# Break up each comment into it's own element in an array
@comm = split (/<\/div>\n/, $comments);
# convert the date to MM/DD/YYYY hh:mm:ss
$datetime = "$date $time";
$parsed = ParseDate($datetime);
$datetime = UnixDate($parsed,"%m/%d/%Y %H:%M:%S");
# Strip out the paragraph tags, MT will add them later anyways.
$text =~ s|\<p\>||g;
$text =~ s|\</p\>||g;
$more =~ s|\<p\>||g;
$more =~ s|\</p\>||g;
# printout the fields in the proper format
print "AUTHOR: $author\n";
print "TITLE: $title\n";
print "DATE: $datetime\n";
print "-----\n";
print "BODY:\n$text\n";
print "-----\n";
print "EXTENDED BODY:\n$more\n";
foreach (@comm) { # For every comment in our aray, printout the necessary formating.
if (length $_ > 7) { # this is here to ignore the last comment record.
($CText) = ($_ =~ m|<div class="comments-body">\n(.+)\n\<span|s);
($CDate) = ($_ =~ m|</a>\son\s(.+)</span>|);
($Ctemp) = ($_ =~ m|Posted\sby:\s(.+)\/a\>|);
($CAuthor) = ($Ctemp =~ m|\>(.+)\<|);
($CURL) = ($Ctemp =~ m|href=\"(.+)\"|);
$CText =~ s|\<p\>||g;
$CText =~ s|\</p\>||g;
$parsed = ParseDate($CDate);
$CDate = UnixDate($parsed,"%m/%d/%Y %H:%M:%S");
print "-----\n";
print "COMMENT:\n";
print "AUTHOR: $CAuthor\n";
print "URL: $CURL\n";
print "DATE: $CDate\n";
print "$CText\n\n";
}
}
print "--------\n";
}

Diet? I don’t need no steekin diet!

This Flash cartoon was sent to me by my wife. I thought it was pretty funny.

Fatkins diet

Warning: Language is not appropriate for young or sensitive ears.

Darned SPARC

PHP5 RC2 and GCC 3.4.0 are both released, but I can’t get either of them to compile cleanly on my Sparc20. PHP5 RC1 built cleanly. Also have GCC 3.3.3 running (which I’m using to build GCC 3.4)

Maybe I just need to replace the Sparc20.


Problems with PHP5 RC2 start with

/bin/sh /export/home/eugenem/Temporary/apache/php-5.0.0RC2/libtool –silent –preserve-dup-deps –mode=compile gcc -Iext/standard/ -I/export/home/eugenem/Temporary/apache/php-5.0.0RC2/ext/standard/ -DPHP_ATOM_INC -I/export/home/eugenem/Temporary/apache/php-5.0.0RC2/include -I/export/home/eugenem/Temporary/apache/php-5.0.0RC2/main -I/export/home/eugenem/Temporary/apache/php-5.0.0RC2 -I/export/home/eugenem/Temporary/apache/php-5.0.0RC2/Zend -I/usr/local/include/libxml2 -I/usr/local/include -I/export/home/eugenem/Apps/mysql4/include/mysql -D_POSIX_PTHREAD_SEMANTICS -I/export/home/eugenem/Temporary/apache/php-5.0.0RC2/TSRM -g -O2 -prefer-pic -c /export/home/eugenem/Temporary/apache/php-5.0.0RC2/ext/standard/filters.c -o ext/standard/filters.lo
/bin/sh /export/home/eugenem/Temporary/apache/php-5.0.0RC2/libtool –silent –preserve-dup-deps –mode=compile gcc -Iext/standard/ -I/export/home/eugenem/Temporary/apache/php-5.0.0RC2/ext/standard/ -DPHP_ATOM_INC -I/export/home/eugenem/Temporary/apache/php-5.0.0RC2/include -I/export/home/eugenem/Temporary/apache/php-5.0.0RC2/main -I/export/home/eugenem/Temporary/apache/php-5.0.0RC2 -I/export/home/eugenem/Temporary/apache/php-5.0.0RC2/Zend -I/usr/local/include/libxml2 -I/usr/local/include -I/export/home/eugenem/Apps/mysql4/include/mysql -D_POSIX_PTHREAD_SEMANTICS -I/export/home/eugenem/Temporary/apache/php-5.0.0RC2/TSRM -g -O2 -prefer-pic -c /export/home/eugenem/Temporary/apache/php-5.0.0RC2/ext/standard/proc_open.c -o ext/standard/proc_open.lo
In file included from /export/home/eugenem/Temporary/apache/php-5.0.0RC2/Zend/zend.h:244,
from /export/home/eugenem/Temporary/apache/php-5.0.0RC2/main/php.h:34,
from /export/home/eugenem/Temporary/apache/php-5.0.0RC2/ext/standard/proc_open.c:23:
/export/home/eugenem/Temporary/apache/php-5.0.0RC2/Zend/zend_hash.h:39: error: parse error before ‘*’ token
/export/home/eugenem/Temporary/apache/php-5.0.0RC2/Zend/zend_hash.h:39: error: parse error before “uint”
/export/home/eugenem/Temporary/apache/php-5.0.0RC2/Zend/zend_hash.h:39: error: `ulong’ declared as function returning a function
/export/home/eugenem/Temporary/apache/php-5.0.0RC2/Zend/zend_hash.h:49: error: field `h’ declared as a function
/export/home/eugenem/Temporary/apache/php-5.0.0RC2/Zend/zend_hash.h:50: error: parse error before “uint”

and just go downhill from there. First I figured it was a messed up download, but redownloading didn’t help much. Now I’ll have to dig into the files and explore.

Physics discussion

Here’s an interesting looking resource for physics type geeks.

Physics Forums. Kind of like the sci.physics newsgroups but probably with a higher SNR and a pretty wide range of topics. Haven’t spent too much time browsing it yet, but it looks interesting. Need to spend some more time checking it out.

Don’t see anything in my field though. Maybe it’s not so great after all… 🙂