<?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>Josh Schumacher: A PHP Developer</title>
	<atom:link href="http://blog.joshschumacher.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.joshschumacher.com</link>
	<description>The biggest and the best in the Northwest</description>
	<pubDate>Tue, 03 Jun 2008 17:05:18 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>Strategic Analysis: Google Presentation</title>
		<link>http://blog.joshschumacher.com/2008/06/03/strategic-analysis-google-presentation/</link>
		<comments>http://blog.joshschumacher.com/2008/06/03/strategic-analysis-google-presentation/#comments</comments>
		<pubDate>Tue, 03 Jun 2008 09:39:27 +0000</pubDate>
		<dc:creator>Josh Schumacher</dc:creator>
		
		<category><![CDATA[Web 2.0]]></category>

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

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

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

		<category><![CDATA[strategic analysis]]></category>

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

		<guid isPermaLink="false">http://blog.joshschumacher.com/?p=18</guid>
		<description><![CDATA[Important: This presentation was created in December of 2006, the information most likely is out of date.  I am posting this in response to the demand from slideshare.
During my senior year at Western Washington University, for a final project in my Management 495 class, I did group presentation, performing a strategic analysis of Google [...]]]></description>
			<content:encoded><![CDATA[<p><b>Important: This presentation was created in December of 2006, the information most likely is out of date.  I am posting this in response to the demand from slideshare.</b></p>
<p>During my senior year at <a href="http://www.wwu.edu/">Western Washington University</a>, for a final project in my Management 495 class, I did group presentation, performing a strategic analysis of Google and the positioning in the search engine market.  I posted this slideshow to <a href="http://slideshare.net">slideshare</a> and received an incredible amount of comments and messages asking for the presentation.  The presentation currently has over 25,000 views and over 100 favorites.</p>
<p>Like I said in the disclaimer, this slideshow is a year and a half old so a lot of the information is out dated.  Also, looking back at the slideshow, there are some formatting issues that I would resolve if I had to go back and do it again.  The presentation, was put together using Apple&#8217;s <a href="http://www.apple.com/iwork/keynote/">Keynote</a> software.  This was a group presentation so I was not the only contributer.  The other contributers were: Charity Thomas, Frieder Mack and Jennifer Bell.</p>
<p>You can download a pdf version of the presentation here: <a href='http://blog.joshschumacher.com/wp-content/uploads/2008/06/google-presentation.pdf'>Google Strategic Analysis Presentation</a> <img src="http://joshschumacher.com/images/pdf.png" alt="[PDF]" /> (December 2006)</p>
<div style="width:425px;text-align:left" id="__ss_32219"><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slideshare.net/swf/ssplayer2.swf?doc=strategic-analysis-google-15381&#038;rel=0"/><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slideshare.net/swf/ssplayer2.swf?doc=strategic-analysis-google-15381&#038;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;"><a href="http://www.slideshare.net/?src=embed"><img src="http://static.slideshare.net/swf/logo_embd.png" style="border:0px none;margin-bottom:-5px" alt="SlideShare"/></a> | <a href="http://www.slideshare.net/joshs633/strategic-analysis-google?src=embed" title="View Strategic Analysis: Google on SlideShare">View</a> | <a href="http://www.slideshare.net/upload?src=embed">Upload your own</a></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.joshschumacher.com/2008/06/03/strategic-analysis-google-presentation/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Standardizing a way to represent an object in PHP</title>
		<link>http://blog.joshschumacher.com/2008/04/23/standardizing-a-way-to-represent-an-object-in-php/</link>
		<comments>http://blog.joshschumacher.com/2008/04/23/standardizing-a-way-to-represent-an-object-in-php/#comments</comments>
		<pubDate>Wed, 23 Apr 2008 06:20:04 +0000</pubDate>
		<dc:creator>Josh Schumacher</dc:creator>
		
		<category><![CDATA[PHP]]></category>

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

		<guid isPermaLink="false">http://blog.joshschumacher.com/2007/08/04/standardizing-a-way-to-represent-an-object-in-php/</guid>
		<description><![CDATA[During the process of designing our API at Treemo, one of the first major design implementation hurdles we had to overcome was how to standardize a way to define what data in an object was "exportable" and can later be transformed into XML.  The solution that I came up with defines a Node and [...]]]></description>
			<content:encoded><![CDATA[<p>During the process of designing our API at <a href="http://treemo.com">Treemo</a>, one of the first major design implementation hurdles we had to overcome was how to standardize a way to define what data in an object was "exportable" and can later be transformed into XML.  The solution that I came up with defines a Node and a NodeCollection object.</p>
<p>When deciding what the data structure should look like, I wrote some pseudo XML that we need to be able to model.</p>
<div class="igBar"><span id="lxml-3"><a href="#" onclick="javascript:showPlainTxt('xml-3'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">XML:</span>
<div id="xml-3">
<div class="xml">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;channel<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;owner</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"testuser"</span> <span style="color: #000066;">email</span>=<span style="color: #ff0000;">"test@test.com"</span> <span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;list</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"foo"</span><span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;item</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"123"</span><span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;files<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;image</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"http://foo.bar.com"</span> <span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;3gp</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"http://3gp.foo.bar.com"</span> <span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/files<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/item<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/list<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/channel<span style="font-weight: bold; color: black;">&gt;</span></span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>A Node has a <tt>(string) $type</tt>, <tt>(mixed) $attributes</tt> and <tt>(NodeCollection) $children</tt>.  Using the above XML as a reference, our root node (let's call it <tt>$root</tt>) would have <tt>$type</tt> = 'channel' and no attributes.  You would then add two nodes to the NodeCollection <tt>$children</tt>, owner and list.  Owner would have <tt>$attributes</tt> of <tt>array('name'=&gt;'testuser', 'email'=&gt;'test@test.com')</tt> and <tt>$children</tt> would be an empty NodeCollection.</p>
<p>The biggest design decision made about NodeCollection was that <tt>NodeCollection implements Iterator</tt>.  By implementing Iterator, you can later foreach over <tt>$children</tt> and it can loop through the elements with no problem.  Implementing Iterator is a pretty cool design pattern - I'll have to write a post about it in the near future.  The ability to foreach over <tt>$children</tt> helps tremendously when writing ExportNodeToXml.</p>
<p>Wrapping up, pseudo code to export and object to a Node that can later be transformed to XML would look like this:</p>
<div class="igBar"><span id="lphp-4"><a href="#" onclick="javascript:showPlainTxt('php-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-4">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">class</span> Channel implements iExportable <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; public <span style="color:#000000; font-weight:bold;">function</span> toExportable<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$root</span> = <span style="color:#000000; font-weight:bold;">new</span> Node<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'channel'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$root</span>-&gt;<span style="color:#006600;">children</span>-&gt;<span style="color:#006600;">addNode</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#000000; font-weight:bold;">new</span> Node<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'list'</span>, <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'name'</span>=&gt;<span style="color:#FF0000;">'testuser'</span>, <span style="color:#FF0000;">'email'</span>=&gt;<span style="color:#FF0000;">'test@test.com'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$root</span>-&gt;<span style="color:#006600;">children</span>-&gt;<span style="color:#006600;">addNode</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#000000; font-weight:bold;">new</span> Node<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'list'</span>, <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'id'</span>=&gt;<span style="color:#FF0000;">'123'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$root</span>-&gt;<span style="color:#006600;">children</span>-&gt;<span style="color:#006600;">getNode</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC66CC;color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span>-&gt;<span style="color:#006600;">children</span>-&gt;<span style="color:#006600;">addNode</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#000000; font-weight:bold;">new</span> Node<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'files'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$root</span>-&gt;<span style="color:#006600;">children</span>-&gt;<span style="color:#006600;">getNode</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC66CC;color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span>-&gt;<span style="color:#006600;">children</span>-&gt;<span style="color:#006600;">getNode</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC66CC;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span>-&gt;<span style="color:#006600;">children</span>-&gt;<span style="color:#006600;">addNode</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'image'</span>, <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'href'</span>=&gt;<span style="color:#FF0000;">'http://foo.bar.com'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$root</span>-&gt;<span style="color:#006600;">children</span>-&gt;<span style="color:#006600;">getNode</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC66CC;color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span>-&gt;<span style="color:#006600;">children</span>-&gt;<span style="color:#006600;">getNode</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC66CC;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span>-&gt;<span style="color:#006600;">children</span>-&gt;<span style="color:#006600;">addNode</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'3gp'</span>, <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'href'</span>=&gt;<span style="color:#FF0000;">'http://3gp.foo.bar.com'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.joshschumacher.com/2008/04/23/standardizing-a-way-to-represent-an-object-in-php/feed/</wfw:commentRss>
		</item>
		<item>
		<title>I love public radio in Seattle</title>
		<link>http://blog.joshschumacher.com/2007/08/03/i-love-public-radio-in-seattle/</link>
		<comments>http://blog.joshschumacher.com/2007/08/03/i-love-public-radio-in-seattle/#comments</comments>
		<pubDate>Sat, 04 Aug 2007 00:37:57 +0000</pubDate>
		<dc:creator>Josh Schumacher</dc:creator>
		
		<category><![CDATA[Life]]></category>

		<guid isPermaLink="false">http://blog.joshschumacher.com/2007/08/03/i-love-public-radio-in-seattle/</guid>
		<description><![CDATA[For the majority of my life, my dad worked for a public radio station in Spokane, KPBX, so I've always had an affinity for public radio.  Since moving to the Seattle area and spending a lot of time in my car commuting to and from work (usually about 35 min - 1 hour each [...]]]></description>
			<content:encoded><![CDATA[<p>For the majority of my life, my dad worked for a public radio station in Spokane, <a href="http://kpbx.org/">KPBX</a>, so I've always had an affinity for public radio.  Since moving to the Seattle area and spending a lot of time in my car commuting to and from work (usually about 35 min - 1 hour each way) I've been listening to a lot of radio.  When I first started commuting, I listened to a lot of commercial radio but I find that stuff gets really old, really fast.  I can only listen to <a href="http://www.youtube.com/watch?v=mrTUhkN7RFA">Umbrella by Rihanna</a> so many times before my head wants to explode.</p>
<p>Recently, I've rediscovered my love for public radio. With the trio of eclectic music from <a href="http://kexp.org">KEXP 90.9</a>, dance and techno from <a href="http://www.c895worldwide.com">C89.5</a> and local, national and international news from <a href="http://www.kuow.org/">KUOW 94.9</a> I can always find something good to listen to. Not only am I aurally satisfied, listening to public radio often seems to put me in a civically minded mood - encouraging me to soaking up as much information and culture as my brain can handle.</p>
<p>On another note, I haven't posted in a while - after graduating, I started at a company called <a href="http://ascentium.com/">Ascentium</a>.  They are an interactive technical marketing and consulting firm.  I worked there as a web developer for about 2.5 months and then I decided I wasn't really being challenged enough and I missed writing PHP a lot.  So I left to start working at a startup that I had looked at during my initial job search right after graduating, <a href="http://treemo.com">Treemo</a>.</p>
<p>I've been at Treemo since the middle of June and I'm loving it.  We have some really cool stuff coming down the pipe in the near future.  Right now, I'm working on writing an API - very exciting work.  Now that I'm working back in the PHP biz, I'm going to start writing about developing PHP again.  Stay tuned.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.joshschumacher.com/2007/08/03/i-love-public-radio-in-seattle/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PHP - Delete selected items from an array</title>
		<link>http://blog.joshschumacher.com/2007/03/22/php-delete-selected-items-from-an-array/</link>
		<comments>http://blog.joshschumacher.com/2007/03/22/php-delete-selected-items-from-an-array/#comments</comments>
		<pubDate>Fri, 23 Mar 2007 01:01:12 +0000</pubDate>
		<dc:creator>Josh Schumacher</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.joshschumacher.com/2007/03/22/php-delete-selected-items-from-an-array/</guid>
		<description><![CDATA[I was enlightened the day I discovered array_filter.  You may find yourself with an array of values and you want to delete some of those values from the array.  There is no 'delete element from array' function built into php but you can use an even more powerful function, array_filter.
Let's look at a [...]]]></description>
			<content:encoded><![CDATA[<p>I was enlightened the day I discovered <code>array_filter</code>.  You may find yourself with an array of values and you want to delete some of those values from the array.  There is no 'delete element from array' function built into php but you can use an even more powerful function, <code>array_filter</code>.</p>
<p>Let's look at a simple example.  I have an array containing values, some are numeric, some might not be.  I only want my array to contain the valid numeric entries and I want to delete the other values.  PHP has a helper function we are going to be utilizing, <code>is_numeric</code>.</p>
<div class="igBar"><span id="lphp-7"><a href="#" onclick="javascript:showPlainTxt('php-7'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-7">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$data</span> = <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC66CC;color:#800000;">42</span>, <span style="color:#FF0000;">"foo"</span>, <span style="color:#CC66CC;color:#800000;">96</span>, <span style="color:#FF0000;">""</span>, <span style="color:#CC66CC;color:#800000;">100</span>.<span style="color:#CC66CC;color:#800000;">96</span>, <span style="color:#FF0000;">"php"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// Filter each value of $data through the function is_numeric</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$numeric_data</span> = <a href="http://www.php.net/array_filter"><span style="color:#000066;">array_filter</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$data</span>, <span style="color:#FF0000;">"is_numeric"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// Re-key the array so the keys are sequential and numeric (starting at 0)</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$numeric_data</span> = <a href="http://www.php.net/array_values"><span style="color:#000066;">array_values</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$numeric_data</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// Print out the new, filtered data</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/print_r"><span style="color:#000066;">print_r</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$numeric_data</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The output from above is:</p>
<pre>
Array
(
    [0] => 42
    [1] => 96
    [2] => 100.96
)
</pre>
<p>Pretty handy function.  Notice how I ran my data through the function <code>array_values</code>, before that function was run, the keys were <code>(0,2,4)</code>.</p>
<p>Another example with a user defined function.  I have defined a collection of tags and I want my tag collection to only contain tags that match the criteria the user has requested.</p>
<div class="igBar"><span id="lphp-8"><a href="#" onclick="javascript:showPlainTxt('php-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-8">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$tagCollection</span> = <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"AJAX"</span>, <span style="color:#FF0000;">"Analytics"</span>, <span style="color:#FF0000;">"CSS"</span>, <span style="color:#FF0000;">"Javascript"</span>, <span style="color:#FF0000;">"JoshSchumacher.com"</span>, <span style="color:#FF0000;">"PHP"</span>, <span style="color:#FF0000;">"Prototype"</span>, <span style="color:#FF0000;">"Web 2.0"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// Custom function used to filter the $tagCollection based on query sent to page</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">function</span> strTagMatch<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$val</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#0000FF;">$query</span> = <a href="http://www.php.net/isset"><span style="color:#000066;">isset</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$_REQUEST</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'Tags'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> ? <span style="color:#0000FF;">$_REQUEST</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'Tags'</span><span style="color:#006600; font-weight:bold;">&#93;</span> : <span style="color:#FF0000;">''</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#616100;">return</span> <span style="color:#006600; font-weight:bold;">&#40;</span>stripos<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$val</span>, <span style="color:#0000FF;">$query</span><span style="color:#006600; font-weight:bold;">&#41;</span> !== <span style="color:#000000; font-weight:bold;">false</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$tags</span> = <a href="http://www.php.net/array_filter"><span style="color:#000066;">array_filter</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$tagCollection</span>, <span style="color:#FF0000;">"strTagMatch"</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Voila! Deleting elements from an array has never been easier.</p>
<p>For more information, see the <a href="http://us3.php.net/manual/en/function.array-filter.php">php documentation on array_filter</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.joshschumacher.com/2007/03/22/php-delete-selected-items-from-an-array/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Howto: Exclude developer hits in Analytics</title>
		<link>http://blog.joshschumacher.com/2007/03/16/howto-not-track-developer-hits-in-analytics/</link>
		<comments>http://blog.joshschumacher.com/2007/03/16/howto-not-track-developer-hits-in-analytics/#comments</comments>
		<pubDate>Fri, 16 Mar 2007 18:25:29 +0000</pubDate>
		<dc:creator>Josh Schumacher</dc:creator>
		
		<category><![CDATA[Analytics]]></category>

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

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

		<guid isPermaLink="false">http://blog.joshschumacher.com/2007/03/16/howto-not-track-developer-hits-in-analytics/</guid>
		<description><![CDATA[When developing a site, I visit it a lot - OK Josh, that was an obvious.  Point is, I was tired of tracking my visits to sites that I maintain.  I really care about tracking significant users and how they navigate the site and what pages they find valuable but I don't care [...]]]></description>
			<content:encoded><![CDATA[<p>When developing a site, I visit it a lot - OK Josh, that was an obvious.  Point is, I was tired of tracking my visits to sites that I maintain.  I really care about tracking significant users and how they navigate the site and what pages they find valuable but I don't care about my hits.</p>
<p>I put together a quick page that I can navigate to that will install a cookie for the browser. I can then check for the cookie in my standard header include so the <a href='http://analytics.google.com'>Google Analytics</a> tracking code isn't sent to the browser.</p>
<p><strong>The code to set the cookie</strong> (and make sure it's installed correctly)</p>
<div class="igBar"><span id="lphp-11"><a href="#" onclick="javascript:showPlainTxt('php-11'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-11">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/setcookie"><span style="color:#000066;">setcookie</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"hideAnalytics"</span>, <span style="color:#FF0000;">'true'</span>, <a href="http://www.php.net/time"><span style="color:#000066;">time</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>+<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC66CC;color:#800000;">3600</span>*<span style="color:#CC66CC;color:#800000;">24</span>*<span style="color:#CC66CC;color:#800000;">365</span>*<span style="color:#CC66CC;color:#800000;">30</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/isset"><span style="color:#000066;">isset</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$_COOKIE</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'hideAnalytics'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> &amp;&amp; <span style="color:#0000FF;">$_COOKIE</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'hideAnalytics'</span><span style="color:#006600; font-weight:bold;">&#93;</span> == <span style="color:#FF0000;">'true'</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/print"><span style="color:#000066;">print</span></a> <span style="color:#FF0000;">"Cookie installed"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Similar (but inverse) code is then inserted in my header</strong></p>
<div class="igBar"><span id="lphp-12"><a href="#" onclick="javascript:showPlainTxt('php-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-12">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?</span> <span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span>!<a href="http://www.php.net/isset"><span style="color:#000066;">isset</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$_COOKIE</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'hideAnalytics'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> || <span style="color:#0000FF;">$_COOKIE</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'hideAnalytics'</span><span style="color:#006600; font-weight:bold;">&#93;</span> != <span style="color:#FF0000;">'true'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#000000; font-weight:bold;">?&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ANALYTICS TRACKING CODE</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?</span> <span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Analytics is a great tool and it's going to be even more useful now that I won't be tracking my own hits.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.joshschumacher.com/2007/03/16/howto-not-track-developer-hits-in-analytics/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Facebook, meet iPhoto - iPhoto, meet Facebook</title>
		<link>http://blog.joshschumacher.com/2007/03/15/facebook-meet-iphoto-iphoto-meet-facebook/</link>
		<comments>http://blog.joshschumacher.com/2007/03/15/facebook-meet-iphoto-iphoto-meet-facebook/#comments</comments>
		<pubDate>Fri, 16 Mar 2007 01:16:26 +0000</pubDate>
		<dc:creator>Josh Schumacher</dc:creator>
		
		<category><![CDATA[Web 2.0]]></category>

		<guid isPermaLink="false">http://blog.joshschumacher.com/2007/03/15/facebook-meet-iphoto-iphoto-meet-facebook/</guid>
		<description><![CDATA[I am impressed. Facebook announced their long awaited iPhoto exporter today.  What does this mean?  I can finally quickly load my pictures that I already store in iPhoto into Facebook pain free.  I have been waiting for this for months, I was excited when the mentioned this was going to become a [...]]]></description>
			<content:encoded><![CDATA[<p><img style='float: right; padding: 8px;' src='http://blog.joshschumacher.com/wp-content/uploads/2007/03/icon100.jpg' alt='Image copywrite Facebook' />I am impressed. Facebook <a href='http://blog.facebook.com/blog.php?post=2253657130'>announced</a> their long awaited iPhoto exporter today.  What does this mean?  I can finally quickly load my pictures that I already store in iPhoto into Facebook pain free.  I have been waiting for this for months, I was excited when the <a href='http://blog.facebook.com/blog.php?post=2234227130'>mentioned</a> this was going to become a reality and then they <a href='http://developers.facebook.com/documentation.php?v=1.0&#038;method=photos.upload'>released</a> the ability to upload pictures using the API.  I was ready to go and start making this app myself but we were told they were going to be releasing this feature soon.</p>
<p>Facebook delivered on this plugin and they delivered well.  I am impressed, you can even tag your photos from within iPhoto!  I hope all OSX wielding, facebook dwelling, photo taking folks enjoy this as much as I do.</p>
<p><a href='http://developers.facebook.com/iphoto/'>Download the iPhoto exporter</a>, you won't be disappointed.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.joshschumacher.com/2007/03/15/facebook-meet-iphoto-iphoto-meet-facebook/feed/</wfw:commentRss>
		</item>
		<item>
		<title>It&#8217;s a redesign - JoshSchumacher.com</title>
		<link>http://blog.joshschumacher.com/2007/03/12/its-a-redesign-joshschumachercom/</link>
		<comments>http://blog.joshschumacher.com/2007/03/12/its-a-redesign-joshschumachercom/#comments</comments>
		<pubDate>Tue, 13 Mar 2007 03:23:47 +0000</pubDate>
		<dc:creator>Josh Schumacher</dc:creator>
		
		<category><![CDATA[CSS]]></category>

		<category><![CDATA[JoshSchumacher.com]]></category>

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

		<guid isPermaLink="false">http://blog.joshschumacher.com/2007/03/12/its-a-redesign-joshschumachercom/</guid>
		<description><![CDATA[Last week, I decided it was time to freshen things up on my portfolio site.  This was a great chance for me to test my css powers and modify the presentation of my semantic XHTML without changing the markup (well very minimally changing the markup - I modified some content during the redesign so [...]]]></description>
			<content:encoded><![CDATA[<p>Last week, I decided it was time to freshen things up on <a href='http://joshschumacher.com'>my portfolio</a> site.  This was a great chance for me to test my css powers and modify the presentation of my semantic XHTML without changing the markup (well very minimally changing the markup - I modified some content during the redesign so I had to modify the markup a little).  The navigation changed dramatically but the markup was still a division containing an un-ordered list.  If you're interesting in looking at my css, feel free to <a href="http://joshschumacher.com/basic.css">find inspiration</a>.  You can find the before and afters below.</p>
<div style='float: left; margin-right: 20px;'><strong>Before</strong><br />
<a rel="lightbox" href='http://blog.joshschumacher.com/wp-content/uploads/2007/03/first-design-joshschumachercom.png' title='The first design of joshschumacher.com'><img src='http://blog.joshschumacher.com/wp-content/uploads/2007/03/first-design-joshschumachercom-thumb.png' alt='The first design of joshschumacher.com' style='border: solid 1px #444;' /></a></div>
<div style='float: left; margin-left: 20px;'><strong>After</strong><br />
<a rel="lightbox" href='http://blog.joshschumacher.com/wp-content/uploads/2007/03/redesigned-joshschumachercom.png' title='The redesigned joshschumacher.com'><img src='http://blog.joshschumacher.com/wp-content/uploads/2007/03/redesigned-joshschumachercom-thumb.png' alt='The redesigned joshschumacher.com' style='border: solid 1px #444;' /></a></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.joshschumacher.com/2007/03/12/its-a-redesign-joshschumachercom/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Playing well together: Prototype JS and PHP</title>
		<link>http://blog.joshschumacher.com/2007/03/02/playing-well-together-prototype-js-and-php/</link>
		<comments>http://blog.joshschumacher.com/2007/03/02/playing-well-together-prototype-js-and-php/#comments</comments>
		<pubDate>Sat, 03 Mar 2007 06:30:56 +0000</pubDate>
		<dc:creator>Josh Schumacher</dc:creator>
		
		<category><![CDATA[Ajax]]></category>

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

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

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

		<guid isPermaLink="false">http://blog.joshschumacher.com/2007/03/02/playing-well-together-prototype-js-and-php/</guid>
		<description><![CDATA[I've decided that manipulating dates client side is a mess.  I've been working on a multi-user php calendar for the past few months.  One of the features I'm most proud of is an availability chart similar to a feature outlook has so you can schedule a meeting with multiple people and see when [...]]]></description>
			<content:encoded><![CDATA[<p>I've decided that manipulating dates client side is a mess.  I've been working on a multi-user php calendar for the past few months.  One of the features I'm most proud of is an availability chart similar to a feature outlook has so you can schedule a meeting with multiple people and see when everyone is free and busy.</p>
<p><a href="http://blog.joshschumacher.com/wp-content/uploads/2007/03/availability_view.png" title="Availability View"><img src="http://blog.joshschumacher.com/wp-content/uploads/2007/03/availability_view.thumbnail.png" style="border: 1px solid #999999; margin: 5px; padding: 2px; float: right" alt="Availability View" /></a>Since I'm using <a href="http://www.prototypejs.org/">Prototype</a> for my javascript library already, I took advantage of the <a href="http://prototype-window.xilinus.com/">Prototype Window Class</a> to make modal and dialog windows. One of the downsides to this is it adds another step of complexity to ensuring everything is properly synchronized. For example, my scheduler window has to maintain in sync with it's parent window if dates where changed at that level.</p>
<p>To start off, I create actions for nextDay() and prevDay().  These are simply fired onclick() on buttons with corresponding labels.</p>
<div class="igBar"><span id="ljavascript-17"><a href="#" onclick="javascript:showPlainTxt('javascript-17'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-17">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">function</span> nextDay<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">updateAvailabilityChart<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'next'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Next we'll define the updateAvailabilityChart() function.  The arrayInviteUsers holds an array of user ids (this is out of the scope of this article).</p>
<div class="igBar"><span id="ljavascript-18"><a href="#" onclick="javascript:showPlainTxt('javascript-18'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-18">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">// param change = none, next or prev</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">function</span> updateAvailabilityChart<span style="color: #66cc66;">&#40;</span>change<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> startString = window.<span style="color: #006600;">parent</span>.<span style="color: #006600;">getStartDate</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> endString = window.<span style="color: #006600;">parent</span>.<span style="color: #006600;">getEndDate</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'availabilityChart'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">innerHTML</span> = <span style="color: #3366CC;">'Loading...'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> counter = <span style="color: #CC0000;color:#800000;">0</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> params = <span style="color: #3366CC;">''</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">arrayInviteUsers.<span style="color: #006600;">each</span><span style="color: #66cc66;">&#40;</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>user<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">counter++;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">params += <span style="color: #3366CC;">'userid'</span>+counter+<span style="color: #3366CC;">'='</span>+user+<span style="color: #3366CC;">'&amp;amp;'</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">params += <span style="color: #3366CC;">'startString='</span>+startString+<span style="color: #3366CC;">'&amp;amp;'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">params += <span style="color: #3366CC;">'endString='</span>+endString+<span style="color: #3366CC;">'&amp;amp;'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">params += <span style="color: #3366CC;">'change='</span>+change;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> url = <span style="color: #3366CC;">'get_availability.php'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> myAjax = <span style="color: #003366; font-weight: bold;">new</span> Ajax.<span style="color: #006600;">Request</span><span style="color: #66cc66;">&#40;</span> url, <span style="color: #66cc66;">&#123;</span> method: <span style="color: #3366CC;">'get'</span>, parameters: params, onSuccess: loadedAvail <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'q'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">value</span> = <span style="color: #3366CC;">''</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The above code will make an Ajax request to get_availability.php which will increment, decrement or keep the start and end dates the same and then return some cool response text starting with the new start date, new end date and html for the availability table.  I defined a delimiter of '^^;;^^' just so I can tell where data starts and stops.  Below is the basic code in get_availability.php.</p>
<div class="igBar"><span id="lphp-19"><a href="#" onclick="javascript:showPlainTxt('php-19'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-19">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$strStartTime</span> = <a href="http://www.php.net/isset"><span style="color:#000066;">isset</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$_REQUEST</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'startString'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> ? <a href="http://www.php.net/strtotime"><span style="color:#000066;">strtotime</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$_REQUEST</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'startString'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> : <a href="http://www.php.net/time"><span style="color:#000066;">time</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$strEndTime</span> = <a href="http://www.php.net/isset"><span style="color:#000066;">isset</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$_REQUEST</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'endString'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> ? <a href="http://www.php.net/strtotime"><span style="color:#000066;">strtotime</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$_REQUEST</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'endString'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> : <a href="http://www.php.net/time"><span style="color:#000066;">time</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span>!<a href="http://www.php.net/is_numeric"><span style="color:#000066;">is_numeric</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$strStartTime</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$strStartTime</span> = <a href="http://www.php.net/time"><span style="color:#000066;">time</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span>!<a href="http://www.php.net/is_numeric"><span style="color:#000066;">is_numeric</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$strEndTime</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$strEndTime</span> = <span style="color:#0000FF;">$strStartTime</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$strStartTime</span>&gt; <span style="color:#0000FF;">$strEndTime</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$strEndTime</span> = <span style="color:#0000FF;">$strStartTime</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$change</span> = <a href="http://www.php.net/isset"><span style="color:#000066;">isset</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$_REQUEST</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'change'</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> ? <span style="color:#0000FF;">$_REQUEST</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'change'</span><span style="color:#006600; font-weight:bold;">&#93;</span> : <span style="color:#FF0000;">'none'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">switch</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$change</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">case</span> <span style="color:#FF0000;">'prev'</span>:</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$strTime</span> = <a href="http://www.php.net/mktime"><span style="color:#000066;">mktime</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC66CC;color:#800000;">0</span>,<span style="color:#CC66CC;color:#800000;">0</span>,<span style="color:#CC66CC;color:#800000;">0</span>,<a href="http://www.php.net/date"><span style="color:#000066;">date</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'m'</span>,<span style="color:#0000FF;">$strStartTime</span><span style="color:#006600; font-weight:bold;">&#41;</span>,<a href="http://www.php.net/date"><span style="color:#000066;">date</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'d'</span>,<span style="color:#0000FF;">$strStartTime</span><span style="color:#006600; font-weight:bold;">&#41;</span>-<span style="color:#CC66CC;color:#800000;">1</span>,<a href="http://www.php.net/date"><span style="color:#000066;">date</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'Y'</span>,<span style="color:#0000FF;">$strStartTime</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">break</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">case</span> <span style="color:#FF0000;">'next'</span>:</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$strTime</span> = <a href="http://www.php.net/mktime"><span style="color:#000066;">mktime</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC66CC;color:#800000;">0</span>,<span style="color:#CC66CC;color:#800000;">0</span>,<span style="color:#CC66CC;color:#800000;">0</span>,<a href="http://www.php.net/date"><span style="color:#000066;">date</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'m'</span>,<span style="color:#0000FF;">$strStartTime</span><span style="color:#006600; font-weight:bold;">&#41;</span>,<a href="http://www.php.net/date"><span style="color:#000066;">date</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'d'</span>,<span style="color:#0000FF;">$strStartTime</span><span style="color:#006600; font-weight:bold;">&#41;</span>+<span style="color:#CC66CC;color:#800000;">1</span>,<a href="http://www.php.net/date"><span style="color:#000066;">date</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'Y'</span>,<span style="color:#0000FF;">$strStartTime</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">break</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">default</span>:</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$strTime</span> = <span style="color:#0000FF;">$strStartTime</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">break</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$strTimeEnd</span> = <span style="color:#0000FF;">$strTime</span> + <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$strEndTime</span> - <span style="color:#0000FF;">$strStartTime</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/print"><span style="color:#000066;">print</span></a> <a href="http://www.php.net/date"><span style="color:#000066;">date</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'m<span style="color:#000099; font-weight:bold;">\/</span>d<span style="color:#000099; font-weight:bold;">\/</span>Y'</span>,<span style="color:#0000FF;">$strTime</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/print"><span style="color:#000066;">print</span></a> <span style="color:#FF0000;">"^^;;^^"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/print"><span style="color:#000066;">print</span></a> <a href="http://www.php.net/date"><span style="color:#000066;">date</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'m<span style="color:#000099; font-weight:bold;">\/</span>d<span style="color:#000099; font-weight:bold;">\/</span>Y'</span>,<span style="color:#0000FF;">$strTimeEnd</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/print"><span style="color:#000066;">print</span></a> <span style="color:#FF0000;">"^^;;^^"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$display</span> = <span style="color:#000000; font-weight:bold;">new</span> Display<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$display</span>-&gt;<span style="color:#006600;">drawDayAvailibility</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$usersArray</span>, <span style="color:#0000FF;">$strTime</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Finally, the Ajax request defined a function to be called when the request return successfully.  This function will update the innerHTML of a div on the page and tell the parent window what the new start date and end date is.</p>
<div class="igBar"><span id="ljavascript-20"><a href="#" onclick="javascript:showPlainTxt('javascript-20'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-20">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">function</span> loadedAvail<span style="color: #66cc66;">&#40;</span>transport<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> entityParts = transport.<span style="color: #006600;">responseText</span>.<span style="color: #006600;">split</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'^^;;^^'</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> newStart&nbsp; &nbsp; = entityParts<span style="color: #66cc66;">&#91;</span><span style="color: #CC0000;color:#800000;">0</span><span style="color: #66cc66;">&#93;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> newEnd&nbsp; &nbsp; &nbsp; = entityParts<span style="color: #66cc66;">&#91;</span><span style="color: #CC0000;color:#800000;">1</span><span style="color: #66cc66;">&#93;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> html &nbsp; &nbsp;&nbsp; &nbsp;= entityParts<span style="color: #66cc66;">&#91;</span><span style="color: #CC0000;color:#800000;">2</span><span style="color: #66cc66;">&#93;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'availabilityChart'</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">innerHTML</span> = html;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">window.<span style="color: #006600;">parent</span>.<span style="color: #006600;">setStartDate</span><span style="color: #66cc66;">&#40;</span>newStart<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">window.<span style="color: #006600;">parent</span>.<span style="color: #006600;">setEndDate</span><span style="color: #66cc66;">&#40;</span>newEnd<span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>This is a very small piece of a very large project but it's fun to share with others. If you have questions or could benefit from some more of the details going into this basic process, let me know and I can post more.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.joshschumacher.com/2007/03/02/playing-well-together-prototype-js-and-php/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Transitions</title>
		<link>http://blog.joshschumacher.com/2007/02/20/transitions/</link>
		<comments>http://blog.joshschumacher.com/2007/02/20/transitions/#comments</comments>
		<pubDate>Wed, 21 Feb 2007 07:05:40 +0000</pubDate>
		<dc:creator>Josh Schumacher</dc:creator>
		
		<category><![CDATA[Life]]></category>

		<guid isPermaLink="false">http://blog.joshschumacher.com/2007/02/20/transitions/</guid>
		<description><![CDATA[I am graduating from Western Washington University this March - just over a month from now.  It's an exiting time, classes are winding down, the job hunt is on and we're looking for a place to live in the Seattle area.  My girlfriend Megan is going to be doing her student teaching in [...]]]></description>
			<content:encoded><![CDATA[<p>I am graduating from Western Washington University this March - just over a month from now.  It's an exiting time, classes are winding down, the job hunt is on and we're looking for a place to live in the Seattle area.  My girlfriend Megan is going to be doing her student teaching in a second grade classroom in Normandy Park, WA and is very excited for that transition in her life.</p>
<p>My job search has identified a couple of fun companies.  I'm really looking for a PHP/MySQL/CSS/Javascript position so if you know of anyone hiring or if you are a potential employer - I'm your man.  My resume is available online at: <a href="http://joshschumacher.com/resume.php">http://joshschumacher.com/resume.php</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.joshschumacher.com/2007/02/20/transitions/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
