<?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"
	>

<channel>
	<title>Developer Tutorials' Webmaster Blog</title>
	<atom:link href="http://www.developertutorials.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.developertutorials.com/blog</link>
	<description>Keeping webmasters up-to-date on technology.</description>
	<pubDate>Fri, 18 Jul 2008 10:00:14 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<item>
		<title>Running background processes in PHP</title>
		<link>http://www.developertutorials.com/blog/php/running-background-processes-in-php-349/</link>
		<comments>http://www.developertutorials.com/blog/php/running-background-processes-in-php-349/#comments</comments>
		<pubDate>Fri, 18 Jul 2008 10:00:14 +0000</pubDate>
		<dc:creator>Akash Mehta</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.developertutorials.com/blog/php/running-background-processes-in-php-349/</guid>
		<description><![CDATA[So you&#8217;ve just built a fantastic processing routine for your application. You&#8217;ve checked and double checked the integrity of user input, and you&#8217;re doing some serious processing. There&#8217;s only one problem: it&#8217;s too slow. There&#8217;s a simple solution: forking your processing script, and running the code as a background process asynchronously. It can email your [...]]]></description>
			<content:encoded><![CDATA[<p>So you&#8217;ve just built a fantastic processing routine for your application. You&#8217;ve checked and double checked the integrity of user input, and you&#8217;re doing some serious processing. There&#8217;s only one problem: it&#8217;s too slow. There&#8217;s a simple solution: forking your processing script, and running the code as a background process asynchronously. It can email your user when it&#8217;s done: they&#8217;ll wait. In this tutorial, I&#8217;ll show you how to get started with background processes in PHP.<span id="more-349"></span></p>
<p>When we want some kind of background process running our PHP code, we have a simple challenge: we can&#8217;t leave it up to the client. On the web, people hit their stop button, their browsers lock up and they force quit, they even have the odd power outage. When we want to do complex processing on the server side, we need to detach from the client-server model of a web-served script. PHP can fork a script, but the parent script is still facing an unreliable client.</p>
<p>Our best option, then, is to launch a background process from the command line. There are three steps to this: starting the background script, passing it information to do its job, and checking when it&#8217;s finished.</p>
<p><strong>Starting the background script</strong><br />
On UNIX systems, we can easily call another PHP script via the shell, set it to run off in the background and send its output to /dev/null. Here&#8217;s a sample:</p>

<div class="wp_syntax"><div class="code"><pre class="php"><span style="color: #990000;">exec</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/usr/bin/php proc.php &gt;/dev/null &amp;#038;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Here, we call the <code>exec</code> function; instructing it to run our local PHP binary - usually at /usr/bin/php or /usr/local/bin/php, check with your host/sysadmin. We pass it a single argument: the filename of the PHP script that handles our background process. We then send the output to /dev/null, effectively destroying it. The last character, the &amp; symbol, is important - this tells the system to start this process in the background and to let us continue.</p>
<p><strong>Talking to the background process</strong><br />
It&#8217;s all very well to start a background process, but now it needs to know what to do. We handle this through command line arguments. Let&#8217;s update the previous example:</p>

<div class="wp_syntax"><div class="code"><pre class="php"><span style="color: #990000;">exec</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/usr/bin/php proc.php --task=50 &gt;/dev/null &amp;#038;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Our proc.php file might look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="php"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #990000;">echo</span> <span style="color: #0000ff;">&quot;Handling process &quot;</span><span style="color: #339933;">.</span><span style="color: #000033;">$argv</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Running &#8220;php proc.php &#8211;task=50&#8243; on command line produces the following output:</p>
<pre>Handling process --task=50</pre>
<p>From here, you can easily design your script to do what it needs to.</p>
<p><strong>Monitoring the background process</strong><br />
There&#8217;s just one last detail: how do we monitor the progress of our background process? It&#8217;s best to use an independent datastore that can be relied upon, instead of communicating with running threads - your application&#8217;s MySQL database would be perfect. You can create a &#8220;sessions&#8221; or &#8220;jobs&#8221; table with an ID column, a status column (started, in progress, finished - 0, 1, 2), and any other information you need. Before you start your background process, create a new entry in this table and check the insert ID, then pass it to the background process when you start it:</p>

<div class="wp_syntax"><div class="code"><pre class="php"><span style="color: #990000;">exec</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/usr/bin/php proc.php --some_info=50 --job=1234 &gt;/dev/null &amp;#038;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Your proc.php file can then update the table row with the ID you supply it, and your front end applications can provide status updates to end users by checking up on all pending jobs for the current user - relatively straightforward business logic.</p>
<p>If you&#8217;re going to be running many background processes, a job queue and an &#8220;always-on&#8221; script running on your server may also be an option. In this case, consider looking into <a href="http://php.net/pcntl_fork">pcntl_fork()</a> and the <a href="http://www.developertutorials.com/php-manual/ref.exec.html">program execution functions</a>.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d349').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d349" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.developertutorials.com/blog/php/running-background-processes-in-php-349/&amp;title=Running+background+processes+in+PHP" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.developertutorials.com/blog/php/running-background-processes-in-php-349/&amp;title=Running+background+processes+in+PHP" title="Add to&nbsp;digg"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http://www.developertutorials.com/blog/php/running-background-processes-in-php-349/&amp;title=Running+background+processes+in+PHP" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://www.developertutorials.com/blog/php/running-background-processes-in-php-349/&amp;title=Running+background+processes+in+PHP" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d349').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.developertutorials.com/blog/php/running-background-processes-in-php-349/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Testing email routines in web applications</title>
		<link>http://www.developertutorials.com/blog/web/testing-email-routines-in-web-applications-348/</link>
		<comments>http://www.developertutorials.com/blog/web/testing-email-routines-in-web-applications-348/#comments</comments>
		<pubDate>Tue, 15 Jul 2008 09:00:53 +0000</pubDate>
		<dc:creator>Akash Mehta</dc:creator>
		
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.developertutorials.com/blog/web/testing-email-routines-in-web-applications-348/</guid>
		<description><![CDATA[For any web developer that&#8217;s ever had to build a signup routine, email is the necessary evil that takes pride of place among hated activities. Sure, a simple call to the language&#8217;s mail library will send a message through, but the moment the boss wants a HTML email, or users need attachments, everything starts to [...]]]></description>
			<content:encoded><![CDATA[<p>For any web developer that&#8217;s ever had to build a signup routine, email is the necessary evil that takes pride of place among hated activities. Sure, a simple call to the language&#8217;s mail library will send a message through, but the moment the boss wants a HTML email, or users need attachments, everything starts to get tricky. To top things off, automating testing of an email routine can be near impossible with the usual tools. Today we&#8217;ll look at some of the options for testing email routines in web applications.<span id="more-348"></span></p>
<p>The signup validation is the bane of a web application - despite disposable emails more and more common, site owners and sales staff continue to insist on tying an email address to every user. The validation email, a common task for web developers, can quickly take up far more development time than it involves user time. Making the process of building and maintaining email routines as efficient as possible is simple better for everybody.</p>
<p>The challenge is this: an email, once sent, is not actually sent. For example, when PHP&#8217;s mail() function returns true, it simply means that the message has been passed on to the system&#8217;s mail server and received succesfully. The actual email could be sent many hours later, or never at all.</p>
<p><a href="http://www.lastcraft.com/fakemail.php" target="_blank">Fakemail</a>, from the creators of <a href="http://www.developertutorials.com/blog/php/simpletest-unit-testing-for-php-332/">SimpleTest</a>, is a mail server gateway of sorts, in that it replaces your local mail server for momentarily. When an email is sent on the machine, Fakemail will pick it up and divert it to a predictable location on the filesystem.</p>
<p>We can then create reliable email systems in three easy steps:</p>
<p>1. Build a single, common email routine for the application<br />
2. Run the email routine during build tests<br />
3. Check the email was sent</p>
<p><strong>Building a common email routine</strong><br />
This is the single most important factor. As your email routines grow in complexity beyond a single call to a native language API, it&#8217;s important that all your email routines use the same final message sending code, if not exactly the same emailing system altogether. For PHP, I recommend the PEAR mailing classes.</p>
<p><strong>Run the email routine during build tests</strong><br />
Use <a href="http://www.developertutorials.com/blog/php/phing-a-build-system-for-php-249/">Phing</a> to automate your build process, if only to make sure you run your unit tests every time. Then use <a href="http://www.developertutorials.com/blog/php/simpletest-unit-testing-for-php-332/">SimpleTest</a> or PHPUnit (or even <a href="http://www.developertutorials.com/blog/web/selenium-ide-front-end-web-application-testing-322/">Selenium</a>) to start Fakemail and then run the signup (or similar) routine, causing an email to be sent.</p>
<p><strong>Check the email was sent</strong><br />
Finally, use a unit test or other server-side script to verify that the email was sent: assert that Fakemail created a particular file e.g. templaterecipient@localhost.1 will be created for the first email sent to templaterecipient@localhost.</p>
<p>Fakemail coexists happily with unit testing; in fact, the project website offers sample code for SimpleTest, useful for PHP developers. A similar routine in other web stacks should be fairly trivial to setup; the SimpleTest unit test is barely 20 lines long.</p>
<p>Testing email is not hard, and it can save a lot of stress later. To get started with Fakemail, just check out the extensive tutorial on <a href="http://www.lastcraft.com/fakemail.php">the project page</a>.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d348').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d348" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.developertutorials.com/blog/web/testing-email-routines-in-web-applications-348/&amp;title=Testing+email+routines+in+web+applications" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.developertutorials.com/blog/web/testing-email-routines-in-web-applications-348/&amp;title=Testing+email+routines+in+web+applications" title="Add to&nbsp;digg"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http://www.developertutorials.com/blog/web/testing-email-routines-in-web-applications-348/&amp;title=Testing+email+routines+in+web+applications" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://www.developertutorials.com/blog/web/testing-email-routines-in-web-applications-348/&amp;title=Testing+email+routines+in+web+applications" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d348').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.developertutorials.com/blog/web/testing-email-routines-in-web-applications-348/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Turn Your Wordpress Blog into a Social Network</title>
		<link>http://www.developertutorials.com/blog/design/turn-your-wordpress-blog-into-a-social-network-347/</link>
		<comments>http://www.developertutorials.com/blog/design/turn-your-wordpress-blog-into-a-social-network-347/#comments</comments>
		<pubDate>Mon, 14 Jul 2008 16:54:45 +0000</pubDate>
		<dc:creator>JonGos</dc:creator>
		
		<category><![CDATA[Design]]></category>

		<category><![CDATA[WordPress]]></category>

		<category><![CDATA[network]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[social]]></category>

		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.developertutorials.com/blog/design/turn-your-wordpress-blog-into-a-social-network-347/</guid>
		<description><![CDATA[
Wordpress is a CMS that was built for blogging but many people have repurposed it for magazines, newspapers, blog networks and all sorts of other goodies!  But did you know you can hack your Wordpress blog to be a no-cost solution for a social network?  Well you can, and here&#8217;s fifteen plug-ins that [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.command-tab.com/" target="_blank"><img src="http://www.command-tab.com/images/wordpress/halo_wordpress.jpg"></a></p>
<p>Wordpress is a CMS that was built for blogging but many people have repurposed it for magazines, newspapers, blog networks and all sorts of other goodies!  But did you know you can hack your Wordpress blog to be a no-cost solution for a social network?  Well you can, and here&#8217;s fifteen plug-ins that will let you do it.</p>
<p><span id="more-347"></span></p>
<p>1. <a href="http://wordpress.org/extend/plugins/wp-gravatar/"  target="_blank">WP-Gravatar</a><br />
Install WP-Gravatar for adding &#8216;faces&#8217; to your members and your writers.  This plugin lets you use Gravatar, MyBlogLog, OpenAvatar, Wavatar, Identicon, monsterID or Favico.ico files with your comments.  Gives you a Widget with your profile info and your gravatar. Let&#8217;s you set your own CSS style to use with the Comments section and the author about box.</p>
<p>2. <a href="http://wordpress.org/extend/plugins/ajaxd-wordpress/"  target="_blank">Ajaxed Wordpress</a><br />
A highly customizable plugin to add AJAX to your blog. AWP uses AJAX to load posts inline, paginate posts, load and submit comments, and more.  For that Web 2.0 look and feel.</p>
<p>3. <a href="http://wordpress.org/extend/plugins/members-only/" target="_blank">Members Only</a><br />
A WordPress plugin that allows you to make your WordPress blog only viewable to visitors that are logged in.  This is good for protecting your user&#8217;s data and your blog content.</p>
<p>4. <a href="http://wordpress.org/extend/plugins/profiles/" target="_blank">Profiles</a><br />
Profiles allows the easy display and management of personal profiles / biographies, or any other similarly periodic information. In particular, it adds a &#8220;profiles&#8221; tab to the management section and allows you to easily edit information about the profiles as well as associate an image (with optional watermark) with each profile.</p>
<p>5. <a href="http://wordpress.org/extend/plugins/wp-super-cache/" target="_blank">WP Super Cache</a><br />
A very fast caching engine for WordPress that produces static html files.  When your network does start to receive high levels of traffic, you&#8217;ll need this to prevent your site from going down.</p>
<p>6. <a href="http://wordpress.org/extend/plugins/post-plugin-library/" target="_blank">Post-Plugin Library</a><br />
Makes calling Similar posts, Recent Posts, Random Posts and Recent Comments easier.  </p>
<p>7. <a href="http://wordpress.org/extend/plugins/exec-php/" target="_blank">Exec PHP</a><br />
This plug-in is a godsend!  It allows you to add PHP markup to wordpress pages and posts.  This will give you even greater control over how wordpress looks and acts, allowing you customize with no restriction.</p>
<p>8. <a href="http://wordpress.org/extend/plugins/quick-sms/" target="_blank">Quick SMS</a><br />
This will allow visitors to send SMS messages to blog owners.  It would be ideal for a WordpressMU network as it would allow everyone to stay in constant contact with each other.  Could also be hacked to create a &#8220;twitter&#8221;-like service for all members.</p>
<p>9. <a href="http://wordpress.org/extend/plugins/umapper/" target="_blank">UMapper</a><br />
UMapper plugin is universal mapping platform, which makes it a snap to create engaging maps and add them to your blog posts. Microsoft Virtual Earth, Google Maps, OpenStreet - all are supported by this truly universal (hence the name UMapper - Universal Mapper) plugin.</p>
<p>10. <a href="http://wordpress.org/extend/plugins/invite-friends/" target="_blank">Invite Friends</a><br />
This plugins main goal was to provide the ability to any of your registered users, to invite more people to the community.</p>
<p>11. <a href="http://wordpress.org/extend/plugins/nextgen-gallery/" target="_blank">NextGen Gallery</a><br />
Very customizable Gallery option for Wordpress.  Turn your blog into a mini &#8216;Flickr&#8217;!</p>
<p>12. <a href="http://wordpress.org/extend/plugins/wp-popup-scheduler/">Popup Scheduler</a><br />
If used correctly, a popup is always the best way to achieve great results (be it in sales or subscription rate). It is also the best tool to grab your readers attention. This plugin allow you to customize and schedule a popup to show according to various situation. 1) You can schedule a popup to show a welcome message whenever a new visitor arrives at your site 2) You can schedule a popup to show on the readers returned visit to thank them for reading your blog and invite them to subscribe to your feed/email update. 3) If there is any major changes to your website, you can show a popup to inform your readers of the changes 4) If you are selling products on your blog, you can schedule a popup whenever you have a new product launch 5) During a campaign (such as charity donation drive, blogathon etc), you can schedule a popup to show for a number of days to increase the awareness of the campaign. and many more&#8230;</p>
<p>13. <a href="http://wordpress.org/extend/plugins/sabre/" target="_blank">SABRE</a><br />
Sabre is an acronym for Simple Anti Bot Registration Engine. It&#8217;s a set of counter measures against spam registration on your blog.</p>
<p>14. <a href="http://wordpress.org/extend/plugins/wordpress-dashboard-editor/" target="_blank">Dashboard Editor</a><br />
This plugin allows you to add whatever you want to the Wordpress dashboard through PHP and HTML even Sidebar Widgets. You can also wipe the entire dashboard or individually remove some of the more irritating sections like the Dev news, Planet Wordpress and the getting started section.  This allows for the creation of custom designs for the back end to hide the fact that you&#8217;re even using Wordpress!</p>
<p>15. <a href="http://wordpress.org/extend/plugins/sezwho/" target="_blank">SezWho</a><br />
SezWho is a distributed context, rating and reputation system for social media sites like blogs, forums, wikis, video/picture sharing sites, discussion boards and anywhere else where people collaborate on the web.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d347').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d347" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.developertutorials.com/blog/design/turn-your-wordpress-blog-into-a-social-network-347/&amp;title=Turn+Your+Wordpress+Blog+into+a+Social+Network" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.developertutorials.com/blog/design/turn-your-wordpress-blog-into-a-social-network-347/&amp;title=Turn+Your+Wordpress+Blog+into+a+Social+Network" title="Add to&nbsp;digg"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http://www.developertutorials.com/blog/design/turn-your-wordpress-blog-into-a-social-network-347/&amp;title=Turn+Your+Wordpress+Blog+into+a+Social+Network" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://www.developertutorials.com/blog/design/turn-your-wordpress-blog-into-a-social-network-347/&amp;title=Turn+Your+Wordpress+Blog+into+a+Social+Network" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d347').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.developertutorials.com/blog/design/turn-your-wordpress-blog-into-a-social-network-347/feed/</wfw:commentRss>
		</item>
		<item>
		<title>First Look at A.viary.com</title>
		<link>http://www.developertutorials.com/blog/design/first-look-at-aviarycom-346/</link>
		<comments>http://www.developertutorials.com/blog/design/first-look-at-aviarycom-346/#comments</comments>
		<pubDate>Mon, 14 Jul 2008 15:33:15 +0000</pubDate>
		<dc:creator>JonGos</dc:creator>
		
		<category><![CDATA[Design]]></category>

		<category><![CDATA[adobe]]></category>

		<category><![CDATA[aviary]]></category>

		<category><![CDATA[photoshop]]></category>

		<guid isPermaLink="false">http://www.developertutorials.com/blog/design/first-look-at-aviarycom-346/</guid>
		<description><![CDATA[One of the hottest application suites to hit the design community since Adobe was born is now upon us.  A.viay.com is a well executed visionary attempt at becoming the &#8216;CS3&#8242; of web apps.  And I&#8217;m not sure how it happened, but while Adobe wasn&#8217;t paying attention this group may have just snatched the [...]]]></description>
			<content:encoded><![CDATA[<p>One of the hottest application suites to hit the design community since Adobe was born is now upon us.  A.viay.com is a well executed visionary attempt at becoming the &#8216;CS3&#8242; of web apps.  And I&#8217;m not sure how it happened, but while Adobe wasn&#8217;t paying attention this group may have just snatched the market.</p>
<p>We all love web apps, as long as you&#8217;re connected they provide cheap, fast and less resource alternatives to desktop solutions.  On top of that they store your data in the cloud, a good place for it if your computer ever crashes or is stolen.  </p>
<p><a href='http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-17.png'><img src="http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-17-300x152.png" alt="" width="300" height="152" class="alignnone size-medium wp-image-333" /></a></p>
<p><span id="more-346"></span></p>
<p>My initial observations&#8230;</p>
<p><a href='http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-72.png'><img src="http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-72-300x215.png" alt="" width="300" height="215" class="alignnone size-medium wp-image-338" /></a></p>
<p><strong>1) It&#8217;s Built on Flex/Flash 9</strong><br />
One thing Adobe has got to be proud of is that so far it looks like all the A.viary apps are being built using many of their products like Flex, Flash and Coldfusion.  A while back I speculated that Adobe might simply try to buy these guys out rather than compete.  If that&#8217;s the case, A.viary did themselves a big favor by using an all Adobe back-end.</p>
<p><a href='http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-21.png'><img src="http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-21-300x190.png" alt="" width="300" height="190" class="alignnone size-medium wp-image-334" /></a></p>
<p><strong>2) It&#8217;s a Little Slow</strong><br />
One thing that&#8217;s always been annoying about Flash-based web apps is that the more robust of them take a long time to load.  This isn&#8217;t a huge concern but it us annoying.  They need to figure out a way to bench mark this app so that more of the loading happens while the user is operating the software, not waiting to use it.</p>
<p><a href='http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-82.png'><img src="http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-82-300x235.png" alt="" width="300" height="235" class="alignnone size-medium wp-image-339" /></a></p>
<p><strong>3) You can Import Images from the Web</strong><br />
I used to be a big fan of Picnik.com but now that they charge your separately than Flickr does for a Pro Account, not so much. Since I already own Photoshop, I don&#8217;t feel the need to pay to be able to do the same things in a web app.  That app should be free, even if it needs to run adds to pay for itself.  A.viary (for now) is 100% free and overs a bucketload of functionality over Picnik.</p>
<p><a href='http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-111.png'><img src="http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-111-300x280.png" alt="" width="300" height="280" class="alignnone size-medium wp-image-342" /></a></p>
<p><strong>4) It rethinks the &#8216;Work Window&#8217;</strong><br />
One flaw in a lot of new design software applications is that they either clone Adobe&#8217;s Photoshop or Corel&#8217;s Draw.  With A.viary things are reminiscent of existing operands but you can tell the designers tried to diversify a bit.  In the end the UI feels more like GIMP than Photoshop.</p>
<p><strong>5. Key commands Work</strong><br />
One of the things that makes this suite so useful is that key commands work as if it were truly a desktop app.  This definitely decreased the time it took me to get to know the software, and start using it to make something.</p>
<p><strong>6. Filters / Layers / Effects</strong><br />
Nothing new here, if you&#8217;ve used Adobe, you&#8217;ve used most of these before.  There are some unique ones though.  What the heck is Kuwahara?</p>
<p><a href='http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-131.png'><img src="http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-131-300x195.png" alt="" width="300" height="195" class="alignnone size-medium wp-image-344" /></a></p>
<p><strong>7. Undo is Fast</strong><br />
The system must cache your every step because Undo/Redo seems almost faster than most desktop apps!</p>
<p><a href='http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-141.png'><img src="http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-141-300x293.png" alt="" width="300" height="293" class="alignnone size-medium wp-image-345" /></a></p>
<p><strong>8. Saving is Public/Private</strong><br />
Saving your files takes a page out of the book of most web applications by allowing you either to save your files privately or in the public gallery of A.viary users for all to see.  You&#8217;re also given the option to allow others to edit.  This is cool but I wish there were more granular control.  For instance if, I wanted my friend Mike to collaborate with me on a design but not the whole world I&#8217;d be out of luck.</p>
<p>All in all the A.viary product line looks impressive and is poised to really disrupt the industry!</p>

<a href='http://www.developertutorials.com/blog/design/first-look-at-aviarycom-346/attachment/picture-17/' title='picture-17'><img src="http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-17-150x150.png" width="150" height="150" class="attachment-thumbnail" alt="" /></a>
<a href='http://www.developertutorials.com/blog/design/first-look-at-aviarycom-346/attachment/picture-21-2/' title='picture-21'><img src="http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-21-150x150.png" width="150" height="150" class="attachment-thumbnail" alt="" /></a>
<a href='http://www.developertutorials.com/blog/design/first-look-at-aviarycom-346/attachment/picture-61-2/' title='picture-61'><img src="http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-61-150x150.png" width="150" height="150" class="attachment-thumbnail" alt="" /></a>
<a href='http://www.developertutorials.com/blog/design/first-look-at-aviarycom-346/attachment/picture-72/' title='picture-72'><img src="http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-72-150x150.png" width="150" height="150" class="attachment-thumbnail" alt="" /></a>
<a href='http://www.developertutorials.com/blog/design/first-look-at-aviarycom-346/attachment/picture-82/' title='picture-82'><img src="http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-82-150x150.png" width="150" height="150" class="attachment-thumbnail" alt="" /></a>
<a href='http://www.developertutorials.com/blog/design/first-look-at-aviarycom-346/attachment/picture-9-2/' title='picture-9'><img src="http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-9-53x150.png" width="53" height="150" class="attachment-thumbnail" alt="" /></a>
<a href='http://www.developertutorials.com/blog/design/first-look-at-aviarycom-346/attachment/picture-101/' title='picture-101'><img src="http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-101-150x104.png" width="150" height="104" class="attachment-thumbnail" alt="" /></a>
<a href='http://www.developertutorials.com/blog/design/first-look-at-aviarycom-346/attachment/picture-111/' title='picture-111'><img src="http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-111-150x150.png" width="150" height="150" class="attachment-thumbnail" alt="" /></a>
<a href='http://www.developertutorials.com/blog/design/first-look-at-aviarycom-346/attachment/picture-121/' title='picture-121'><img src="http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-121-150x150.png" width="150" height="150" class="attachment-thumbnail" alt="" /></a>
<a href='http://www.developertutorials.com/blog/design/first-look-at-aviarycom-346/attachment/picture-131/' title='picture-131'><img src="http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-131-150x150.png" width="150" height="150" class="attachment-thumbnail" alt="" /></a>
<a href='http://www.developertutorials.com/blog/design/first-look-at-aviarycom-346/attachment/picture-141/' title='picture-141'><img src="http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-141-150x150.png" width="150" height="150" class="attachment-thumbnail" alt="" /></a>

<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d346').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d346" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.developertutorials.com/blog/design/first-look-at-aviarycom-346/&amp;title=First+Look+at+A.viary.com" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.developertutorials.com/blog/design/first-look-at-aviarycom-346/&amp;title=First+Look+at+A.viary.com" title="Add to&nbsp;digg"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http://www.developertutorials.com/blog/design/first-look-at-aviarycom-346/&amp;title=First+Look+at+A.viary.com" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://www.developertutorials.com/blog/design/first-look-at-aviarycom-346/&amp;title=First+Look+at+A.viary.com" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d346').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.developertutorials.com/blog/design/first-look-at-aviarycom-346/feed/</wfw:commentRss>
		</item>
		<item>
		<title>SimpleTest: Unit Testing for PHP</title>
		<link>http://www.developertutorials.com/blog/php/simpletest-unit-testing-for-php-332/</link>
		<comments>http://www.developertutorials.com/blog/php/simpletest-unit-testing-for-php-332/#comments</comments>
		<pubDate>Mon, 14 Jul 2008 14:00:06 +0000</pubDate>
		<dc:creator>Akash Mehta</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.developertutorials.com/blog/php/simpletest-unit-testing-for-php-332/</guid>
		<description><![CDATA[We recently looked at front-end testing of web applications with Selenium. Today, we&#8217;ll take another approach to testing your PHP applications: backend unit testing for your actual PHP code. As part of our posts on test driven development, here&#8217;s a quick intro to using SimpleTest to test your PHP applications.
SimpleTest is a PHP unit testing [...]]]></description>
			<content:encoded><![CDATA[<p>We recently looked at <a href="http://www.developertutorials.com/blog/web/selenium-ide-front-end-web-application-testing-322/">front-end testing of web applications with Selenium</a>. Today, we&#8217;ll take another approach to testing your PHP applications: backend unit testing for your actual PHP code. As part of our posts on test driven development, here&#8217;s a quick intro to using SimpleTest to test your PHP applications.<span id="more-332"></span></p>
<p><a href="http://simpletest.org/" target="_blank">SimpleTest</a> is a PHP unit testing and web testing framework along the lines of <a href="http://www.junit.org/">JUnit</a> and JWebUnit. It provides a comprehensive set of APIs for testing everything from your class methods to your SSL-secured authentication pages.</p>
<p>Unit testing in PHP generally validates that individual sections of your source code are functioning as expected. As your project grows, it&#8217;s hard to remember what each and every module is responsible for, especially with multiple developers. Unit tests help check that a function or method does what it&#8217;s meant to, and when run during a build process or around version control commits, can check that recent changes haven&#8217;t broken expected functionality.</p>
<p>Let&#8217;s look at a simple SimpleTest example:</p>

<div class="wp_syntax"><div class="code"><pre class="php"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SIMPLE_TEST'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'simpletest/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span>SIMPLE_TEST <span style="color: #339933;">.</span> <span style="color: #0000ff;">'autorun.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'arithmetic_class.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> TestOfArithmetic <span style="color: #000000; font-weight: bold;">extends</span> UnitTestCase <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">function</span> TestOfArithmetic<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000033;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">UnitTestCase</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Test of Arithmetic'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> testAddition<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000033;">$arithmetic</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Arithmetic<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000033;">$result</span> <span style="color: #339933;">=</span> <span style="color: #000033;">$arithmetic</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">add</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000033;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">assertEqual</span><span style="color: #009900;">&#40;</span><span style="color: #000033;">$result</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>SimpleTest provides PHP classes that serve as the ground work for unit testing. When we define a new unit test case - in this case, &#8220;TestOfArithmetic&#8221;, SimpleTest automatically works out what tests you&#8217;ve defined in order to run them. We then simple create new methods for our tests, run whatever logic we need, and use assert calls to check that we have achieved our expected outcome. In this case, we want to assert that the return value of Arithmetic::add(1, 1) equals 2.</p>
<p>This may seem rather lengthy for a single test, but additional tests can be added on in as little as a single line of code, and an entire application can be quickly checked for reliability with just a few hundred lines of unit tests. Once this is in place, we can run our unit tests by loading up this script in our browser, and if everything is in order, we see a nice and concise status page displaying the results of the tests.</p>
<p>Of course, why write tests after you write your application code, when you could write it sooner and sooner, and maybe even before? That&#8217;s the approach of test driven development (TDD) - SimpleTest is perfectly happy with writing tests for code that doesn&#8217;t exist yet. TDD, from one of the guys who created Extreme Programming (XP), basically involves writing tests to define the design of code, and then working away at the code till it passes the tests, and SimpleTest is a great way to achieve it in PHP.</p>
<p>SimpleTest is hosted on SourceForge, so <a href="http://sourceforge.net/projects/simpletest">head over and try it out</a>. They&#8217;ve also got <a href="http://simpletest.org/en/first_test_tutorial.html">a great tutorial</a> on their <a href="http://simpletest.org/">main project site</a>.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d332').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d332" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.developertutorials.com/blog/php/simpletest-unit-testing-for-php-332/&amp;title=SimpleTest%3A+Unit+Testing+for+PHP" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.developertutorials.com/blog/php/simpletest-unit-testing-for-php-332/&amp;title=SimpleTest%3A+Unit+Testing+for+PHP" title="Add to&nbsp;digg"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http://www.developertutorials.com/blog/php/simpletest-unit-testing-for-php-332/&amp;title=SimpleTest%3A+Unit+Testing+for+PHP" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://www.developertutorials.com/blog/php/simpletest-unit-testing-for-php-332/&amp;title=SimpleTest%3A+Unit+Testing+for+PHP" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d332').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.developertutorials.com/blog/php/simpletest-unit-testing-for-php-332/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Getting Started with ORM in PHP</title>
		<link>http://www.developertutorials.com/blog/php/getting-started-with-orm-in-php-331/</link>
		<comments>http://www.developertutorials.com/blog/php/getting-started-with-orm-in-php-331/#comments</comments>
		<pubDate>Mon, 14 Jul 2008 13:00:00 +0000</pubDate>
		<dc:creator>Akash Mehta</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.developertutorials.com/blog/php/getting-started-with-orm-in-php-331/</guid>
		<description><![CDATA[ORM, or Object Relational Mapping, is a database design approach that simplifies managing complex databases for programmers. Instead of direct database access, an ORM layer in a PHP framework can make &#8220;objects&#8221; stored in a database behave like actual objects from a programming perspective - for example, creating a new &#8220;car&#8221; stored in the database [...]]]></description>
			<content:encoded><![CDATA[<p>ORM, or Object Relational Mapping, is a database design approach that simplifies managing complex databases for programmers. Instead of direct database access, an ORM layer in a PHP framework can make &#8220;objects&#8221; stored in a database behave like actual objects from a programming perspective - for example, creating a new &#8220;car&#8221; stored in the database could involve a call to <code>$car->new()</code>. By abstracting actual database access, web development can be more productive and result in more reliable applications. Here&#8217;s a quick intro to ORM in PHP.<span id="more-331"></span></p>
<p>ORM brings data closer to a programming paradigm, where actual information is stored and accessed through interfaces that resemble actual objects. In PHP frameworks, this is typically achieved through the framework providing classes representing database information, that can then be manipulated as actual objects such as a car or a booking. This is almost always a level above actual database operations - when using an ORM layer, writing actual SQL queries is taken care of, although an understanding of how to is always helpful.</p>
<p>Let&#8217;s consider a simple database, consisting of users and posts. ORM defines relationships between objects (and in general, also between tables) where an object either has one or has many of another object. For example, a post might have one author, while an author would have many posts. By adding foreign keys to the actual database, and defining these simple relationships (usually hard-coded), an ORM layer can take care of working with related data.</p>
<p><a href="http://cakephp.org/">CakePHP</a>&#8217;s ORM layer is possibly one of the most used ORM layers of any PHP framework, and is a good example of how a simple ORM implementation should function. In Cake, when an author model is defined as having many posts, any calls to fetch a particular author will automatically fetch all posts related to that author. The entire database logic is taken care of, and instead of thinking in terms of SQL queries, we get to think in terms of actual objects.</p>
<p><a href="http://www.symfony-project.org/">Symfony</a> also has quite a nice ORM layer, although the symfony implementation is a little more hands-off, based around database design conventions and it&#8217;s YAML schema file approach. But you don&#8217;t need to be using a PHP framework to take advantage of ORM; the <a href="http://www.phpdoctrine.org/">Doctrine</a> project provides a powerful ORM layer that can be implemented on its own or within an MVC framework. Doctrine also provides an object-oriented SQL-like language to write database queries - the Doctrine Query Language is is great for complex object retrieval. <a href="http://propel.phpdb.org/trac/">Propel</a> is another popular option, and is actually the ORM layer behind Symfony.</p>
<p>At the end of the day, ORM provides a fundamental advantage over writing raw SQL queries: it&#8217;s designed to retrieve information, not record sets. While thinking about data in terms of objects is a major paradigm shift from hands-on PHP scripting, it&#8217;s a great way to deal with the challenge of complex databases. So what are you waiting for? Grab <a href="http://cakephp.org/">a</a> <a href="http://www.symfony-project.org/">framework</a> or <a href="http://www.phpdoctrine.org/">a</a> <a href="http://propel.phpdb.org/trac/">library</a>, and dive in to the world of ORM.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d331').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d331" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.developertutorials.com/blog/php/getting-started-with-orm-in-php-331/&amp;title=Getting+Started+with+ORM+in+PHP" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.developertutorials.com/blog/php/getting-started-with-orm-in-php-331/&amp;title=Getting+Started+with+ORM+in+PHP" title="Add to&nbsp;digg"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http://www.developertutorials.com/blog/php/getting-started-with-orm-in-php-331/&amp;title=Getting+Started+with+ORM+in+PHP" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://www.developertutorials.com/blog/php/getting-started-with-orm-in-php-331/&amp;title=Getting+Started+with+ORM+in+PHP" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d331').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.developertutorials.com/blog/php/getting-started-with-orm-in-php-331/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Create a Custom Firefox Search Tool in Five Minutes</title>
		<link>http://www.developertutorials.com/blog/general/create-a-custom-firefox-search-tool-in-five-minutes-325/</link>
		<comments>http://www.developertutorials.com/blog/general/create-a-custom-firefox-search-tool-in-five-minutes-325/#comments</comments>
		<pubDate>Sun, 13 Jul 2008 13:47:16 +0000</pubDate>
		<dc:creator>JonGos</dc:creator>
		
		<category><![CDATA[General]]></category>

		<category><![CDATA[code]]></category>

		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[search]]></category>

		<guid isPermaLink="false">http://www.developertutorials.com/blog/general/create-a-custom-firefox-search-tool-in-five-minutes-325/</guid>
		<description><![CDATA[site:yourblogname.com searchterm
This is an example how to search your blog as a query in Google.  But have you ever wanted to learn how to make your own &#8216;Search Tools&#8217; for Firefox so that you can look-up information on your own blog quickly, from anywhere on the internet? Or do you want to hack Google [...]]]></description>
			<content:encoded><![CDATA[<p><code>site:yourblogname.com searchterm</code></p>
<p>This is an example how to search your blog as a query in Google.  But have you ever wanted to learn how to make your own &#8216;Search Tools&#8217; for Firefox so that you can look-up information on your own blog quickly, from anywhere on the internet? Or do you want to hack Google Custom search to improve your earnings and it&#8217;s functionality?</p>
<p><a href='http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-13.png'><img src="http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-13-300x104.png" alt="" width="300" height="104" class="alignnone size-medium wp-image-327" /></a></p>
<p><span id="more-325"></span></p>
<p>It turns out making a search tool is relatively simple.  In fact using <a href="http://ready.to/search/en/#">this tool</a>, you can make one in about five minutes.  The trick is to figure out what a search query on your blog looks like.  For Wordpress users, it might look like this:</p>
<p><code>http://yourblog.com/blog/?s=news&amp;search=Search</code></p>
<p>This is important because you&#8217;ll notice the form asks you for a <strong>front of search term</strong> and a <strong>back of search term</strong>.  The query itself should be left out so that your users can enter whatever they want.  Let&#8217;s dissect the search query&#8230;.</p>
<p>FRONT<br />
<code>http://yourblog.com/blog/?s=</code></p>
<p>QUERY<br />
<code>news</code></p>
<p>BACK<br />
<code>&amp;search=Search</code></p>
<p>Your own search queries may look a bit different than this depending upon the software you use.  To get the query preform a search using the GUI and then copy and paste the query from the navigation bar.  </p>
<p><a href='http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-2.png'><img src="http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-2-300x24.png" alt="" width="300" height="24" class="alignnone size-medium wp-image-326" /></a></p>
<p>If you&#8217;re using Google custom search, you&#8217;ll notice that the query looks very different.  This is because they use identifiers to keep track of revenues earned from custom search.  Now, I have no idea if hacking their custom code is a violation of TOS but I&#8217;ve done it, it works but since it&#8217;s questionable I can&#8217;t flat out explain what to do here.  Instead, we&#8217;ll create one using the Wordpress specific query&#8230;.</p>
<p><a href='http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-81.png'><img src="http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-81-300x213.png" alt="" width="300" height="213" class="alignnone size-medium wp-image-328" /></a></p>
<p>Ready.to then creates the XML file needed to add custom search to your top navigation bar.  You can see where it puts the tool below:</p>
<p><a href='http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-71.png'><img src="http://www.developertutorials.com/blog/wp-content/uploads/2008/07/picture-71-253x300.png" alt="" width="253" height="300" class="alignnone size-medium wp-image-330" /></a></p>
<p>Notice that I now have custom search option added to my Firefox Toolbar.  That&#8217;s great, you&#8217;ve got an XML file, however if you upload the file to your blog and link to it, Firefox won&#8217;t know to execute the script.  To do that you need to add a bit of javascript code to the header of your site and use another custom query for linking.</p>
<p><code>&lt;script type="text/javascript"&gt;<br />
&lt;!--<br />
function addp(csurl) {<br />
try {<br />
window.external.AddSearchProvider(csurl);<br />
} catch (e) {<br />
alert("You need to use Internet Explorer (7.0 or later)<br />
or Firefox (2.0 or later) to install the OpenSearch plug-in.");<br />
}}<br />
//--&gt;<br />
&lt;/SCRIPT&gt;</code></p>
<p>That script tells the browser what to do with the .xml file.  Now we need to tell Firefox where to find it, and that it&#8217;s an executable and not just a linked file.  We do this with the <strong>addp</strong> request defined in the header script&#8230;</p>
<p><code><br />
&lt;a href="#" onClick="addp(&quot;http://developertutorials.com/blog/DevTut.xml&quot;);"&gt;</code></p>
<p>This tells the browser that the file is executable, the script tells FireFox what to do with that executable (add it to the toolbar).</p>
<p>That&#8217;s it, if everything went well you&#8217;ve created a custom search tool for Firefox in about five minutes.  You can get the Developer Tutorial Firefox Search Tool <a href="http://appfrica.net/blog/test145">here</a>.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d325').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d325" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.developertutorials.com/blog/general/create-a-custom-firefox-search-tool-in-five-minutes-325/&amp;title=Create+a+Custom+Firefox+Search+Tool+in+Five+Minutes" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.developertutorials.com/blog/general/create-a-custom-firefox-search-tool-in-five-minutes-325/&amp;title=Create+a+Custom+Firefox+Search+Tool+in+Five+Minutes" title="Add to&nbsp;digg"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http://www.developertutorials.com/blog/general/create-a-custom-firefox-search-tool-in-five-minutes-325/&amp;title=Create+a+Custom+Firefox+Search+Tool+in+Five+Minutes" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://www.developertutorials.com/blog/general/create-a-custom-firefox-search-tool-in-five-minutes-325/&amp;title=Create+a+Custom+Firefox+Search+Tool+in+Five+Minutes" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d325').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.developertutorials.com/blog/general/create-a-custom-firefox-search-tool-in-five-minutes-325/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How to Follow Design Tutorials</title>
		<link>http://www.developertutorials.com/blog/design/how-to-follow-design-tutorials-324/</link>
		<comments>http://www.developertutorials.com/blog/design/how-to-follow-design-tutorials-324/#comments</comments>
		<pubDate>Sun, 13 Jul 2008 12:46:08 +0000</pubDate>
		<dc:creator>JonGos</dc:creator>
		
		<category><![CDATA[Design]]></category>

		<category><![CDATA[tutorial]]></category>

		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.developertutorials.com/blog/design/how-to-follow-design-tutorials-324/</guid>
		<description><![CDATA[
Image via Wikipedia
Are people getting spoiled?  
In the last two years or so, the number of free design &#8216;instruction&#8217; and resource sites has exploded.  Unfortunately, a lot of people seem to think we live in the Matrix, where ideas can just be downloaded into their heads.  Well, it&#8217;s 2008 and they haven&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p><span class="zemanta-img" style="right"><a href="http://en.wikipedia.org/wiki/Image:The_Matrix_Poster.jpg"><img src="http://upload.wikimedia.org/wikipedia/en/thumb/c/c1/The_Matrix_Poster.jpg/202px-The_Matrix_Poster.jpg" alt="poster for The Matrix" style="block;"></a><br />
<span class="zemanta-img-attribution" style="right;">Image via <a href="http://en.wikipedia.org/wiki/Image:The_Matrix_Poster.jpg">Wikipedia</a></span></span></p>
<p><strong>Are people getting spoiled?</strong>  </p>
<p>In the last two years or so, the number of free design &#8216;instruction&#8217; and resource sites has exploded.  Unfortunately, a lot of people seem to think we live in the Matrix, where ideas can just be downloaded into their heads.  Well, it&#8217;s 2008 and they haven&#8217;t invented that technology yet. Until they do we still have to <em>work</em> to come up with new ideas and to learn how to best execute them.</p>
<p><span id="more-324"></span></p>
<p>It takes a little bit of time and experimentation to understand design effects, not just <em>how to do them</em>, but why one might use them and when to use one effect versus another.  Every good designer has a &#8216;method to their madness&#8217; and it&#8217;s important to try to get into the same headspace as your favorite designer.  This means relaxing a bit an realizing that you may not get everything right the first time, or you may spend a few hours Googling around trying to get everything to make sense.  <a href="http://vandelaydesign.com/blog/design/learning-from-other-designers/">Vandelay Design</a> has some good advice:</p>
<blockquote cite="http://vandelaydesign.com/blog/design/learning-from-other-designers/"><p>One of the things that I like about web design is that there’s always plenty to learn, regardless of how experienced you are. I know that my knowledge really only scratches the surface of web design and development, and I appreciate the fact that seemingly unlimited resources are available to allow me to become a better designer.</p>
<p>The design community is filled with sources of inspiration and helpful sites for encouraging growth in abilities. Each of us needs to take our own unique approach to personal development that works for us.</p>
</blockquote>
<p>In my post &#8216;<a href="http://www.developertutorials.com/blog/design/photoshop-design/the-tutorial-for-all-tutorials-163/">The Tutorial for all Tutorials</a>&#8216;, I listed the rules I try to follow when making good design tutorials.  Now I&#8217;m going to share advice on how to follow them&#8230;</p>
<p><strong>1. Learn Fundamentals</strong><br />
When you&#8217;re trying to follow a tutorial about how to turn your little brother into giant <strong>Robeast</strong> in Photoshop it might help to know what the difference between the burn tool and the shadow tool.  Because design tutorials are so common these days, some writers are going to assume a lot about their audience.  This means they may not list every single step because they assume some people will be able to follow them regardless.  I know this because occasionally <a href="http://www.developertutorials.com/blog/design/photoshop-design/creating-energy-spheres-in-photoshop-119/">I&#8217;m guilty of it</a>.  No matter what, you simply aren&#8217;t the best designer you can be if you don&#8217;t at least try learn the basics of your craft.  So if you don&#8217;t already know, learn what the <a href="http://simplephotoshop.com/photoshop_tools/index.htm" rel="bookmark">photoshop tools</a> do.</p>
<p><strong>2.  Know when You&#8217;re Out of Your League</strong><br />
It never hurts to ask questions.  A few people may ridicule you or they may ignore you or they may be a little hard on you.   That&#8217;s okay because your asking the question didn&#8217;t do anything but show your dedication to getting things right.  However, rather than emailing the writer directly, why not post your thoughts as a comment?  Essentially by reading design tutorial blogs we are crowd sourcing instruction, why not also crowd source support for those tutorials?  If you post comments on <a href="http://developertutorials.com/">developertutorials.com</a> or <a href="http://gosdot.com/unity/category/creative/">my other blog</a> rest assured, someone will answer them.  It also takes the pressure off the tutorial writer because they know they don&#8217;t have to answer the same question fifteen times.</p>
<p><strong>3. Reread Before You Give Up</strong><br />
The other day I was having some trouble <a href="http://www.developertutorials.com/blog/design/subversion-workflow-for-designers-pt-1-231/">figuring out Subversion</a>.  I was following a tutorial but for some reason at the time everything was coming out greek and I could not figure out the techniques I was trying to learn.  I didn&#8217;t give up, I didn&#8217;t ask questions but somehow I still got everything working.  How?  I walked away.</p>
<p>The next day I came back and followed the same tutorial word for word and it worked.  The only thing that had changed between the first day and the second day was me.  I had new perspective and things started to make sense that hadn&#8217;t before.  I realized I had skipped a few words that turned out to be critical, I had misinterpreted other sections and a few things I was able to guess at.  Remember when your people used to tell you to put a study sheet <em>under your pillow</em> the night before an exam?  This is because, contrary to popular belief, you still <strong>think</strong> in your sleep and sometimes the subconscious can solve problems passively without your being aware.</p>
<p><strong>4. You Do Not Suck at Photoshop</strong><br />
No matter what your profession or hobby is, if you aren&#8217;t confident about your own prowess, people are less-likely to believe in you. In &#8220;<a href="http://www.developertutorials.com/blog/design/five-point-form-mastering-professionalism-as-a-freelance-designer-135/">Five Point Form: Mastering Professionalism as a Freelance Designer</a>&#8221; I talked about this a bit&#8230;</p>
<blockquote cite="http://www.developertutorials.com/blog/design/five-point-form-mastering-professionalism-as-a-freelance-designer-135/"><p>Another thing I’ve learned is that most people are completely incapable from recognizing real talent from anything else that might be put in front of them. If they aren’t designers, they don’t think like designers and they don’t really know what makes one designer better than another. Thus, they need to be convinced. I’ve seen people who choose horrible color palettes and layouts make upwards of $10K while people making photoshop designs that are nothing short of brilliant make pennies. The average client is waiting on you to tell them that you’re great, that you know your stuff and to prove it to the best of their understanding. This is why presenting yourself with confidence (not arrogance) is key to getting class “A” projects.</p>
</blockquote>
<p>The bottom line is you need to muster up confidence, this will lead to trying new things and making bold creative decisions that can&#8217;t be taught.  So <a href="http://www.mydamnchannel.com/Big_Fat_Brain/You_Suck_at_Photoshop/YouSuckatPhotoshop1_398.aspx">don&#8217;t believe the hype</a>, you do not suck a photoshop! </p>
<p>Ultimately, we all need to be patient with each other.  If a tutorial isn&#8217;t 100% up to par, don&#8217;t try to demean the person who is essentially offering a free service.  Make suggestions.  A few people have asked me flat out to revisit my posts on how to <a href="http://www.developertutorials.com/blog/design/designing-and-coding-a-wordpress-theme-from-scratch-part-1-143/">Design a Wordpress Tutorial from Scratch</a>.  They were polite, and brought up valid critiques that made me realize I didn&#8217;t cover things as well as I should have.  As a result I&#8217;ll be revisiting that series later this month.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d324').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d324" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.developertutorials.com/blog/design/how-to-follow-design-tutorials-324/&amp;title=How+to+Follow+Design+Tutorials" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.developertutorials.com/blog/design/how-to-follow-design-tutorials-324/&amp;title=How+to+Follow+Design+Tutorials" title="Add to&nbsp;digg"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http://www.developertutorials.com/blog/design/how-to-follow-design-tutorials-324/&amp;title=How+to+Follow+Design+Tutorials" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://www.developertutorials.com/blog/design/how-to-follow-design-tutorials-324/&amp;title=How+to+Follow+Design+Tutorials" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d324').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.developertutorials.com/blog/design/how-to-follow-design-tutorials-324/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Selenium IDE: Front-end web application testing</title>
		<link>http://www.developertutorials.com/blog/web/selenium-ide-front-end-web-application-testing-322/</link>
		<comments>http://www.developertutorials.com/blog/web/selenium-ide-front-end-web-application-testing-322/#comments</comments>
		<pubDate>Fri, 11 Jul 2008 09:00:22 +0000</pubDate>
		<dc:creator>Akash Mehta</dc:creator>
		
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.developertutorials.com/blog/web/selenium-ide-front-end-web-application-testing-322/</guid>
		<description><![CDATA[Ever setup a demo for a client, only to find you had a syntax error in one of the key files? Or maybe you&#8217;ve forgotten to setup the database on the staging server and your boss is staring at a screen of MySQL errors. In this tutorial, I&#8217;ll show you how to put together a [...]]]></description>
			<content:encoded><![CDATA[<p>Ever setup a demo for a client, only to find you had a syntax error in one of the key files? Or maybe you&#8217;ve forgotten to setup the database on the staging server and your boss is staring at a screen of MySQL errors. In this tutorial, I&#8217;ll show you how to put together a simple frontend-based test suite using Selenium, to help identify these issues sooner than later.<span id="more-322"></span></p>
<p>The Selenium project provides a set of tools to handle the testing of web applications. Selenium itself is simply a portable software testing framework, where the tests can be written in HTML or a programming/scripting language. The difference with Selenium is that tests are run directly within a web browser, &#8220;just like real users do.&#8221;</p>
<p>As a result, Selenium are very much oriented towards client-side results. For example, one of the simplest tests you can run in Selenium is loading a URL and checking if a certain snippet of text is or isn&#8217;t on the page. Selenium offers a number of applications built around the same standard, but we&#8217;re interested in Selenium IDE, a Firefox extension that allows tests to be developed and run from within Firefox with no additional software installation.</p>
<p>To get started with Selenium, just head over to <a href="https://addons.mozilla.org/firefox/2079/">the addon page to download Selenium IDE</a>. Once you&#8217;ve installed it, restart Firefox and find Selenium in your Tools menu. Load it up, and find an application you want to practice on - one of your pet projects, maybe, or a website you frequently visit. Because Selenium runs on top of a standard web browser, it doesn&#8217;t care what you test, as long as it has HTML to work with.</p>
<p>The moment you start Selenium IDE, it starts recording commands. Selenium testing is composed of &#8220;test suites&#8221;, of which you may have one per application. Each suite includes cases, one of which has been created already and helpfully titled &#8220;Untitled&#8221;, and each cases consists of a series of commands to be executed in succession. When you start navigating around the current page, Selenium IDE will add those navigation procedures to the current test case, so that they can be replayed at a later stage. Start by clicking on a link; you&#8217;ll see a &#8220;clickAndWait&#8221; appear in the table panel of your Selenium window.</p>
<p>To create your Selenium tests, you can simply navigate around your website while recording. Selenium records everything from clicking links to entering data in input fields and submitting forms. To stop recording, hit the red circle in the top-right. At a basic level, this tests that your pages are being served correctly. You can then add in commands within the table - I suggest starting with &#8220;verifyTextPresent&#8221; to check if a snippet of text is found within the page (expressions allowed).</p>
<p>Once you&#8217;re finished, your test window might look something like this:</p>
<p><img src="http://www.developertutorials.com/blog/wp-content/uploads/2008/07/selenium1.png" alt="" title="Selenium IDE Test Window" width="400" height="429" class="alignnone size-full wp-image-323" /></p>
<p>To run your tests, just hit the green play buttons - you may need to slow down Selenium to wait for pages to load if you&#8217;re running tests over the internet. Remember that some of Selenium&#8217;s tests are based on the DOM, and will fail if the DOM hasn&#8217;t loaded yet even if the application is running fine.</p>
<p>To save your tests to run them later, just use the File menu. In future posts, we&#8217;ll look at more complex use of Selenium and the multitude of custom commands available. In the meantime, why not subscribe to our RSS feed?</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d322').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d322" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.developertutorials.com/blog/web/selenium-ide-front-end-web-application-testing-322/&amp;title=Selenium+IDE%3A+Front-end+web+application+testing" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.developertutorials.com/blog/web/selenium-ide-front-end-web-application-testing-322/&amp;title=Selenium+IDE%3A+Front-end+web+application+testing" title="Add to&nbsp;digg"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http://www.developertutorials.com/blog/web/selenium-ide-front-end-web-application-testing-322/&amp;title=Selenium+IDE%3A+Front-end+web+application+testing" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://www.developertutorials.com/blog/web/selenium-ide-front-end-web-application-testing-322/&amp;title=Selenium+IDE%3A+Front-end+web+application+testing" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d322').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.developertutorials.com/blog/web/selenium-ide-front-end-web-application-testing-322/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Migrating legacy PHP 4 applications to PHP 5</title>
		<link>http://www.developertutorials.com/blog/javascript/migrating-legacy-php-4-applications-to-php-5-320/</link>
		<comments>http://www.developertutorials.com/blog/javascript/migrating-legacy-php-4-applications-to-php-5-320/#comments</comments>
		<pubDate>Thu, 10 Jul 2008 06:00:34 +0000</pubDate>
		<dc:creator>Akash Mehta</dc:creator>
		
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.developertutorials.com/blog/javascript/migrating-legacy-php-4-applications-to-php-5-320/</guid>
		<description><![CDATA[As Ivo Jansch pointed out on the Ibuildings blog, there&#8217;s barely a month left till security fixes are discontinued for PHP 4. While support for PHP 4 officially ended last December, security updates were offered until 08-08-08. Most major web hosts have been phasing out PHP 4 support, but many legacy applications built with PHP [...]]]></description>
			<content:encoded><![CDATA[<p>As Ivo Jansch pointed out on the Ibuildings blog, there&#8217;s barely a month left till security fixes are discontinued for PHP 4. While support for PHP 4 officially ended last December, security updates were offered until 08-08-08. Most major web hosts have been phasing out PHP 4 support, but many legacy applications built with PHP 4 in mind are currently in use, and the more intricate will take quite some time to move to PHP 5. Here are some tips and resources for managing the migration process.<span id="more-320"></span></p>
<p>PHP 5 supports most of the legacy syntax features of PHP 4. Most code written for PHP 4 should function fine under PHP 5, and a comprehensive test suite could check this. However, many of the backwards-incompatible changes in PHP 5 were in regard to language quirks, and quite a few hacks rely on these in order to function. Here are some issues to watch out for:</p>
<ul>
<li>Class names provided by language features - get_class(), get_parent_class()  and get_class_methods() now return the name of the classes/methods exactly as declared; earlier, they were lowercased first</li>
<li>The new object model is quite different - an empty object is no longer considered &#8220;empty&#8221; by empty(), among other changes</li>
<li>Files with functions cannot be included twice; PHP 5 throws an error as the function is being redeclared</li>
<li>Illegal uses of string offsets (e.g. $somestring[0]) will throw an error</li>
<li>On Windows servers, the include/require_once functions are case insensitive - &#8220;SomeFile.php&#8221; and &#8220;somefile.php&#8221; will only be included once</li>
</ul>
<p>Legacy applications making use of the CLI, especially under Windows, should be aware of the new names for binaries. The CGI binary has been renamed to php-cgi (previously php), while the CLI binary has been moved back into the main directory as php. Other applications calling PHP scripts may also want to look at php-win on Windows, which serves the same function as the CLI except without the black &#8220;DOS box&#8221;.</p>
<p>Finally, there are some new reserved keywords. If you are upgrading straight to PHP 5.3, watch out for the new namespace keywords, including &#8220;namespace&#8221;, &#8220;use&#8221; and __NAMESPACE__. The new OOP features introduce quite a few keywords popular in enterprise applications - &#8220;public&#8221;, &#8220;private&#8221;, &#8220;protected&#8221;, &#8220;clone&#8221;, &#8220;try&#8221; and &#8220;this&#8221; come to mind (more available <a href="http://www.php.net/manual/en/reserved.php#reserved.keywords">here</a>). Error checking every file (run &#8220;php -l /path/to/file.php&#8221;) can pick these up fair quickly.</p>
<p>PHP 4 has been discontinued for some time; indeed, the latest release, 4.4.8, is from early January. Major legacy applications should be ported as quickly as possible to avoid security issues; existing code should be thoroughly checked for syntax and language feature changes as well. The PHP manual has some <a href="http://www.php.net/manual/en/migration5.php">handy documentation on migrating</a>, and the PHP 5 features are clearly noted all around the manual - check the revision history of functions as well.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a title="Click me to see the sites." href="#" onclick="$$('div.d320').each( function(e) { e.visualEffect('slide_down',{duration:2.5}) }); return false;"><strong><em>Bookmark It</em></strong></a>
<br />
<div class="d320" style="overflow:hidden">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.developertutorials.com/blog/javascript/migrating-legacy-php-4-applications-to-php-5-320/&amp;title=Migrating+legacy+PHP+4+applications+to+PHP+5" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.developertutorials.com/blog/javascript/migrating-legacy-php-4-applications-to-php-5-320/&amp;title=Migrating+legacy+PHP+4+applications+to+PHP+5" title="Add to&nbsp;digg"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http://www.developertutorials.com/blog/javascript/migrating-legacy-php-4-applications-to-php-5-320/&amp;title=Migrating+legacy+PHP+4+applications+to+PHP+5" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://www.developertutorials.com/blog/javascript/migrating-legacy-php-4-applications-to-php-5-320/&amp;title=Migrating+legacy+PHP+4+applications+to+PHP+5" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://www.developertutorials.com/blog/wp-content/plugins/social_bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<br />
<a style="font-size:90%;text-align: right; " title="Click me to hide the sites." href="#" onclick="$$('div.d320').each( function(e) { e.visualEffect('slide_up',{duration:0.5}) }); return false;">Hide Sites</a>
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.developertutorials.com/blog/javascript/migrating-legacy-php-4-applications-to-php-5-320/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
