<?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>the codem web development blog - Surry Hills, Sydney, Australia &#187; sydphp</title>
	<atom:link href="http://www.codem.com.au/streams/tag/sydphp/feed" rel="self" type="application/rss+xml" />
	<link>http://www.codem.com.au/streams</link>
	<description>web development, architecture and server management</description>
	<lastBuildDate>Wed, 30 Nov 2011 23:22:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Desk space available (Bapple)</title>
		<link>http://www.codem.com.au/streams/2011/office/desk-space-available-bapple.html</link>
		<comments>http://www.codem.com.au/streams/2011/office/desk-space-available-bapple.html#comments</comments>
		<pubDate>Thu, 03 Feb 2011 04:54:54 +0000</pubDate>
		<dc:creator>James Ellis</dc:creator>
				<category><![CDATA[office]]></category>
		<category><![CDATA[desk space]]></category>
		<category><![CDATA[surry hills]]></category>
		<category><![CDATA[sydney]]></category>
		<category><![CDATA[sydphp]]></category>

		<guid isPermaLink="false">http://www.codem.com.au/streams/?p=83</guid>
		<description><![CDATA[Are you looking for a desk/office space in Surry Hills 3 minutes from Central station? Codem&#8217;s web collaborators Bapple are offering a desk space &#8211; here&#8217;s the low down: &#8220;Offering a desk space to web/creative professionals. We&#8217;d also like to work with you if you choose! $86/wk + GST (or $395/mth all inclusive). The space [...]]]></description>
			<content:encoded><![CDATA[<p>Are you looking for a desk/office space in Surry Hills 3 minutes from Central station? Codem&#8217;s web collaborators Bapple are offering a desk space &#8211; here&#8217;s the low down:</p>
<p>&#8220;Offering a desk space to web/creative  professionals. We&#8217;d also like to work with you if you choose! $86/wk + GST (or $395/mth all inclusive). The space comes with:</p>
<ul>
<li> large desk</li>
<li> chair</li>
<li> broadband</li>
<li> A/C</li>
<li>Kitchen and Loo access</li>
<li>24/7 access</li>
<li>sunlight + balcony</li>
</ul>
<p>It&#8217;s a clean, bright office with friendly creative/web developer folk and no  bills&#8221;</p>
<p><img src="http://img1.classistatic.com/cps/kj/110117/537r7/0507ibk_19.jpeg" alt="desk space available, Surry Hills, Sydney" /><br />
(Desk on right will be on the left where white table is pictured.)</p>
<p>Contact Pete for more info on 0419144829 or visit <a href="http://bapple.com.au">the Bapple website</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.codem.com.au/streams/2011/office/desk-space-available-bapple.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Consuming XML, fast, with PHP and XMLReader</title>
		<link>http://www.codem.com.au/streams/2009/web-development/consuming-xml-fast-with-php-and-xmlreader.html</link>
		<comments>http://www.codem.com.au/streams/2009/web-development/consuming-xml-fast-with-php-and-xmlreader.html#comments</comments>
		<pubDate>Sun, 03 May 2009 12:37:13 +0000</pubDate>
		<dc:creator>James Ellis</dc:creator>
				<category><![CDATA[web development]]></category>
		<category><![CDATA[pullparsing]]></category>
		<category><![CDATA[simplexml]]></category>
		<category><![CDATA[sydphp]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[xmlreader]]></category>

		<guid isPermaLink="false">http://www.customr.net/streams/?p=32</guid>
		<description><![CDATA[Let&#8217;s face it, XML isn&#8217;t the lightest of data serialisation formats out there. Consider and compare this: &#60;alternate_description&#62;something else&#60;alternate_description&#62; against this, in JSON { alternate_description : "something else" } Those repetitive XML tags are really just extra bytes to download and parse. Unfortunately, sometimes, we have to consume huge gobs of XML for a project [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s face it, XML isn&#8217;t the lightest of data serialisation formats out there. Consider and compare this:</p>
<pre>&lt;alternate_description&gt;something else&lt;alternate_description&gt;</pre>
<p>against this, in JSON</p>
<pre>{ alternate_description : "something else" }</pre>
<p>Those repetitive XML tags are really just extra bytes to download and parse. Unfortunately, sometimes, we have to consume huge gobs of XML for a project and for that we have <a href="http://php.net/xmlreader">XMLReader</a>, the lesser known cousin of <a href="http://php.net/simplexml">SimpleXML.</a></p>
<p>Unlike SimpleXML, which consumes the entire document before making it available for parsing, XMLReader &#8220;acts as a cursor going forward on the document stream and stopping at each node on the way&#8221; (php.net/xmlreader). Kind of like a line-by-line CSV parser but acting on the nodes of an XML document.<br />
Choosing the right XML parser for the job is very important, as if you don&#8217;t choose correctly it can lead to unwanted and avoidable performance issues on your server.</p>
<p>To illustrate this, I pointed both SimpleXML and XMLReader at the same 190MB XML document via a PHP shell script, ran two tests on each extension and profiled the results.  Test one found a node at the start of the file, the other test found a node at the end of the file.</p>
<p>The XML document in question is a standard XML document containing 21467 records, it looks something like this:</p>
<pre>&lt;persons&gt;
   &lt;person&gt;
       &lt;name&gt;John&lt;/name&gt;
       &lt;!-- other nodes --&gt;
   &lt;/person&gt;
   &lt;!-- 21466 person nodes --&gt;
&lt;/persons&gt;</pre>
<p>Peak memory usage is measured by the &#8220;top&#8221; command (%MEM).</p>
<h4>SimpleXML</h4>
<pre>Test One:
Nodes : 1
Peak Memory Usage: 18%
Processed 190MB of XML in 3.14164 seconds

Test Two:
Nodes : 21467
Peak Memory Usage: 18%
Processed 190MB of XML in 3.20796 seconds</pre>
<h4>XMLReader</h4>
<pre>Test One:
Nodes: 1
Peak Memory Usage: 0.3%
Processed 190MB of XML in 0.00128 seconds

Test Two:
Nodes : 21467
Peak Memory Usage: 0.7%
Processed 190MB of XML in 16.4478 seconds</pre>
<p>These results really give an indication of the different uses of both extensions.</p>
<p>XMLReader flew through finding the first element in no time at all while SimpleXML took about the same time to find the first and the last element. The big difference is memory &#8212; XMLReader performed about 50 times better than SimpleXML.<br />
Understandably, XMLReader took a lot longer to find the last node as it had to process each node in the document until it found a match. A seek() method on the XMLReader class would obviously be useful here to skip unwanted nodes.</p>
<h4>Use cases</h4>
<p>For simple parsing such as RSS feed handling and small XML documents SimpleXML is definitely the way to go. It&#8217;s easy access to document nodes is a great advantage.<br />
For larger document importing, XMLReader wins hands-down due to its ability to read the document node by node with limited impact on system memory, in fact you can parse XML documents with XMLReader that are larger than the available system memory.</p>
<p>One final tip: avoid building large data structures while processing large XML documents with XMLReader as it defeats the purpose of using XMLReader in the first place &#8212; just grab the data needed to perform an operation and skip to the next iteration.</p>
<h4>Other Resources</h4>
<ul>
<li><a href="http://www.ibm.com/developerworks/library/x-pullparsingphp.html">Pull parsing XML in PHP</a></li>
<li><a href="http://php.net/simplexml">SimpleXML documentation</a></li>
<li><a href="http://php.net/xmlreader">XMLReader documentation</a></li>
<li><a href="http://blog.lib.umn.edu/fenne035/academe2.0/2007/04/speed_reading_xml_with_php_xml.html">Speed reading XML with XMLReader</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.codem.com.au/streams/2009/web-development/consuming-xml-fast-with-php-and-xmlreader.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>providing patches in feature-based web development</title>
		<link>http://www.codem.com.au/streams/2009/web-development/providing-patches-in-feature-based-web-development.html</link>
		<comments>http://www.codem.com.au/streams/2009/web-development/providing-patches-in-feature-based-web-development.html#comments</comments>
		<pubDate>Fri, 27 Feb 2009 06:46:22 +0000</pubDate>
		<dc:creator>James Ellis</dc:creator>
				<category><![CDATA[web development]]></category>
		<category><![CDATA[bazaar]]></category>
		<category><![CDATA[sydphp]]></category>
		<category><![CDATA[version control]]></category>

		<guid isPermaLink="false">http://developments.customr.net/?p=24</guid>
		<description><![CDATA[A while back, I did a presentation to the Sydney PHP Group on feature based web development using Bazaar, a distributed version control system. At the time is was quite interesting to see the number of attendees who a) didn&#8217;t know about or use version control or b) were using CVS (the instant coffee of [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://sydphp.org/2008/05/11/presentation-feature-based-web-development-with-bazaar/">A while back</a>, I did a presentation to the <a href="http://sydphp.org">Sydney PHP Group</a> <a href="http://sydphp.org/2008/05/11/presentation-feature-based-web-development-with-bazaar/">on feature based web development</a> using <a href="http://bazaar-vcs.org">Bazaar</a>, a distributed version control system. At the time is was quite interesting to see the number of attendees who a) didn&#8217;t know about or use version control or b) were using CVS (the instant coffee of version control).</p>
<p>If you are doing web development amongst a team and want a really solid branching system without headache inducing conflict/merge issues then Bazaar is a really valuable tool. One of the best things about patching in Bazaar is the <em>send</em> command:</p>
<pre>
$ bzr help send
Purpose: Mail or create a merge-directive for submitting changes.
Usage:   bzr send [SUBMIT_BRANCH] [PUBLIC_BRANCH]
</pre>
<p>The send command enables you by default to mail a patch file to the patch manager, who can then test and merge it into a centralised mainline branch. If you don&#8217;t want to mail patches they can be uploaded to the remote server in one go, even though <em>send</em> doesn&#8217;t as yet support saving to remote locations.<br />
The trick is to provide &#8216;-&#8217; (stdout) as the output file then pipe it to ssh for upload to your remote directives location.</p>
<pre>
bzr send -o - sftp://me@someserver/path/to/remote/branch | ssh me@someserver "cat > /path/to/directives/my.patch"
</pre>
<p>After bzr does it&#8217;s stuff and you&#8217;ve logged in to the remote server, a patch file is available (my.patch) that can be applied, tested and either reverted or committed using bzr merge, pull, commit and revert.</p>
<p>Tip 1: if you don&#8217;t have SSH access to your server <a href="https://launchpad.net/bzr-upload">try the bzr upload plugin</a><br />
Tip 2: storing your public ssh key on the remote server will allow you to perform the send without password prompts.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codem.com.au/streams/2009/web-development/providing-patches-in-feature-based-web-development.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

