<?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>unseen &#187; blog</title>
	<atom:link href="http://unseen.ws/category/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://unseen.ws</link>
	<description>my inner geek's domain</description>
	<lastBuildDate>Fri, 18 Mar 2011 16:30:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Add more space to a VMWare Virtual Machine</title>
		<link>http://unseen.ws/2011/03/add-more-space-to-a-vmware-virtual-machine/</link>
		<comments>http://unseen.ws/2011/03/add-more-space-to-a-vmware-virtual-machine/#comments</comments>
		<pubDate>Fri, 18 Mar 2011 16:30:01 +0000</pubDate>
		<dc:creator>hrrkii</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://unseen.ws/?p=163</guid>
		<description><![CDATA[I prefer to dev in a linux environment, but I don&#8217;t always prefer to run a linux desktop.  So for my setup I run a linux desktop in VMWare Player so that I have the best of both worlds.   The other advantage is this setup allows me to take my dev setup with [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://gparted.sourceforge.net/livecd.php"><img class="alignleft" style="margin: 5px;" src="http://gparted.sourceforge.net/images/gparted-64.png" alt="" width="64" height="64" /></a>I prefer to dev in a linux environment, but I don&#8217;t always prefer to run a linux desktop.  So for my setup I run a linux desktop in <a href="http://www.vmware.com/products/player/">VMWare Player</a> so that I have the best of both worlds.   The other advantage is this setup allows me to take my dev setup with me as I float from machine to machine.</p>
<p>Over time my vm has grown to fill all 10 GB of diskspace I originally allocated and I have to constantly fight against filling the disk.  Enough was enough and I decided to finally figure out how to grow the vm disk or setup a new one with bigger disk and migrate.  Good news, it turned out to be less pain to grow disk then setup new vm.</p>
<p>How did I do it you ask&#8230; glad you asked.</p>
<ol>
<li>Got a hold of vmware-vdiskmanager tool
<ol>
<li>I use VMWare Player that does not come with this tool so I downloaded the <a href="http://www.vmware.com/support/developer/vddk/">Virtual Disk Development Kit </a></li>
</ol>
</li>
<li>Run the vmware-vdiskmanager tool against your virtual disk
<ol>
<li>Here is <a href="http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&amp;cmd=displayKC&amp;externalId=1004047">VMWare KB </a>article I used detailing how to do this.</li>
</ol>
</li>
<li>Resize partition of virtual machine to use new diskspace.
<ol>
<li>I used <a href="http://gparted.sourceforge.net/livecd.php">GParted Live</a> to do this</li>
</ol>
</li>
<li>Enjoy the freedom from nagging popups warning you about disk space.</li>
</ol>
<ol></ol>
]]></content:encoded>
			<wfw:commentRss>http://unseen.ws/2011/03/add-more-space-to-a-vmware-virtual-machine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Netbeans, PHPUnit, and You</title>
		<link>http://unseen.ws/2009/06/netbeans-phpunit-and-you/</link>
		<comments>http://unseen.ws/2009/06/netbeans-phpunit-and-you/#comments</comments>
		<pubDate>Wed, 17 Jun 2009 19:27:22 +0000</pubDate>
		<dc:creator>hrrkii</dc:creator>
				<category><![CDATA[blog]]></category>

		<guid isPermaLink="false">http://unseen.ws/?p=84</guid>
		<description><![CDATA[My love affair with NetBeans continues.  The latest discovery in the long list of things to rave about is it&#8217;s newly built in (was part of the 6.7 Beta release) support for unit testing with PHPUnit.  There is a nice tutorial over on the NetBeans site that gets you up and running with it in [...]]]></description>
			<content:encoded><![CDATA[<p>My<a href="http://unseen.ws/2009/03/netbeans-for-php-ftw/"> love affair with NetBeans</a> continues.  The latest discovery in the long list of things to rave about is it&#8217;s newly built in (was part of the 6.7 Beta release) support for unit testing with PHPUnit.  There is a <a href="http://www.netbeans.org/kb/docs/php/phpunit.html" target="_blank">nice tutorial</a> over on the NetBeans site that gets you up and running with it in no time.</p>
<p>I got done with the tutorial and was stoked to try running unit tests on an existing project from within netbeans, but I quickly hit the wall when I tried running a test:</p>
<p><img class="alignnone size-full wp-image-88" title="System-2" src="http://unseen.ws/wp-content/uploads/2009/06/System-2.jpg" alt="System-2" width="478" height="368" /></p>
<p>Figured no prob, I&#8217;ll just open the project properties and set the test directory.  Hit another wall, that field is read only and won&#8217;t let you type in it.  After some more playing I finally stumbled across the solution for telling NetBeans about an existing tests directory.</p>
<p><span id="more-84"></span></p>
<p>You have to right click on the project and select Test:</p>
<p><img class="alignnone size-full wp-image-89" title="System" src="http://unseen.ws/wp-content/uploads/2009/06/System.jpg" alt="System" width="459" height="580" /></p>
<p>After doing that you&#8217;ll get the dialog asking where the tests dir is:</p>
<p><img class="alignnone size-medium wp-image-87" title="System-1" src="http://unseen.ws/wp-content/uploads/2009/06/System-1-300x135.jpg" alt="System-1" width="300" height="135" /></p>
<p>Once you set the test dir Netbeans will know where to find you&#8217;re tests and you&#8217;ll be good go:</p>
<p><img class="alignnone size-full wp-image-85" title="phpunit_testing - NetBeans IDE 6.7 RC2-1" src="http://unseen.ws/wp-content/uploads/2009/06/phpunit_testing-NetBeans-IDE-6.7-RC2-1.jpg" alt="phpunit_testing - NetBeans IDE 6.7 RC2-1" width="331" height="304" /></p>
<p>That&#8217;s all well and good, but what if you ever want to move the test directory?  You&#8217;re up a against the same problem where the test directory in the project properties box is a read only field.  Here are the steps I took to be able to get around this:</p>
<ol>
<li>close the project if  it is open</li>
<li>find your nbproject direcotry (in the project root by default)</li>
<li>pop open the project.properties file inside of the nbproject directory</li>
<li>look for the line with the test.src.dir variable</li>
<li>edit the value or remove the line and go through the steps above for telling NB where the test dir is</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://unseen.ws/2009/06/netbeans-phpunit-and-you/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Speed Tests of Zend_Config Approaches</title>
		<link>http://unseen.ws/2009/05/speed-tests-of-zend_config-approaches/</link>
		<comments>http://unseen.ws/2009/05/speed-tests-of-zend_config-approaches/#comments</comments>
		<pubDate>Tue, 05 May 2009 17:24:15 +0000</pubDate>
		<dc:creator>hrrkii</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://unseen.ws/?p=71</guid>
		<description><![CDATA[On a project I&#8217;m working on we are using bits and pieces from the Zend Framework.  We want to utilize the Zend_Config functionality to be able to standardize and make it easier to setup as well as access config information.  We also wanted a way to be able to have the config automatically reflect the [...]]]></description>
			<content:encoded><![CDATA[<p>On a project I&#8217;m working on we are using bits and pieces from the<a href="http://framework.zend.com/" target="_blank"> Zend Framework</a>.  We want to utilize the <a href="http://framework.zend.com/manual/en/zend.config.html" target="_blank">Zend_Config</a> functionality to be able to standardize and make it easier to setup as well as access config information.  We also wanted a way to be able to have the config automatically reflect the environment we are running in (production vs testing vs dev).</p>
<p>Our first stab at it was utilizing ini format configs and the <a href="http://framework.zend.com/manual/en/zend.config.adapters.ini.html"> Zend_Config_Ini</a> importer.  The configs were nice and clean, and had support built in for being environment aware.  This also is the approach the documentation seems to be pushing, almost anything that utilizes a config example in the documentation utilizes ini style configs.</p>
<p>A couple thoughts kept creeping into my mind though.  Whats the performance of converting ini file into the final config object going to be like?  How does it compare to other possible approaches to loading the config object?</p>
<p>Only one way to find out.  Time to fire up the PHP Raceway (my little homegrown testing framework for testing out these sort of things).  What I did was take the example config from the <a href="http://framework.zend.com/docs/quickstart" target="_blank">quick start</a> documentation and added a config section for an array of data, then set up that config for trying out the three different approaches.  First is the standard ini way, second is building an array in php then building the config object from that, and third is creating a blank config object and loading it by hand.  Here are the racers.</p>
<p><span id="more-71"></span></p>
<h3>The Racers</h3>
<h4><strong>The INI approach</strong></h4>
<p><em>Instantiation Code:</em></p>
<div class="codecolorer-container php twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$config</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Zend_Config_Ini<span style="color: #009900;">&#40;</span>CONFIG_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/config.ini'</span><span style="color: #339933;">,</span> APPLICATION_ENVIRONMENT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p><em> Config File:</em></p>
<div class="codecolorer-container ini twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="ini codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>production<span style="">&#93;</span></span><br />
phpSettings.display_startup_errors <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 0</span><br />
phpSettings.display_errors <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 0</span><br />
bootstrap.path <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> APPLICATION_PATH </span><span style="color: #933;">&quot;/Bootstrap.php&quot;</span><br />
bootstrap.class <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;Bootstrap&quot;</span><br />
resources.frontController.controllerDirectory <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> APPLICATION_PATH </span><span style="color: #933;">&quot;/controllers&quot;</span><br />
resources.layout.layoutPath <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> APPLICATION_PATH </span><span style="color: #933;">&quot;/layouts/scripts&quot;</span><br />
resources.view<span style="">&#91;</span><span style="">&#93;</span> <span style="color: #000066; font-weight:bold;">=</span><br />
resources.db.adapter <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;PDO_SQLITE&quot;</span><br />
resources.db.params.dbname <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> APPLICATION_PATH </span><span style="color: #933;">&quot;/../data/db/guestbook.db&quot;</span><br />
testarray<span style="">&#91;</span><span style="">&#93;</span> <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;test1&quot;</span><br />
testarray<span style="">&#91;</span><span style="">&#93;</span> <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;test2&quot;</span><br />
testarray<span style="">&#91;</span><span style="">&#93;</span> <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;test3&quot;</span><br />
testarray<span style="">&#91;</span><span style="">&#93;</span> <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;test4&quot;</span><br />
testarray<span style="">&#91;</span><span style="">&#93;</span> <span style="color: #000066; font-weight:bold;">=</span> <span style="color: #933;">&quot;test5&quot;</span><br />
<span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>staging : production<span style="">&#93;</span></span><br />
<span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>testing : production<span style="">&#93;</span></span><br />
phpSettings.display_startup_errors <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 1</span><br />
phpSettings.display_errors <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 1</span><br />
resources.db.params.dbname <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> APPLICATION_PATH </span><span style="color: #933;">&quot;/../data/db/guestbook-testing.db&quot;</span><br />
<span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>development : production<span style="">&#93;</span></span><br />
phpSettings.display_startup_errors <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 1</span><br />
phpSettings.display_errors <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 1</span><br />
resources.db.params.dbname <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> APPLICATION_PATH </span><span style="color: #933;">&quot;/../data/db/guestbook-dev.db&quot;</span></div></div>
<h4><strong>The PHP Array approach</strong></h4>
<p><em>Instantiation Code:</em></p>
<div class="codecolorer-container php twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$config</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Zend_Config<span style="color: #009900;">&#40;</span><span style="color: #b1b100;">require</span> CONFIG_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/config.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p><em> Config File:</em></p>
<div class="codecolorer-container php twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<span style="color: #000088;">$config</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'phpSettings'</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #339933;">=&gt;</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'display_startup_errors'</span> &nbsp; &nbsp; <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'phpSettings.display_errors'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'boostrap'</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">=&gt;</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'path'</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">=&gt;</span> APPLICATION_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/Bootstrap.php&quot;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'class'</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;Bootstrap&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'resources'</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #339933;">=&gt;</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'frontController'</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #339933;">=&gt;</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'controllerDirectory'</span> &nbsp; &nbsp;<span style="color: #339933;">=&gt;</span> APPLICATION_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/controllers&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'layout'</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">=&gt;</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'layoutPath'</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">=&gt;</span> APPLICATION_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/layouts/scripts&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'view'</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">=&gt;</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'db'</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">=&gt;</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'adapter'</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">&quot;PDO_SQLITE&quot;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'params'</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">=&gt;</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'dbname'</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">=&gt;</span> APPLICATION_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/../data/db/guestbook.db&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'testarray'</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #339933;">=&gt;</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'test1'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'test2'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'test3'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'test4'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'test5'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>APPLICATION_ENVIRONMENT <span style="color: #339933;">==</span> <span style="color: #0000ff;">'staging'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span>APPLICATION_ENVIRONMENT <span style="color: #339933;">==</span> <span style="color: #0000ff;">'teseting'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'phpSettings'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'display_startup_errors'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'phpSettings'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'display_errors'</span><span style="color: #009900;">&#93;</span> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'resources'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'db'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'params'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'dbname'</span><span style="color: #009900;">&#93;</span> &nbsp; <span style="color: #339933;">=</span> APPLICATION_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/../data/db/guestbook-testing.db&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$config</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span>APPLICATION_ENVIRONMENT <span style="color: #339933;">==</span> <span style="color: #0000ff;">'development'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'phpSettings'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'display_startup_errors'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'phpSettings'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'display_errors'</span><span style="color: #009900;">&#93;</span> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'resources'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'db'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'params'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'dbname'</span><span style="color: #009900;">&#93;</span> &nbsp; <span style="color: #339933;">=</span> APPLICATION_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/../data/db/guestbook-testing.db&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$config</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$config</span><span style="color: #339933;">;</span></div></div>
<h4><strong>The PHP Config Fill approach</strong></h4>
<p><em>Instantiation Code:</em></p>
<div class="codecolorer-container php twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$config</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Zend_Config<span style="color: #009900;">&#40;</span><a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><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: #339933;">;</span><br />
<span style="color: #b1b100;">require</span> CONFIG_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/config_fill.php'</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setReadOnly</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p><em> Config File:</em></p>
<div class="codecolorer-container php twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">phpSettings</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">phpSettings</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">display_startup_errors</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">phpSettings</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">display_errors</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">boostrap</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">boostrap</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">path</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #339933;">=</span> APPLICATION_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/Bootstrap.php&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">boostrap</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">class</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Bootstrap'</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">resources</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">resources</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">frontController</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">resources</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">frontController</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">controllerDirectory</span> <span style="color: #339933;">=</span> APPLICATION_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/controllers&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">resources</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">layout</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">resources</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">layout</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">layoutPath</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">=</span> APPLICATION_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/layouts/scripts&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">resources</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">resources</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">resources</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">adapter</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;PDO_SQLITE&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">resources</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">params</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">resources</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">params</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">dbname</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">=</span> APPLICATION_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/../data/db/guestbook.db&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">testarray</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'test1'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'test2'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'test3'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'test4'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'test5'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>APPLICATION_ENVIRONMENT <span style="color: #339933;">==</span> <span style="color: #0000ff;">'staging'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span>APPLICATION_ENVIRONMENT <span style="color: #339933;">==</span> <span style="color: #0000ff;">'teseting'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">phpSettings</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">display_startup_errors</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">phpSettings</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">display_errors</span> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">resources</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">params</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">dbname</span> &nbsp; &nbsp; &nbsp; <span style="color: #339933;">=</span> APPLICATION_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/../data/db/guestbook-testing.db&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span>APPLICATION_ENVIRONMENT <span style="color: #339933;">==</span> <span style="color: #0000ff;">'development'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">phpSettings</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">display_startup_errors</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">phpSettings</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">display_errors</span> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$config</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">resources</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">params</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">dbname</span> &nbsp; &nbsp; &nbsp; <span style="color: #339933;">=</span> APPLICATION_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/../data/db/guestbook-testing.db&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<h3><strong>The results</strong></h3>
<p style="padding-left: 30px;">*times are in seconds*<br />
laps   = 10000</p>
<p>PHP Array Config Format is the WINNER!<br />
total time = 2.70539808273<br />
average time = 0.00027054</p>
<p>Ini Config Format results:<br />
total time = 4.37592101097 which is 1.67052292824 slower than the winner<br />
average time = 0.00043759 which is 0.00016705 per lap slower than the winner<br />
this racer took 62% longer than the winner</p>
<p>PHP Config Fill results:<br />
total time = 3.37267208099 which is 0.66727399826 slower than the winner<br />
average time = 0.00033727 which is 6.673E-5 per lap slower than the winner<br />
this racer took 25% longer than the winner</p>
<h3>Conclusion</h3>
<p>If speed is absolute biggest concern, I&#8217;d have to say go with the building of an array and passing it into the constructer.  The array aproach made our eyes burn, so we ended up going with the hand filling of the config object because the little bit of performance hit was worth the trade off of and easier to work with and read config file.</p>
<p>One huge thing of note.  I run <a href="http://xcache.lighttpd.net/" target="_blank">xcache</a> on my systems, and to be honest could not image running a production system without some sort of opcode cacher.  If you happen to not have access to an opcode cacher these results will change drastically.  Check out what happens when I turn xcache off:</p>
<p style="padding-left: 30px;">*times are in seconds*<br />
laps   = 10000</p>
<p>PHP Array Config Format is the WINNER!<br />
total time = 3.0291249752<br />
average time = 0.00030291</p>
<p>Ini Config Format results:<br />
total time = 4.26868700981 which is 1.23956203461 slower than the winner<br />
average time = 0.00042687 which is 0.00012396 per lap slower than the winner<br />
this racer took 41% longer than the winner</p>
<p>PHP Config Fill results:<br />
total time = 4.76278781891 which is 1.7336628437 slower than the winner<br />
average time = 0.00047628 which is 0.00017337 per lap slower than the winner<br />
this racer took 58% longer than the winner</p>
<p>If you you&#8217;re not running an opcode cacher looks like you had better steer clear of the hand filling approach and go with the array for speed or ini for maintainability.<br />
In the end this sort of micro-optimization may not gain you much in terms of noticeable real world performance, especially when you compare this to the cost of database or api queries.  But if you&#8217;re a speed freak, or are trying to cut down on the work your server is having to do during the day, this is some good food for thought.</p>
]]></content:encoded>
			<wfw:commentRss>http://unseen.ws/2009/05/speed-tests-of-zend_config-approaches/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>PHP multibyte character dumbness</title>
		<link>http://unseen.ws/2009/04/php-multibyte-character-dumbness/</link>
		<comments>http://unseen.ws/2009/04/php-multibyte-character-dumbness/#comments</comments>
		<pubDate>Wed, 22 Apr 2009 17:29:52 +0000</pubDate>
		<dc:creator>hrrkii</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[utf8]]></category>

		<guid isPermaLink="false">http://unseen.ws/?p=68</guid>
		<description><![CDATA[I got bit this week by something that I have somehow managed to avoid via complete dumb luck up till now.  It&#8217;s the fact that PHP is retarded when it comes to handling UTF-8 strings.
I couldn&#8217;t figure out why a string kept coming out with gibberish on the end.  The app was truncating the string [...]]]></description>
			<content:encoded><![CDATA[<p>I got bit this week by something that I have somehow managed to avoid via complete dumb luck up till now.  It&#8217;s the fact that PHP is retarded when it comes to handling UTF-8 strings.</p>
<p>I couldn&#8217;t figure out why a string kept coming out with gibberish on the end.  The app was truncating the string because it was too long, and the spot it was getting truncated at was at a single quote mark.  My initial thinking led me down a road where I thought perhaps it was one of those goofy quote marks and maybe it had gotten incorrectly encoded along the way and was not proper UTF-8.  After determining it was not an encoding problem one of the guys at work reminded me that UTF-8 characters can be mutibyte, and perhaps it had something to do with that.  After a little research, sure enough, the substr function I was using is one of dumb functions and was chopping that multibyte character in half, leaving only the gibberish.</p>
<p>In PHP &lt; version 6 the core string functionality generally disregards the fact that charters could be multibyte, and just assumes 1 byte = 1 character.  In my research I ran across a great page that has a rundown of the different problematic string functions and their level of risk when it comes to dealing with UTF-8:   <a href="http://www.phpwact.org/php/i18n/utf-8">Handling UTF-8 with PHP [Web Application Component Toolkit]</a>.</p>
<p>My particluar situation was resolved by not chopping in the middle of words and instead finding and chopping at the preceding whitespace, but if you don&#8217;t have the luxury of tweaking your logic, I highly recommend taking a look at the <a href="http://us.php.net/mbstring">Multibyte String Library</a>, or procrastinate until PHP6 is out :)</p>
]]></content:encoded>
			<wfw:commentRss>http://unseen.ws/2009/04/php-multibyte-character-dumbness/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web Dev Communities</title>
		<link>http://unseen.ws/2009/04/web-dev-communities/</link>
		<comments>http://unseen.ws/2009/04/web-dev-communities/#comments</comments>
		<pubDate>Fri, 10 Apr 2009 22:46:50 +0000</pubDate>
		<dc:creator>hrrkii</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://unseen.ws/?p=65</guid>
		<description><![CDATA[Ran across this article from Marco Tabini and along with being pretty insightful it cracked me up, and I thought was worth sharing:
The Accidental Businessman: Communities.
Now I&#8217;ve not actually been part of the Ruby community, but I can tell you that when I cross paths with someone who is from it, I generally come away [...]]]></description>
			<content:encoded><![CDATA[<p>Ran across this article from Marco Tabini and along with being pretty insightful it cracked me up, and I thought was worth sharing:</p>
<p><a href="http://mtabini.blogspot.com/2009/04/communities.html">The Accidental Businessman: Communities</a>.</p>
<p>Now I&#8217;ve not actually been part of the Ruby community, but I can tell you that when I cross paths with someone who is from it, I generally come away feeling the same way that Marco does.</p>
<p>The contrast of the PHP and Python communities was pretty good.  Having <a href="http://unseen.ws/2009/03/smoron-goes-live/">recently dipped my toe</a> into the Python community I would have to agree with the keg party vs study group metaphor.  Though I did tend to find the python folks overly harsh and often misinformed when it came to criticism of PHPers.  Maybe our party music is disturbing their studies :)</p>
]]></content:encoded>
			<wfw:commentRss>http://unseen.ws/2009/04/web-dev-communities/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MossCat.com Redesign</title>
		<link>http://unseen.ws/2009/04/mosscatcom-redesign/</link>
		<comments>http://unseen.ws/2009/04/mosscatcom-redesign/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 22:46:28 +0000</pubDate>
		<dc:creator>hrrkii</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[dev]]></category>
		<category><![CDATA[mosscat]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[website]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://unseen.ws/?p=59</guid>
		<description><![CDATA[
Just launched a redesign of my wife and I&#8217;s personal blog and photo site.  You can read about some of the motivation on the MossCat Reborn post over on mosscat.com.
The work involved was a new page design and creation of a Wordpress theme from that design.  I made use of the Tan Tan Flickr Photo [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://mosscat.com"><img class="aligncenter size-full wp-image-60" title="mosscat logo" src="http://unseen.ws/wp-content/uploads/2009/04/logo.png" alt="mosscat logo" width="180" height="58" /></a></p>
<p>Just launched a redesign of my wife and I&#8217;s personal blog and photo site.  You can read about some of the motivation on the <a href="http://mosscat.com/2009/04/mosscat-reborn/">MossCat Reborn</a> post over on <a href="http://mosscat.com">mosscat.com</a>.</p>
<p>The work involved was a new page design and creation of a Wordpress theme from that design.  I made use of the <a href="http://tantannoodles.com/toolkit/photo-album/">Tan Tan Flickr Photo Album </a>plugin to incorporate our flickr photos.  I&#8217;m very pleased with how it turned out.</p>
<p>The only casualty along the way was IE6 due to the png alpha used in the background images. There is a nice <a href="http://24ways.org/2007/supersleight-transparent-png-in-ie6">article on 24Ways.org</a> discussing the issue.  I gave the SuperSleight solution a try, but it didn&#8217;t work very well, plus  I also feel that it is somewhat my duty to help the web move forward by doing my part to let IE6 die, so I&#8217;m content with the page looking like garbage on IE6.</p>
<p>The design utilizes<a href="http://developer.yahoo.com/yui/grids/"> YUI Grids CSS</a> for the layout and <a href="http://developer.yahoo.com/yui/base/">YUI Base CSS </a>for the style foundation.  I investigated a number of other css frameworks that are currently out there such as <a href="http://www.blueprintcss.org/">BluePrint</a> and <a href="http://960.gs/">960 GS</a> since I&#8217;ve used YUI in the past and wanted to see what else there was.  There is a lot of great choices out there, and all have a little somthing to offer, but ultimately I came back to YUI CSS because I preferred its documentation, flexibility, and capabilities over the other options I found.</p>
]]></content:encoded>
			<wfw:commentRss>http://unseen.ws/2009/04/mosscatcom-redesign/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>hunch.com review</title>
		<link>http://unseen.ws/2009/04/hunchcom-review/</link>
		<comments>http://unseen.ws/2009/04/hunchcom-review/#comments</comments>
		<pubDate>Sun, 05 Apr 2009 23:22:40 +0000</pubDate>
		<dc:creator>hrrkii</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[review]]></category>
		<category><![CDATA[website]]></category>

		<guid isPermaLink="false">http://unseen.ws/?p=55</guid>
		<description><![CDATA[Alex gave me an invite to try out hunch.com and I gave it a whirl since it sounded like a good concept, but I tried 3 questions and am thoroughly not impressed.
Maybe I&#8217;m too particular, maybe it&#8217;s the questions I asked, but spending just as much time with google  as I did with this service [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://notjustrandom.com/blog/2009/03/30/trying-out-hunch/">Alex</a> gave me an invite to try out <a href="http://hunch.com">hunch.com</a> and I gave it a whirl since it sounded like a good concept, but I tried 3 questions and am thoroughly not impressed.</p>
<p>Maybe I&#8217;m too particular, maybe it&#8217;s the questions I asked, but spending just as much time with google  as I did with this service or using the &#8220;I&#8217;m feeling lucky&#8221; button would have yielded me better results.</p>
<p>I asked about what would be the best cloud computing platform and it did not take into account my particular situation and so half the answers were of no use to me (a flaw Alex also noticed).</p>
<p>I asked about which longboard I should buy (now that the weather is getting nice I&#8217;m hunting for one), and it new nothing of my question and would not allow me to start a new topic since I had not used the service enough.  I guess it is good for spam blocking, but annoying.</p>
<p>I also threw hunch a softball question after it crashed and burned on the first two and asked about which mac would be right for me.  It did manage to pick the type of mac I&#8217;m currently eyeballing but did not offer any help as far as which configuration or the type of customization I would need to make it useful for me.  It helped point me in the general direction but failed to yield what I consider a truly useful result.</p>
<p>Hopefully it can get better with time as it &#8220;learns&#8221; from the crowd, but for now it is just a novelty.</p>
]]></content:encoded>
			<wfw:commentRss>http://unseen.ws/2009/04/hunchcom-review/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Why Django Sucks</title>
		<link>http://unseen.ws/2009/03/why-django-sucks/</link>
		<comments>http://unseen.ws/2009/03/why-django-sucks/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 21:14:46 +0000</pubDate>
		<dc:creator>hrrkii</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[scaling]]></category>

		<guid isPermaLink="false">http://unseen.ws/?p=37</guid>
		<description><![CDATA[I&#8217;m getting ready to start a new project and I&#8217;m debating between using Django again or moving onto something else.
I was doing a little research and ran across this awesome, and extremely funny, video of the presentation Cal Henderson (from Flickr) did at DjangoCon 2008.

He is right on the money with many of his points. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m getting ready to start a new project and I&#8217;m debating between using Django again or moving onto something else.</p>
<p>I was doing a little research and ran across this awesome, and extremely funny, video of the <a href="http://www.youtube.com/watch?v=i6Fr65PFqfk">presentation Cal Henderson (from Flickr) did at DjangoCon 2008</a>.<br />
<object width="320" height="265" data="http://www.youtube.com/v/i6Fr65PFqfk&amp;hl=en&amp;fs=1&amp;color1=0x3a3a3a&amp;color2=0x999999" type="application/x-shockwave-flash"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/i6Fr65PFqfk&amp;hl=en&amp;fs=1&amp;color1=0x3a3a3a&amp;color2=0x999999" /><param name="allowfullscreen" value="true" /></object></p>
<p>He is right on the money with many of his points.  If you never expect a site to take off, or have a lot of data, many of these issues don&#8217;t matter.  But what if you get popular&#8230;. Do you then ditch Django? Do you spend the time hacking in solutions yourself for these issues?   I&#8217;ve only done one real  project with Django, but it felt like I was so far removed from the db layer that it would be pretty hard to dig in and create solutions for the Django db shortcomings.</p>
<p>For getting a project off the ground though, Django does rock.  It&#8217;s pluggable app architecture makes it easy to find solutions for common problems so that you don&#8217;t have to reinvent the wheel.  I guess you just have to be realistic about the expectations for the project and decide if launchability (aka getting the site built and live) is more important than easy scalability.</p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><span class="zem-script more-related"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
]]></content:encoded>
			<wfw:commentRss>http://unseen.ws/2009/03/why-django-sucks/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Happy Pi Day</title>
		<link>http://unseen.ws/2009/03/happy-pi-day/</link>
		<comments>http://unseen.ws/2009/03/happy-pi-day/#comments</comments>
		<pubDate>Sat, 14 Mar 2009 23:29:55 +0000</pubDate>
		<dc:creator>hrrkii</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[math]]></category>

		<guid isPermaLink="false">http://unseen.ws/?p=30</guid>
		<description><![CDATA[
For those of you that might not be aware, today is Pi Day. In a show of support I&#8217;m sporting my own piece of Pi gear today:

And for even more Pi fun, how bout a slice:
3.
1
41
592
6535
89793
238462
6433832
79502884
197169399
3751058209
7494459230
781640628620
8998628034825
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.piday.org/"><img class="size-full wp-image-31 alignnone" title="piday_logo" src="http://unseen.ws/wp-content/uploads/2009/03/piday_logo.png" alt="piday_logo" width="210" height="87" /></a></p>
<p>For those of you that might not be aware, today is <a href="http://www.piday.org/">Pi Day</a>. In a show of support I&#8217;m sporting my own piece of Pi gear today:</p>
<p><img class="size-medium wp-image-32 alignnone" title="chicken_pot_pi" src="http://unseen.ws/wp-content/uploads/2009/03/chicken_pot_pi-300x225.jpg" alt="chicken_pot_pi" width="300" height="225" /></p>
<p>And for even more Pi fun, how bout a slice:</p>
<p>3.<br />
1<br />
41<br />
592<br />
6535<br />
89793<br />
238462<br />
6433832<br />
79502884<br />
197169399<br />
3751058209<br />
7494459230<br />
781640628620<br />
8998628034825</p>
]]></content:encoded>
			<wfw:commentRss>http://unseen.ws/2009/03/happy-pi-day/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Smoron Goes Live</title>
		<link>http://unseen.ws/2009/03/smoron-goes-live/</link>
		<comments>http://unseen.ws/2009/03/smoron-goes-live/#comments</comments>
		<pubDate>Tue, 10 Mar 2009 04:44:36 +0000</pubDate>
		<dc:creator>hrrkii</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[smoron]]></category>

		<guid isPermaLink="false">http://unseen.ws/?p=29</guid>
		<description><![CDATA[My best friend growing up was named Ed.  I saw him a few month ago and he brought up a crazy idea that he and some others had come up with while camping.  A site for for all things smore.  A place for people that go dumb at the thought of smores to share recipe [...]]]></description>
			<content:encoded><![CDATA[<p>My best friend growing up was named Ed.  I saw him a few month ago and he brought up a crazy idea that he and some others had come up with while camping.  A site for for all things smore.  A place for people that go dumb at the thought of smores to share recipe ideas and find a collection of smore related goodness.</p>
<p><a href="http://smoron.com/"><img src="http://smoron.com/media/images/smoron_logo.png" alt="" width="263" height="40" /></a></p>
<p>I decided this would be the perfect opportunity to try my hand at something new.  So I dusted off my Python skills and dove head first into the <a class="zem_slink" title="Django (web framework)" rel="homepage" href="http://www.djangoproject.com">Django</a> pool.  I have to say, I&#8217;m quite impressed.  I&#8217;ve been a hard core PHPer for quite a number of years, but have always held fond memories of my short stint as a Python hacker.</p>
<p>Django was a great excuse to play with Python again.  Like any framework, there is a good bit of learning curve to go from the overly simplified hello world type app to something real world.  Now that I&#8217;m done climbing the mountain, I can look back and see it was not too hard a climb and that the mountain was really a hill considering I was relearning a new language at the same time as the framework.  It blows my mind at how little code actually had to be written to create the fully functioning site.  Apparently its true:<br />
<a href="http://www.djangopony.com/"></a></p>
<p style="text-align: center;"><a href="http://www.djangopony.com/"><img class="aligncenter" src="http://www.djangopony.com/media/img/small/wallpaper.png" alt="" width="200" height="125" /></a></p>
<div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><span class="zem-script more-related"><script src="http://static.zemanta.com/readside/loader.js" type="text/javascript"></script></span></div>
]]></content:encoded>
			<wfw:commentRss>http://unseen.ws/2009/03/smoron-goes-live/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

