<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Andrew Havens Blog &#187; Uncategorized</title>
	<atom:link href="http://blog.andrewhavens.com/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.andrewhavens.com</link>
	<description></description>
	<lastBuildDate>Mon, 14 Dec 2009 19:41:52 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>AJAX file upload with Zend Framework and jQuery</title>
		<link>http://blog.andrewhavens.com/2009/12/14/ajax-file-upload-with-zend-framework-and-jquery/</link>
		<comments>http://blog.andrewhavens.com/2009/12/14/ajax-file-upload-with-zend-framework-and-jquery/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 19:17:38 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[file upload]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://blog.andrewhavens.com/?p=145</guid>
		<description><![CDATA[ I&#8217;m in the process of trying to create a Zend Framework plugin, or helper that will add AJAX file upload capabilities to a Zend Form. It needs to degrade gracefully so that a user can still upload a file in case they have JavaScript (or Flash) disabled in their browser.
Here&#8217;s some plugins I&#8217;ve found [...]]]></description>
			<content:encoded><![CDATA[<!-- Generated by Digg Digg plugin, 
    Author : Yong Mook Kim
    Website : http://www.mkyong.com/blog/digg-digg-wordpress-plugin/
	--><div style='float:right'><table > <td><iframe src='http://digg.com/api/diggthis.php?w=new&amp;u=http%3A%2F%2Fblog.andrewhavens.com%2F2009%2F12%2F14%2Fajax-file-upload-with-zend-framework-and-jquery%2F&amp;t=AJAX+file+upload+with+Zend+Framework+and+jQuery&amp;s=normal' height='80' width='52' frameborder='0' scrolling='no'></iframe></td></table></div><p>I&#8217;m in the process of trying to create a Zend Framework plugin, or helper that will add AJAX file upload capabilities to a Zend Form. It needs to degrade gracefully so that a user can still upload a file in case they have JavaScript (or Flash) disabled in their browser.</p>
<p>Here&#8217;s some plugins I&#8217;ve found along the way that might help you:</p>
<ul>
<li><a href="http://www.phpletter.com/Our-Projects/AjaxFileUpload/">PHP Letter: AJAX File Upload jQuery Plugin</a></li>
<li><a href="http://valums.com/ajax-upload/">Andrew Valums: AJAX Upload</a></li>
<li><a href="http://jquery.malsup.com/form/">jQuery Form Plugin</a> (includes AJAX file upload)</li>
<li><a href="http://www.uploadify.com/">Uploadify: multiple file upload plugin for jQuery</a></li>
<li><a href="http://digitarald.de/project/fancyupload/">Fancy Upload: MooTools AJAX file upload</a></li>
<li><a href="http://swfupload.org/">SWFUpload: JavaScript Flash AJAX file upload</a> (degrades gracefully to normal HTML upload form)</li>
</ul>
<p>If you have any experience (or success) with this, please share it in the comments.</p>
<p>I&#8217;ll post the solution when I am done.</p>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 66px; width: 1px; height: 1px;">http://swfupload.org/SWF</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.andrewhavens.com/2009/12/14/ajax-file-upload-with-zend-framework-and-jquery/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>What is the best PHP mailing list software?</title>
		<link>http://blog.andrewhavens.com/2009/04/07/what-is-the-best-php-mailing-list-software/</link>
		<comments>http://blog.andrewhavens.com/2009/04/07/what-is-the-best-php-mailing-list-software/#comments</comments>
		<pubDate>Wed, 08 Apr 2009 01:27:17 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[mailing list software]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.andrewhavens.com/?p=126</guid>
		<description><![CDATA[ In my search for the best PHP mailing list software, I&#8217;ve come across some pretty bad ones, and some pretty good ones.
My criteria for a &#8220;good PHP mailing list&#8221; is the following:
-easy install
-easy integration
-double opt-in subscription
-sends mail even after browser window has closed (imagine waiting for your PHP script to finish sending an email [...]]]></description>
			<content:encoded><![CDATA[<!-- Generated by Digg Digg plugin, 
    Author : Yong Mook Kim
    Website : http://www.mkyong.com/blog/digg-digg-wordpress-plugin/
	--><div style='float:right'><table > <td><iframe src='http://digg.com/api/diggthis.php?w=new&amp;u=http%3A%2F%2Fblog.andrewhavens.com%2F2009%2F04%2F07%2Fwhat-is-the-best-php-mailing-list-software%2F&amp;t=What+is+the+best+PHP+mailing+list+software%3F&amp;s=normal' height='80' width='52' frameborder='0' scrolling='no'></iframe></td></table></div><p>In my search for the best PHP mailing list software, I&#8217;ve come across some pretty bad ones, and some pretty good ones.</p>
<p>My criteria for a &#8220;good PHP mailing list&#8221; is the following:<br />
-easy install<br />
-easy integration<br />
-double opt-in subscription<br />
-sends mail even after browser window has closed (imagine waiting for your PHP script to finish sending an email to thousands of subscribers, one at a time).<br />
-customizable admin interface<br />
-open source (and free!)<br />
-not a hosted solution</p>
<p>That may be a dream, but I just found a new PHP mailing list that may meet the criteria. phplist.com may just do the trick. I will try it out and let you know what I think. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.andrewhavens.com/2009/04/07/what-is-the-best-php-mailing-list-software/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zend Form U.S. state drop down select menu</title>
		<link>http://blog.andrewhavens.com/2008/11/10/zend-form-us-state-drop-down-select-menu/</link>
		<comments>http://blog.andrewhavens.com/2008/11/10/zend-form-us-state-drop-down-select-menu/#comments</comments>
		<pubDate>Mon, 10 Nov 2008 20:52:00 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Zend Framework]]></category>
		<category><![CDATA[Zend_Form]]></category>

		<guid isPermaLink="false">http://blog.amperactive.com/?p=35</guid>
		<description><![CDATA[ Question: Is there a Zend Form state drop down select menu already created that I could just add to my form?
Answer: No. At least I don&#8217;t think so. Zend_Form doesn&#8217;t have any Zend_Form_Element_StateSelect or anything like that. The only way I found was to pass in an array of states. Feel free to copy [...]]]></description>
			<content:encoded><![CDATA[<!-- Generated by Digg Digg plugin, 
    Author : Yong Mook Kim
    Website : http://www.mkyong.com/blog/digg-digg-wordpress-plugin/
	--><div style='float:right'><table > <td><iframe src='http://digg.com/api/diggthis.php?w=new&amp;u=http%3A%2F%2Fblog.andrewhavens.com%2F2008%2F11%2F10%2Fzend-form-us-state-drop-down-select-menu%2F&amp;t=Zend+Form+U.S.+state+drop+down+select+menu&amp;s=normal' height='80' width='52' frameborder='0' scrolling='no'></iframe></td></table></div><p><strong>Question:</strong> Is there a Zend Form state drop down select menu already created that I could just add to my form?</p>
<p><strong>Answer: </strong>No. At least I don&#8217;t think so. Zend_Form doesn&#8217;t have any Zend_Form_Element_StateSelect or anything like that. The only way I found was to pass in an array of states. Feel free to copy and paste my code.</p>
<pre class="brush: php;">

$states = array('AL'=&gt;'Alabama','AK'=&gt;'Alaska','AZ'=&gt;'Arizona','AR'=&gt;'Arkansas','CA'=&gt;'California','CO'=&gt;'Colorado','CT'=&gt;'Connecticut','DE'=&gt;'Delaware','DC'=&gt;'District Of Columbia','FL'=&gt;'Florida','GA'=&gt;'Georgia','HI'=&gt;'Hawaii','ID'=&gt;'Idaho','IL'=&gt;'Illinois', 'IN'=&gt;'Indiana', 'IA'=&gt;'Iowa',  'KS'=&gt;'Kansas','KY'=&gt;'Kentucky','LA'=&gt;'Louisiana','ME'=&gt;'Maine','MD'=&gt;'Maryland', 'MA'=&gt;'Massachusetts','MI'=&gt;'Michigan','MN'=&gt;'Minnesota','MS'=&gt;'Mississippi','MO'=&gt;'Missouri','MT'=&gt;'Montana','NE'=&gt;'Nebraska','NV'=&gt;'Nevada','NH'=&gt;'New Hampshire','NJ'=&gt;'New Jersey','NM'=&gt;'New Mexico','NY'=&gt;'New York','NC'=&gt;'North Carolina','ND'=&gt;'North Dakota','OH'=&gt;'Ohio','OK'=&gt;'Oklahoma', 'OR'=&gt;'Oregon','PA'=&gt;'Pennsylvania','RI'=&gt;'Rhode Island','SC'=&gt;'South Carolina','SD'=&gt;'South Dakota','TN'=&gt;'Tennessee','TX'=&gt;'Texas','UT'=&gt;'Utah','VT'=&gt;'Vermont','VA'=&gt;'Virginia','WA'=&gt;'Washington','WV'=&gt;'West Virginia','WI'=&gt;'Wisconsin','WY'=&gt;'Wyoming');

$state = new Zend_Form_Element_Select('state');
$state-&gt;setLabel('State')
-&gt;setMultiOptions($states)
-&gt;setRegisterInArrayValidator(false);
$form-&gt;addElement($state);
</pre>
<p>Here&#8217;s a link to a helpful blog post with common PHP arrays: <a href="http://blog.ninedays.org/2008/01/03/php-state-drop-down-menu-reusable-code/">http://blog.ninedays.org/2008/01/03/php-state-drop-down-menu-reusable-code/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.andrewhavens.com/2008/11/10/zend-form-us-state-drop-down-select-menu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to compare the differences between two arrays in PHP</title>
		<link>http://blog.andrewhavens.com/2008/10/30/how-to-compare-the-differences-between-two-arrays-in-php/</link>
		<comments>http://blog.andrewhavens.com/2008/10/30/how-to-compare-the-differences-between-two-arrays-in-php/#comments</comments>
		<pubDate>Thu, 30 Oct 2008 19:21:40 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[arrays]]></category>
		<category><![CDATA[comparison]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.amperactive.com/?p=27</guid>
		<description><![CDATA[ Question: How do I write a function to compare the differences between two arrays?
Consider the following scenarios:
$alreadyInTheDatabase = array('name' =&#62; 'Joe', 'address' =&#62; '123 Fake St');
$newFormValuesArray = array('name' =&#62; 'Joe', 'address' =&#62; 'My address has changed');

$alreadyInTheDatabase = array('name' =&#62; 'Joe', 'address' =&#62; '123 Fake St');
$newFormValuesArray = array('name' =&#62; 'Joe'); //a bad form has address [...]]]></description>
			<content:encoded><![CDATA[<!-- Generated by Digg Digg plugin, 
    Author : Yong Mook Kim
    Website : http://www.mkyong.com/blog/digg-digg-wordpress-plugin/
	--><div style='float:right'><table > <td><iframe src='http://digg.com/api/diggthis.php?w=new&amp;u=http%3A%2F%2Fblog.andrewhavens.com%2F2008%2F10%2F30%2Fhow-to-compare-the-differences-between-two-arrays-in-php%2F&amp;t=How+to+compare+the+differences+between+two+arrays+in+PHP&amp;s=normal' height='80' width='52' frameborder='0' scrolling='no'></iframe></td></table></div><p><strong>Question:</strong> How do I write a function to compare the differences between two arrays?</p>
<p>Consider the following scenarios:</p>
<pre class="brush: php;">$alreadyInTheDatabase = array('name' =&gt; 'Joe', 'address' =&gt; '123 Fake St');
$newFormValuesArray = array('name' =&gt; 'Joe', 'address' =&gt; 'My address has changed');

$alreadyInTheDatabase = array('name' =&gt; 'Joe', 'address' =&gt; '123 Fake St');
$newFormValuesArray = array('name' =&gt; 'Joe'); //a bad form has address missing from the array

$alreadyInTheDatabase = array('name' =&gt; 'Joe'); //address was never in the database to begin with
$newFormValuesArray = array('name' =&gt; 'Joe', 'address' =&gt; '123 Fake St');</pre>
<p>I&#8217;m writing a function to check whether or not I need to update a field in a database, so my function will tell me what the differences are between what&#8217;s already in the database, and what form fields have changed. If the field is the same as the one that&#8217;s in the database, I won&#8217;t need to update it. If the values are different, I&#8217;ll update. If the form has a field that doesn&#8217;t even exist yet in the database (because it hasn&#8217;t been created yet), I&#8217;ll need to know that too. So I&#8217;ll just return an array of the keys that differ.</p>
<p>There are a lot of PHP functions that exist to solve all sorts of scenarios where you would want to compare arrays, but none of them return an array of the differences between <em>both</em> arrays.</p>
<blockquote><p><a href="http://us3.php.net/manual/en/function.array-diff.php">array_diff</a> — Computes the difference of arrays<br />
<a href="http://us3.php.net/manual/en/function.array-udiff.php">array_udiff</a> — Computes the difference of arrays by using a callback function for data comparison<br />
<a href="http://us3.php.net/manual/en/function.array-diff-key.php">array_diff_key</a> — Computes the difference of arrays using keys for comparison<br />
<a href="http://us3.php.net/manual/en/function.array-diff-uassoc.php">array_diff_uassoc</a> — Computes the difference of arrays with additional index check which is performed by a user supplied callback function<br />
<a href="http://us3.php.net/manual/en/function.array-diff-ukey.php">array_diff_ukey</a> — Computes the difference of arrays using a callback function on the keys for comparison<br />
<a href="http://us3.php.net/manual/en/function.array-intersect.php">array_intersect</a> — Computes the intersection of arrays<br />
<a href="http://us3.php.net/manual/en/function.array-uintersect.php">array_uintersect</a> — Computes the intersection of arrays, compares data by a callback function<br />
<a href="http://us3.php.net/manual/en/function.array-intersect-assoc.php">array_intersect_assoc</a> — Computes the intersection of arrays with additional index check<br />
<a href="http://us3.php.net/manual/en/function.array-intersect-key.php">array_intersect_key</a> — Computes the intersection of arrays using keys for comparison<br />
<a href="http://us3.php.net/manual/en/function.array-intersect-uassoc.php">array_intersect_uassoc</a> — Computes the intersection of arrays with additional index check, compares indexes by a callback function<br />
<a href="http://us3.php.net/manual/en/function.array-intersect-ukey.php">array_intersect_ukey</a> — Computes the intersection of arrays using a callback function on the keys for comparison<br />
<a href="http://us3.php.net/manual/en/function.array-udiff-assoc.php">array_udiff_assoc</a> — Computes the difference of arrays with additional index check, compares data by a callback function<br />
<a href="http://us3.php.net/manual/en/function.array-udiff-uassoc.php">array_udiff_uassoc</a> — Computes the difference of arrays with additional index check, compares data and indexes by a callback function<br />
<a href="http://us3.php.net/manual/en/function.array-uintersect-assoc.php">array_uintersect_assoc</a> — Computes the intersection of arrays with additional index check, compares data by a callback function<br />
<a href="http://us3.php.net/manual/en/function.array-uintersect-uassoc.php">array_uintersect_uassoc</a> — Computes the intersection of arrays with additional index check, compares data and indexes by a callback functions</p></blockquote>
<p>Quite a lengthy list, isn&#8217;t it?? Now you can sense my confusion and frustration. We want to check the values, but return the key of the value that is different. We&#8217;ll also check the keys to see if we need to create a field that doesn&#8217;t already exist in the database.</p>
<p><strong>Answer:</strong> We&#8217;ll use array_diff_assoc() to return an associative array of the keys and values that differ in the first array. Then we&#8217;ll swap the arrays to check the second array against the first. We&#8217;ll merge the two arrays of differences using array_merge() and return just the keys by using array_keys().</p>
<pre class="brush: php;">function getDifferences($alreadyInTheDatabase, $newFormValuesArray) {

$diff1 = array_diff_assoc($alreadyInTheDatabase, $newFormValuesArray);
$diff2 = array_diff_assoc($newFormValuesArray, $alreadyInTheDatabase);

$merged = array_merge($diff1, $diff2);

$justTheKeys = array_keys($merged);

return $justTheKeys;

}</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.andrewhavens.com/2008/10/30/how-to-compare-the-differences-between-two-arrays-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
