<?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>Shane Stillwell</title>
	<atom:link href="http://www.shanestillwell.com/index.php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.shanestillwell.com</link>
	<description>Craftmaster of Code</description>
	<lastBuildDate>Thu, 02 Feb 2012 17:31:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Performing a &#8216;like&#8217; match in MongoDB</title>
		<link>http://www.shanestillwell.com/index.php/2012/02/02/performing-a-like-match-in-mongodb/</link>
		<comments>http://www.shanestillwell.com/index.php/2012/02/02/performing-a-like-match-in-mongodb/#comments</comments>
		<pubDate>Thu, 02 Feb 2012 17:31:45 +0000</pubDate>
		<dc:creator>shane</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Doctrine2]]></category>
		<category><![CDATA[MongoDB]]></category>

		<guid isPermaLink="false">http://www.shanestillwell.com/?p=290</guid>
		<description><![CDATA[So looking through the Doctrine ODM docs on Query Building, I didn&#8217;t see anything that lent itself to a like query such as that is found in MySQL. There isn&#8217;t a like, option, but using Regular Expressions will work just fine for me. $queryBuilder-&#62;field&#40;'title'&#41;-&#62;equals&#40;new \MongoRegex&#40;'/keyword/i'&#41;&#41;; That will perform a case-insensative query for the term &#8216;keyword&#8216; [...]]]></description>
			<content:encoded><![CDATA[<p>So looking through the <a href="http://www.doctrine-project.org/docs/mongodb_odm/1.0/en/reference/query-builder-api.html">Doctrine ODM docs on Query Building</a>, I didn&#8217;t see anything that lent itself to a <em>like</em> query such as that is found in MySQL. There isn&#8217;t a <em>like</em>, option, but using <strong>Regular Expressions</strong> will work just fine for me.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$queryBuilder</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">field</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'title'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">equals</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> \MongoRegex<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/keyword/i'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>That will perform a case-insensative query for the term &#8216;<em>keyword</em>&#8216; in the field &#8216;<em>title</em>&#8216;</p>
<p>Resources<br />
<a href="http://groups.google.com/group/doctrine-user/browse_thread/thread/daadb4e3030c196c ">http://groups.google.com/group/doctrine-user/browse_thread/thread/daadb4e3030c196c </a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.shanestillwell.com/index.php/2012/02/02/performing-a-like-match-in-mongodb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Thoughts on Zend Framework &amp; Doctrine 2 Design</title>
		<link>http://www.shanestillwell.com/index.php/2012/01/30/thoughts-on-zend-framework-doctrine-2-design/</link>
		<comments>http://www.shanestillwell.com/index.php/2012/01/30/thoughts-on-zend-framework-doctrine-2-design/#comments</comments>
		<pubDate>Mon, 30 Jan 2012 19:30:37 +0000</pubDate>
		<dc:creator>shane</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[Doctrine2]]></category>
		<category><![CDATA[PHPUnit]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://www.shanestillwell.com/?p=272</guid>
		<description><![CDATA[I usually structure my Zend Framework projects like the image on the right. This comes almost straight from the ZF documentation for recommended project structures http://framework.zend.com/manual/en/project-structure.project.html I&#8217;ve been stressing using PHPunit more and more in my projects and endevour to include tests for all my classes. When you are connected to a DB, it&#8217;s harder to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.shanestillwell.com/wp-content/uploads/2012/01/Screen-Shot-2012-01-30-at-12.47.02-PM.png"><img class="alignright size-medium wp-image-273" title="Zend Framework Directory Structure" src="http://www.shanestillwell.com/wp-content/uploads/2012/01/Screen-Shot-2012-01-30-at-12.47.02-PM-225x300.png" alt="" width="225" height="300" /></a>I usually structure my Zend Framework projects like the image on the right. This comes almost straight from the ZF documentation for recommended project structures <a href="http://framework.zend.com/manual/en/project-structure.project.html">http://framework.zend.com/manual/en/project-structure.project.html</a></p>
<p>I&#8217;ve been stressing using PHPunit more and more in my projects and endevour to include tests for all my classes. When you are connected to a DB, it&#8217;s harder to test, but with the help of the Doctrine2 workflow, I think I&#8217;ve found a nice way to keep DB updates out of my Unit Tests.</p>
<h2>How to test without touching a DB?</h2>
<p>First, you need to have really skinny controllers. What does that mean? Well, controllers should really only do a few things.</p>
<ul>
<li>Work with both the <em>Request</em> and the <em>Response</em></li>
<li>Instantiate forms and populate them with data</li>
<li>Talk to the <em>Views</em></li>
<li>Hand everything else off to a class in the <em>services</em> directory</li>
</ul>
<div>Did you catch that last part? Most of the heavy lifting you&#8217;re tempted to put in the controller should be shifted out to a services class (e.g. Application_Service_Email). That way you can keep your controllers nice and lean.</div>
<div>Now the services classes will be the ones doing instantiating classes to get the work done.</div>
<h2>How does Doctrine fit into this?</h2>
<p>Glad you asked. Doctrine uses a particular workflow when writing out values to the DB (MySql, Mongo, Postgres).</p>
<p>First you have to tell Doctrine to persist your object, in our case here the $user object. This is done using the DocumentManager ($dm). How do you get ahold of $dm?  That&#8217;s another lesson soon to come.</p>
<p><em>$dm-&gt;persist($user);</em></p>
<p>You can do this to multiple objects and Doctrine keeps them in a queue. Then you have to write your changes to the DB. We do this with the flush command</p>
<p><em>$dm-&gt;flush();</em></p>
<p>That physically goes out to the DB and creates/updates/deletes all the objects in the queue. A very efficient way to work with the DB.</p>
<h2>That&#8217;s great, but how does this fit into Unit Testing?</h2>
<p>Simple. We persist in the Service class and flush in the controller. Here&#8217;s how this would look in the code? I thought you&#8217;d never ask.</p>
<script>document.write('<link rel="stylesheet" href="https://gist.github.com/stylesheets/gist/embed.css"/>')

document.write('<div id=\"gist-1706078\" class=\"gist\">\n\n        <div class=\"gist-file\">\n          <div class=\"gist-data gist-syntax\">\n              <div class=\"gist-highlight\"><pre><div class=\'line\' id=\'LC1\'><span class=\"cp\">&lt;?php<\/span> <\/div><div class=\'line\' id=\'LC2\'><br/><\/div><div class=\'line\' id=\'LC3\'><span class=\"k\">class<\/span> <span class=\"nc\">Application_Service_User<\/span> <span class=\"k\">extends<\/span> <span class=\"nx\">Application_Service_Abstract<\/span><\/div><div class=\'line\' id=\'LC4\'><span class=\"p\">{<\/span><\/div><div class=\'line\' id=\'LC5\'>&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"k\">public<\/span> <span class=\"k\">function<\/span> <span class=\"nf\">createUser<\/span><span class=\"p\">(<\/span><span class=\"nx\">\\Application_Model_User<\/span> <span class=\"nv\">$user<\/span><span class=\"p\">,<\/span> <span class=\"nv\">$data<\/span><span class=\"p\">)<\/span><\/div><div class=\'line\' id=\'LC6\'>&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"p\">{<\/span><\/div><div class=\'line\' id=\'LC7\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nv\">$user<\/span> <span class=\"o\">=<\/span> <span class=\"nv\">$user<\/span><span class=\"o\">-&gt;<\/span><span class=\"na\">createUser<\/span><span class=\"p\">(<\/span><span class=\"nv\">$data<\/span><span class=\"p\">);<\/span><\/div><div class=\'line\' id=\'LC8\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nv\">$this<\/span><span class=\"o\">-&gt;<\/span><span class=\"na\">dm<\/span><span class=\"o\">-&gt;<\/span><span class=\"na\">persist<\/span><span class=\"p\">(<\/span><span class=\"nv\">$user<\/span><span class=\"p\">);<\/span><\/div><div class=\'line\' id=\'LC9\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"k\">return<\/span> <span class=\"nv\">$user<\/span><span class=\"p\">;<\/span><\/div><div class=\'line\' id=\'LC10\'>&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"p\">}<\/span><\/div><div class=\'line\' id=\'LC11\'><br/><\/div><div class=\'line\' id=\'LC12\'><span class=\"p\">}<\/span><\/div><\/pre><\/div>\n          <\/div>\n\n          <div class=\"gist-meta\">\n            <a href=\"https://gist.github.com/raw/1706078/64ab23f4fcebe11829a1053cbfd3d24dda158a1f/User.php\" style=\"float:right;\">view raw<\/a>\n            <a href=\"https://gist.github.com/1706078#file_user.php\" style=\"float:right;margin-right:10px;color:#666\">User.php<\/a>\n            <a href=\"https://gist.github.com/1706078\">This Gist<\/a> brought to you by <a href=\"http://github.com\">GitHub<\/a>.\n          <\/div>\n        <\/div>\n\n        <div class=\"gist-file\">\n          <div class=\"gist-data gist-syntax\">\n              <div class=\"gist-highlight\"><pre><div class=\'line\' id=\'LC1\'><span class=\"cp\">&lt;?php<\/span><\/div><div class=\'line\' id=\'LC2\'><br/><\/div><div class=\'line\' id=\'LC3\'><br/><\/div><div class=\'line\' id=\'LC4\'><span class=\"k\">class<\/span> <span class=\"nc\">AuthController<\/span> <span class=\"k\">extends<\/span> <span class=\"nx\">Zend_Controller_Action<\/span><\/div><div class=\'line\' id=\'LC5\'><span class=\"p\">{<\/span><\/div><div class=\'line\' id=\'LC6\'><br/><\/div><div class=\'line\' id=\'LC7\'><br/><\/div><div class=\'line\' id=\'LC8\'>&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"k\">public<\/span> <span class=\"k\">function<\/span> <span class=\"nf\">createAction<\/span><span class=\"p\">()<\/span><\/div><div class=\'line\' id=\'LC9\'>&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"p\">{<\/span><\/div><div class=\'line\' id=\'LC10\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nv\">$form<\/span>   <span class=\"o\">=<\/span> <span class=\"k\">new<\/span> <span class=\"nx\">\\Application_Form_User<\/span><span class=\"p\">();<\/span><\/div><div class=\'line\' id=\'LC11\'><br/><\/div><div class=\'line\' id=\'LC12\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"k\">if<\/span> <span class=\"p\">(<\/span><span class=\"o\">!<\/span><span class=\"nv\">$this<\/span><span class=\"o\">-&gt;<\/span><span class=\"na\">getRequest<\/span><span class=\"p\">()<\/span><span class=\"o\">-&gt;<\/span><span class=\"na\">isPost<\/span><span class=\"p\">())<\/span> <span class=\"p\">{<\/span><\/div><div class=\'line\' id=\'LC13\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nv\">$this<\/span><span class=\"o\">-&gt;<\/span><span class=\"na\">view<\/span><span class=\"o\">-&gt;<\/span><span class=\"na\">form<\/span> <span class=\"o\">=<\/span> <span class=\"nv\">$form<\/span><span class=\"p\">;<\/span><\/div><div class=\'line\' id=\'LC14\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"k\">return<\/span><span class=\"p\">;<\/span><\/div><div class=\'line\' id=\'LC15\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"p\">}<\/span><\/div><div class=\'line\' id=\'LC16\'><br/><\/div><div class=\'line\' id=\'LC17\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"k\">if<\/span> <span class=\"p\">(<\/span><span class=\"o\">!<\/span><span class=\"nv\">$form<\/span><span class=\"o\">-&gt;<\/span><span class=\"na\">isValid<\/span><span class=\"p\">(<\/span><span class=\"nv\">$_POST<\/span><span class=\"p\">))<\/span> <span class=\"p\">{<\/span><\/div><div class=\'line\' id=\'LC18\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nv\">$this<\/span><span class=\"o\">-&gt;<\/span><span class=\"na\">view<\/span><span class=\"o\">-&gt;<\/span><span class=\"na\">form<\/span> <span class=\"o\">=<\/span> <span class=\"nv\">$form<\/span><span class=\"p\">;<\/span><\/div><div class=\'line\' id=\'LC19\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"k\">return<\/span><span class=\"p\">;<\/span><\/div><div class=\'line\' id=\'LC20\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"p\">}<\/span><\/div><div class=\'line\' id=\'LC21\'><br/><\/div><div class=\'line\' id=\'LC22\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"k\">try<\/span> <span class=\"p\">{<\/span><\/div><div class=\'line\' id=\'LC23\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nv\">$userService<\/span>        <span class=\"o\">=<\/span> <span class=\"k\">new<\/span> <span class=\"nx\">\\Application_Service_User<\/span><span class=\"p\">();<\/span><\/div><div class=\'line\' id=\'LC24\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nv\">$user<\/span> <span class=\"o\">=<\/span> <span class=\"nv\">$userService<\/span><span class=\"o\">-&gt;<\/span><span class=\"na\">createUser<\/span><span class=\"p\">(<\/span><span class=\"k\">new<\/span> <span class=\"nx\">\\Application_Model_User<\/span><span class=\"p\">(),<\/span> <span class=\"nv\">$form<\/span><span class=\"o\">-&gt;<\/span><span class=\"na\">getValues<\/span><span class=\"p\">());<\/span><\/div><div class=\'line\' id=\'LC25\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nv\">$this<\/span><span class=\"o\">-&gt;<\/span><span class=\"na\">dm<\/span><span class=\"o\">-&gt;<\/span><span class=\"na\">flush<\/span><span class=\"p\">(<\/span><span class=\"k\">array<\/span><span class=\"p\">(<\/span><span class=\"s1\">&#39;safe&#39;<\/span> <span class=\"o\">=&gt;<\/span> <span class=\"k\">true<\/span><span class=\"p\">));<\/span> <span class=\"c1\">// Catch duplicates in MongoDB<\/span><\/div><div class=\'line\' id=\'LC26\'><br/><\/div><div class=\'line\' id=\'LC27\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"p\">}<\/span> <span class=\"k\">catch<\/span> <span class=\"p\">(<\/span><span class=\"nx\">MongoException<\/span> <span class=\"nv\">$e<\/span><span class=\"p\">)<\/span> <span class=\"p\">{<\/span><\/div><div class=\'line\' id=\'LC28\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nv\">$form<\/span><span class=\"o\">-&gt;<\/span><span class=\"na\">reset<\/span><span class=\"p\">();<\/span><\/div><div class=\'line\' id=\'LC29\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"nv\">$this<\/span><span class=\"o\">-&gt;<\/span><span class=\"na\">view<\/span><span class=\"o\">-&gt;<\/span><span class=\"na\">form<\/span> <span class=\"o\">=<\/span> <span class=\"nv\">$form<\/span><span class=\"p\">;<\/span><\/div><div class=\'line\' id=\'LC30\'><br/><\/div><div class=\'line\' id=\'LC31\'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"p\">}<\/span><\/div><div class=\'line\' id=\'LC32\'>&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"p\">}<\/span><\/div><div class=\'line\' id=\'LC33\'><br/><\/div><div class=\'line\' id=\'LC34\'><span class=\"p\">}<\/span><\/div><div class=\'line\' id=\'LC35\'><br/><\/div><\/pre><\/div>\n          <\/div>\n\n          <div class=\"gist-meta\">\n            <a href=\"https://gist.github.com/raw/1706078/9f41636014bf5ad0f3b7159c72ebe18e1dc5a434/UserController.php\" style=\"float:right;\">view raw<\/a>\n            <a href=\"https://gist.github.com/1706078#file_user_controller.php\" style=\"float:right;margin-right:10px;color:#666\">UserController.php<\/a>\n            <a href=\"https://gist.github.com/1706078\">This Gist<\/a> brought to you by <a href=\"http://github.com\">GitHub<\/a>.\n          <\/div>\n        <\/div>\n<\/div>\n')
</script><div style='margin-bottom:1em;padding:0;'><noscript><code><pre style='overflow:auto;margin:0;padding:0;border:1px solid #DDD;'>&lt;?php 

class Application_Service_User extends Application_Service_Abstract
{
    public function createUser(\Application_Model_User $user, $data)
    {
        $user = $user-&gt;createUser($data);
        $this-&gt;dm-&gt;persist($user);
        return $user;
    }

}</pre></code></noscript></div>
<p>The important parts to look at in the above code is the in the &#8216;User.php&#8217; (Service Class), we are persisting our objects there. In the Controller we are flushing them.</p>
<p>This makes it easy to test since you&#8217;re not actually going to hit the DB unless you test the Controller (That&#8217;s integration testing, not Unit testing).</p>
<h2>One Caveat</h2>
<p>Sometimes you need the Id of an object. You&#8217;re only able to get this when you actually insert the object into the DB. So in your Service class it may be necessary to issue the <em>flush</em> command, but there are ways around this tool.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shanestillwell.com/index.php/2012/01/30/thoughts-on-zend-framework-doctrine-2-design/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title></title>
		<link>http://www.shanestillwell.com/index.php/2012/01/29/271/</link>
		<comments>http://www.shanestillwell.com/index.php/2012/01/29/271/#comments</comments>
		<pubDate>Sun, 29 Jan 2012 18:02:23 +0000</pubDate>
		<dc:creator>shane</dc:creator>
				<category><![CDATA[Apple]]></category>

		<guid isPermaLink="false">http://www.shanestillwell.com/index.php/2012/01/29/271/</guid>
		<description><![CDATA[A simple framework for zend js integration through Ajax that can be used for element]]></description>
			<content:encoded><![CDATA[<p>A simple framework for zend js integration through Ajax that can be used for element</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shanestillwell.com/index.php/2012/01/29/271/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Converting Audio to a CCK FileField content type for Drupal 6</title>
		<link>http://www.shanestillwell.com/index.php/2011/11/03/converting-audio-to-a-cck-filefield-content-type-for-drupal-6/</link>
		<comments>http://www.shanestillwell.com/index.php/2011/11/03/converting-audio-to-a-cck-filefield-content-type-for-drupal-6/#comments</comments>
		<pubDate>Thu, 03 Nov 2011 00:38:28 +0000</pubDate>
		<dc:creator>shane</dc:creator>
				<category><![CDATA[Drupal]]></category>

		<guid isPermaLink="false">http://www.shanestillwell.com/?p=152</guid>
		<description><![CDATA[This is the script I used to convert our Audio content type to CCK FileField content type. &#160; I created a content type called podcast Copy the following script to a file convert.php and place it in your website&#8217;s DocumentRoot https://gist.github.com/1335420 Run the script by going to your website http://example.com/convert.php Done&#8230; now the audio nodes show [...]]]></description>
			<content:encoded><![CDATA[<p>This is the script I used to convert our <a href="http://drupal.org/project/audio">Audio</a> content type to <a href="http://drupal.org/project/cck">CCK</a> <a href="http://drupal.org/project/filefield">FileField</a> content type.</p>
<p>&nbsp;</p>
<ol>
<li>I created a content type called <strong>podcast</strong></li>
<li>Copy the following script to a file <em>convert.php</em> and place it in your website&#8217;s DocumentRoot</li>
<li><a href="https://gist.github.com/1335420">https://gist.github.com/1335420</a></li>
<li>Run the script by going to your website http://example.com/convert.php</li>
<li>Done&#8230; now the audio nodes show be podcast nodes and will work.</li>
</ol>
<div>For extra fun, I&#8217;ve added <a href="http://drupal.org/project/swftools">SWFTools</a></div>
<h3>Resources</h3>
<p>This was of limited help<br />
<a href="http://geeksandgod.com/tutorials/computers/cms/drupal/drupal-converting-audio-module-filefield-module">http://geeksandgod.com/tutorials/computers/cms/drupal/drupal-converting-audio-module-filefield-module</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.shanestillwell.com/index.php/2011/11/03/converting-audio-to-a-cck-filefield-content-type-for-drupal-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Poedit and phtml files giving error from xgettext</title>
		<link>http://www.shanestillwell.com/index.php/2011/08/26/poedit-and-phtml-files-giving-error-from-xgettext/</link>
		<comments>http://www.shanestillwell.com/index.php/2011/08/26/poedit-and-phtml-files-giving-error-from-xgettext/#comments</comments>
		<pubDate>Fri, 26 Aug 2011 01:27:20 +0000</pubDate>
		<dc:creator>shane</dc:creator>
				<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[<h3>Problem</h3>
I had just set up a Poedit for a project at work and was trying to update the *.po file with new translations. It wasn't finding a whole load of them.

After a while of poking around, it dawned on me that it was not looking in my phtml files. Simple enough, I just added *.phtml to the list of extensions in the parsers preference.

Then I receive a big long error message that xgettext didn't know what phtml.

<h3>Solution</h3>
Add pthtml to your list of extensions
<code>
*.php;*.phtml
</code>

You also need to add " -L php" to the end of your Parser command
<code>
xgettext --force-po -o %o %C %K %F -L php
</code>

]]></description>
			<content:encoded><![CDATA[<h3>Problem</h3>
<p>I had just set up a Poedit for a project at work and was trying to update the *.po file with new translations. It wasn&#8217;t finding a whole load of them.</p>
<p>After a while of poking around, it dawned on me that it was not looking in my phtml files. Simple enough, I just added *.phtml to the list of extensions in the parsers preference.</p>
<p>Then I receive a big long error message that xgettext didn&#8217;t know what phtml.</p>
<h3>Solution</h3>
<p>Add pthtml to your list of extensions<br />
<code><br />
*.php;*.phtml<br />
</code></p>
<p>You also need to add &#8221; -L php&#8221; to the end of your Parser command<br />
<code><br />
xgettext --force-po -o %o %C %K %F -L php</code></p>
<div class="mceTemp">
<dl id="attachment_134" class="wp-caption alignnone" style="width: 242px;">
<dt class="wp-caption-dt"><a href="http://www.shanestillwell.com/wp-content/uploads/2011/08/Screen-Shot-2011-08-25-at-9.15.19-PM.png"><img class="size-medium wp-image-134" title="Poedit Parse PHP" src="http://www.shanestillwell.com/wp-content/uploads/2011/08/Screen-Shot-2011-08-25-at-9.15.19-PM-232x300.png" alt="Poedit Parse PHP" width="232" height="300" /></a></dt>
</dl>
</div>
<p><code><br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.shanestillwell.com/index.php/2011/08/26/poedit-and-phtml-files-giving-error-from-xgettext/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The continuing Saga of Lion</title>
		<link>http://www.shanestillwell.com/index.php/2011/08/17/the-continuing-saga-of-lion/</link>
		<comments>http://www.shanestillwell.com/index.php/2011/08/17/the-continuing-saga-of-lion/#comments</comments>
		<pubDate>Wed, 17 Aug 2011 01:56:47 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[Development]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Should you upgrade to OS X Lion???   Meh.... it's presented more problems than previous upgrades.

Maybe I should have waited until 10.7.1, so this is my punishment for being bleeding edge.

Another issue I saw was the continual nag when I opened some apps (Billings and Cyberduck) that "This program was downloaded from the Internet... blah blah blah" This normally happens once for a program then goes away after you say "OK", but this was happening everytime I opened those two programs.

The solution.

<code>
sudo xattr -d com.apple.quarantine /Applications/Billings.app
</code>

This shut the bugger up.

Resources
https://discussions.apple.com/message/6930135#6930135


]]></description>
			<content:encoded><![CDATA[<p>Should you upgrade to OS X Lion???   Meh&#8230;. it&#8217;s presented more problems than previous upgrades.</p>
<p>Maybe I should have waited until 10.7.1, so this is my punishment for being bleeding edge.</p>
<p>Another issue I saw was the continual nag when I opened some apps (Billings and Cyberduck) that &#8220;This program was downloaded from the Internet&#8230; blah blah blah&#8221; This normally happens once for a program then goes away after you say &#8220;OK&#8221;, but this was happening everytime I opened those two programs.</p>
<p>The solution.</p>
<p><code><br />
sudo xattr -d com.apple.quarantine /Applications/Billings.app<br />
</code></p>
<p>This shut the bugger up.</p>
<p>Resources</p>
<p>https://discussions.apple.com/message/6930135#6930135</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shanestillwell.com/index.php/2011/08/17/the-continuing-saga-of-lion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrading to OS X Lion [SOLVED Chrome issue ]</title>
		<link>http://www.shanestillwell.com/index.php/2011/07/27/upgrading-to-os-x-lion-solved-chrome-issue/</link>
		<comments>http://www.shanestillwell.com/index.php/2011/07/27/upgrading-to-os-x-lion-solved-chrome-issue/#comments</comments>
		<pubDate>Wed, 27 Jul 2011 16:35:43 +0000</pubDate>
		<dc:creator>shane</dc:creator>
				<category><![CDATA[Apple]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[I took the plunge on Monday and upgraded to Lion.  I know better than to do an OS upgrade while I have a mountain of work on my plate, but oh well.

The upgrade itself was the easiest ever. Just buy it, download it, then it takes about 30 minutes to install.  Done.

What I like
-The interface is cleaner
-Mission control (aka Expose et. al) is a bit better
-Full screen is nice.
-Local Time Machine backups are nice


What I don't like
- The scrolling.  I tried it for a whole day, but it doesn't feel natural at all, so I reverted back to the original scrolling direction.
- Finder got rid of my "Macintosh HD" in the side bar. I'm sure I can get it back, but I need to go to the root directory once in a while. it was nice having it there.
- It seems slower than Snow Leopard. Seems like my machine is running at a warmer than normal and slower than normal rate.

What broke
- I was using Zend Server CE as my local web / mysql server. That was utterly broken. Instead of just reinstalling right away I tried out the local web server following this write up by Rob Allen
http://akrabat.com/php/setting-up-php-mysql-on-os-x-10-7-lion/

Worked good, but it seemed really slow (more on that below).

So because of this apparent slowness I installed MAMP.  It installed fine, but MAMP had problems resolving host names and doing network calls... Someone said it was a bug in the PHP version that MAMP ships. Anyway, it didn't solve the speed problem either (that should have been my first clue).

I looked into installing Nginx on Mac, but didn't have 'make' installed so I'll have to pass for now.

I redownloaded Zend Server CE and installed that. Worked fine, but it was still slow.

Chrome is to blame.
- I use the local /etc/hosts file to resolve names for local development. For some reason Chrome under OS X Lion takes about 10 seconds to resolve the name when it has to use the hosts file.  So every request was taking about 10 seconds... almost the whole time it was waiting for DNS to time out.

- Once I opened Safari to do local development the local web server was as zippy as before.....

Now I just have to figure out why Chrome is taking so long to resolve a name that is in the local hosts file.

[UPDATE]
To fix the Chrome slow issue... I just needed to move each entry in the /etc/hosts file to it's own line.

so instead of 
<code>
127.0.0.1 www.example.com www1.example.com
</code>

It would be 
<code>
127.0.0.1 www.example.com 
127.0.0.1 www1.example.com
</code>


http://superuser.com/questions/313128/lion-name-resolution-order]]></description>
			<content:encoded><![CDATA[<p>I took the plunge on Monday and upgraded to Lion. I know better than to do an OS upgrade while I have a mountain of work on my plate, but oh well.</p>
<p>The upgrade itself was the easiest ever. Just buy it, download it, then it takes about 30 minutes to install. Done.</p>
<h2>What I like</h2>
<ul>
<li>The interface is cleaner</li>
<li>Mission control (aka Expose et. al) is a bit better</li>
<li>Full screen is nice.</li>
<li>Local Time Machine backups are nice</li>
</ul>
<h2>What I don&#8217;t like</h2>
<ul>
<li>The scrolling. I tried it for a whole day, but it doesn&#8217;t feel natural at all, so I reverted back to the original scrolling direction.</li>
<li>Finder got rid of my &#8220;Macintosh HD&#8221; in the side bar. I&#8217;m sure I can get it back, but I need to go to the root directory once in a while. it was nice having it there.</li>
<li>It seems slower than Snow Leopard. Seems like my machine is running at a warmer than normal and slower than normal rate.</li>
</ul>
<h2>What broke</h2>
<p>I was using Zend Server CE as my local web / mysql server. That was utterly broken. Instead of just reinstalling right away I tried out the local web server following this write up by Rob Allen</p>
<p>http://akrabat.com/php/setting-up-php-mysql-on-os-x-10-7-lion/</p>
<p>Worked good, but it seemed really slow (more on that below).</p>
<p>So because of this apparent slowness I installed MAMP. It installed fine, but MAMP had problems resolving host names and doing network calls&#8230; Someone said it was a bug in the PHP version that MAMP ships. Anyway, it didn&#8217;t solve the speed problem either (that should have been my first clue).</p>
<p>I looked into installing Nginx on Mac, but didn&#8217;t have &#8216;make&#8217; installed so I&#8217;ll have to pass for now.</p>
<p>I redownloaded Zend Server CE and installed that. Worked fine, but it was still slow.</p>
<h2>Chrome is to blame</h2>
<ul>
<li>I use the local /etc/hosts file to resolve names for local development. For some reason Chrome under OS X Lion takes about 10 seconds to resolve the name when it has to use the hosts file. So every request was taking about 10 seconds&#8230; almost the whole time it was waiting for DNS to time out.</li>
<li>Once I opened Safari to do local development the local web server was as zippy as before&#8230;..</li>
<li>Now I just have to figure out why Chrome is taking so long to resolve a name that is in the local hosts file.</li>
</ul>
<p><strong>[UPDATE]</strong><br />
To fix the Chrome slow issue&#8230; I just needed to move each entry in the /etc/hosts file to it&#8217;s own line.</p>
<p>so instead of<br />
<code><br />
127.0.0.1 www.example.com www1.example.com<br />
</code></p>
<p>It would be<br />
<code><br />
127.0.0.1 www.example.com<br />
127.0.0.1 www1.example.com<br />
</code></p>
<p><a href="http://superuser.com/questions/313128/lion-name-resolution-order">http://superuser.com/questions/313128/lion-name-resolution-order</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.shanestillwell.com/index.php/2011/07/27/upgrading-to-os-x-lion-solved-chrome-issue/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Qwest DSL and OpenDNS&#8230; opting out of the DNS override.</title>
		<link>http://www.shanestillwell.com/index.php/2011/07/25/qwest-dsl-and-opendns-opting-out-of-the-dns-override/</link>
		<comments>http://www.shanestillwell.com/index.php/2011/07/25/qwest-dsl-and-opendns-opting-out-of-the-dns-override/#comments</comments>
		<pubDate>Mon, 25 Jul 2011 23:52:11 +0000</pubDate>
		<dc:creator>shane</dc:creator>
				<category><![CDATA[Server Admin]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[While reconfiguring the network at the church, I noticed that my DNS queries were not getting curbed by OpenDNS.  Browsing to 'bad' sites should give you a no no page from OpenDNS, but nothing was tripping it... not even 4chan :S

The I realized that Qwest is doing some DNS override where they actually do the DNS query.  

<h2>The Solution</h2>
You need to opt out of this "wonderful" service from Qwest.
http://www.qwest.net/web.help/?confirm=1

After that, it was just fine.

I guess Qwest couldn't resist trying to pick up that money on the table since they have access to all that traffic.... wonder how much money they make on ads.]]></description>
			<content:encoded><![CDATA[<p>While reconfiguring the network at the church, I noticed that my DNS queries were not getting curbed by OpenDNS.  Browsing to &#8216;bad&#8217; sites should give you a no no page from OpenDNS, but nothing was tripping it&#8230; not even 4chan :S</p>
<p>The I realized that Qwest is doing some DNS override where they actually do the DNS query.  </p>
<h2>The Solution</h2>
<p>You need to opt out of this &#8220;wonderful&#8221; service from Qwest.</p>
<p>http://www.qwest.net/web.help/?confirm=1</p>
<p>After that, it was just fine.</p>
<p>I guess Qwest couldn&#8217;t resist trying to pick up that money on the table since they have access to all that traffic&#8230;. wonder how much money they make on ads.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shanestillwell.com/index.php/2011/07/25/qwest-dsl-and-opendns-opting-out-of-the-dns-override/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nginx SSL certificate error message &#8220;key values mismatch&#8221;</title>
		<link>http://www.shanestillwell.com/index.php/2011/05/26/nginx-ssl-certificate-error-message/</link>
		<comments>http://www.shanestillwell.com/index.php/2011/05/26/nginx-ssl-certificate-error-message/#comments</comments>
		<pubDate>Thu, 26 May 2011 23:13:53 +0000</pubDate>
		<dc:creator>shane</dc:creator>
				<category><![CDATA[Server Admin]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[When setting up a SSL certificate and chain file for Nginx, you need to combine them into one file.  If you combine them in the wrong order you'll get a message similar to the following.

<code>
SSL_CTX_use_PrivateKey_file(" ... /www.nginx.com.key") failed
   (SSL: error:0B080074:x509 certificate routines:
    X509_check_private_key:key values mismatch)
</code>

This means you either didn't combine them or you combined them in the wrong order.  To combine the two together just do something like this.

<code>
cat www.example.com.crt www.certificatechain.com.ca > www.example.com.combined.crt
</code>

Now you'll be happy as a lark.]]></description>
			<content:encoded><![CDATA[<p>When setting up a SSL certificate and chain file for Nginx, you need to combine them into one file.  If you combine them in the wrong order you&#8217;ll get a message similar to the following.</p>
<p><code><br />
SSL_CTX_use_PrivateKey_file(" ... /www.nginx.com.key") failed<br />
   (SSL: error:0B080074:x509 certificate routines:<br />
    X509_check_private_key:key values mismatch)<br />
</code></p>
<p>This means you either didn&#8217;t combine them or you combined them in the wrong order.  To combine the two together just do something like this.</p>
<p><code><br />
cat www.example.com.crt www.certificatechain.com.ca > www.example.com.combined.crt<br />
</code></p>
<p>Now you&#8217;ll be happy as a lark.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shanestillwell.com/index.php/2011/05/26/nginx-ssl-certificate-error-message/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Understanding the Nginx map directive</title>
		<link>http://www.shanestillwell.com/index.php/2011/05/23/understanding-the-nginx-map-directive/</link>
		<comments>http://www.shanestillwell.com/index.php/2011/05/23/understanding-the-nginx-map-directive/#comments</comments>
		<pubDate>Mon, 23 May 2011 17:05:39 +0000</pubDate>
		<dc:creator>shane</dc:creator>
				<category><![CDATA[Server Admin]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[When switching to Nginx I needed to have a variable that signified if the site was in HTTP or HTTPS mode.  So I found this little bit of code.
<code>
    map $scheme $fastcgi_https { ## Detect when HTTPS is used
        default off;
        https on;
    }
</code>


This works great, but I really didn't understand it until now so let's take it line by line.

<h2>Line 1</h2>
<code>
    map $scheme $fastcgi_https { ## Detect when HTTPS is used
</code>
This is where all the glory happens. <code>$scheme</code> is an internal variable within Nginx and is either HTTP or HTTPS (maybe some other ones in the future like SPDY).  Then you have <code>$fastcgi_https</code>, this is the name of the variable we're creating for future use in our config files. Nothing but comments after that stuff.

<h2>Line 2 and 3</h2>
<code>
        default off;
        https on;
</code>
This is our map of values.  When Nginx's <code>$sheme</code> variable is equal to "HTTPS", then the <code>$fastcgi_https</code> variable will equal "on", otherwise the variable just equals "off".

Not too complex, but I just didn't pick up on the format until now.  Read more at
http://wiki.nginx.org/HttpMapModule]]></description>
			<content:encoded><![CDATA[<p>When switching to Nginx I needed to have a variable that signified if the site was in HTTP or HTTPS mode.  So I found this little bit of code.<br />
<code><br />
    map $scheme $fastcgi_https { ## Detect when HTTPS is used<br />
        default off;<br />
        https on;<br />
    }<br />
</code></p>
<p>This works great, but I really didn&#8217;t understand it until now so let&#8217;s take it line by line.</p>
<h2>Line 1</h2>
<p><code><br />
    map $scheme $fastcgi_https { ## Detect when HTTPS is used<br />
</code><br />
This is where all the glory happens. <code>$scheme</code> is an internal variable within Nginx and is either HTTP or HTTPS (maybe some other ones in the future like SPDY).  Then you have <code>$fastcgi_https</code>, this is the name of the variable we&#8217;re creating for future use in our config files. Nothing but comments after that stuff.</p>
<h2>Line 2 and 3</h2>
<p><code><br />
        default off;<br />
        https on;<br />
</code><br />
This is our map of values.  When Nginx&#8217;s <code>$sheme</code> variable is equal to &#8220;HTTPS&#8221;, then the <code>$fastcgi_https</code> variable will equal &#8220;on&#8221;, otherwise the variable just equals &#8220;off&#8221;.</p>
<p>Not too complex, but I just didn&#8217;t pick up on the format until now.  Read more at</p>
<p>http://wiki.nginx.org/HttpMapModule</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shanestillwell.com/index.php/2011/05/23/understanding-the-nginx-map-directive/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

