<?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>Albert Fama &#187; Content</title>
	<atom:link href="http://albertfama.com/category/content/feed/" rel="self" type="application/rss+xml" />
	<link>http://albertfama.com</link>
	<description>Freelance Web Programmer - specializing in PHP &#38; MySQL</description>
	<lastBuildDate>Fri, 20 Nov 2009 16:06:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Display Errors</title>
		<link>http://albertfama.com/php/display-errors/</link>
		<comments>http://albertfama.com/php/display-errors/#comments</comments>
		<pubDate>Fri, 20 Nov 2009 16:06:31 +0000</pubDate>
		<dc:creator>Albert Fama</dc:creator>
				<category><![CDATA[Content]]></category>
		<category><![CDATA[Error Handling]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://albertfama.com/?p=975</guid>
		<description><![CDATA[The display_errors directive in the PHP ini file &#8216;tells&#8217; PHP if errors should be added to the output stream (normally printed to the screen) or if they should not be displayed in the browser. &#160; &#60;IMPORTANT&#62; It should be noted that this setting DOES NOT suppress the error. Even if the directive is set to [...]]]></description>
			<content:encoded><![CDATA[<p>The display_errors directive in the PHP ini file &#8216;tells&#8217; PHP if errors should be added to the output stream (normally printed to the screen) or if they should not be displayed in the browser.<br />
<br />&nbsp;<br />
<strong>&lt;IMPORTANT&gt;</strong></p>
<p>It should be noted that this setting <strong>DOES NOT</strong> suppress the error. Even if the directive is set to &#8216;Off&#8217; (do not display errors) errors which occur in a script are still triggered and will be processed by the error handler.</p>
<p><strong>&lt;/IMPORTANT&gt;</strong><br />
<br />&nbsp;<br />
PHP does not offer a special display_errors function, but by using the <a href="http://us.php.net/manual/en/function.ini-set.php"  title="PHP Manual: ini_set()">ini_set()</a> function we can control the setting of this directive within our script. The function signature looks like this:</p>
<p>string ini_set  ( string $varname  , string $newvalue  )</p>
<p>blah, blah</p>

                            <div id="aspdf">
                                <a href="http://albertfama.com/wp-content/plugins/as-pdf/generate.php?post=975">
                                    <span>&nbsp;</span>
                                </a>
                            </div>
                        ]]></content:encoded>
			<wfw:commentRss>http://albertfama.com/php/display-errors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Error Reporting</title>
		<link>http://albertfama.com/php/error-reporting/</link>
		<comments>http://albertfama.com/php/error-reporting/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 20:30:44 +0000</pubDate>
		<dc:creator>Albert Fama</dc:creator>
				<category><![CDATA[Content]]></category>
		<category><![CDATA[Error Handling]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://albertfama.com/?p=924</guid>
		<description><![CDATA[PHP provides numerous error configuration options in the php.ini file. Since many people do not have the option of editing their ini file I would like to concentrate this series of posts on the ones which can be set within scripts (at run-time), more specifically ones you should consider using when creating a strategy for [...]]]></description>
			<content:encoded><![CDATA[<p>PHP provides numerous error configuration options in the php.ini file. Since many people do not have the option of editing their ini file I would like to concentrate this series of posts on the ones which can be set within scripts (at run-time), more specifically ones you should consider using when creating a strategy for handling errors. If you would like a complete list of the configuration options within PHP, the manual provides a very nice <a href="http://www.php.net/manual/en/errorfunc.configuration.php" title="PHP Manual: Errors and Logging Configuration Options" >chart</a>.</p>
<p>The configuration option I would like to address in this article is, of course, error_reporting.</p>
<p>Let&#8217;s start digging.</p>
<h4>error_reporting</h4>
<p>The error_reporting directive (within the PHP ini file) allows you to set the level of errors reported by PHP. By default this is set to &#8216;E_ALL &amp; ~E_NOTICE&#8217;. This <em>&#8216;tells&#8217;</em> PHP to report all errors, <em><strong>except</strong></em> Notices.</p>
<p>PHP provides a built-in function for getting and setting the error_reporting level: <a href="http://www.php.net/manual/en/function.error-reporting.php" title="PHP Manual: error_reporting()" >error_reporting()</a>. The function signature looks like this:</p>
<p><code>int error_reporting  ([ int $level  ] )</code></p>
<p>The function accepts one optional argument, a new error reporting level, and returns the old error reporting level. Although the signiture shows that the function accepts an integer, the new level sent can be represented by a <a href="http://www.php.net/manual/en/errorfunc.constants.php"  title="PHP Manual: Predefined Constants">predefined constant</a>. In fact it is recommended that you use the predefined constants to ensure future compatibility.</p>
<p>The available constants can be used in combination to build up a <a rel="nofollow" href="http://en.wikipedia.org/wiki/Bitmask"  title="Wikipedia: Bitmask">bitmask</a>; the bitmask <em>tells</em> PHP which errors to report and which to suppress. Since these constants are actually bitmasks, you will need to use <a href="http://www.php.net/manual/en/language.operators.bitwise.php"  title="PHP Manual: Bitwise Operators">bitwise operators</a> when combining them.</p>
<p>An example of the error reporting setting I use in development is:</p>
<pre name="code" class="php">
$old_setting = error_reporting(E_ALL | E_STRICT);
</pre>
<p>From the predefined constants chart the setting E_ALL equates to the integer 30719 and means:</p>
<blockquote><p>All errors and warnings, as supported, except of level E_STRICT in PHP < 6. </p></blockquote>
<p>From the predefined constants chart the setting E_STRICT equates to the integer 2048 and means:</p>
<blockquote><p>Enable to have PHP suggest changes to your code which will ensure the best interoperability and forward compatibility of your code. </p></blockquote>
<p>So basically, this tell PHP to report all errors, notices, and messages generated at the E_STRICT level.</p>
<p>Back to the code&#8230;</p>
<p>The variable $old_setting will now be set to: 6135, the default setting for error reporting (using the predefined constants again that would be: E_ALL &amp; ~E_NOTICE). </p>
<p>A small code example:</p>
<pre name="code" class="php">
&lt;?php
//get the current error reporting setting
$current_setting = error_reporting();

//check if error reporting is set to E_ALL | E_STRICT
if (8191 != $current_setting) {
    //not set to E_ALL | E_STRICT make it so
    error_reporting(E_ALL | E_STRICT);
}

//display new error reporting setting

echo error_reporting(); //displays 8191
?>
</pre>
<p>A more useful example would be to change the error_reporting setting based on the environment the script is being run in. </p>
<p>Let&#8217;s say you have a configuration file which defines the constant &#8216;ENV&#8217;, this can be set to &#8216;production&#8217; (live site) or &#8216;development&#8217;. If the script is run in production then we want to use &#8216;E_ALL &amp; ~E_NOTICE&#8217; (default), but when running in development we want to use E_ALL | E_STRICT.</p>
<p>config.php:</p>
<pre name="code" class="php">
&lt;?php

//define enviroment
define('ENV', 'development');
</pre>
<p>Script File:</p>
<pre name="code" class="php">
&lt;?php

//load configuration file
require_once('config.php');

//check ENV constant to see if running in development
if ('development' == ENV) {
    //running in development so change default setting
    error_reporting(E_ALL | E_STRICT);
    //now all errors, notices, and suggestions will be reported
}
</pre>
<p>That&#8217;s it! I&#8217;m sure you can see how useful this function can be.</p>
<blockquote><p><strong>Side Note:</strong> If you are unsure what a bitmask is or are unfamiliar with bitwise operators, you may want to checkout this <a href="http://www.joestump.net/2004/06/a-quick-bitmask-howto-for-programmers.html"  title="joestump.net: A Quick Bitmask HOWTO for Programmers">post</a> from <a href="http://www.joestump.net/"  title="joestump.net">joestump.net</a>.</p></blockquote>
</blockquote>

                            <div id="aspdf">
                                <a href="http://albertfama.com/wp-content/plugins/as-pdf/generate.php?post=924">
                                    <span>&nbsp;</span>
                                </a>
                            </div>
                        ]]></content:encoded>
			<wfw:commentRss>http://albertfama.com/php/error-reporting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP 5 Zend Cert Exam: My Experience</title>
		<link>http://albertfama.com/content/php-5-zend-cert-exam-my-experience/</link>
		<comments>http://albertfama.com/content/php-5-zend-cert-exam-my-experience/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 23:12:10 +0000</pubDate>
		<dc:creator>Albert Fama</dc:creator>
				<category><![CDATA[Content]]></category>

		<guid isPermaLink="false">http://albertfama.com/?p=694</guid>
		<description><![CDATA[On Monday afternoon, I figured I was as ready as I was going to be and finally scheduled my PHP 5 Zend Certification Exam for Tuesday Morning. Since my original post about preparing for the exam seemed fairly popular, I figured a follow up was in order. As I&#8217;m sure you&#8217;re aware Pearsonvue administers the [...]]]></description>
			<content:encoded><![CDATA[<p>On Monday afternoon, I figured I was as ready as I was going to be and finally scheduled my PHP 5 Zend Certification Exam for Tuesday Morning. Since my <a href="/content/preparing-for-zend-exam/" title="Preparing for Zend PHP 5 Certification Exam ">original post</a> about preparing for the exam seemed fairly popular, I figured a follow up was in order.</p>
<p>As I&#8217;m sure you&#8217;re aware <a href="http://pearsonvue.com/zend/"  title="pearsonvue.com: zend section">Pearsonvue</a> administers the exam. The testing centers are usually apart of other organizations (colleges, tech centers, etc.)</p>
<p>First, I was asked to arrive 15 minutes early so that I could complete the registration process and start my exam &#8216;on time&#8217;. Registration basically consisted of showing two forms of ID and locking away all personal items; including wallets, bags, hats (if I had known this I would&#8217;ve combed my hair), and so on. I was then given a laminated piece of paper, a black dry erase marker, and an eraser which I was allowed to use during the exam. The exam &#8216;proctor&#8217; then lead me to a computer, started the exam application, and wished me luck.</p>
<p>The exam was setup very similar to the practice tests. The screen displays the amount of time left, the current question number and the total number of questions. If you don&#8217;t already know, there are 70 questions to be completed in 90 minutes.</p>
<p>For each question you can check a box to mark for review, submit a comment to the test writers, and of course a place to answer the question. Answers range from: true/false, multiple choice, or fill in. Multiple choice can ask for more than one answer or &#8216;None of the above&#8217; / &#8216;All of the above&#8217;, I hate that.</p>
<p>Since I cannot give you examples of actual questions, or any real detailed information about the questions asked, let just say you definitely need a good basis in the topics listed on the Zend Certification <a href="http://www.zend.com/en/services/certification/php-5-certification/"  title="zend.com: PHP 5 Certififcation information">page</a> (scroll to the bottom). You, of course, don&#8217;t need to know everything contained in the topics listed, but have the knowledge to make an educated guesses, when you run up against a question you don&#8217;t know.</p>
<p>After completing all the questions, a review screen is displayed which tells you the questions marked for review, and whether you answered the question. I get very apprehensive when taking exams, and have a tendency second guess all my answers, consequently my review screen showed that I had marked all but a few questions for review.</p>
<p>You then have options to &#8216;end the exam&#8217;, &#8216;review the questions marked&#8217;, or &#8216;review all questions&#8217;. Since I had about half the exam time left, I chose to review all questions.</p>
<p>On my second pass at the questions, I only left about 5 which I wanted to go over once more if I had the time, which I did.</p>
<p>Upon clicking &#8216;end exam&#8217;, it calculates your score, in about 5 (very long seconds), then displays whether you&#8217;ve passed or failed. Since I&#8217;m writing this post you should know that I passed, else I would have just never mentioned the exam again <img src='http://albertfama.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>BTW &#8211; If you don&#8217;t already know, learn how to convert hexadecimal and octal, you may only have one question which asks, but it is one question you are guaranteed to get right, if you know how.</p>

                            <div id="aspdf">
                                <a href="http://albertfama.com/wp-content/plugins/as-pdf/generate.php?post=694">
                                    <span>&nbsp;</span>
                                </a>
                            </div>
                        ]]></content:encoded>
			<wfw:commentRss>http://albertfama.com/content/php-5-zend-cert-exam-my-experience/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Preparing for Zend PHP 5 Certification Exam</title>
		<link>http://albertfama.com/content/preparing-for-zend-exam/</link>
		<comments>http://albertfama.com/content/preparing-for-zend-exam/#comments</comments>
		<pubDate>Sun, 12 Jul 2009 20:45:07 +0000</pubDate>
		<dc:creator>Albert Fama</dc:creator>
				<category><![CDATA[Content]]></category>

		<guid isPermaLink="false">http://albertfama.com/?p=675</guid>
		<description><![CDATA[As some of you know I am preparing to take the Zend PHP 5 certification exam in the near future (exact date not set), and have opted to actually study the material instead of just winging it, probably a good idea. I thought I might be able to provide some tips for anyone considering taking [...]]]></description>
			<content:encoded><![CDATA[<p>As some of you know I am preparing to take the Zend PHP 5 certification exam in the near future (exact date not set), and have opted to actually study the material instead of just winging it, probably a good idea. I thought I might be able to provide some tips for anyone considering taking the exam in the future.</p>
<p>My first advice it to purchase the <a href="http://www.zend.com/en/store/php-certification/online-practice-testing"  title="Zend.com: practice tests">Practice tests</a>, which are offered by <a href="http://www.zend.com/"  title="Zend.com">Zend</a>, and given by <a href="http://www.phparch.com/"  title="php|architect">php|architect</a>. I was originally just going to study for the exam from the multitude of books I currently own, but 10 tests for $22 USD, I figured WTF. </p>
<p>So far I have taken ( and passed:) ) 4 practice tests. What is most impressive is at the end of the exam, you get a break down of how you did on each section and what your final score would be if this were the real exam. Such as:</p>
<p><center><img src="/images/exam_result.png" title="Exam Results" alt="Exam Results" /></center></p>
<p>For each section (and the final grade) it is possible to receive: fail, pass, or excellent. I believe &#8216;fail&#8217; and &#8216;excellent&#8217; are fairly self explanatory. Pass means that you are within a narrow margin of the passing score and may want to refresh your knowledge of the material. As you can see, I need to do some studying on &#8216;streams and network programming&#8217;. Which is why you may have seen my request for a good tutorial about sockets, on <a href="http://twitter.com/albertfama"  title="twitter.com: albertfama">twitter</a>.</p>
<p>Another nice thing about the practice test is that you gives you a feel for the type of questions the exam will ask. I don&#8217;t want to say they are trick questions, but you really need to read the question and carefully review the code provided, because it is not always as simple as it seems. Let&#8217;s just say, if you saw the code in your everyday project you would be scratching your head wondering why the coder made the function so complicated, when it could be written so much more simply.</p>
<p>There is also a study guide published by <a href="http://www.phparch.com/books/isbn/0973862149"  title="php|architect: Zend Certification Study Guide">php|architect</a>. The study guide provides a nice overview of all the topics, divided into chapters corresponding to the sections of the exam. It should not be seen as a comprehensive resource of all the material on the exam, but is intended to provide a synopsis of the material and is sold as such.</p>
<p>You can purchase the study guide, practice tests, and an exam voucher in one <a href="http://www.zend.com/en/store/php-certification/zend-php5-certification-bundle"  zend.com: Zend PHP 5 Certification Bundle>bundle</a> on zend.com, if you decide the study guide would be a benefit to you.</p>
<p>If you have already taken the exam, please comment and let everyone what the <strong>real</strong> exam is like.</p>

                            <div id="aspdf">
                                <a href="http://albertfama.com/wp-content/plugins/as-pdf/generate.php?post=675">
                                    <span>&nbsp;</span>
                                </a>
                            </div>
                        ]]></content:encoded>
			<wfw:commentRss>http://albertfama.com/content/preparing-for-zend-exam/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Whatever happened to: PHPBuilder.com</title>
		<link>http://albertfama.com/content/whatever-happened-to-phpbuilder-com/</link>
		<comments>http://albertfama.com/content/whatever-happened-to-phpbuilder-com/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 05:12:18 +0000</pubDate>
		<dc:creator>Albert Fama</dc:creator>
				<category><![CDATA[Content]]></category>
		<category><![CDATA[Site Reviews]]></category>
		<category><![CDATA[reviews]]></category>
		<category><![CDATA[site revies]]></category>

		<guid isPermaLink="false">http://albertfama.com/?p=343</guid>
		<description><![CDATA[PHPBuilder.com used to be one of my first stops when looking for information about PHP. Their articles and tutorials were well written and covered the topic at hand completely. The forums section consisted of a smaller community of programmers than some of the other major sites. When I was first learning PHP I liked that [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://phpbuilder.com/"  title="PHPBuilder">PHPBuilder.com</a> used to be one of my first stops when looking for information about PHP. Their articles and tutorials were well written and covered the topic at hand completely. The forums section consisted of a smaller community of programmers than some of the other major sites. When I was first learning PHP I liked that fact and felt I had a chance to participate more than I had in a larger community. </p>
<p>As time moved on and I became more familiar with PHP I began to stop frequenting <a href="http://phpbuilder.com/"  title="PHPBuilder">PHPBuilder</a> and similar sites, preferring instead to go directly to the PHP documentation and figure out what needed to be done from there. This is both good and bad. I&#8217;m sure everyone has seen the comment &#8216;<a rel="nofollow" href="http://en.wikipedia.org/wiki/RTFM"  title="Wikipedia: Read The Fucking Manual">RTFM</a>&#8216;, but sometimes this is not the best option. The manual will tell you almost all you need to know about the technical specifications, but it will not tell you how different functionality relates and the best practices for using that functionality. This is why tutorials are sometimes a much better resource than the manual itself.</p>
<p>Back to the topic of <a href="http://phpbuilder.com/"  title="PHPBuilder">PHPBuilder</a>. At some point the site fell off my radar, and eventually lost its spot in my bookmarks. I had not visited  in numerous years, but it recently appeared in some search results which brought it back to mind, so I decided to take a look around and see what happened to the site.</p>
<p>I am happy to report that the site has remained publishing complete and informative articles on many aspects of programming with PHP and has stayed true to being a resource for PHP developers. </p>
<p>A quick glance at the homepage gives the user a nice snap shot of what is going on in the PHP community as well as new additions to the articles section and the community forums.</p>
<p>There are a number of articles which were written as a series such as <a rel="nofollow" href="http://cid-4515677bdf99b35f.spaces.live.com/default.aspx"  title="Peter Shaw: homepage">Peter Shaw</a>&#8216;s (<a href="http://www.phpbuilder.com/people/viewprofile.php?user_id=174305"  title="PHPBuilder: Peter Shaw Profile">1</a>) &#8220;<a href="http://phpbuilder.com/columns/peter_shaw20090226.php3"  title="PHPBuilder: The ABC's of PHP">The ABC&#8217;s of PHP</a>&#8221; which was written in ten different parts. If your new to PHP and looking for a good primer then I recommend this series. Of course many other topics are covered in the <a href="http://www.phpbuilder.com/columns/"  title="PHPBuilder: Articles">articles section</a> which is broken down into different categories.</p>
<p>I casually browsed the community forums which are alive and well, and seem to have retained the friendly atmosphere I remember. Almost every post has at least one reply, which is always nice to see. One section of the boards that caught my eye was the <a href="http://phpbuilder.com/board/forumdisplay.php?f=24"  title="PHPBuilder: Code Critique Forum">Code Critique Forum</a>. This is an extremely valuable resource for coders of all levels. I strongly believe this is one of (if not the) best way to become a better coder.</p>
<p>Another section which I do not recall <a href="http://phpbuilder.com/"  title="PHPBuilder">PHPBuilder</a> having is the <a href="http://www.phpbuilder.com/snippet/"  title="PHPBuilder: Code Library">Code Library</a>. Here you can find code snippets (again broken down into categories) for many of the routine tasks which occur in projects. Even if you are not a fan of using code someone else wrote, reviewing code that others have written is a great way to learn.</p>
<p>Well that is about it, I encourage everyone to go to <a href="http://phpbuilder.com/"  title="PHPBuilder">PHPBuilder</a> and have a look around, I&#8217;m sure you will find something you&#8217;ve been looking for.</p>
<blockquote><p>
<strong>Just an FYI</strong>: </p>
<p>I have not and will never accept money for a review of any kind. All the opinions expressed here are mine.
</p></blockquote>

                            <div id="aspdf">
                                <a href="http://albertfama.com/wp-content/plugins/as-pdf/generate.php?post=343">
                                    <span>&nbsp;</span>
                                </a>
                            </div>
                        ]]></content:encoded>
			<wfw:commentRss>http://albertfama.com/content/whatever-happened-to-phpbuilder-com/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Getting started with Dojo (part 1)</title>
		<link>http://albertfama.com/php/getting-started-with-dojo-part-1/</link>
		<comments>http://albertfama.com/php/getting-started-with-dojo-part-1/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 02:52:41 +0000</pubDate>
		<dc:creator>Albert Fama</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Content]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Dojo]]></category>
		<category><![CDATA[project]]></category>

		<guid isPermaLink="false">http://albertfama.com/?p=304</guid>
		<description><![CDATA[During this past weekend I was contacted by a client asking if I could implement a few new functionality requests on their site. Basically they wanted to slowly enter the world of Web 2.0, by implementing small tweaks to existing functionality. I have been working with this client of a few years now and have [...]]]></description>
			<content:encoded><![CDATA[<p>During this past weekend I was contacted by a client asking if I could implement a few new functionality requests on their site. Basically they wanted to slowly enter the world of Web 2.0, by implementing small tweaks to existing functionality. </p>
<p>I have been working with this client of a few years now and have a great rapport with them. For this most recent project they have no requirements about which JavaScript library to use just as long as it has the functionality which is required by the project. This left me in a little bit of a dilemma, which JavaScript library should I use?</p>
<p>I have tried many libraries in the past and had used the <a rel="nofollow" href="http://developer.yahoo.com/yui/"  title="Yahoo! User Interface Library">Yahoo! User Interface Library (YUI)</a> extensively for a previous project. Although it&#8217;s a good library I have had the urge to try out <a href="http://dojotoolkit.com"  title="Dojo: the JavaScript toolkit">Dojo</a>. I first learned about the library when it came coupled with the <a href="http://zendframework.com/"  title="Zend Framework">Zend Framework</a>. After a few small personal projects I never really used either again.</p>
<p>Doing a little research on <a href="http://dojotoolkit.com"  title="Dojo: the JavaScript toolkit">Dojo</a>&#8216;s current capabilities and verifying that it has the functionality required for my project, I have decided to use Dojo and document my experience here. I&#8217;m hoping that even if you currently use a different JavaScript library that this set of posts will inspire you to try something new for a change.</p>
<p>My first task will be to build something similar to the &#8216;Suggest&#8217; functionality on Google. This afternoon I attempted to find a good tutorial explaining how this is accomplished in Dojo, but could not locate exactly what I wanted. The problem seems to be that all the combo box / auto complete tutorials for dojo create a select menu rather than a simple text box and since this is going to be implemented for a search engine the select menu option is not actually an option. (Get it &#8216;select menu&#8217;, &#8216;option&#8217;&#8230;programming humor my wife loves it.)</p>
<p>Over the next few days I will be working on this project and will have one or two more posts detailing how I implement the functionality. If anyone has not heard of Dojo or has never used it here are a few links to get you started.</p>
<h4>Dojo Links</h4>
<ul>
<li><a href="http://dojotoolkit.com"  title="Dojo: the JavaScript toolkit">Homepage</a></li>
<li><a href="http://dojotoolkit.org/downloads"  title="Dojo: Download">Download</a></li>
<li><a href="http://dojotoolkit.org/docs"  title="Dojo: Documentation">Documentation</a></li>
<li><a href="http://dojotoolkit.org/book/dojo-book-0-9/hello-world-tutorial"  title="Dojo: Hello World Tutorial">Hello World Tutorial</a></li>
</ul>
<p>My next post will assume you already have Dojo <em>installed</em> and have worked through the &#8216;Hello World&#8217; tutorial. Here are some brief notes about installing Dojo.</p>
<h5>Dojo Installation</h5>
<p>When installing Dojo you have three options</p>
<ul>
<li>Load the toolkit directly from <a rel="nofollow" href="http://dev.aol.com/dojo"  title="AOL CDN: Dojo Toolkit">AOL&#8217;s Content Distribution Network </a>(CDN) or from the <a rel="nofollow" href="http://code.google.com/apis/ajaxlibs/documentation/index.html#dojo"  title="Google CDN: Dojo Toolkit">CDN of Google</a>.</li>
<li>Download and store the toolkit on your server</li>
<li>Checkout a copy from the SVN repository (maybe not the greatest idea if your implementing on a live site)</li>
</ul>
<p>I believe the first two options are completely viable for a live website and each have their pros and cons. I choose to download the toolkit and keep it on my server. The upside is that since I have the files locally I can open them up and browse through the code whenever I would like (you can learn a lot this way).</p>
<p>&nbsp;</p>
<blockquote><p><strong>In my opinion&#8230;</strong></p>
<p>When attempting to update an existing site with the newest gadgets available, it is best to take slowly. Implement a few updates at a time, without forcing the users to change the way they use the site. The response received from the users will tell you what is worth it and when you&#8217;ve gone too far.</p></blockquote>

                            <div id="aspdf">
                                <a href="http://albertfama.com/wp-content/plugins/as-pdf/generate.php?post=304">
                                    <span>&nbsp;</span>
                                </a>
                            </div>
                        ]]></content:encoded>
			<wfw:commentRss>http://albertfama.com/php/getting-started-with-dojo-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Site Launch</title>
		<link>http://albertfama.com/content/site-launch/</link>
		<comments>http://albertfama.com/content/site-launch/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 23:35:37 +0000</pubDate>
		<dc:creator>Albert Fama</dc:creator>
				<category><![CDATA[Content]]></category>
		<category><![CDATA[site launch]]></category>

		<guid isPermaLink="false">http://albertfama.com/?p=125</guid>
		<description><![CDATA[OK, so this is the obligatory post announcing the official launch of my new site. Don&#8217;t worry I have migrated the most popular content from the previous site. Anyone looking for an older article; simply substitute the new domain name for the old and you should be able to locate exactly what your looking for. [...]]]></description>
			<content:encoded><![CDATA[<p>OK, so this is the obligatory post announcing the official launch of my new site. Don&#8217;t worry I have migrated the most popular content from the previous site. Anyone looking for an older article; simply substitute the new domain name for the old and you should be able to locate exactly what your looking for. </p>
<p>The purpose of this new site remains to be; providing the beginner/intermediate web developer with a source of accurate and informative articles on web development, but will also focus on several new projects and groups which I recently began contributing to.</p>
<p>I hope you enjoy&#8230;</p>

                            <div id="aspdf">
                                <a href="http://albertfama.com/wp-content/plugins/as-pdf/generate.php?post=125">
                                    <span>&nbsp;</span>
                                </a>
                            </div>
                        ]]></content:encoded>
			<wfw:commentRss>http://albertfama.com/content/site-launch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Application Directory Structure</title>
		<link>http://albertfama.com/content/application-directory-structure/</link>
		<comments>http://albertfama.com/content/application-directory-structure/#comments</comments>
		<pubDate>Sun, 20 Jul 2008 05:50:35 +0000</pubDate>
		<dc:creator>Albert Fama</dc:creator>
				<category><![CDATA[Content]]></category>
		<category><![CDATA[Project: Udid]]></category>
		<category><![CDATA[directory structure]]></category>
		<category><![CDATA[project]]></category>

		<guid isPermaLink="false">http://obnexus.net/?p=47</guid>
		<description><![CDATA[In our last installment we created the directory structure we will be using for the development environment. Which was: udid &#124; &#124;-&#62; project &#124;    &#124;-&#62; branches &#124;    &#124;-&#62; tags &#124;    &#124;-&#62; trunk &#124;         &#124;-&#62; public_html &#124;         &#124;-&#62; Udid &#124; &#124;-&#62; simpletest Today we will be adding a directory structure for the actual application itself, which means we will be working [...]]]></description>
			<content:encoded><![CDATA[<p>In our last <a title="Development Environment Setup" href="/content/development-enviroment-setup/" target="_self">installment</a> we created the directory structure we will be using for the development environment. Which was:</p>
<p><code>udid<br />
|<br />
|-&gt; project<br />
|    |-&gt; branches<br />
|    |-&gt; tags<br />
|    |-&gt; trunk<br />
|         |-&gt; public_html<br />
|         |-&gt; Udid<br />
|<br />
|-&gt; simpletest</code></p>
<p>Today we will be adding a directory structure for the actual application itself, which means we will be working in the udid/project/trunk/Udid directory. Just as a refresher the public_html directory is our document root and all our PHP code will be stored outside the root in the &#8216;Udid&#8217; directory.</p>
<p>There is one thing I want to mention before we really get into it. As a general rule I like to define one class per file, this is not a hard and fast rule I adhere to, but for the most part one file = one class. Given this I will use the terms &#8216;class&#8217; and &#8216;file&#8217; almost interchangeable for this post.</p>
<p>OK now that that is out of the way&#8230;There are two directories I include in ALL my project and they are:</p>
<ul>
<li>Documents &#8211; this will hold all developer documentation for the project; code documentation, &#8216;to do&#8217; lists, notes, etc.</li>
<li>UnitTests &#8211; This of course will hold all the unit tests for the application code.</li>
</ul>
<p>So now our Udid directory looks like:<br />
<code>Udid<br />
|<br />
|-&gt; Documents<br />
|-&gt; UnitTests</code></p>
<p>Now it is time to make some design decision about the structure of the application code itself. The directory structure really should be looked upon as an organizational task, i.e. What is the best way to organize the files we will be creating? The organization needs to make sense to you or your team of developers. One way to test yourself when you are deciding on a structure is to attempt to explain it to someone (if no one is available then write it down). If you find yourself going back over parts of the structure or having trouble finding the words to truly explain everything, then it is probably time to go back and try to reorganize. (I guess this post will be a good test for me, huh?)</p>
<p>So here goes&#8230;</p>
<p>One of my pet peeves about many PHP applications is that the PHP, HTML, and CSS are completely muddled together. I have to admit the PHP community in general has been getting better at the separation of presentation and business logic, but in many personal project that I&#8217;ve seen this is still an issue. For this project we will be using a template system where we define actual HTML templates. Since we will need a place to hold these template files I create the directory &#8216;Templates&#8217; beneath &#8216;Udid&#8217;.</p>
<p>I also know there will be generic classes we need to define which are not a part of any one section of the application, but are used by multiple aspects of the application such as database classes, iterators, an &#8216;emailer&#8217; etc. These classes are also not limited to this one application, but can be used over and over again in project after project. I often think of these classes as books in a library, available to everyone. Consequently I will call the directory which holds these classes the &#8216;Library&#8217;.</p>
<p>Finally we will need a place to store all the core components of our application and I&#8217;ve decided to call this storage area the: &#8216;Core&#8217;. Honestly I&#8217;m not crazy about this name, in the past I&#8217;ve used; Engine, Backend, etc. but I don&#8217;t really like them either so for this project we are calling it &#8216;Core&#8217;.</p>
<p>We have now added three other directories and the current structure looks like this:</p>
<p><code>Udid<br />
|<br />
|-&gt; Core<br />
|-&gt; Documents<br />
|-&gt; Library<br />
|-&gt; Templates<br />
|-&gt; UnitTests</code></p>
<p>We have one last directory to address and the base application structure will be complete. That directory is the &#8216;Core&#8217;. We cannot just start creating files in the &#8216;Core&#8217; without some sort of organization or we&#8217;ll end up with an application core which consists of a long list of files with no organization except for maybe some naming conventions. Since this is where the majority of our development time will be spent, we need to define some parameters about where files should exist.</p>
<p>For this project we will be using the <a href="http://www.tonymarston.net/php-mysql/model-view-controller.html" title="tonymarston.net: Model View Controller"  target="_self">Model View Controller</a> (MVC) design pattern. This is an organizational pattern to help separate different parts of the application code. As with all design patterns there is a lot programming theory associated with it and there is no way I can fully explain it here. If you are not familiar with this design pattern I urge you to search the net for more information. For our purposes the basic idea of each section is:</p>
<ul>
<li>Model &#8211; Contains application data and business logic. Objects which represent the data, and the processes to change that data.</li>
<li>View &#8211; Extracts data from the model and shapes it for presentation.</li>
<li>Controller &#8211; Receives requests and directs it for proper processing. Basically interpreting the request for the Model and View.</li>
</ul>
<p>Since we will be using this pattern I have decided to create one directory for each section below &#8216;Core&#8217;. These will hold the files associated to each section. Now some may argue that the &#8216;Templates&#8217; directory should be located below &#8216;View&#8217;, but I disagree. I want a place for templates that can easily be found, and is not located within the application code itself. I use this reasoning because I want other people who may not be PHP programmers to be able to find the templates and alter the display of the application.</p>
<p>There is one final directory I would like to include and that is a directory to hold <a href="http://phpdoc.org/" title="phpDocumentor" >phpDocumentor</a>. We will use this to generate documentation for the code. This directory will be stored beneath the top &#8216;udid&#8217; directory.</p>
<p>We have finally completed the development and application structure:</p>
<p><code>udid<br />
|<br />
|-&gt; project<br />
|    |-&gt; branches<br />
|    |-&gt; tags<br />
|    |-&gt; trunk<br />
|         |-&gt; public_html<br />
|         |-&gt; Udid<br />
|              |-&gt; Core<br />
|              |    |-&gt; Controller<br />
|              |    |-&gt; Model<br />
|              |    |-&gt; View<br />
|              |<br />
|              |-&gt; Documents<br />
|              |-&gt; Library<br />
|              |-&gt; Templates<br />
|              |-&gt; UnitTests<br />
|<br />
|-&gt; simpletest<br />
|-&gt; phpdoc</code></p>
<p>We can now import this directory structure to SVN and export our working copy.</p>
<p>Thanks for reading. Until next time&#8230;</p>

                            <div id="aspdf">
                                <a href="http://albertfama.com/wp-content/plugins/as-pdf/generate.php?post=47">
                                    <span>&nbsp;</span>
                                </a>
                            </div>
                        ]]></content:encoded>
			<wfw:commentRss>http://albertfama.com/content/application-directory-structure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Development Environment Setup</title>
		<link>http://albertfama.com/content/development-enviroment-setup/</link>
		<comments>http://albertfama.com/content/development-enviroment-setup/#comments</comments>
		<pubDate>Sat, 12 Jul 2008 18:29:52 +0000</pubDate>
		<dc:creator>Albert Fama</dc:creator>
				<category><![CDATA[Content]]></category>
		<category><![CDATA[Project: Udid]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[environment]]></category>
		<category><![CDATA[project]]></category>

		<guid isPermaLink="false">http://obnexus.net/?p=46</guid>
		<description><![CDATA[Before we get into the directory structure we will be using for this project, I wanted to let you know I have decided on a project name. The basic idea for the application I&#8217;m building is to create a hierarchical storage system, hence the name: UDID &#8211; User Designed/Defined Information Directory (Of course it is [...]]]></description>
			<content:encoded><![CDATA[<p>Before we get into the directory structure we will be using for this project, I wanted to let you know I have decided on a project name. The basic idea for the application I&#8217;m building is to create a hierarchical storage system, hence the name:</p>
<p>UDID &#8211; User Designed/Defined Information Directory<br />
(Of course it is an acronym, you expected something else?)</p>
<p>There is a legitimate reason for naming the project before even setting up the development area. The project will be stored under the &#8216;Udid&#8217; directory, and all of the class names will reflect the position of the file within the project&#8217;s directory structure. I will explain more about this when we get into writing classes and actually coding, but if you would like more information about this type of setup you can read about the <a href="http://framework.zend.com/" title="Zend Framework" >Zend Framework</a> <a href="http://framework.zend.com/manual/en/coding-standard.naming-conventions.html" title="Zend Framework naming conventions" >naming conventions for classes</a>.</p>
<p>OK now we have a name and it&#8217;s time to setup the directory structure. First we create the &#8216;udid&#8217; directory and beneath that we create a &#8216;project&#8217; directory; such as:<br />
<code><br />
udid<br />
|-&gt; project<br />
</code><br />
The &#8216;project&#8217; directory will hold all the files directly associated to the project. The reason I have created this directory and did not just store the project code within &#8216;udid&#8217;, is because we will be using some third party applications to help with development and I do not want that third party code to actually be associated to the project code. For example we will be using <a href="http://www.lastcraft.com/simple_test.php" title="Simple Test" >Simple Test</a> for unit testing. We will be placing Simple Test within &#8216;udid&#8217;, but not within &#8216;project&#8217;. So now we have:<br />
<code><br />
udid<br />
|-&gt; project<br />
|-&gt; simpletest<br />
</code><br />
As you know we will be using SVN to store the code, so we are going to be using what I learned as the traditional setup for a SVN project, not because it is the traditional way, but because I&#8217;ve used it before and it has worked well for me. This structure is:<br />
<code><br />
project<br />
|-&gt; branches<br />
|-&gt; tags<br />
|-&gt; trunk<br />
</code><br />
These three directories have very specific purposes:</p>
<ul>
<li><strong>branches</strong>: Experimental development branches. Branches are used when you decide to make some dramatic changes to the code base, but your not really sure how it is going to work out, so you do not want to code within the &#8216;trunk&#8217; but you may want to merge the code within the trunk at a later time.</li>
<li><strong>tags</strong>: This directory is used to store the project at certain milestones, i.e. version releases.</li>
<li><strong>trunk</strong>: Main development thread</li>
</ul>
<p>So this is what our directory structure looks like so far:<br />
<code><br />
udid<br />
|<br />
|-&gt; project<br />
|  |-&gt; branches<br />
|  |-&gt; tags<br />
|  |-&gt; trunk<br />
|<br />
|-&gt; simpletest<br />
</code><br />
OK, for the rest of this post we will be working in the &#8216;trunk&#8217; to setup the actual directory structure for the project code&#8230;</p>
<p>At some point a long time ago I got into the habit of creating a subdomain for each new project I work on, this I find convenient because the subdomain&#8217;s document root is its own and is not cluttered with other directories, files, etc. As an added bonus the document root can be anywhere on the system. Consequently the directories below &#8216;trunk&#8217; look like this:<br />
<code><br />
trunk<br />
|-&gt; public_html<br />
|-&gt; Udid<br />
</code><br />
Obviously &#8216;public_html&#8217; is the document root, and &#8216;Udid&#8217; will store all the back-end PHP code. Notice the PHP code will be stored outside the document root (where a browser is unable to access it directly). I prefer to setup my projects this way as an added security measure. For more information about the security aspects of this; check out <a href="http://shiflett.org" title="Chris Shiflett PHP and Web Application Security" >Chris Shiflett</a>&#8216;s article: <a href="http://shiflett.org/articles/secure-design" title="shiflett.org: Security Corner: Secure Design" >Security Corner: Secure Design</a> (be sure to read the comments).</p>
<p>For now &#8216;public_html&#8217; will remain empty and &#8216;Udid&#8217; will hold the directory structure for the application. So this will be the development directory structure we&#8217;ll be using&#8230;<br />
<code><br />
udid<br />
|<br />
|-&gt; project<br />
|    |-&gt; branches<br />
|    |-&gt; tags<br />
|    |-&gt; trunk<br />
|         |-&gt; public_html<br />
|         |-&gt; Udid<br />
|<br />
|-&gt; simpletest<br />
</code><br />
Please note, I have still not imported the project into SVN, you can actually do the import as soon as you have the first directory created, but I like to wait until I have the basic structure of the application set, which brings us to the topic of the next post. What is the directory structure of the application itself; or what directories will be created below Udid: &#8216;udid-&gt;project-&gt;trunk-&gt;Udid&#8217;?</p>
<p>I will post this structure in the next few days, and import the project into SVN, so we can finally get down to some code! Thanks for reading.</p>

                            <div id="aspdf">
                                <a href="http://albertfama.com/wp-content/plugins/as-pdf/generate.php?post=46">
                                    <span>&nbsp;</span>
                                </a>
                            </div>
                        ]]></content:encoded>
			<wfw:commentRss>http://albertfama.com/content/development-enviroment-setup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Starting a New Project</title>
		<link>http://albertfama.com/content/starting-a-new-project/</link>
		<comments>http://albertfama.com/content/starting-a-new-project/#comments</comments>
		<pubDate>Fri, 04 Jul 2008 18:18:17 +0000</pubDate>
		<dc:creator>Albert Fama</dc:creator>
				<category><![CDATA[Content]]></category>
		<category><![CDATA[Project: Udid]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[environment]]></category>
		<category><![CDATA[project]]></category>
		<category><![CDATA[requirements]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://obnexus.net/?p=45</guid>
		<description><![CDATA[Greetings once again; I am currently in the design phase of a new project. I thought it could prove to be an interesting set of blog entries if I loosely documented the progress here at Obnexus. I will try to relate all experiences as the project is created. Even if we try to account for [...]]]></description>
			<content:encoded><![CDATA[<p>Greetings once again; I am currently in the design phase of a new project. I thought it could prove to be an interesting set of blog entries if I loosely documented the progress here at Obnexus. I will try to relate all experiences as the project is created. </p>
<p>Even if we try to account for all aspects in the design phase, I know there will be situations where decisions made early on will have negative effects later down the road. I will document everything as it happens, because I find that I learn more from mistakes, and hopefully you will to. </p>
<p>I will mainly be working on this project solo, which means I will not only be dealing with PHP and MySQL, but also HTML, CSS, JavaScript, etc. Since I believe many developers work alone I hope that this will interest most readers.</p>
<p>I personally like to start a project with a name, simply because it gives the project an identity, but&#8230; In this case I cannot decide on an appropriate name so I am going to skip this step for the moment and move onto some actual code design, one of the most important and exciting steps.</p>
<p>First let&#8217;s set down some general guidelines: </p>
<ul>
<li>Version Control: Subversion (SVN)</li>
<li>PHP Version: The project will be written in PHP5 and will not support PHP4. Let&#8217;s face it PHP4 is dead and if your server is still running 4 you NEED to upgrade. </li>
<li>MySQL Version: I will be using MySQL 5, again if your not on 5, what are you waiting for?</li>
<li>HTTP Server Platform: Apache</li>
<li>Browser Support: Firefox, Internet Explorer, AOL Browser, Netscape, Opera, Safari. This is just a list off the top of my head, basically we are going to attempt to support as many browsers as possible.</li>
</ul>
<p>Again these are just general guidelines; eventually the project will be able to support multiple database servers, different HTTP server platforms, etc. Initially these are our targets for support; no reason to bog the development process down with attempting to support everything under the sun, but&#8230; Since we want the project to be as flexible as possible, we will need to account for this NOW in our framework design.</p>
<p>OK, now that we have our guidelines; the next step will be to start coding right? Wrong, next we will decide on a directory structure, and create the SVN repository to hold our project.</p>
<p>I hope you are as excited as I am to get this thing underway, please check back soon.</p>

                            <div id="aspdf">
                                <a href="http://albertfama.com/wp-content/plugins/as-pdf/generate.php?post=45">
                                    <span>&nbsp;</span>
                                </a>
                            </div>
                        ]]></content:encoded>
			<wfw:commentRss>http://albertfama.com/content/starting-a-new-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

