<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>MaisonBisson.com &#187; php</title>
	<atom:link href="http://maisonbisson.com/blog/post/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://maisonbisson.com</link>
	<description>A bunch of stuff I would have emailed you about.</description>
	<lastBuildDate>Sat, 14 Nov 2009 20:14:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Lessons Learned: Why It&#8217;s Better Not To Use Parentheses When They&#8217;re Optional</title>
		<link>http://maisonbisson.com/blog/post/13877/lessons-learned-why-its-better-not-to-use-parentheses-when-theyre-optional/</link>
		<comments>http://maisonbisson.com/blog/post/13877/lessons-learned-why-its-better-not-to-use-parentheses-when-theyre-optional/#comments</comments>
		<pubDate>Tue, 05 May 2009 17:07:53 +0000</pubDate>
		<dc:creator>Casey Bisson</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[parentheses]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[return()]]></category>

		<guid isPermaLink="false">http://maisonbisson.com/?p=13877</guid>
		<description><![CDATA[
There it is in the PHP manual for return():
Note: since return() is a language construct and not a function, the parentheses surrounding its arguments are not required. It is common to leave them out, and you actually should do so as PHP has less work to do in this case.
I knew the parentheses were optional, but I&#8217;ve [...]]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="maisonbisson-13877"><!-- &nbsp; --></abbr>
<p>There it is in the <a href="http://php.net/return">PHP manual for <code>return()</code></a>:</p>
<blockquote><p>Note: since return() is a language construct and not a function, the parentheses surrounding its arguments are not required. It is common to leave them out, and you actually should do so as PHP has less work to do in this case.</p></blockquote>
<p>I knew the parentheses were optional, but I&#8217;ve been merrily using them all along. And I probably would have continued doing so until I saw the second note attached to the docs:</p>
<blockquote><p>Note: You should never use parentheses around your return variable when returning by reference, as this will not work. You can only return variables by reference, not the result of a statement. If you use return ($a); then you&#8217;re not returning a variable, but the result of the expression ($a) (which is, of course, the value of $a).</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://maisonbisson.com/blog/post/13877/lessons-learned-why-its-better-not-to-use-parentheses-when-theyre-optional/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Magic Constants: __LINE__, __FILE__, __DIR__, __FUNCTION__, __CLASS__, __METHOD__, and __NAMESPACE__</title>
		<link>http://maisonbisson.com/blog/post/13788/php-magic-constants-__line__-__file__-__dir__-__function__-__class__-__method__-and-__namespace__/</link>
		<comments>http://maisonbisson.com/blog/post/13788/php-magic-constants-__line__-__file__-__dir__-__function__-__class__-__method__-and-__namespace__/#comments</comments>
		<pubDate>Mon, 27 Apr 2009 17:31:17 +0000</pubDate>
		<dc:creator>Casey Bisson</dc:creator>
				<category><![CDATA[Dispatches]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[constants]]></category>
		<category><![CDATA[dir]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[line]]></category>
		<category><![CDATA[magic]]></category>
		<category><![CDATA[method]]></category>
		<category><![CDATA[namespace]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[__CLASS__]]></category>
		<category><![CDATA[__DIR__]]></category>
		<category><![CDATA[__FILE__]]></category>
		<category><![CDATA[__FUNCTION__]]></category>
		<category><![CDATA[__LINE__]]></category>
		<category><![CDATA[__METHOD__]]></category>
		<category><![CDATA[__NAMESPACE__]]></category>

		<guid isPermaLink="false">http://maisonbisson.com/?p=13788</guid>
		<description><![CDATA[
I&#8217;ve been using __FILE__ for years, but I never thought to look for its siblings.
echo ' line:'. __LINE__ .' file:'. __FILE__ .' directory:'. __DIR__ .' function:'. __FUNCTION__ .' class:'. __CLASS__ .' method:'. __METHOD__ .' namespace:'. __NAMESPACE__;
I feel as though I should have noticed these earlier; they&#8217;re clearly referenced in the docs for debug_backtrace(), after all.
]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="maisonbisson-13788"><!-- &nbsp; --></abbr>
<p>I&#8217;ve been using __FILE__ for years, but I never thought to look for its <a href="http://us.php.net/manual/en/language.constants.predefined.php">siblings</a>.</p>
<pre class="brush: php;">echo ' line:'. __LINE__ .' file:'. __FILE__ .' directory:'. __DIR__ .' function:'. __FUNCTION__ .' class:'. __CLASS__ .' method:'. __METHOD__ .' namespace:'. __NAMESPACE__;</pre>
<p>I feel as though I should have noticed these earlier; they&#8217;re clearly referenced in the docs for <a title="PHP: debug_backtrace - Manual" href="http://php.net/debug_backtrace">debug_backtrace()</a>, after all.</p>
]]></content:encoded>
			<wfw:commentRss>http://maisonbisson.com/blog/post/13788/php-magic-constants-__line__-__file__-__dir__-__function__-__class__-__method__-and-__namespace__/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scaling PHP</title>
		<link>http://maisonbisson.com/blog/post/11407/scaling-php/</link>
		<comments>http://maisonbisson.com/blog/post/11407/scaling-php/#comments</comments>
		<pubDate>Mon, 22 Sep 2008 13:28:50 +0000</pubDate>
		<dc:creator>Casey Bisson</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[callgrind]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Rasmus Lerdorf]]></category>
		<category><![CDATA[scaling]]></category>
		<category><![CDATA[scaling, php2008]]></category>
		<category><![CDATA[web applications]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://maisonbisson.com/blog/post/11407/</guid>
		<description><![CDATA[
This two year old post about Rasmus Lerdorf&#8217;s PHP scaling tips (slides) is interesting in the context of what we&#8217;ve learned since then. APC now seems common, and it&#8217;s supposedly built-in to PHP6. Still, I&#8217;d be interested in seeing an update. Are MySQL prepared statements still slow?
And that&#8217;s where Rasmus&#8217; latest presentation comes in. We [...]]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="maisonbisson-11407"><!-- &nbsp; --></abbr>
<p>This two year old post about <a title="Rasmus Lerdorf on scaling web apps with PHP" href="http://www.niallkennedy.com/blog/archives/2006/07/rasmus-lerdorf-php-web20.html">Rasmus Lerdorf&#8217;s PHP scaling tips</a> (<a href="http://talks.php.net/show/oscon06/0">slides</a>) is interesting in the context of what we&#8217;ve learned since then. <a href="http://pecl.php.net/package/APC">APC</a> now seems common, and it&#8217;s supposedly built-in to PHP6. Still, I&#8217;d be interested in seeing an update. Are MySQL prepared statements still slow?</p>
<p>And that&#8217;s where <a href="http://talks.php.net/show/drupal08/">Rasmus&#8217; latest presentation</a> comes in. We don&#8217;t learn anything about MySQL prepared statements, but we do learn how to find choke points in our applications using callgrind and other tools. In his examples, he can do a little over 600 transactions per second with both static HTML <em>and</em> simple PHP, but various frameworks &#8212; with many inclusions and function calls &#8212; can slow that to under 50 transactions per second (I suppose they&#8217;d explain that in a <a href="http://en.wikipedia.org/wiki/Office_Space">TPS report</a>).</p>
]]></content:encoded>
			<wfw:commentRss>http://maisonbisson.com/blog/post/11407/scaling-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing PHP APC On RHEL/CentOS</title>
		<link>http://maisonbisson.com/blog/post/12589/installing-php-apc-on-rhel-centos/</link>
		<comments>http://maisonbisson.com/blog/post/12589/installing-php-apc-on-rhel-centos/#comments</comments>
		<pubDate>Mon, 15 Sep 2008 00:08:34 +0000</pubDate>
		<dc:creator>Casey</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[apc]]></category>
		<category><![CDATA[Centos]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[rhel]]></category>
		<category><![CDATA[system administration]]></category>

		<guid isPermaLink="false">http://maisonbisson.com/?p=12589</guid>
		<description><![CDATA[

Yum up some packages:

yum install php-pear php-devel httpd-devel


Install APC using pear (the pear installer is smarter than the pecl installer):
When the installer asks about APXS, say &#8216;no&#8217;. 

pear install pecl/apc


Tell PHP to load APC:

echo extension=apc.so &#62; /etc/php.d/apc.ini


Restart Apache:

/sbin/service httpd graceful



]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="maisonbisson-12589"><!-- &nbsp; --></abbr>
<ol>
<li>Yum up some packages:

<div class="wp_syntax"><div class="code"><pre class="csh" style="font-family:monospace;">yum install php-pear php-devel httpd-devel</pre></div></div>

</li>
<li>Install APC using pear (the pear installer is smarter than the pecl installer):<br />
When the installer asks about APXS, say &#8216;no&#8217;. </p>

<div class="wp_syntax"><div class="code"><pre class="csh" style="font-family:monospace;">pear install pecl/apc</pre></div></div>

</li>
<li>Tell PHP to load APC:

<div class="wp_syntax"><div class="code"><pre class="csh" style="font-family:monospace;">echo extension=apc.so &gt; /etc/php.d/apc.ini</pre></div></div>

</li>
<li>Restart Apache:

<div class="wp_syntax"><div class="code"><pre class="csh" style="font-family:monospace;">/sbin/service httpd graceful</pre></div></div>

</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://maisonbisson.com/blog/post/12589/installing-php-apc-on-rhel-centos/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Mark Jaquith On WordPress Security For Plugin Developers</title>
		<link>http://maisonbisson.com/blog/post/12243/mark-jaquith-on-wordpress-security-for-plugin-developers/</link>
		<comments>http://maisonbisson.com/blog/post/12243/mark-jaquith-on-wordpress-security-for-plugin-developers/#comments</comments>
		<pubDate>Sat, 16 Aug 2008 18:15:20 +0000</pubDate>
		<dc:creator>Casey Bisson</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[coding standards]]></category>
		<category><![CDATA[Mark Jaquith]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[SQL injections]]></category>
		<category><![CDATA[web security]]></category>
		<category><![CDATA[WordCamp]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[XSRF]]></category>
		<category><![CDATA[xss]]></category>

		<guid isPermaLink="false">http://maisonbisson.com/blog/?p=12243</guid>
		<description><![CDATA[

I&#8217;ve been pretty aware of the risks of SQL injection and am militant about keeping my database interactions clean. Mark Jaquith today reminded me about the need to make sure my browser output is filtered through clean_url(), sanitize_url(), and attribute_escape(). Furthermore, we all need to remember current_user_can(), check_admin_referer(), and nonces.
]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="maisonbisson-12243"><!-- &nbsp; --></abbr>
<p><a href="http://www.flickr.com/photos/maisonbisson/2772914796/" title="hardening plugins against acronym attacks by misterbisson, on Flickr"><img src="http://farm4.static.flickr.com/3145/2772914796_f25db56d47.jpg" width="500" height="374" alt="hardening plugins against acronym attacks" /></a></p>
<p>I&#8217;ve been pretty aware of the risks of SQL injection and am militant about keeping my database interactions clean. <a href="http://markjaquith.com/" title="Mark Jaquith">Mark Jaquith</a> <a href="http://2008.sf.wordcamp.org/">today</a> reminded me about the need to make sure my browser output is filtered through <code>clean_url()</code>, <code>sanitize_url()</code>, and <code>attribute_escape()</code>. Furthermore, we all need to remember <code>current_user_can()</code>, <a href="http://codex.wordpress.org/Function_Reference/check_admin_referer"><code>check_admin_referer()</code></a>, and <a href="http://codex.wordpress.org/Wordpress_Nonce_Implementation">nonces</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://maisonbisson.com/blog/post/12243/mark-jaquith-on-wordpress-security-for-plugin-developers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Is My PHP Script Running Out Of Memory?</title>
		<link>http://maisonbisson.com/blog/post/12190/is-my-php-script-running-out-of-memory/</link>
		<comments>http://maisonbisson.com/blog/post/12190/is-my-php-script-running-out-of-memory/#comments</comments>
		<pubDate>Thu, 07 Aug 2008 19:12:15 +0000</pubDate>
		<dc:creator>Casey Bisson</dc:creator>
				<category><![CDATA[Dispatches]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[memory_get_peak_usage]]></category>
		<category><![CDATA[memory_get_usage]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://maisonbisson.com/blog/?p=12190</guid>
		<description><![CDATA[
I&#8217;ve got a PHP script that sometimes just dies with no errors to the browser and no messages in the error log. I&#8217;ve seen this in the past with scripts that consumed too much memory (yeah, it should have issued an error, but it didn&#8217;t, and increasing the memory limit fixed it), but now the [...]]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="maisonbisson-12190"><!-- &nbsp; --></abbr>
<p>I&#8217;ve got a PHP script that sometimes just dies with no errors to the browser and no messages in the error log. I&#8217;ve seen this in the past with scripts that consumed too much memory (yeah, it <em>should</em> have issued an error, but it didn&#8217;t, and increasing the memory limit fixed it), but now the memory limit is set pretty high and I&#8217;m not sure I want to increase it further. I certainly don&#8217;t want to increase it without seeing where it&#8217;s going wrong, anyway.</p>
<p>To do that, <a href="http://www.ibm.com/developerworks/opensource/library/os-php-v521/" title="What's new in PHP V5.2, Part 1: Using the new memory manager">IBM developerWorks says</a> the <a href="http://php.net/memory_get_usage" title="PHP: memory_get_usage - Manual"><code>memory_get_usage()</code></a> and <a href="http://php.net/manual/en/function.memory-get-peak-usage.php"><code>memory_get_peak_usage()</code></a> functions are for me. And they offer some other interesting tips as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://maisonbisson.com/blog/post/12190/is-my-php-script-running-out-of-memory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web Development Languages</title>
		<link>http://maisonbisson.com/blog/post/12173/web-development-languages/</link>
		<comments>http://maisonbisson.com/blog/post/12173/web-development-languages/#comments</comments>
		<pubDate>Tue, 15 Jul 2008 13:44:04 +0000</pubDate>
		<dc:creator>Casey Bisson</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[languages]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[popularity]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://maisonbisson.com/blog/?p=12173</guid>
		<description><![CDATA[
David Cloutman pointed to Craiglist&#8217;s job ads as an indicator of programming language popularity. Here&#8217;s the hit counts for “web design jobs” and “internet engineering jobs” in the Bay Area:


&#160;
PHP
Java
Ruby
Python
PERL


internet engineering jobs
167
246
85
98
109


web design jobs
110
71
22
19
31



Cloutman has a few ideas for what the numbers mean, but I&#8217;m just entertained by the data. (Note: he corrected his original [...]]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="maisonbisson-12173"><!-- &nbsp; --></abbr>
<p><a href="http://lists.webjunction.org/wjlists/web4lib/2008-July/047913.html" title="[Web4lib] Web Languages">David Cloutman pointed to</a> Craiglist&#8217;s job ads as an indicator of programming language popularity. Here&#8217;s the hit counts for “web design jobs” and “internet engineering jobs” in the Bay Area:</p>
<table>
<tr>
<td>&nbsp;</td>
<td>PHP</td>
<td>Java</td>
<td>Ruby</td>
<td>Python</td>
<td>PERL</td>
</tr>
<tr>
<td>internet engineering jobs</td>
<td>167</td>
<td>246</td>
<td>85</td>
<td>98</td>
<td>109</td>
</tr>
<tr>
<td>web design jobs</td>
<td>110</td>
<td>71</td>
<td>22</td>
<td>19</td>
<td>31</td>
<td></td>
</tr>
</table>
<p>Cloutman has a few ideas for <a href="http://lists.webjunction.org/wjlists/web4lib/2008-July/047913.html">what the numbers mean</a>, but I&#8217;m just entertained by the data. (Note: he <a href="http://lists.webjunction.org/wjlists/web4lib/2008-July/047916.html">corrected his original numbers</a>.)</p>
]]></content:encoded>
			<wfw:commentRss>http://maisonbisson.com/blog/post/12173/web-development-languages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JSON on RHEL &amp; PHP 5.1.6</title>
		<link>http://maisonbisson.com/blog/post/12137/json-rhel-centos-php-516/</link>
		<comments>http://maisonbisson.com/blog/post/12137/json-rhel-centos-php-516/#comments</comments>
		<pubDate>Wed, 28 May 2008 14:12:28 +0000</pubDate>
		<dc:creator>Casey Bisson</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[red hat]]></category>
		<category><![CDATA[rhel]]></category>
		<category><![CDATA[system administration]]></category>
		<category><![CDATA[yum]]></category>

		<guid isPermaLink="false">http://maisonbisson.com/blog/?p=12137</guid>
		<description><![CDATA[
Stuck with PHP 5.1.6 on RHEL or even CentOS (and a sysadmin who insists on using packages)? Need JSON? I did. The solution is easy:
yum install php-devel
pecl install json
The pecl install failed when it hit an 8MB memory limit, and I was clueless about how to fix it until I learned that the pecl installer [...]]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="maisonbisson-12137"><!-- &nbsp; --></abbr>
<p>Stuck with PHP 5.1.6 on RHEL or even CentOS (and a sysadmin who insists on using packages)? Need JSON? I did. The solution is easy:</p>
<p><code>yum install php-devel<br />
pecl install json</code></p>
<p>The pecl install failed when it hit an 8MB memory limit, and I was clueless about how to fix it until I learned that the pecl installer ignores the <code>php.ini</code>. Turns out the best solution is to use the pear installer (which does follow <code>php.ini</code> settings):</p>
<p><code>pear install pecl/json</code></p>
]]></content:encoded>
			<wfw:commentRss>http://maisonbisson.com/blog/post/12137/json-rhel-centos-php-516/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Parse HTML And Traverse DOM In PHP?</title>
		<link>http://maisonbisson.com/blog/post/12097/parse-html-and-traverse-dom-in-php-2/</link>
		<comments>http://maisonbisson.com/blog/post/12097/parse-html-and-traverse-dom-in-php-2/#comments</comments>
		<pubDate>Wed, 05 Mar 2008 01:22:37 +0000</pubDate>
		<dc:creator>Casey Bisson</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[domDocument]]></category>
		<category><![CDATA[loadHTML]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[simplexml_import_dom]]></category>

		<guid isPermaLink="false">http://maisonbisson.com/blog/post/12097/parse-html-and-traverse-dom-in-php-2</guid>
		<description><![CDATA[
I spoke of this the other day, but now I&#8217;ve learned of PHP&#8217;s DOM functions, including loadHTML(). Use it in combination with simplexml_import_dom like this:

$dom = new domDocument;
$dom-&#62;loadHTML&#40;'&#60;ul&#62;&#60;li&#62;one&#60;/li&#62;&#60;li&#62;two&#60;/li&#62;&#60;li&#62;three&#60;ul&#62;&#60;li&#62;sublist item&#60;/li&#62;&#60;/ul&#62;&#60;/li&#62;&#60;/ul&#62;'&#41;;
if&#40;$dom&#41;&#123;
	$xml = simplexml_import_dom&#40;$dom&#41;;
	print_r&#40;$xml&#41;;
&#125;

This IBM developerWorks article has some more useful info.

Here&#8217;s some code I prototyped to parse out the ISBNs and LCCN (or any data, really) from [...]]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="maisonbisson-12097"><!-- &nbsp; --></abbr>
<p>I <a href="http://maisonbisson.com/blog/post/11996/parse-html-and-traverse-dom-in-php" title="http://maisonbisson.com/blog/post/11996/parse-html-and-traverse-dom-in-php">spoke of this the other day</a>, but now I&#8217;ve learned of <a href="http://us3.php.net/manual/en/ref.dom.php">PHP&#8217;s DOM functions</a>, including <a href="http://us3.php.net/manual/en/function.dom-domdocument-loadhtml.php" title="PHP: DOMDocument-">loadHTML()</a>. Use it in combination with <a href="http://us.php.net/manual/en/function.simplexml-import-dom.php" title="PHP: simplexml_import_dom - Manual">simplexml_import_dom</a> like this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$dom</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> domDocument<span style="color: #339933;">;</span>
<span style="color: #000088;">$dom</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">loadHTML</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;ul&gt;&lt;li&gt;one&lt;/li&gt;&lt;li&gt;two&lt;/li&gt;&lt;li&gt;three&lt;ul&gt;&lt;li&gt;sublist item&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dom</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$xml</span> <span style="color: #339933;">=</span> <span style="color: #990000;">simplexml_import_dom</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dom</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">print_r</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$xml</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>This <a href="http://www.ibm.com/developerworks/library/x-simplexml.html" title="SimpleXML processing with PHP">IBM developerWorks article</a> has some more useful info.</p>
<p><span id="more-12097"></span></p>
<p>Here&#8217;s some code I prototyped to parse out the ISBNs and LCCN (or any data, really) from an <a href="http://library.plymouth.edu/read/184908">an average record</a> in <a href="http://about.scriblio.net/">Scriblio</a>:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$dom</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> domDocument<span style="color: #339933;">;</span>
<span style="color: #000088;">$dom</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">loadHTML</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dom</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$xml</span> <span style="color: #339933;">=</span> <span style="color: #990000;">simplexml_import_dom</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dom</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$xml</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">body</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ul</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">li</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$thing</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$thing</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'class'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'isbn'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$thing</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ul</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">li</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$stuff</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #990000;">print_r</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$stuff</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$thing</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'class'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'lccn'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$thing</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ul</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">li</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$stuff</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #990000;">print_r</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$stuff</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://maisonbisson.com/blog/post/12097/parse-html-and-traverse-dom-in-php-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Parse HTML And Traverse DOM In PHP?</title>
		<link>http://maisonbisson.com/blog/post/11996/parse-html-and-traverse-dom-in-php/</link>
		<comments>http://maisonbisson.com/blog/post/11996/parse-html-and-traverse-dom-in-php/#comments</comments>
		<pubDate>Tue, 04 Mar 2008 01:11:40 +0000</pubDate>
		<dc:creator>Casey Bisson</dc:creator>
				<category><![CDATA[Dispatches]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[dom]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[parse]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Tidy]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://maisonbisson.com/blog/post/11996/parse-html-and-traverse-dom-in-php</guid>
		<description><![CDATA[
I love how easily I can traverse an HTML document with jQuery, and I&#8217;d love to be able to do it in PHP. There are a few classes, but the PHP binding for Tidy seems to be where it&#8217;s at. The Zend dev pages make it look that way, anyway.
]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="maisonbisson-11996"><!-- &nbsp; --></abbr>
<p>I love how easily I can <a href="http://www.learningjquery.com/category/types/dom-traversing">traverse an HTML document with jQuery</a>, and I&#8217;d love to be able to do it in PHP. There are a few classes, but the <a href="http://www.php.net/manual/en/ref.tidy.php" title="PHP: tidy - Manual">PHP binding</a> for <a href="http://tidy.sourceforge.net/" title="HTML Tidy Project Page">Tidy</a> seems to be where it&#8217;s at. The <a href="http://devzone.zend.com/node/view/id/761#Heading7" title="Tidying up your HTML with PHP 5">Zend dev pages</a> make it look that way, anyway.</p>
]]></content:encoded>
			<wfw:commentRss>http://maisonbisson.com/blog/post/11996/parse-html-and-traverse-dom-in-php/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Apache, MySQL, and PHP on MacOS X</title>
		<link>http://maisonbisson.com/blog/post/12075/apache-mysql-and-php-on-macos-x/</link>
		<comments>http://maisonbisson.com/blog/post/12075/apache-mysql-and-php-on-macos-x/#comments</comments>
		<pubDate>Thu, 24 Jan 2008 17:07:04 +0000</pubDate>
		<dc:creator>Casey Bisson</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[amp]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[installing]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[mac os X]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://maisonbisson.com/blog/post/12075/apache-mysql-and-php-on-macos-x</guid>
		<description><![CDATA[
p0ps Harlow tweeted something about trying to get an AMP environment running on his Mac. Conversation followed, and eventually I sent along an email that look sorta like this:
If you&#8217;re running 10.4 (I doubt it, but it&#8217;s worth mentioning because I&#8217;m most familiar with it), here&#8217;s how I&#8217;ve setup dozens of machines for web development [...]]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="maisonbisson-12075"><!-- &nbsp; --></abbr>
<p><a href="http://www.p0ps.com/" title="p0ps.com">p0ps Harlow</a> tweeted something about trying to get an AMP environment running on his Mac. Conversation followed, and eventually I sent along an email that look sorta like this:</p>
<blockquote><p>If you&#8217;re running 10.4 (I doubt it, but it&#8217;s worth mentioning because I&#8217;m most familiar with it), here&#8217;s how I&#8217;ve setup dozens of machines for web development and WordPress:</p>
<p>Install MySQL<br />
<a href="http://dev.mysql.com/downloads/mysql/5.0.html#macosx-dmg">http://dev.mysql.com/downloads/mysql/5.0.html#macosx-dmg</a></p>
<p>Install Marc Liyanage&#8217;s PHP 5 package<br />
<a href="http://www.entropy.ch/software/macosx/php/">http://www.entropy.ch/software/macosx/php/</a></p>
<p>From there all you have to do is install WordPress.</p>
<p>10.5 changed lots of this (as you probably already know). The good news is that it includes current versions of the AMP suite. The bad news is that the PHP doesn&#8217;t include a number of useful components. Still, it will run WordPress and I&#8217;ve got it working on my laptop. These directions look like pretty much what I had to do:</p>
<p><a href="http://stringfoo.com/2007/11/05/server_setup_on_leopard/">http://stringfoo.com/2007/11/05/server_setup_on_leopard/</a><br />
<a href="http://remysharp.com/2007/10/27/lamp-in-leopard-osx-105-php5-and-apache-22">http://remysharp.com/2007/10/27/lamp-in-leopard-osx-105-php5-and-apache-22</a></p>
<p>It&#8217;s likely none of that will be helpful, in which case you will have discovered why I&#8217;m no longer a sysadmin.</p></blockquote>
<p><a href="http://www.entropy.ch/home/">Marc Liyanage</a>&#8217;s builds of <a href="http://www.entropy.ch/software/macosx/php/">PHP for Mac</a> are probably the easiest to use and they include most all the extensions a person could want, but he hadn&#8217;t released a package for Leopard at the time (<a href="http://www.entropy.ch/phpbb2/viewtopic.php?t=2945">he&#8217;s got a release in beta now</a>). As it turned out, p0ps actually was running 10.4, and he got things going in a jiffy.</p>
]]></content:encoded>
			<wfw:commentRss>http://maisonbisson.com/blog/post/12075/apache-mysql-and-php-on-macos-x/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>sifting results of error_log( &#8230;</title>
		<link>http://maisonbisson.com/blog/post/12048/sifting-results-of-error_log/</link>
		<comments>http://maisonbisson.com/blog/post/12048/sifting-results-of-error_log/#comments</comments>
		<pubDate>Thu, 17 Jan 2008 21:04:52 +0000</pubDate>
		<dc:creator>Casey Bisson</dc:creator>
				<category><![CDATA[Dispatches]]></category>
		<category><![CDATA[debug_backtrace]]></category>
		<category><![CDATA[error_log]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://maisonbisson.com/blog/post/12048/sifting-results-of-error_log</guid>
		<description><![CDATA[
sifting results of

error_log&#40; $_SERVER&#91;'REQUEST_URI'&#93; .&#34;\n&#34;. $_SERVER&#91;'REMOTE_ADDR'&#93; .&#34;\n&#34;. print_r&#40; debug_backtrace&#40;&#41;, TRUE &#41; &#41;;

]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="maisonbisson-12048"><!-- &nbsp; --></abbr>
<p>sifting results of</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">error_log</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REQUEST_URI'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">.</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REMOTE_ADDR'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">.</span> <span style="color: #990000;">print_r</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">debug_backtrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">TRUE</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://maisonbisson.com/blog/post/12048/sifting-results-of-error_log/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mac OS X 10.5 Comes With Apache 2 and PHP 5</title>
		<link>http://maisonbisson.com/blog/post/11968/mac-os-x-105-comes-with-apache-2-and-php-5/</link>
		<comments>http://maisonbisson.com/blog/post/11968/mac-os-x-105-comes-with-apache-2-and-php-5/#comments</comments>
		<pubDate>Sun, 28 Oct 2007 08:19:26 +0000</pubDate>
		<dc:creator>Casey Bisson</dc:creator>
				<category><![CDATA[Blink]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[Leopard]]></category>
		<category><![CDATA[Mac OS X 10.5]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://maisonbisson.com/blog/post/11968/mac-os-x-105-comes-with-apache-2-and-php-5</guid>
		<description><![CDATA[
Yep. Leopard comes with new stuff. Lazeez says it works fine, but commenters here are having trouble.
leopard, Mac OS X 10.5, apache, php
]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="maisonbisson-11968"><!-- &nbsp; --></abbr>
<p>Yep. Leopard comes with new stuff. <a href="http://mymacinations.com/2007/10/28/apache-php-and-mysql-on-leopard/" title="My Macinations » Apache PHP and Mysql on Leopard">Lazeez says it works fine</a>, but <a href="http://www.sitecrafting.com/blog/apache-mysql-php-on-leopard/" title="SiteCrafting ">commenters here are having trouble</a>.</p>
<p><tags>leopard, Mac OS X 10.5, apache, php</tags></p>
]]></content:encoded>
			<wfw:commentRss>http://maisonbisson.com/blog/post/11968/mac-os-x-105-comes-with-apache-2-and-php-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Speedy PHP: Intermediate Code Caching</title>
		<link>http://maisonbisson.com/blog/post/10970/speedy-php-intermediate-code-caching/</link>
		<comments>http://maisonbisson.com/blog/post/10970/speedy-php-intermediate-code-caching/#comments</comments>
		<pubDate>Thu, 31 May 2007 15:10:08 +0000</pubDate>
		<dc:creator>Casey Bisson</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[acceleration]]></category>
		<category><![CDATA[apc]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[intermediate code cache]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[scaling]]></category>
		<category><![CDATA[web applications]]></category>
		<category><![CDATA[zend]]></category>

		<guid isPermaLink="false">http://maisonbisson.com/blog/post/10970/#speedy-php-intermediate-code-caching</guid>
		<description><![CDATA[
I&#8217;ve been working on MySQL optimization for a while, and though there&#8217;s still more to done on that front, I&#8217;ve gotten to the point where the the cumulative query times make up less than half of the page generation time.
So I&#8217;m optimizing code when the solution is obvious (and I hope to rope Zach into [...]]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="maisonbisson-10970"><!-- &nbsp; --></abbr>
<p>I&#8217;ve been working on MySQL optimization for a while, and though there&#8217;s still more to done on that front, I&#8217;ve gotten to the point where the the cumulative query times make up less than half of the page generation time.</p>
<p>So I&#8217;m optimizing code when the solution is obvious (and I hope to rope <a href="http://nosheep.net/">Zach</a> into giving the code a performance audit soon), but I&#8217;m also looking at optimizing how PHP works.</p>
<p>Once upon a time, most of us ran PHP as a CGI, and every time a request came in, the PHP interpreter would have to launch, read/compile/execute the script, then spit out the result and shutdown. Now (hopefully) everybody&#8217;s running PHP as an Apache module, so all the time spent launching the interpreter, allocating memory and other resources for it, and then shutting it down and cleaning up after it, is done just once for each thread of Apache.</p>
<p>It might not sound like much, but I had a chance to compare CGI vs. module performance recently and found that a fairly simple, but frequently accessed script running as a CGI completely swamped a server as a CGI (creating a load average over 20), but was hardly noticed when running as a module. </p>
<p>But even as a module, the PHP scripts still need to be interpreted and compiled before they can be executed. And because of the way PHP works, this is done every time the page/script is requested.</p>
<p>Java programmers, among others, criticize PHP for this, but that <a href="http://www.37signals.com/svn/archives2/fear_shark_attacks_and_will_it_scale.php">small inefficiency</a> is part of what makes PHP so easy to use (and popular). And that ease of use means people are building some really interesting <a href="http://gettingreal.37signals.com/ch04_Scale_Later.php">apps worth scaling</a>.</p>
<p>Anyway, there&#8217;s a solution to eliminate that inefficiency in PHP: intermediate code caching.</p>
<p>By caching the executable code generated by the interpreter, then the using the cached copy instead of the source script for the next request, you can enjoy the benefits of PHP&#8217;s easy development and compiled code&#8217;s fast execution time. A number of projects all promise anywhere from double to 10X jump in performance.</p>
<ul>
<li><a href="http://www.php-accelerator.co.uk/" title="The ionCube PHP Accelerator: Home">ionCube PHP Accelerator</a><br />This has the most recognizable “brand,” and some hosting providers even offer it, but it&#8217;s offered <a href="http://phprpms.sourceforge.net/phpa">only in binary form</a> and <a href="http://www.php-accelerator.co.uk/faq.php#license">the license</a> seems intentionally ambiguous (um, <a href="http://www.fsf.org/licensing/essays/free-sw.html">not free</a>?).</li>
<li><a href="http://sourceforge.net/projects/turck-mmcache/" title="SourceForge.net: Turck MMCache for PHP">Turck MMCache for PHP</a><br />Has a good <a href="http://turck-mmcache.sourceforge.net/index_old.html">performance chart</a>, and is GPL&#8217;d, but development appears to have ended in 2003.</li>
<li><a href="http://web.archive.org/web/20040401135239/bwcache.bware.it/cache.htm">afterBURNERr*Cache</a><br />Yeah, I had to point to a page in the Wayback Machine, this project is dead.</li>
<li><a href="http://www.zend.com/products/zend_platform/">Zend Platform Performance Suite</a><br />A commercial suite that includes <a href="http://www.zend.com/products/zend_platform/features_comparison">piles of goodies</a>, if you pay.</li>
<li><a href="http://pecl.php.net/package/apc" title="PECL :: Package :: APC">APC: Alternative PHP Cache</a><br />It&#8217;s under active development and includes Rasmus Lerdorf, the guy who created PHP, among the project leads. License: <a href="http://www.php.net/license/2_02.txt">BSD-style</a> (<a href="http://www.gnu.org/philosophy/license-list.html">non-copyleft</a>)</li>
</ul>
<p>I haven&#8217;t actually tried any of these yet, but I&#8217;m looking for information and suggestions, and I&#8217;m likely to try APC, maybe even Zend soon. Just as soon as I make an app compelling enough (and large enough) to need it.</p>
<p><tags>php, caching, acceleration, zend, apc, intermediate code cache, optimization, scaling, web applications</tags></p>
]]></content:encoded>
			<wfw:commentRss>http://maisonbisson.com/blog/post/10970/speedy-php-intermediate-code-caching/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>PHP Libraries for Collaborative Filtering and Recommendations</title>
		<link>http://maisonbisson.com/blog/post/11661/php-libraries-for-collaborative-filtering-and-recommendations/</link>
		<comments>http://maisonbisson.com/blog/post/11661/php-libraries-for-collaborative-filtering-and-recommendations/#comments</comments>
		<pubDate>Mon, 30 Apr 2007 23:20:25 +0000</pubDate>
		<dc:creator>Casey Bisson</dc:creator>
				<category><![CDATA[Blink]]></category>
		<category><![CDATA[Libraries & Networked Information]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[code libraries]]></category>
		<category><![CDATA[Collaborative Filtering]]></category>
		<category><![CDATA[e-Commerce]]></category>
		<category><![CDATA[Item-based Collaborative Filtering]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Recommender Systems]]></category>
		<category><![CDATA[web application development]]></category>

		<guid isPermaLink="false">http://maisonbisson.com/blog/post/11661/#php-libraries-for-collaborative-filtering-and-recommendations</guid>
		<description><![CDATA[
Daniel Lemire and Sean McGrath note that “User personalization and profiling is key to many succesful Web sites. Consider that there is considerable free content on the Web, but comparatively few tools to help us organize or mine such content for specific purposes.” And they&#8217;ve written a paper and released prototype code on collaborative filtering.
Vogoo [...]]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="maisonbisson-11661"><!-- &nbsp; --></abbr>
<p><a href="http://www.daniel-lemire.com/fr/abstracts/TRD01.html" title="Implementing a Rating-Based Item-to-Item Recommender System in PHP/SQL">Daniel Lemire and Sean McGrath note</a> that “User personalization and profiling is key to many succesful Web sites. Consider that there is considerable free content on the Web, but comparatively few tools to help us organize or mine such content for specific purposes.” And they&#8217;ve <a href="http://www.daniel-lemire.com/fr/documents/publications/webpaper.pdf">written a paper</a> and released <a href="http://www.daniel-lemire.com/fr/documents/publications/webpaper.txt">prototype code</a> on <a href="http://en.wikipedia.org/wiki/Collaborative_filtering" title="Collaborative filtering - Wikipedia, the free encyclopedia">collaborative filtering</a>.</p>
<p><a href="http://www.vogoo-api.com/" title="Vogoo - Web Site Personalization &#038; Collaborative Filtering">Vogoo claims</a> to be a “a powerful collaborative filtering engine that allows Webmasters to easily add personalization features to their Web Sites.”</p>
<p><tags>Item-based Collaborative Filtering, Recommender Systems, e-Commerce, Collaborative Filtering, code libraries, php, web application development</tags></p>
]]></content:encoded>
			<wfw:commentRss>http://maisonbisson.com/blog/post/11661/php-libraries-for-collaborative-filtering-and-recommendations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Parsing MARC Directory Info</title>
		<link>http://maisonbisson.com/blog/post/11513/parsing-marc-directory-info-is-easy/</link>
		<comments>http://maisonbisson.com/blog/post/11513/parsing-marc-directory-info-is-easy/#comments</comments>
		<pubDate>Thu, 16 Nov 2006 17:35:11 +0000</pubDate>
		<dc:creator>Casey Bisson</dc:creator>
				<category><![CDATA[Libraries & Networked Information]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[libraries]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[marc]]></category>
		<category><![CDATA[marc directory]]></category>
		<category><![CDATA[parsing]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[raw marc]]></category>

		<guid isPermaLink="false">http://maisonbisson.com/blog/post/11513/</guid>
		<description><![CDATA[
I expected a record that looked like this:
LEADER 00000nas  2200000Ia 4500
001    18971047
008    890105c19079999mau u p       0uuua0eng
010    07023955 /rev
040    DLC&#124;cAUG
049    PSMM
050    F41.5&#124;b.A64
090    F41.5&#124;b.A64
110 2  Appalachian Mountain Club
245 [...]]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="maisonbisson-11513"><!-- &nbsp; --></abbr>
<p>I expected a record that looked like this:</p>
<pre><code>LEADER 00000nas  2200000Ia 4500
001    18971047
008    890105c19079999mau u p       0uuua0eng
010    07023955 /rev
040    DLC|cAUG
049    PSMM
050    F41.5|b.A64
090    F41.5|b.A64
110 2  Appalachian Mountain Club
245 14 The A.M.C. White Mountain guide <img src='http://maisonbisson.com/wp-includes/images/smilies/icon_neutral.gif' alt=':|' class='wp-smiley' /> ba guide to trails in
       the mountains of New Hampshire and adjacent parts of Maine
246 13 AMC White Mountain guide
246 13 White Mountain guide
246 13 A.M.C. White Mountain guide
260    Boston,|bThe Club,
300    v. <img src='http://maisonbisson.com/wp-includes/images/smilies/icon_neutral.gif' alt=':|' class='wp-smiley' /> bill., maps (some fold., some col.) ;|c16 cm
362 0  1st-     ed.; 1907-
500    Title varies slightly
651  0 White Mountains (N.H. and Me.)|xGuidebooks</code></pre>
<p>but instead got a record that looked like this:</p>
<pre style="overflow: auto;"><code>00939cas  2200265Ia 4500001001300000003000700013005001700020008004100037020001500078040001800093050001600111110003100127245012200158246003000280246002600310246003200336246003000368260005500398300005700453362003600510500002700546650001100573651007300584999001600657
ocm18971047
OCoLC
20020918102844.0
890105c19079999mau u p       0   a0eng
  a0910146489
  aDLCcAUGdNHS
  aF41.5b.A64
2 aAppalachian Mountain Club.
14aThe A. M. C. White Mountain guide :ba guide to trails in the mountains of New Hampshire and adjacent parts of Maine.
13aAMC White Mountain guide.
13aWhite Mountain guide.
13aA.M.C. White Mountain guide
13aAMC White Mountain guide.
  aBoston, Mass. :bAppalachian Mountain Club,c1983.
  a550 p.bill., maps (some fold., some col.) ;c16 cm.
0 a1st- ed.; 1907- ; 25th ed. 1992
  aTitle varies slightly.
  aHiking
0aWhite Mountains (N.H. and Me.)xDescription and travelxGuide-books.
  aCL000018321</code></pre>
<p>(some of the non-printable characters have been replaced with newlines for readability.)</p>
<p>After staring at that record for entirely too long, forgetting about it for a while, then returning again to think about how unreadable it was, then forgetting about it again, then taking one last look, I had that *duh* moment that made me realize what I should have seen on first glance: this is a MARC record that hasn&#8217;t had <a href="http://www.loc.gov/marc/bibliographic/ecbdldrd.html#mrcbdir">its directory</a> parsed.</p>
<p>So here&#8217;s my short-but-handy-and-hopefully-usefull-to-somebody-sometime code to parse the directory and then the rest of the record. It assumes <code>$records</code> is an array of records.</p>
<pre style="overflow: auto;"><code>
foreach($records as $record){
	$temp = explode('', $record);
	$dir = $temp[0];
	$record = substr($record, (strlen($dir) + 1));

	$dir = substr($dir, 24);
	$dir_field = NULL;
	while($dir){
		$dir_field[] = substr($dir, 0, 12);
		$dir = substr($dir, 12);
	}

	$record = str_replace('', '|', $record);
	$marc = NULL;
	foreach($dir_field as $field){
		if(ereg_replace('[^0-9]', '', $field)){
			unset($temp);
			$len = substr($field, 3, 4);
			$pos = substr($field, 7, 5);
			$field = substr($field, 0, 3);
			$temp = substr($record, $pos, $len);
			if($field < 10)
				$temp = '  |'. $temp;
			$marc .= trim($field .'|'. $temp) .“\n”;
			$marc_array[$field] = $temp;
		}
	}
	echo $marc;
}
</code></code></pre>
<p>The actual output of that code on that record is this:</p>
<pre style="overflow: auto;"><code>001|  |ocm18971047
003|  |OCoLC
005|  |20020918102844.0
008|  |890105c19079999mau u p       0   a0eng
020|  |a0910146489
040|  |aDLC|cAUG|dNHS
050|  |aF41.5|b.A64
110|2 |aAppalachian Mountain Club.
245|14|aThe A. M. C. White Mountain guide <img src='http://maisonbisson.com/wp-includes/images/smilies/icon_neutral.gif' alt=':|' class='wp-smiley' /> ba guide to trails in the mountains of New Hampshire and adjacent parts of Maine.
246|13|aAMC White Mountain guide.
246|13|aWhite Mountain guide.
246|13|aA.M.C. White Mountain guide
246|13|aAMC White Mountain guide.
260|  |aBoston, Mass. <img src='http://maisonbisson.com/wp-includes/images/smilies/icon_neutral.gif' alt=':|' class='wp-smiley' /> bAppalachian Mountain Club,|c1983.
300|  |a550 p.|bill., maps (some fold., some col.) ;|c16 cm.
362|0 |a1st- ed.; 1907- ; 25th ed. 1992
500|  |aTitle varies slightly.
650|  |aHiking
651| 0|aWhite Mountains (N.H. and Me.)|xDescription and travel|xGuide-books.
999|  |aCL000018321
</code></pre>
<p>It includes a little bit of fudging that my other MARC parsing code demands, but works and is readable.</p>
<p><tags>code, libraries, library, marc, marc directory, parsing, php, raw marc</tags></p>
]]></content:encoded>
			<wfw:commentRss>http://maisonbisson.com/blog/post/11513/parsing-marc-directory-info-is-easy/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHP Array To XML</title>
		<link>http://maisonbisson.com/blog/post/11450/php-array-to-xml/</link>
		<comments>http://maisonbisson.com/blog/post/11450/php-array-to-xml/#comments</comments>
		<pubDate>Mon, 18 Sep 2006 16:12:22 +0000</pubDate>
		<dc:creator>Casey Bisson</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[array to xml]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[XML_Serializer]]></category>

		<guid isPermaLink="false">http://maisonbisson.com/blog/post/11450/</guid>
		<description><![CDATA[
I needed a quick, perhaps even sloppy way to output an array as XML. Some Googling turned up a few tools, including Simon Willison&#8217;s XmlWriter, Johnny Brochard&#8217;s Array 2 XML, Roger Veciana Associative array to XML, and Gijs van Tulder&#8217;s Array to XML. Finally, Gijs also pointed me to the XML_Serializer PEAR Package.
In an example [...]]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="maisonbisson-11450"><!-- &nbsp; --></abbr>
<p>I needed a quick, perhaps even sloppy way to output an <a href="http://www.php.net/array">array</a> as <a href="http://en.wikipedia.org/wiki/Extensible_Markup_Language">XML</a>. Some Googling turned up a few tools, including <a href="http://simon.incutio.com/archive/2003/04/29/xmlWriter" title="Simon Willison: XmlWriter: Generating XML from PHP">Simon Willison&#8217;s XmlWriter</a>, <a href="http://www.phpclasses.org/browse/package/1826.html" title="PHP Classes - Class: Array 2 XML">Johnny Brochard&#8217;s Array 2 XML</a>, <a href="http://www.phpclasses.org/browse/package/2286.html" title="PHP Classes - Class: Associative array to XML">Roger Veciana Associative array to XML</a>, and <a href="http://gvtulder.f2o.org/notities/arraytoxml/" title="Array to XML function for PHP :: gvtulder.f2o.org">Gijs van Tulder&#8217;s Array to XML</a>. Finally, Gijs also pointed me to the <a href="http://pear.php.net/package/XML_Serializer/redirected" title="PEAR :: Package :: XML_Serializer">XML_Serializer</a> <a href="http://pear.php.net/">PEAR Package</a>.</p>
<p>In an example of how even the smallest barriers can turn people away, I completely ignored the two possible solutions at PHP Classes, because navigating and using the site sucks. I passed on Willison&#8217;s function because, well, it didn&#8217;t look like it would do enough of what I wanted. Despite Gijs&#8217; recommendation of the PEAR module, I was happy enough to use his <a href="http://gvtulder.f2o.org/notities/arraytoxml/">array_to_xml function</a>, as it did what I needed and required the lest work for the moment. I may revisit XML_Serializer sometime, but&#8230;</p>
<p><tags>array, array to xml, php, xml, XML_Serializer</tags></p>
]]></content:encoded>
			<wfw:commentRss>http://maisonbisson.com/blog/post/11450/php-array-to-xml/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Things I Need To Incorporate Into Various Projects</title>
		<link>http://maisonbisson.com/blog/post/11437/things-i-need-to-incorporate-into-various-projects/</link>
		<comments>http://maisonbisson.com/blog/post/11437/things-i-need-to-incorporate-into-various-projects/#comments</comments>
		<pubDate>Thu, 31 Aug 2006 00:57:07 +0000</pubDate>
		<dc:creator>Casey Bisson</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[memcached]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[pspell]]></category>

		<guid isPermaLink="false">http://maisonbisson.com/blog/post/11437/</guid>
		<description><![CDATA[

memcached, a “highly effective caching daemon, &#8230;designed to decrease database load in dynamic web applications,” and the related PHP functions 
pspell PHP functions related to  aspell and this pspell overview from Zend 
http_build_query, duh? 
current connected mysql threads * unix load average = system busy; reduce operations when $system_busy > $x 

development, memcached, mysql, [...]]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="maisonbisson-11437"><!-- &nbsp; --></abbr>
<ul>
<li><a href="http://danga.com/memcached/" title="memcached: a distributed memory object caching system">memcached</a>, a “highly effective caching daemon, &#8230;designed to decrease database load in dynamic web applications,” and the related <a href="http://us3.php.net/memcache" title="PHP: Memcache Functions - Manual">PHP functions</a> </li>
<li><a href="http://us2.php.net/manual/en/ref.pspell.php" title="PHP: Pspell Functions - Manual">pspell PHP functions</a> related to  <a href="http://aspell.net/" title="GNU Aspell">aspell</a> and this <a href="http://www.zend.com/zend/spotlight/spellchecking.php" title="Zend Technologies - Code Gallery Spotlight - Spell checking in PHP">pspell overview from Zend</a> </li>
<li><a href="http://us2.php.net/manual/en/function.http-build-query.php" title="PHP: http_build_query - Manual">http_build_query</a>, duh? </li>
<li>current <a href="http://dev.mysql.com/doc/refman/5.0/en/server-status-variables.html">connected mysql threads</a> * <a href="http://php.net/manual/en/function.sys-getloadavg.php">unix load average</a> = system busy; reduce operations when $system_busy > $x </li>
</ul>
<p><tags>development, memcached, mysql, php, pspell</tags></p>
]]></content:encoded>
			<wfw:commentRss>http://maisonbisson.com/blog/post/11437/things-i-need-to-incorporate-into-various-projects/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dang addslashes() And GPC Magic Quotes</title>
		<link>http://maisonbisson.com/blog/post/11421/dang-addslashes-and-gpc-magic-quotes/</link>
		<comments>http://maisonbisson.com/blog/post/11421/dang-addslashes-and-gpc-magic-quotes/#comments</comments>
		<pubDate>Wed, 23 Aug 2006 00:20:30 +0000</pubDate>
		<dc:creator>Casey Bisson</dc:creator>
				<category><![CDATA[Libraries & Networked Information]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[addslashes]]></category>
		<category><![CDATA[gpc magic quotes]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wpopac]]></category>

		<guid isPermaLink="false">http://maisonbisson.com/blog/post/11421/</guid>
		<description><![CDATA[
Somewhere in the WordPress code extra slashes are being added to my query terms.
I&#8217;ve turned GPC magic quotes off via a php_value magic_quotes_gpc 0 directive in the .htaccess file (we have far too much legacy code that nobody wants to touch to turn it off site-wide). And I know my code is doing one run [...]]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="maisonbisson-11421"><!-- &nbsp; --></abbr>
<p>Somewhere in the WordPress code extra slashes are being added to my query terms.</p>
<p>I&#8217;ve turned <a href="http://www.webmasterstop.com/63.html" title="Magic Quotes and Add Slashes in PHP - Tutorials - Webmaster Stop">GPC magic quotes</a> off via a <a href="http://us2.php.net/configuration.changes"><code>php_value magic_quotes_gpc 0</code></a> directive in the <a href="http://en.wikipedia.org/wiki/.htaccess"><code>.htaccess</code></a> file (we have far too much legacy code that nobody wants to touch to turn it off site-wide). And I know my code is doing one run of <a href="http://us2.php.net/manual/en/function.addslashes.php"><code>addslashes()</code></a>, but where are the other two sets of slashes coming from?</p>
<p><tags>addslashes, gpc magic quotes, php, wordpress, wpopac</tags></p>
]]></content:encoded>
			<wfw:commentRss>http://maisonbisson.com/blog/post/11421/dang-addslashes-and-gpc-magic-quotes/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>T2000 Unboxed And Online</title>
		<link>http://maisonbisson.com/blog/post/11332/t2000-unboxed-and-online/</link>
		<comments>http://maisonbisson.com/blog/post/11332/t2000-unboxed-and-online/#comments</comments>
		<pubDate>Sun, 11 Jun 2006 16:51:16 +0000</pubDate>
		<dc:creator>Casey Bisson</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[amp]]></category>
		<category><![CDATA[amps]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[Blastwave.org]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[solaris]]></category>
		<category><![CDATA[Solaris 10]]></category>
		<category><![CDATA[sun]]></category>
		<category><![CDATA[Sun Microsystems]]></category>
		<category><![CDATA[t2000]]></category>

		<guid isPermaLink="false">http://maisonbisson.com/blog/post/11332/</guid>
		<description><![CDATA[

My Sun T2000 is here, and with Cliff&#8217;s help it&#8217;s now patched, configured, and online. (Aside: what&#8217;s a Sun Happy Meal?)
I&#8217;ll second Jon&#8217;s assessment that Sun really should put some reasonable cable adapters in the box, as the the bundle of adapters necessary to make a null modem connection to the box is ridiculously out [...]]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="maisonbisson-11332"><!-- &nbsp; --></abbr>
<p><a href="http://www.flickr.com/photos/maisonbisson/163751711/" title="Photo Sharing"><img src="http://static.flickr.com/76/163751711_164fc08928.jpg" width="500" height="235" alt="the T2000 colossus" /></a></p>
<p>My <a href="http://www.sun.com/servers/coolthreads/t2000/">Sun T2000</a> is <a href="http://maisonbisson.com/blog/post/11297/" title="Solaris + AMP, ASAP">here</a>, and with <a href="http://spiralbound.net/">Cliff</a>&#8217;s help it&#8217;s now patched, configured, <a href="http://wpopac.net/">and online</a>. (Aside: what&#8217;s a <a href="http://spiralbound.net/2006/06/06/sun-happy-meal-card/">Sun Happy Meal</a>?)</p>
<p>I&#8217;ll second <a href="http://www.lifeaftercoffee.com/">Jon</a>&#8217;s assessment that Sun really should <a href="http://www.lifeaftercoffee.com/2006/03/30/getting-started-with-the-sun-fire-t2000/" title="Life After Coffee » Getting Started with the Sun Fire T2000">put some reasonable cable adapters in the box</a>, as the the bundle of adapters necessary to make a <a href="http://en.wikipedia.org/wiki/Null_modem">null modem</a> connection to the box is ridiculously out of scale (I&#8217;ll get a picture soon).</p>
<p>I&#8217;m getting the application environment put together, which has turned out easier than expected thanks to the convenient packages from <a href="http://www.blastwave.org/" title="Blastwave.org - An OpenSolaris Community Site">Blastwave.org</a>. The box came with <a href="http://www.sun.com/software/solaris/">Solaris 10</a> installed, and after a <a href="http://www.blastwave.org/howto.html">quick installation and configuration of <code>pkg-get</code></a> I was happily installing <a href="http://www.blastwave.org/packages.php/apache">Apache</a>, <a href="http://www.blastwave.org/packages.php/mysql5">MySQL</a>, and <a href="http://www.blastwave.org/packages.php/php5">PHP</a> as simply as typing <code>pkg-get -i apache</code>.</p>
<p><tags>AMP, AMPS, Apache, Blastwave.org, LAMP, MySQL, PHP, Solaris, Solaris 10, Sun, Sun Microsystems, T2000</tags></p>
]]></content:encoded>
			<wfw:commentRss>http://maisonbisson.com/blog/post/11332/t2000-unboxed-and-online/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Solaris + AMP, ASAP</title>
		<link>http://maisonbisson.com/blog/post/11297/solaris-amp-asap/</link>
		<comments>http://maisonbisson.com/blog/post/11297/solaris-amp-asap/#comments</comments>
		<pubDate>Thu, 08 Jun 2006 01:02:04 +0000</pubDate>
		<dc:creator>Casey Bisson</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[amp]]></category>
		<category><![CDATA[amps]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[oss]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[solaris]]></category>
		<category><![CDATA[sun]]></category>
		<category><![CDATA[t2000]]></category>

		<guid isPermaLink="false">http://maisonbisson.com/blog/post/11297/</guid>
		<description><![CDATA[

A Solaris sysadmin I&#8217;m not. But now that I&#8217;ve finally got the Sun T2000 server I begged for a while back, I&#8217;ve got to ramp it up right quick.
The first task is to get a, um, LAMP environment up and running (SAMP?&#8230;oh, Sun wants us to call it AMPS). A bit of Googling turned up [...]]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="maisonbisson-11297"><!-- &nbsp; --></abbr>
<p><a href="http://www.flickr.com/photos/maisonbisson/161669714/" title="Photo Sharing"><img src="http://static.flickr.com/47/161669747_2b17c2d647.jpg" width="500" height="308" alt="Sun Fire T2000" /></a></p>
<p>A Solaris sysadmin I&#8217;m not. But now that I&#8217;ve finally got the <a href="http://www.sun.com/servers/coolthreads/t2000/">Sun T2000</a> server <a href="http://maisonbisson.com/blog/post/11172/">I begged for</a> a while back, I&#8217;ve got to ramp it up right quick.</p>
<p>The first task is to get a, um, <a href="http://en.wikipedia.org/wiki/LAMP_%28software_bundle%29" title="LAMP (software bundle) - Wikipedia, the free encyclopedia">LAMP</a> environment up and running (SAMP?&#8230;oh, Sun wants us to call it AMPS). A bit of Googling turned up <a href="http://forum.sun.com/jive/thread.jspa?threadID=73852" title="Sun Tools &#038; Products Forums - Apache 2.0.52, MySQL, PHP &#038; SSL">this forum thread</a> that suggested <a href="http://www.blastwave.org/howto.html" title="How To Get Started with Blastwave.org">Blastwave.org</a>&#8217;s ports of PHP, MySQL, and Apache.</p>
<p><strong>edit:</strong> I corrected the model number. </p>
<p><tags>amp, amps, apache, lamp, mysql, open source, oss, php, solaris, sun, t2000</tags></p>
]]></content:encoded>
			<wfw:commentRss>http://maisonbisson.com/blog/post/11297/solaris-amp-asap/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>PHP5&#8217;s SimpleXML Now Passes CDATA Content</title>
		<link>http://maisonbisson.com/blog/post/11257/php5s-simplexml-now-passes-cdata-content/</link>
		<comments>http://maisonbisson.com/blog/post/11257/php5s-simplexml-now-passes-cdata-content/#comments</comments>
		<pubDate>Wed, 12 Apr 2006 16:03:09 +0000</pubDate>
		<dc:creator>Casey Bisson</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[cdata]]></category>
		<category><![CDATA[cdata in php]]></category>
		<category><![CDATA[fixed]]></category>
		<category><![CDATA[parsing rss]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[simplexml]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://maisonbisson.com/blog/post/11257/</guid>
		<description><![CDATA[
I didn&#8217;t hear big announcement of it, but deep in the docs (? PHP 5.1.0) you&#8217;ll find a note about additional Libxml parameters. In there you&#8217;ll learn about “LIBXML_NOCDATA,” and it works like this:
simplexml_load_string($xmlraw,&#160;'SimpleXMLElement',&#160;LIBXML_NOCDATA);
Without that option (and with all previous versions of PHP/SimpleXML), SimpleXML just ignores any < ![CDATA[...]]&#62; &#8216;escaped&#8217; content, such as you&#8217;ll find [...]]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="maisonbisson-11257"><!-- &nbsp; --></abbr>
<p>I didn&#8217;t hear big announcement of it, but <a href="http://us3.php.net/manual/en/function.simplexml-load-string.php">deep in the docs</a> (? PHP 5.1.0) you&#8217;ll find a note about <a href="http://us3.php.net/manual/en/ref.libxml.php#libxml.constants" title="additional Libxml parameters">additional Libxml parameters</a>. In there you&#8217;ll learn about “LIBXML_NOCDATA,” and it works like this:</p>
<blockquote><p><code style="display: block; text-align: left; overflow: scroll;">simplexml_load_string($xmlraw,&nbsp;'SimpleXMLElement',&nbsp;LIBXML_NOCDATA);</code></p></blockquote>
<p>Without that option (and with all previous versions of PHP/SimpleXML), SimpleXML just ignores any < ![CDATA[...]]&gt; &#8216;escaped&#8217; content, such as you&#8217;ll find in most every blog feed.</p>
<p><tags>cdata, cdata in php, fixed, parsing rss, php, php5, rss, simplexml, xml</tags></p>
]]></content:encoded>
			<wfw:commentRss>http://maisonbisson.com/blog/post/11257/php5s-simplexml-now-passes-cdata-content/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Performance Optimization</title>
		<link>http://maisonbisson.com/blog/post/11132/performance-optimization/</link>
		<comments>http://maisonbisson.com/blog/post/11132/performance-optimization/#comments</comments>
		<pubDate>Tue, 07 Feb 2006 14:21:07 +0000</pubDate>
		<dc:creator>Casey Bisson</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[hyperthreading]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysql optimization]]></category>
		<category><![CDATA[performance optimization]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[server optimization]]></category>
		<category><![CDATA[server performance]]></category>

		<guid isPermaLink="false">http://maisonbisson.com/blog/?p=11132</guid>
		<description><![CDATA[
A couple notes from the past few days of tweaks and fixes:

Hyper-threading has a huge effect on LAMP performance.&#160;
From now on, I&#8217;ll have bad dreams about running MySQL without Query Caching in the way that I used to have nightmares about going to school wearing only my underwear. The difference is that big.&#160;
WordPress rocks, but [...]]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="maisonbisson-11132"><!-- &nbsp; --></abbr>
<p>A couple notes from the past few days of tweaks and fixes:</p>
<ul>
<li><a href="http://en.wikipedia.org/wiki/Hyperthreading" title="Hyper-threading - Wikipedia, the free encyclopedia">Hyper-threading</a> has a huge effect on <a href="http://en.wikipedia.org/wiki/LAMP_%28software_bundle%29" title="LAMP (software bundle) - Wikipedia, the free encyclopedia">LAMP</a> performance.<br />&nbsp;</li>
<li>From now on, I&#8217;ll have bad dreams about running MySQL without <a href="http://dev.mysql.com/doc/refman/5.0/en/query-cache-configuration.html" title="MySQL 5.0 Reference Manual :: 5.14.3 Query Cache Configuration">Query Caching</a> in the way that I used to have nightmares about going to school wearing only my underwear. The difference is that big.<br />&nbsp;</li>
<li><a href="http://wordpress.org/" title="WordPress › Free Blog Tool and Weblog Platform">WordPress</a> rocks, but it has some queries that will kill large databases. I&#8217;m playing with baseline when I fix &#8216;em, but it&#8217;s worth it.<br />&nbsp;</li>
<li>Being highly ranked for searches related to <a href="http://maisonbisson.com/blog/post/10447/">bears</a> and <a href="http://maisonbisson.com/blog/post/10725/">bear lovers</a> on the weekend that <a href="http://maisonbisson.com/blog/post/10740/">Grizzly Man</a> airs on TV is both good and bad: it doubled my previous high for daily page-loads, but killed my server and taught me some lessons about sloppy coding.<br />&nbsp;</li>
<li>The support techs are <a href="http://lunarpages.com/">Lunarpages</a> continue to pretty much rock.<br />&nbsp;</li>
<li>Having <a href="http://nosheep.net/">friends</a> who cut their teeth on high-performance PHP/MySQL and are willing to spend the night workshopping it with you is indispensable.<br />&nbsp;</li>
<li>It&#8217;s hard to beat the calming beauty of driving home through a snowfall on back roads at 2 AM carried by your life&#8217;s soundtrack.<br />&nbsp;</li>
</ul>
<p><tags>lamp, mysql, php, server optimization, mysql optimization, server performance, hyperthreading, performance optimization</tags></p>
]]></content:encoded>
			<wfw:commentRss>http://maisonbisson.com/blog/post/11132/performance-optimization/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Using XML In PHP5</title>
		<link>http://maisonbisson.com/blog/post/10901/php5-xml/</link>
		<comments>http://maisonbisson.com/blog/post/10901/php5-xml/#comments</comments>
		<pubDate>Tue, 22 Nov 2005 17:42:09 +0000</pubDate>
		<dc:creator>Casey Bisson</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[cdata]]></category>
		<category><![CDATA[docs]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[simplexml]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[xml server]]></category>

		<guid isPermaLink="false">http://maisonbisson.com/blog/?p=10901</guid>
		<description><![CDATA[
Everybody likes documentation. The Zend folks posted this overview and SimpleXML introduction The O&#8217;Reilly folks at ONLamp offered this guide to using SimpleXML. Of course, there&#8217;s always the SimpleXML docs at PHP.net.
Two problems: I haven&#8217;t encountered CDATA in my XML yet, but I do hope to develop a better solution than offered here when I [...]]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="maisonbisson-10901"><!-- &nbsp; --></abbr>
<p>Everybody likes documentation. The <a href="http://www.zend.com/">Zend folks</a> posted this <a href="http://www.zend.com/php5/articles/php5-xmlphp.php" title="Zend Technologies - PHP 5 In Depth - XML in PHP 5 - What's New?">overview</a> and <a href="http://www.zend.com/php5/articles/php5-simplexml.php" title="Zend Technologies - PHP 5 In Depth - SimpleXML">SimpleXML introduction</a> The O&#8217;Reilly folks at ONLamp offered this <a href="http://www.onlamp.com/pub/a/php/2004/01/15/simplexml.html" title="ONLamp.com: Using PHP 5's SimpleXML">guide to using SimpleXML</a>. Of course, there&#8217;s always the <a href="http://us2.php.net/simplexml" title="PHP: SimpleXML functions - Manual">SimpleXML docs</a> at PHP.net.</p>
<p>Two problems: I haven&#8217;t encountered <a href="http://changelog.ca/log/2005/06/14/php-simplexml-cdata-problem--and-my-solution" title="PHP SimpleXML CDATA Problem... and My Solution | By Charles Iliya Krempeaux, B.Sc. | ChangeLog.ca">CDATA in my XML</a> yet, but I do hope to develop a better solution than offered <a href="http://changelog.ca/log/2005/06/14/php-simplexml-cdata-problem--and-my-solution">here</a> when I do. The other is that SimpleXML chokes on illegal characters, a unfortunately common occurrence in documents coming from <a href="http://libdev.plymouth.edu/post/5">III&#8217;s XML Server</a>.<br />
<!-- technorati tags start -->
<p style="text-align:right;font-size:10px;">tags: <a href="http://www.technorati.com/tag/cdata" rel="tag">cdata</a>, <a href="http://www.technorati.com/tag/docs" rel="tag">docs</a>, <a href="http://www.technorati.com/tag/documentation" rel="tag">documentation</a>, <a href="http://www.technorati.com/tag/php" rel="tag">php</a>, <a href="http://www.technorati.com/tag/php5" rel="tag">php5</a>, <a href="http://www.technorati.com/tag/simplexml" rel="tag">simplexml</a>, <a href="http://www.technorati.com/tag/xml server" rel="tag">xml server</a>, <a href="http://www.technorati.com/tag/xml" rel="tag">xml</a></p>
<p><!-- technorati tags end --></p>
]]></content:encoded>
			<wfw:commentRss>http://maisonbisson.com/blog/post/10901/php5-xml/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>I Will Crush You</title>
		<link>http://maisonbisson.com/blog/post/10938/i-will-crush-you/</link>
		<comments>http://maisonbisson.com/blog/post/10938/i-will-crush-you/#comments</comments>
		<pubDate>Wed, 02 Nov 2005 04:54:16 +0000</pubDate>
		<dc:creator>Casey Bisson</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[512mb ram]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[break point]]></category>
		<category><![CDATA[breaking point]]></category>
		<category><![CDATA[celeron]]></category>
		<category><![CDATA[crushed]]></category>
		<category><![CDATA[load average]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[top]]></category>
		<category><![CDATA[web server]]></category>

		<guid isPermaLink="false">http://maisonbisson.com/blog/?p=10938</guid>
		<description><![CDATA[

Or, er, my server will be crushed. I guess I should admit that my stuff could do with some optimization, maybe. Perhaps what I really need is something faster than Celeron with 512MB RAM. Maybe.

tags: 512mb ram, apache, break point, breaking point, celeron, crushed, load average, mysql, php, server, top, web server

]]></description>
			<content:encoded><![CDATA[<abbr class="unapi-id" title="maisonbisson-10938"><!-- &nbsp; --></abbr>
<p><a href="http://www.flickr.com/photos/maisonbisson/58842973/" title="Crushing the poor little server."><img src="http://static.flickr.com/25/58842973_a99e729b5f.jpg" width="500" height="362" style="border: solid 0px #000000; margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px;" /></a></p>
<p>Or, er, my server will be crushed. I guess I should admit that my stuff could do with some optimization, maybe. Perhaps what I really need is something faster than Celeron with 512MB RAM. Maybe.</p>
<p><!-- technorati tags start -->
<p style="text-align:right;font-size:10px;">tags: <a href="http://www.technorati.com/tag/512mb ram" rel="tag">512mb ram</a>, <a href="http://www.technorati.com/tag/apache" rel="tag">apache</a>, <a href="http://www.technorati.com/tag/break point" rel="tag">break point</a>, <a href="http://www.technorati.com/tag/breaking point" rel="tag">breaking point</a>, <a href="http://www.technorati.com/tag/celeron" rel="tag">celeron</a>, <a href="http://www.technorati.com/tag/crushed" rel="tag">crushed</a>, <a href="http://www.technorati.com/tag/load average" rel="tag">load average</a>, <a href="http://www.technorati.com/tag/mysql" rel="tag">mysql</a>, <a href="http://www.technorati.com/tag/php" rel="tag">php</a>, <a href="http://www.technorati.com/tag/server" rel="tag">server</a>, <a href="http://www.technorati.com/tag/top" rel="tag">top</a>, <a href="http://www.technorati.com/tag/web server" rel="tag">web server</a></p>
<p><!-- technorati tags end --></p>
]]></content:encoded>
			<wfw:commentRss>http://maisonbisson.com/blog/post/10938/i-will-crush-you/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>