<?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>geedew &#187; PHP</title>
	<atom:link href="http://www.geedew.com/category/programming/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.geedew.com</link>
	<description>flirting with the accessible web</description>
	<lastBuildDate>Wed, 13 Apr 2011 22:46:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Developing a Robust Build Process Using Phing</title>
		<link>http://www.geedew.com/2011/04/13/developing-a-robust-build-process-using-phing/</link>
		<comments>http://www.geedew.com/2011/04/13/developing-a-robust-build-process-using-phing/#comments</comments>
		<pubDate>Wed, 13 Apr 2011 22:46:59 +0000</pubDate>
		<dc:creator>drew</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Phing]]></category>

		<guid isPermaLink="false">http://www.geedew.com/?p=297</guid>
		<description><![CDATA[What is Phing? Phing is a PHP build process that uses XML , ANT style syntax. At some point in development, the choice is made to begin professional work. If more than 1 developer contributes to the effort, then an (&#8230;)</p><p><a href="http://www.geedew.com/2011/04/13/developing-a-robust-build-process-using-phing/">Read the rest of this entry &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<h3>What is Phing?</h3>
<p><strong>Phing is a PHP build process that uses XML , ANT style syntax.</strong></p>
<p>At some point in development, the choice is made to begin professional work. If more than 1 developer contributes to the effort, then an the easy mode of keeping in sync with that person and, in the future, others that may join the effort is required. Because not all developers are alike, and not all hosting providers are alike, you must have a solid build process of your code.  The build process automates the routines that every developer must do, either daily, hourly, or with every code change as well as when code is pushed into client facing distributions.  Phing is an XML to PHP build process that imitates the ANT build process that many development shops are used to.  As a PHP developer, Phing is much easier for me to work with and get things done, as well as keeps things simple when needing to update the build process.</p>
<p><span id="more-297"></span></p>
<h3>Installing Phing</h3>
<p><strong>Dependencies :</strong></p>
<p><a title="Phing Setup" href="To use Phing you must have installed PHP version 5.2 or above compiled --with-libxml2, as well as --with-xsl if you want to make use of advanced functionality." target="_blank">Straight from the source</a>, &#8220;To use Phing you must have installed PHP version 5.2 or above compiled &#8211;with-libxml2, as well as &#8211;with-xsl if you want to make use of advanced functionality.&#8221; I would hope that if you are doing any serious PHP development, you would already meet these requirements.  If you are needing to upgrade your PHP, then you really should reconsider what you are using PHP for.</p>
<p>My approach to installing Phing is the simplest solution and it follows exactly what the setup guide describes by using Pear.</p>
<pre class="brush: plain; title: ; notranslate">
$ pear channel-discover pear.phing.info&lt;/span&gt;
$ pear install phing/phing
</pre>
<p>You should now be able to test Phing by simply typing &#8216;phing&#8217; from the command line. You should get an error similar to this: &#8216;Buildfile: build.xml does not exist!&#8217;</p>
<h3>Copying and Moving Files</h3>
<p> One of the most important parts of a build process is the ability to move and copy files to different places. Phing makes this easy and allows you to modify the files as you are moving them. Different reasons to have a build process will determine how you would like to set up your folder paths for Phing to manipulate. Let&#8217;s do one that is pretty powerful and pretty simple at the same time: copying all files from a folder, into a single file, located in an entirely different folder.</p>
<p><strong>build.xml</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;project name=&quot;MyWebapp&quot; default=&quot;default&quot; basedir=&quot;.&quot;&gt;
&lt;target name=&quot;default&quot;&gt;
 &lt;foreach param=&quot;dirname&quot; absparam=&quot;absname&quot; target=&quot;compile-folder-js&quot;&gt;
  &lt;fileset dir=&quot;./js&quot;&gt;
   &lt;type type=&quot;dir&quot; /&gt;
   &lt;depth max=&quot;0&quot; min=&quot;0&quot; /&gt;
  &lt;/fileset&gt;
 &lt;/foreach&gt;
&lt;/target&gt;
&lt;target name=&quot;compile-folder-js&quot;&gt;
  &lt;mkdir dir=&quot;./${dirname}-js&quot; /&gt;
  &lt;fileset id=&quot;filestocompile&quot; dir=&quot;js/${dirname}&quot;&gt;
   &lt;include name=&quot;**/*.js&quot; /&gt;
  &lt;/fileset&gt;
  &lt;append destFile=&quot;./${dirname}-js/${dirname}.js&quot;&gt;
   &lt;fileset refid=&quot;filestocompile&quot; /&gt;
  &lt;/append&gt;
&lt;/target&gt;
</pre>
<p>Phing works using a Build.xml file to run the commands when Phing is called.  The only requirements of this file are the project tag and a default target. We have set our default target to run code that dives into the ./js folder path; loops through every <em>folder</em> in this path and passes them to another target (compile-folder-js) for processing; one at a time.  Now we can have in our source ./js/jquery/ and ./js/modernizr/ and this will take all JavaScript files send them to the compile-folder-js target.</p>
<p>The compile-folder-js target will loop through the directory that is passed to it and grab all JavaScript files (recursive folder depth because of the **/ ) and append them to a single file under the path ./directory-js/directory.js. This is pretty great when it comes to a production versus a development site. For instance, in a development site, you may have 5 different JavaScript files, but in a Production site, after a build, you could have a single JavaScript file. However, one point to be aware of, the files will be appended in teh order the file system sends them (defaults as alphabetical order).</p>
<h3>Sanitizing Files</h3>
<p>Now that we are concatenating our JS files, we can take it further and do some sanitizing with JSLint. Adding this to our current project is fairly simple. Start by <a href="http://www.javascriptlint.com/download.htm">downloading</a> the most recent version of JSLint for your operating system. Make sure to uncompress the file and remember where you put the uncompressed file.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;project name=&quot;MyWebapp&quot; default=&quot;default&quot; basedir=&quot;.&quot;&gt;
&lt;target name=&quot;default&quot;&gt;

 &lt;property name=&quot;jslint&quot; value=&quot;./path/to/jslint/jsl-0.3.0-mac/jsl&quot; /&gt;
 &lt;echo msg=&quot;Checking JS for errors...&quot; /&gt;
 &lt;jsllint haltonfailure=&quot;true&quot; cachefile=&quot;./jslint.cache&quot; executable=&quot;${jslint}&quot; conffile=&quot;./path/to/jslint/jsl.default.conf&quot;&gt;
  &lt;fileset dir=&quot;./js&quot;&gt;
   &lt;include name=&quot;**/*.js&quot;/&gt;
  &lt;/fileset&gt;
 &lt;/jsllint&gt;

 &lt;foreach param=&quot;dirname&quot; absparam=&quot;absname&quot; target=&quot;compile-folder-js&quot;&gt;
  &lt;fileset dir=&quot;./js&quot;&gt;
   &lt;type type=&quot;dir&quot; /&gt;
   &lt;depth max=&quot;0&quot; min=&quot;0&quot; /&gt;
  &lt;/fileset&gt;
 &lt;/foreach&gt;
&lt;/target&gt;
&lt;target name=&quot;compile-folder-js&quot;&gt;
  &lt;mkdir dir=&quot;./${dirname}-js&quot; /&gt;
  &lt;fileset id=&quot;filestocompile&quot; dir=&quot;js/${dirname}&quot;&gt;
   &lt;include name=&quot;**/*.js&quot; /&gt;
  &lt;/fileset&gt;
  &lt;append destFile=&quot;./${dirname}-js/${dirname}.js&quot;&gt;
   &lt;fileset refid=&quot;filestocompile&quot; /&gt;
  &lt;/append&gt;
&lt;/target&gt;
</pre>
<p>We&#8217;ve added a JSLint check that runs through all of the JavaScript files and send them through the JSLint downloaded binary for checking.  The process will now stop if you right improper JavaScript, immediately letting you know if you have issues with your code.</p>
<h3>Compressing Files</h3>
<p>Sometimes, checking your JavaScript for errors, and moving into a single folder is just not enough. You still may want to compress them down, obfuscate them, so that they are at the absolute smallest size possible. For this, a good option is Google Closure Compiler. You can <a href="https://github.com/mathewbyrne/closure-task">get a good task</a> to help with this so that it&#8217;s a drop in solution. Just drop this new task definition into your phing path and you are set. Now our code can implement this piece to get a better JavaScript file.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;project name=&quot;MyWebapp&quot; default=&quot;default&quot; basedir=&quot;.&quot;&gt;
 &lt;taskdef name=&quot;googleclosurecompiler&quot; classname=&quot;phing.customtasks.GoogleClosureCompiler&quot; /&gt;

&lt;target name=&quot;default&quot;&gt;
 &lt;property name=&quot;jslint&quot; value=&quot;./path/to/jslint/jsl-0.3.0-mac/jsl&quot; /&gt;
 &lt;echo msg=&quot;Checking JS for errors...&quot; /&gt;
 &lt;jsllint haltonfailure=&quot;true&quot; cachefile=&quot;./jslint.cache&quot; executable=&quot;${jslint}&quot; conffile=&quot;./path/to/jslint/jsl.default.conf&quot;&gt;
  &lt;fileset dir=&quot;./js&quot;&gt;
   &lt;include name=&quot;**/*.js&quot;/&gt;
  &lt;/fileset&gt;
 &lt;/jsllint&gt;

 &lt;foreach param=&quot;dirname&quot; absparam=&quot;absname&quot; target=&quot;compile-folder-js&quot;&gt;
  &lt;fileset dir=&quot;./js&quot;&gt;
   &lt;type type=&quot;dir&quot; /&gt;
   &lt;depth max=&quot;0&quot; min=&quot;0&quot; /&gt;
  &lt;/fileset&gt;
 &lt;/foreach&gt;
&lt;/target&gt;
&lt;target name=&quot;compile-folder-js&quot;&gt;
  &lt;mkdir dir=&quot;./${dirname}-js&quot; /&gt;
  &lt;fileset id=&quot;filestocompile&quot; dir=&quot;js/${dirname}&quot;&gt;
   &lt;include name=&quot;**/*.js&quot; /&gt;
  &lt;/fileset&gt;
  &lt;append destFile=&quot;./${dirname}-js/${dirname}.js&quot;&gt;
   &lt;fileset refid=&quot;filestocompile&quot; /&gt;
  &lt;/append&gt;

 &lt;googleclosurecompiler compilationLevel=&quot;SIMPLE_OPTIMIZATIONS&quot; targetDir=&quot;./${dirname}-js/&quot; failOnError=&quot;true&quot; outputFile=&quot;${dirname}-compressed.js&quot; merge=&quot;true&quot;&gt;
  &lt;fileset dir=&quot;./${dirname}-js/}&quot;&gt;
   &lt;include name=&quot;${dirname}.js&quot; /&gt;
  &lt;/fileset&gt;
 &lt;/googleclosurecompiler&gt;
&lt;/target&gt;
</pre>
<h3>Conclusion</h3>
<p>We&#8217;ve been able to now create a worthwhile setup that allows a webapp to move,verify and compress all of its JavaScript files whenever the command &#8216;phing&#8217; is ran on the path. This is a very simple setup, but one that can really be expanded on. For instance, you can use dates or hashes appended to files so that caching is easier. You can setup a multi-directory structure for better handling of JS versions. You can even pre-gzip your code so that it is much faster for downloads and lighter weight on the server-side load.</p>
<p>Hopefully this will get you into the process of using Phing and developing a solid build process in your web coding.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geedew.com/2011/04/13/developing-a-robust-build-process-using-phing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaScript / PHP  &#8211; Source Documentor for JavaScript</title>
		<link>http://www.geedew.com/2009/01/01/javascript-php-source-documentor-for-javascript/</link>
		<comments>http://www.geedew.com/2009/01/01/javascript-php-source-documentor-for-javascript/#comments</comments>
		<pubDate>Thu, 01 Jan 2009 17:58:28 +0000</pubDate>
		<dc:creator>drew</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[javascipt]]></category>

		<guid isPermaLink="false">http://geedew.com/?p=26</guid>
		<description><![CDATA[I&#8217;ve begun putting together an idea for a PHP program that will document JavaScript.  In the general sense, it will need to have a good lexical analyzer because it need to understand the syntax and the buildup and creation of (&#8230;)</p><p><a href="http://www.geedew.com/2009/01/01/javascript-php-source-documentor-for-javascript/">Read the rest of this entry &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve begun putting together an idea for a PHP program that will document JavaScript.  In the general sense, it will need to have a good lexical analyzer because it need to understand the syntax and the buildup and creation of the functions and classes.   I&#8217;m going to outline some goals that are needed for me to use a program like this.</p>
<p>Requirements</p>
<ol>
<li>Must be autonomous</li>
<li>Must be able to Add/Edit Comments, without having to directly change the source files</li>
<li>Must contain revision controls</li>
<li>Display of the output must be adaptable easily</li>
<li>Must contain an API to access from &#8220;afar&#8221;</li>
</ol>
<p>With those five initial setups, I think I will start to build some thought expirements to figure out exactly what I am talking about.  Should I implement SVN into it?  ScriptDoc formats?  JavaScript engine for analyzing?  Lots of different things.</p>
<p>Come back to this post for more info later.  I&#8217;m going to search out other programs that implement some of these things to figure out if there are any.</p>
<p>Help appreciated <img src='http://www.geedew.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.geedew.com/2009/01/01/javascript-php-source-documentor-for-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating the Ultimate Mobile Developer Computer: Lenovo X61</title>
		<link>http://www.geedew.com/2008/01/01/creating-the-ultimate-mobile-developer-computer-lenovo-x61/</link>
		<comments>http://www.geedew.com/2008/01/01/creating-the-ultimate-mobile-developer-computer-lenovo-x61/#comments</comments>
		<pubDate>Wed, 02 Jan 2008 03:47:04 +0000</pubDate>
		<dc:creator>drew</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[general]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[ibm]]></category>
		<category><![CDATA[lamp]]></category>
		<category><![CDATA[lenovo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[x61]]></category>

		<guid isPermaLink="false">http://geedew.com/2008/01/14/creating-the-ultimate-mobile-developer-computer-lenovo-x61/</guid>
		<description><![CDATA[As a developer, I long for two things that rarely ever come together well. This Christmas, I have been able to do just that, and I love it! I am always on the lookout for something that will give me (&#8230;)</p><p><a href="http://www.geedew.com/2008/01/01/creating-the-ultimate-mobile-developer-computer-lenovo-x61/">Read the rest of this entry &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>  As a developer, I long for two things that rarely ever come together well.  This Christmas, I have been able to do just that, and I love it!  I am always on the lookout for something that will give me the power of a desktop, but the mobility and function of a tablet computer.  Three years ago I had bought a Toshiba m205, which some may know, was one of the first tablet computers to really make a mark on the market.  I really enjoyed it, as it was very nice, but it was quickly outdone by the market.  It really couldn&#8217;t run Vista, and XP Tablet version has never been developed enough to get the full potential from a tablet computer.</p>
<p>IBM has outdone themselves with the x61.  The x61 came out about a half a year ago, and this Christmas they had a one week deal that dropped the price down by nearly 50% of the overall Cost.  I jumped at the prospect, even though I had decided to wait another 6 months to replace my aging Toshiba.  Let me Introduce you to my new computer.</p>
<p><strong>Lenovo X61</strong></p>
<ul>
<li> Dual Core Centrino Pro 1.8Ghz with 4Mb Cache</li>
<li>3Gb 533Mhz DDRII Ram (Max 4Gb)</li>
<li>100Gb 7200rpm Hard Drive with 1Gb Cache for speed boost</li>
<li>Multi-Touch Monitor (Touchscreen and Stylus)</li>
<li>Multi-View Monitor (Indoor and Outdoor &#8211; full sunlight does not affect viewing enjoyment. ** Max resolution is only 1024 x 768)</li>
<li>Tablet Mode (monitor swings around and lays flat)</li>
<li>Vista Business</li>
<li>Intel 965 Integrated Video with 128Mb dedicated memory</li>
<li>3 usb 2.0, Gigabit Lan, Wifi A/B/G/N, SD reader, PCMCIA slot, 1394 Firewire, VGA out, onboard Mic.</li>
<li>4-Cell Battery (8-Cell available) @ 2.5 hours of power</li>
</ul>
<p>So as you can see, this thing flies!  It&#8217;s a tablet computer that weighs a mere 3.77 lbs with the battery in.</p>
<p>Now to the good stuff, what this is intended to do.</p>
<p>First thing I did was install VMware Workstation 6.  This is a virtualization software that will allow me to do what&#8217;s next in the list.</p>
<p>Next I downloaded Ubuntu Gutsy 7.10 in live cd Iso format. Then mounted the ISO as a virtual CD drive.  Fired up VMware and created a new virtual computer, which was subsequently loaded with Ubuntu.</p>
<p>While in Ubuntu, I then installed Quanta+, Apache, PHP5.2, MySql5, RapidSVN.</p>
<p>Quanta has quickly become my chosen editor when it comes to developing.  It&#8217;s fast, sublime, pretty and full of features, including auto finishing words you are typing based on a history of the words you have typed.  The rest of the LAMP install is too long and also reproduced many times over (check out the forums on http://forums.ubuntu.com for more details if you are interested in this) to repeat here for the 10 Millionth time.</p>
<p>While VMWare is running the Ubuntu machine, that I dedicated 512Mb Ram to, I started network installing Microsoft Office.  I really really enjoy using OneNote, which is one of the greatest Tablet Tools that is out there.</p>
<p>After that was all said an done, I know have a mobile computer that packs a serious punch.  I am running Vista using OneNote to take notes, Internet Explorer 7, Firefox, Safari and Opera to test web pages, virtualized Ubuntu Gutsy running my editor and Webserver, so no matter where I happen to be, I can easily program and test via a single powerful machine.</p>
<p>Such an amazing combination, I am sure many of you also would consider the same.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.geedew.com/2008/01/01/creating-the-ultimate-mobile-developer-computer-lenovo-x61/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

