<?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>sometimes infinity is a loop</title>
	<atom:link href="http://fisherwebdev.com/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://fisherwebdev.com/wordpress</link>
	<description>howling screaming chanting</description>
	<lastBuildDate>Wed, 23 Jun 2010 19:48:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Undefined Arguments in JavaScript</title>
		<link>http://fisherwebdev.com/wordpress/2010/06/22/undefined-arguments-in-javascript/</link>
		<comments>http://fisherwebdev.com/wordpress/2010/06/22/undefined-arguments-in-javascript/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 06:22:59 +0000</pubDate>
		<dc:creator>Bill</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Tests]]></category>
		<category><![CDATA[arguments]]></category>
		<category><![CDATA[bullet-proof]]></category>
		<category><![CDATA[crockford]]></category>
		<category><![CDATA[empty string]]></category>
		<category><![CDATA[false]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[js bin]]></category>
		<category><![CDATA[null]]></category>
		<category><![CDATA[tags]]></category>
		<category><![CDATA[test]]></category>
		<category><![CDATA[undefined]]></category>
		<category><![CDATA[zero]]></category>

		<guid isPermaLink="false">http://fisherwebdev.com/wordpress/?p=165</guid>
		<description><![CDATA[Sometimes it&#8217;s the most basic things that make me wonder. In this case, I was trying to figure out the best way to determine that an argument had not been passed to a function. That is, we have a function &#8230; <a href="http://fisherwebdev.com/wordpress/2010/06/22/undefined-arguments-in-javascript/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Sometimes it&#8217;s the most basic things that make me wonder.  In this case, I was trying to figure out the best way to determine that an argument had <em>not</em> been passed to a function.  That is, we have a function that expects function(one, two), but someone might invoke it with function(one).  And we&#8217;d like to know that fact within the function, perhaps to set some default values.<span id="more-165"></span></p>
<p>(I feel that I should have this stuff under my belt, but I often have to remind myself of the weird rules of JavaScript.  I should probably be studying <a href="http://www.crockford.com/">the writings of Doug Crockford</a> more.)</p>
<p>So I start to wonder about this sort of thing, and I turn to the awesome <a href="http://jsbin.com/">JS Bin</a>.  I set up a test there, and I can provide you with a <a href="http://jsbin.com/isiwu3/9/edit">link to the test</a>&#8230; I love that.</p>
<p>But JS Bin is rather impermanent, and just in case that&#8217;s not working out, here is the original test and the results.</p>
<h2>code</h2>
<pre><code>
/* check for an absent argument to a function */

var testIt = function(one, two){
  gnomeSane = '';
  if(two === undefined){
    gnomeSane += "two is undefined. (two === undefined)&lt;br /&gt;";
  }
  if(two === null){
    gnomeSane += "two is null. (two === null)&lt;br /&gt;";
  }
  if(two === false){
    gnomeSane += "two is false. (two === false)&lt;br /&gt;";
  }
  if(two === ''){
    gnomeSane += "two is an empty string. (two === '')&lt;br /&gt;";
  }
  if(two === 0){
    gnomeSane += "two is zero. (two === 0)&lt;br /&gt;";
  }

  if(two == undefined){
    gnomeSane += "two is equivalent to undefined. (two == undefined)&lt;br /&gt;";
  }
  if(two == null){
    gnomeSane += "two is equivalent to null. (two == null)&lt;br /&gt;";
  }
  if(two == false){
    gnomeSane += "two is equivalent to false. (two == false)&lt;br /&gt;";
  }
  if(two == ''){
    gnomeSane += "two is equivalent to an empty string. (two == '')&lt;br /&gt;";
  }
  if(two == 0){
    gnomeSane += "two is equivalent to zero. (two == 0)&lt;br /&gt;";
  }

  if(typeof two == "undefined"){
    gnomeSane += "type of two is 'undefined'. (typeof two == 'undefined')&lt;br /&gt;";
  }

  if(!two){
    gnomeSane += "not two is true. (!two)&lt;br /&gt;";
  }

  gnomeSane = gnomeSane == '' ? 'two is '+two : gnomeSane;
  document.write('&lt;p&gt;'+one+'&lt;br /&gt;'+gnomeSane+'&lt;/p&gt;');
}

testIt('&lt;b&gt;The second argument is not being passed to the function.&lt;/b&gt;');
testIt('&lt;b&gt;Now the second argument is null.&lt;/b&gt;', null);
testIt('&lt;b&gt;Now the second argument is false.&lt;/b&gt;', false);
testIt('&lt;b&gt;Now the second argument is an empty string.&lt;/b&gt;', '');
testIt('&lt;b&gt;Now the second argument is zero.&lt;/b&gt;', 0);
​</code></pre>
<h2>results</h2>
<pre>
The second argument is not being passed to the function.
two is undefined. (two === undefined)
two is equivalent to undefined. (two == undefined)
two is equivalent to null. (two == null)
type of two is 'undefined'. (typeof two == 'undefined')
not two is true. (!two)

Now the second argument is null.
two is null. (two === null)
two is equivalent to undefined. (two == undefined)
two is equivalent to null. (two == null)
not two is true. (!two)

Now the second argument is false.
two is false. (two === false)
two is equivalent to false. (two == false)
two is equivalent to an empty string. (two == '')
two is equivalent to zero. (two == 0)
not two is true. (!two)

Now the second argument is an empty string.
two is an empty string. (two === '')
two is equivalent to false. (two == false)
two is equivalent to an empty string. (two == '')
two is equivalent to zero. (two == 0)
not two is true. (!two)

Now the second argument is zero.
two is zero. (two === 0)
two is equivalent to false. (two == false)
two is equivalent to an empty string. (two == '')
two is equivalent to zero. (two == 0)
not two is true. (!two)
</pre>
<h2>conclusions</h2>
<p>If you want to really just test for an undefined argument use:</p>
<pre>
two === undefined
</pre>
<p>or</p>
<pre>
typeof two == 'undefined'
</pre>
<p>I prefer the terseness of the former.  Also, note that typeof null is equivalent to &#8216;object&#8217;.</p>
<p>If you want to test for undefined <em>or</em> null use either:</p>
<pre>
two == undefined
</pre>
<p>or </p>
<pre>
two == null
</pre>
<p>Using both might make the code more clear, but it is not strictly necessary.</p>
<p>If you want to test for all &#8220;off values&#8221; (undefined, null, false, empty string, zero), then use:</p>
<pre>
!two
</pre>
]]></content:encoded>
			<wfw:commentRss>http://fisherwebdev.com/wordpress/2010/06/22/undefined-arguments-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>This post was sent via Posterous</title>
		<link>http://fisherwebdev.com/wordpress/2010/06/20/this-post-was-sent-via-posterous/</link>
		<comments>http://fisherwebdev.com/wordpress/2010/06/20/this-post-was-sent-via-posterous/#comments</comments>
		<pubDate>Sun, 20 Jun 2010 15:12:56 +0000</pubDate>
		<dc:creator>Bill via Posterous</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://fisherwebdev.com/wordpress/2010/06/20/this-post-was-sent-via-posterous/</guid>
		<description><![CDATA[This is another test to see how easy I can make it for a client to post to their blog. But maybe my real problem is all the bugs on my computer. Posted via email from Bill&#8217;s posterous]]></description>
			<content:encoded><![CDATA[<div class='posterous_autopost'><a href='http://posterous.com/getfile/files.posterous.com/fisherwebdev/n6T7HukJ2uKFq16eFsM1VCUxYrZlLUyRLR7o5VNvpM3loCvMio8DfdTuQrY3/2010-05-26_07.39.21.jpg.scaled.1000.jpg'><img src="http://posterous.com/getfile/files.posterous.com/fisherwebdev/DF4qoIhTxgOvcBtYdFrdP7LOR1RcBZFAtw9TWeuuOHE4nStIo3D9AcvM6v9L/2010-05-26_07.39.21.jpg.scaled.500.jpg" width="500" height="375" /></a>
</p>
<p>This is another test to see how easy I can make it for a client to post to their blog. But maybe my real problem is all the bugs on my computer. </p>
<p style="font-size: 10px">  <a href="http://posterous.com">Posted via email</a>   from <a href="http://fisherwebdev.posterous.com/this-post-was-sent-via-posterous">Bill&#8217;s posterous</a>  </p>
</p></div>
]]></content:encoded>
			<wfw:commentRss>http://fisherwebdev.com/wordpress/2010/06/20/this-post-was-sent-via-posterous/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>This post came from my Android</title>
		<link>http://fisherwebdev.com/wordpress/2010/06/19/this-post-came-from-my-android/</link>
		<comments>http://fisherwebdev.com/wordpress/2010/06/19/this-post-came-from-my-android/#comments</comments>
		<pubDate>Sat, 19 Jun 2010 21:12:30 +0000</pubDate>
		<dc:creator>Bill</dc:creator>
				<category><![CDATA[Tests]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wordpress android iphone posterous]]></category>

		<guid isPermaLink="false">http://fisherwebdev.com/wordpress/2010/06/19/this-post-came-from-my-android/</guid>
		<description><![CDATA[I&#8217;m using the WordPress app for Android. The purpose of this post is simply to test this out. I have a client that would like to photo-blog from his iPhone, so I thought. I might check out the possibilities. I &#8230; <a href="http://fisherwebdev.com/wordpress/2010/06/19/this-post-came-from-my-android/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m using the WordPress app for Android. The purpose of this post is simply to test this out. I have a client that would like to photo-blog from his iPhone, so I thought. I might check out the possibilities. I might instead rig something up with <a href="http://posterous.com">Posterous</a>.  </p>
]]></content:encoded>
			<wfw:commentRss>http://fisherwebdev.com/wordpress/2010/06/19/this-post-came-from-my-android/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom Styles for Google Maps</title>
		<link>http://fisherwebdev.com/wordpress/2010/05/22/custom-styles-for-google-maps/</link>
		<comments>http://fisherwebdev.com/wordpress/2010/05/22/custom-styles-for-google-maps/#comments</comments>
		<pubDate>Sat, 22 May 2010 11:09:15 +0000</pubDate>
		<dc:creator>Bill</dc:creator>
				<category><![CDATA[Google APIs]]></category>
		<category><![CDATA[Google Maps]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Tests]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://fisherwebdev.com/wordpress/?p=154</guid>
		<description><![CDATA[I attended Google I/O 2010 this past week, and they announced that that the Google Maps API v3 is now able to be styled. Check out the announcement on the Google Blog. Here is my first experiment with it. Before &#8230; <a href="http://fisherwebdev.com/wordpress/2010/05/22/custom-styles-for-google-maps/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I attended <a href="http://code.google.com/events/io/2010/">Google I/O 2010</a> this past week, and they announced that that the <a href="http://code.google.com/apis/maps/documentation/javascript/">Google Maps API v3</a> is now able to be styled.  Check out the <a href="http://googlegeodevelopers.blogspot.com/2010/05/add-touch-of-style-to-your-maps.html">announcement on the Google Blog</a>.  Here is my first <a href="http://fisherwebdev.com/mapcolors">experiment</a> with it.</p>
<p><span id="more-154"></span></p>
<p>Before now, this was something only possible with tools like <a href="http://mapnik.org/">Mapnik</a>, <a href="http://teczno.com/cascadenik/doc/">Cascadenik</a> and <a href="http://www.openstreetmap.org/">OpenStreetMap</a>.  And for white-label maps or extremely customized maps, those tools are still quite relevant.</p>
<h2>Resources</h2>
<ul>
<li><a href="http://code.google.com/apis/maps/documentation/javascript/">Google Maps API</a></li>
<li><a href="http://code.google.com/apis/maps/documentation/javascript/overlays.html#StyledMaps">Google Styled Maps Documentation</a></li>
<li><a href="http://gmaps-samples-v3.googlecode.com/svn/trunk/styledmaps/wizard/index.html">Google Styled Maps Wizard</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://fisherwebdev.com/wordpress/2010/05/22/custom-styles-for-google-maps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>vCards as QR Codes with Google Chart API</title>
		<link>http://fisherwebdev.com/wordpress/2010/05/21/vcards-as-qr-codes-with-google-image-chart-api/</link>
		<comments>http://fisherwebdev.com/wordpress/2010/05/21/vcards-as-qr-codes-with-google-image-chart-api/#comments</comments>
		<pubDate>Fri, 21 May 2010 23:53:16 +0000</pubDate>
		<dc:creator>Bill</dc:creator>
				<category><![CDATA[Google APIs]]></category>
		<category><![CDATA[Information Flow]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[QR Codes]]></category>

		<guid isPermaLink="false">http://fisherwebdev.com/wordpress/?p=140</guid>
		<description><![CDATA[Here is an example of a vCard turned into a UTF-8 encoded URL string. Once we encode it in this fashion, we can put it in a URL formatted for the Google Chart API that will generate a QR Code &#8230; <a href="http://fisherwebdev.com/wordpress/2010/05/21/vcards-as-qr-codes-with-google-image-chart-api/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Here is an example of a <a href="http://en.wikipedia.org/wiki/VCard">vCard</a> turned into a UTF-8 encoded URL string.  Once we encode it in this fashion, we can put it in a URL formatted for the <a href="http://code.google.com/apis/chart/docs/making_charts.html">Google Chart API</a> that will generate a <a href="http://en.wikipedia.org/wiki/QR_Code">QR Code</a> of the vCard data.<span id="more-140"></span></p>
<h2>Original vCard</h2>
<pre><code>
BEGIN:VCARD
VERSION:3.0
N:Gump;Forrest
FN:Forrest Gump
ORG:Bubba Gump Shrimp Co.
TITLE:Shrimp Man
TEL;TYPE=WORK,VOICE:(111) 555-1212
TEL;TYPE=HOME,VOICE:(404) 555-1212
ADR;TYPE=WORK:;;100 Waters Edge;Baytown;LA;30314;United States of America
LABEL;TYPE=WORK:100 Waters Edge\nBaytown, LA 30314\nUnited States of America
ADR;TYPE=HOME:;;42 Plantation St.;Baytown;LA;30314;United States of America
LABEL;TYPE=HOME:42 Plantation St.\nBaytown, LA 30314\nUnited States of America
EMAIL;TYPE=PREF,INTERNET:forrestgump@example.com
REV:20080424T195243Z
END:VCARD
</code></pre>
<h2>vCard Encoded for a URL</h2>
<pre><code>
BEGIN%3AVCARD%0AVERSION%3A3.0%0AN%3AGump%3BForrest%0AFN%3AForrest%20Gump%0AORG%3ABubba%20Gump%20Shrimp%20Co.%0ATITLE%3AShrimp%20Man%0ATEL%3BTYPE%3DWORK%2CVOICE%3A%28111%29%20555-1212%0ATEL%3BTYPE%3DHOME%2CVOICE%3A%28404%29%20555-1212%0AADR%3BTYPE%3DWORK%3A%3B%3B100%20Waters%20Edge%3BBaytown%3BLA%3B30314%3BUnited%20States%20of%20America%0ALABEL%3BTYPE%3DWORK%3A100%20Waters%20Edge%5CnBaytown%2C%20LA%2030314%5CnUnited%20States%20of%20America%0AADR%3BTYPE%3DHOME%3A%3B%3B42%20Plantation%20St.%3BBaytown%3BLA%3B30314%3BUnited%20States%20of%20America%0ALABEL%3BTYPE%3DHOME%3A42%20Plantation%20St.%5CnBaytown%2C%20LA%2030314%5CnUnited%20States%20of%20America%0AEMAIL%3BTYPE%3DPREF%2CINTERNET%3Aforrestgump%40example.com%0AREV%3A20080424T195243Z%0AEND%3AVCARD
</code></pre>
<h2>Encoded, but perhaps easier to read</h2>
<pre><code>
BEGIN%3AVCARD%0A
VERSION%3A3.0%0A
N%3AGump%3BForrest%0A
FN%3AForrest%20Gump%0A
ORG%3ABubba%20Gump%20Shrimp%20Co.%0A
TITLE%3AShrimp%20Man%0A
TEL%3BTYPE%3DWORK%2CVOICE%3A%28111%29%20555-1212%0A
TEL%3BTYPE%3DHOME%2CVOICE%3A%28404%29%20555-1212%0A
ADR%3BTYPE%3DWORK%3A%3B%3B100%20Waters%20Edge%3BBaytown%3BLA%3B30314%3BUnited%20States%20of%20America%0A
LABEL%3BTYPE%3DWORK%3A100%20Waters%20Edge%5CnBaytown%2C%20LA%2030314%5CnUnited%20States%20of%20America%0A
ADR%3BTYPE%3DHOME%3A%3B%3B42%20Plantation%20St.%3BBaytown%3BLA%3B30314%3BUnited%20States%20of%20America%0A
LABEL%3BTYPE%3DHOME%3A42%20Plantation%20St.%5CnBaytown%2C%20LA%2030314%5CnUnited%20States%20of%20America%0A
EMAIL%3BTYPE%3DPREF%2CINTERNET%3Aforrestgump%40example.com%0A
REV%3A20080424T195243Z%0A
END%3AVCARD
</code></pre>
<h2>Submit to Google</h2>
<p>This can now be submitted to Google&#8217;s Chart API as a URL:</p>
<pre><code>

http://chart.apis.google.com/chart?cht=qr&#038;chs=400x400&#038;chl=BEGIN:VCARD%0AVERSION:3.0%0AN:Gump;Forrest%0AFN:Forrest%20Gump%0AORG:Bubba%20Gump%20Shrimp%20Co.%0ATITLE:Shrimp%20Man%0ATEL;TYPE%3DWORK,VOICE:(111)%20555-1212%0ATEL;TYPE%3DHOME,VOICE:(404)%20555-1212%0AADR;TYPE%3DWORK:;;100%20Waters%20Edge;Baytown;LA;30314;United%20States%20of%20America%0ALABEL;TYPE%3DWORK:100%20Waters%20Edge\nBaytown,%20LA%2030314\nUnited%20States%20of%20America%0AADR;TYPE%3DHOME:;;42%20Plantation%20St.;Baytown;LA;30314;United%20States%20of%20America%0ALABEL;TYPE%3DHOME:42%20Plantation%20St.\nBaytown,%20LA%2030314\nUnited%20States%20of%20America%0AEMAIL;TYPE%3DPREF,INTERNET:forrestgump%40example.com%0AREV:20080424T195243Z%0AEND:VCARD&#038;chld=L

</code></pre>
<h2>The Result</h2>
<p>The image below is coming from the Google Chart API, not an image file on my server.<br />
<img src="http://chart.apis.google.com/chart?cht=qr&#038;chs=400x400&#038;chl=BEGIN:VCARD%0AVERSION:3.0%0AN:Gump;Forrest%0AFN:Forrest%20Gump%0AORG:Bubba%20Gump%20Shrimp%20Co.%0ATITLE:Shrimp%20Man%0ATEL;TYPE%3DWORK,VOICE:(111)%20555-1212%0ATEL;TYPE%3DHOME,VOICE:(404)%20555-1212%0AADR;TYPE%3DWORK:;;100%20Waters%20Edge;Baytown;LA;30314;United%20States%20of%20America%0ALABEL;TYPE%3DWORK:100%20Waters%20Edge\nBaytown,%20LA%2030314\nUnited%20States%20of%20America%0AADR;TYPE%3DHOME:;;42%20Plantation%20St.;Baytown;LA;30314;United%20States%20of%20America%0ALABEL;TYPE%3DHOME:42%20Plantation%20St.\nBaytown,%20LA%2030314\nUnited%20States%20of%20America%0AEMAIL;TYPE%3DPREF,INTERNET:forrestgump%40example.com%0AREV:20080424T195243Z%0AEND:VCARD&#038;chld=L" alt="Example QR Code" /></p>
<h2>Resources</h2>
<ul>
<li><a href="http://en.wikipedia.org/wiki/VCard">vCard</a></li>
<li><a href="http://www.hypergurl.com/urlencode.html">URL Encode and Decode Generator Tool</a></li>
<li><a href="http://php.net/manual/en/function.urlencode.php">PHP urlencode</a></li>
<li><a href="http://code.google.com/apis/chart/docs/making_charts.html">Google Image Chart API</a> &#8211; <a href="http://code.google.com/apis/chart/docs/gallery/qr_codes.html">QR Code Generator</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://fisherwebdev.com/wordpress/2010/05/21/vcards-as-qr-codes-with-google-image-chart-api/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tarpipe: a cool idea for lifestreaming, but is it secure?</title>
		<link>http://fisherwebdev.com/wordpress/2009/12/21/tarpipe-a-cool-idea-for-lifestreaming-but-is-it-secure/</link>
		<comments>http://fisherwebdev.com/wordpress/2009/12/21/tarpipe-a-cool-idea-for-lifestreaming-but-is-it-secure/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 09:44:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Information Flow]]></category>
		<category><![CDATA[lifestreaming]]></category>

		<guid isPermaLink="false">http://fisherwebdev.com/wordpress/?p=126</guid>
		<description><![CDATA[I decided to check out Tarpipe because it looks like the kind of information flow / lifestreaming thing I&#8217;ve been interested in developing for Posterous. Strangely, Tarpipe doesn&#8217;t support Posterous, but instead supports Tumblr. But I thought I&#8217;d try it &#8230; <a href="http://fisherwebdev.com/wordpress/2009/12/21/tarpipe-a-cool-idea-for-lifestreaming-but-is-it-secure/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I decided to check out <a href="http://tarpipe.com">Tarpipe</a> because it looks like the kind of information flow / <a href="http://en.wikipedia.org/wiki/Lifestreaming">lifestreaming</a> thing I&#8217;ve been interested in developing for <a href="http://posterous.com">Posterous</a>.  Strangely, Tarpipe doesn&#8217;t support Posterous, but instead supports <a href="http://www.tumblr.com">Tumblr</a>.  But I thought I&#8217;d try it anyway.  </p>
<p>The creepy thing, however, is that I had to give my <a href="http://twitter.com">Twitter</a> login info to Tarpipe to get this rolling.<span id="more-126"></span>  Even if I decided that I trust these people, how can that be secure?  They must be submitting this info to Twitter <i>in plain text</i>, right?  That means they are storing it <i>in plain text</i>, right?  Or maybe I don&#8217;t understand their advanced cryptography?  My understanding was that once you encrypted something, that&#8217;s it.  You can&#8217;t de-encrypt it.  You&#8217;re supposed to simply compare two encrypted values&#8230; something tells me this is not happening.</p>
<p>I also wonder how this is achieved on Posterous or Tumblr, with their native autoposting to other services.</p>
<p>Anyhoo&#8230; it might be incredibly useful at some point, so I&#8217;m just checking it out for now.  But my Twitter password will probably change very soon.</p>
<p>UPDATE: Looks like Tarpipe is pretty much barely beta, and it&#8217;s not as useful as I originally thought&#8230; probably will be after they start using <a href="http://code.google.com/p/pubsubhubbub/">PubSubHubbub</a> or <a href="http://en.wikipedia.org/wiki/Cron">cron jobs</a> or some other way of turning regular RSS/Atom feeds into real-time feeds.  Apparently, one needs to develop a custom application to use much of what they have built.  That&#8217;s cool, but not easy for a quick test.</p>
]]></content:encoded>
			<wfw:commentRss>http://fisherwebdev.com/wordpress/2009/12/21/tarpipe-a-cool-idea-for-lifestreaming-but-is-it-secure/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WordPress CMS: testimonials, custom fields, and random posts</title>
		<link>http://fisherwebdev.com/wordpress/2009/11/13/wordpress-cms-testimonials-custom-fields-and-random-posts/</link>
		<comments>http://fisherwebdev.com/wordpress/2009/11/13/wordpress-cms-testimonials-custom-fields-and-random-posts/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 20:07:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://fisherwebdev.com/wordpress/?p=110</guid>
		<description><![CDATA[Today I had to set up a way to organize and publish the content of customer testimonials. Excerpts from these testimonials were going to appear in the left column of the page, in addition to being able to viewed in &#8230; <a href="http://fisherwebdev.com/wordpress/2009/11/13/wordpress-cms-testimonials-custom-fields-and-random-posts/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Today I had to set up a way to organize and publish the content of customer testimonials.  Excerpts from these testimonials were going to appear in the left column of the page, in addition to being able to viewed in their entirety.  So the designer of the site and I both agreed they should be Posts, submitted within a Testimonial category.</p>
<p>On the page where the testimonial should appear, the client would have the option of getting a specific Testimonial to appear in the left column.  However, if the client forgot to specify a Testimonial post, then a random testimonial would appear instead.</p>
<p>Here is the code that went in index.php&#8230;<span id="more-110"></span></p>
<pre><code>&lt;?php
    if(in_array("testimonial_id", get_post_custom_keys())){
        $custom_fields = get_post_custom();
        //get_custom_field_value() is in functions.php
        $excerpt_id = get_custom_field_value('testimonial_id', $custom_fields);
        $wp_post_obj = get_post($excerpt_id);
    }
    else{ //no testimonial_id set, so use random testimonial post
        $rand_posts = get_posts('showposts=1&#038;category_name=Testimonial&#038;orderby=rand');
        $wp_post_obj = $rand_posts[0];
    }
    $testimonial_custom_fields = get_post_custom($wp_post_obj-&gt;ID);
    $blockquote = $wp_post_obj-&gt;post_excerpt;
    $cite = get_custom_field_value('testimonial_person', $testimonial_custom_fields);
    $location = get_custom_field_value('testimonial_location', $testimonial_custom_fields);
?&gt;
&lt;blockquote&gt;&lt;?php echo($blockquote); ?&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;cite&gt;&lt;?php echo($cite); ?&gt;&lt;/cite&gt;&lt;/p&gt;
&lt;p&gt;&lt;?php echo($location); ?&gt;&lt;/p&gt;
</code></pre>
<p>There are a couple of notable things about that code.  First, we test to see if the client put a testimonial_id custom field in the page where the testimonial appears.  If the custom field is there, then we retrieve the value of it with a custom function stored in functions.php (more on that below).  If not, then we get a random post within the Testimonial category.  Second, we take the post object and retrieve the Excerpt from it, as well as two custom fields using our same custom function.</p>
<p>Here is the code that goes in functions.php&#8230;</p>
<pre><code>
/* ********************************
get_custom_field_value($custom_field_key, $custom_fields_array)

purpose:
    to retrieve the value of a custom field.
args:
    $custom_field_key : the name of the custom field.
    $custom_fields_array : the associative array of custom fields returned by get_custom_fields().
returns:
    the value of the custom field, or if the custom field does not exist, an empty string.
example:
    $custom_fields = get_post_custom();
    $excerpt_id = get_custom_field_value('testimonial_id', $custom_fields);
    - or further reduced to -
    $excerpt_id = get_custom_field_value('testimonial_id', get_post_custom());
******************************** */
function get_custom_field_value($custom_field_key, $custom_fields_array) {
    if(isset($custom_fields_array[$custom_field_key])){
        foreach ($custom_fields_array[$custom_field_key] as $key => $value) {
            $return = $value; //use the last one, if the custom field is accidentally used more than once.
        }
        return $return;
}
    else{
        return "";
    }
}
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://fisherwebdev.com/wordpress/2009/11/13/wordpress-cms-testimonials-custom-fields-and-random-posts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sections of a WordPress Site</title>
		<link>http://fisherwebdev.com/wordpress/2009/10/22/sections-of-a-wordpress-site/</link>
		<comments>http://fisherwebdev.com/wordpress/2009/10/22/sections-of-a-wordpress-site/#comments</comments>
		<pubDate>Fri, 23 Oct 2009 06:54:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://fisherwebdev.com/wordpress/?p=90</guid>
		<description><![CDATA[Sometimes it&#8217;s useful to know whether the current post or page is within a specified hierarchical section of the site. For example, I may have a page on my site called &#8220;Super Funky&#8221;, and some child pages dedicated to James &#8230; <a href="http://fisherwebdev.com/wordpress/2009/10/22/sections-of-a-wordpress-site/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Sometimes it&#8217;s useful to know whether the current post or page is within a specified hierarchical section of the site.  </p>
<p>For example, I may have a page on my site called &#8220;Super Funky&#8221;, and some child pages dedicated to James Brown, Sly Stone, Parliament-Funkadelic, etc.  On these pages, I have some special code that prevents them from uncontrollably getting down on the dancefloor&#8230; but the question is, how do we set up the logic that will check whether we are within the Super Funky section of the site? <span id="more-90"></span></p>
<p>Let&#8217;s say the Super Funky page&#8217;s ID number is 74.  I could easily check to see if the current page has page-id-74 as an ancestor with the following code:</p>
<pre>
<code>
$ancestors = get_post_ancestors($post);
if(in_array(74, $ancestors)) {
    // Code that will be parsed when this page has a ancestor with id 74
}
</pre>
<p></code></p>
<p>I found that code snippet on <a href="http://coenjacobs.net/blog/page-ancestors-easy-wordpress">Coen Jacobs' blog</a>.</p>
<p><strong>However</strong>, that code won't include the Super Funky page itself.  So if we want to have some conditional logic for code that should only execute in the Super Funky section of the site, we might want to write a function and put it in the /wp-content/themes/my_theme/functions.php file.  Here is my suggestion:</p>
<p><code>
<pre>
/* ********************************

is_in_section($section_post_id, $post_obj)

purpose: to see if the current post/page is either the descendant of a specified post/page,
	or if it is the specified post/page itself.

args:
	$section_post_id : this is the post id number.
	$post_obj : this is the object returned by $wp_query->get_queried_object();

example:
	if( !is_in_section(74, $wp_query->get_queried_object()) ){
		//this code does not execute within page-id-74, or any of its descendants
	}

******************************** */
function is_in_section($section_post_id, $post_obj) {
      $post_ancestors = get_post_ancestors($post_obj->ID);
      if( $post_obj->ID == $section_post_id || (in_array($section_post_id, $post_ancestors)) ){
      	return true;
      }
      else{
      	return false;
      }
}
</code></pre>
<p>I hope that's useful!</p>
]]></content:encoded>
			<wfw:commentRss>http://fisherwebdev.com/wordpress/2009/10/22/sections-of-a-wordpress-site/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Default WordPress Video</title>
		<link>http://fisherwebdev.com/wordpress/2009/09/11/default-wordpress-video/</link>
		<comments>http://fisherwebdev.com/wordpress/2009/09/11/default-wordpress-video/#comments</comments>
		<pubDate>Fri, 11 Sep 2009 10:12:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://fisherwebdev.com/wordpress/?p=76</guid>
		<description><![CDATA[Some comparisons of the stock video functionality, using the &#8220;Add Video&#8221; button above the editing window in WP 2.8. Here is an example of the &#8220;file URL&#8221; option &#8212; not so great.  The upload functionality on the WordPress backend is &#8230; <a href="http://fisherwebdev.com/wordpress/2009/09/11/default-wordpress-video/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Some comparisons of the stock video functionality, using the &#8220;Add Video&#8221; button above the editing window in WP 2.8. <span id="more-76"></span></p>
<p>Here is an example of the &#8220;file URL&#8221; option &#8212; not so great.  The upload functionality on the WordPress backend is nice, but of course the video playback over HTTP is not happening &#8212; basically you either have to download the file or have Quicktime installed.</p>
<p><a rel="attachment wp-att-77" href="http://fisherwebdev.com/wordpress/2009/09/11/default-wordpress-video/jumps/">jumps</a></p>
<p>Another option is the &#8220;from URL&#8221; option &#8212; pick your favorite video service: YouTube, Vimeo, etc.  Am I doing something wrong?  This is just a link.</p>
<p><a href="http://www.youtube.com/watch?v=8Zku1xvhkEc">Two Equations</a></p>
]]></content:encoded>
			<wfw:commentRss>http://fisherwebdev.com/wordpress/2009/09/11/default-wordpress-video/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>YouTube Lightbox Embedding</title>
		<link>http://fisherwebdev.com/wordpress/2009/08/28/youtube-lightbox-embedding/</link>
		<comments>http://fisherwebdev.com/wordpress/2009/08/28/youtube-lightbox-embedding/#comments</comments>
		<pubDate>Sat, 29 Aug 2009 05:13:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Web Video]]></category>

		<guid isPermaLink="false">http://fisherwebdev.com/wordpress/?p=51</guid>
		<description><![CDATA[Here is a YouTube Flash video player that is viewed within the ever-popular &#8220;lightbox effect&#8221;. To achieve this, I am using iBox, which is freely available as a simple JavaScript file or as a WordPress plugin. Since this is within &#8230; <a href="http://fisherwebdev.com/wordpress/2009/08/28/youtube-lightbox-embedding/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Here is a <a href="http://youtube.com">YouTube</a> <a href="http://www.adobe.com/products/flashplayer/">Flash</a> video player that is viewed within the ever-popular &#8220;lightbox effect&#8221;.  To achieve this, I am using <a href="http://www.ibegin.com/labs/ibox/">iBox</a>, which is freely available as a simple JavaScript file or as a <a href="http://wordpress.org">WordPress</a> plugin.  Since this is within my blog, I chose the WordPress version.</p>
<p>iBox allows me to use a link to a YouTube video.  In this case, I wanted my link to look like a video clip, so I used <a href="http://docs.info.apple.com/article.html?path=Mac/10.4/en/mh364.html">Grab on my MacBook to get an image</a> of the video player on my <a href="http://fisherwebdev.com/wordpress/2009/08/10/youtube-player-tests/">YouTube player test page</a>.</p>
<p>That worked fine, but to prevent those &#8220;related videos&#8221; from popping up at the end of the playback, I had to edit the iBox JavaScript file.  Basically, I had to update the HTML string that would be dynamically added to the DOM to bring it inline with <a href="http://code.google.com/apis/youtube/player_parameters.html">YouTube&#8217;s current recommendations</a> for modifying the player.  And then I had to tweak the player.  <span id="more-51"></span></p>
<p>So this was the original block of code from iBox.js:</p>
<pre><code>
var html='&lt;object width="100%" height="100%" style="overflow: hidden; display: block;"&gt;
</code></pre>
<p>And this was my modification:</p>
<pre><code>
 var html = '&lt;object ' +
                'width="100%" ' +
                'height="100%" ' +
                'style="overflow:hidden; display:block;" ' +
                'data="http://www.' + domain + '/v/' + id +
                    '&amp;hl=en' +
                    '&amp;fs=1' +
                    '&amp;rel=0' +
                    '&amp;showinfo=0' +
                '" ' +
                'type="application/x-shockwave-flash" ' +
            '&gt;' +
                '&lt;param ' +
                    'name="src" ' +
                    'value="http://www.' + domain + '/v/' + id +
                        '&amp;hl=en' +
                        '&amp;fs=1' +
                        '&amp;rel=0' +
                        '&amp;showinfo=0' +
                        '&amp;autoplay=1' +
                '" /&gt;' +
                '&lt;param name="allowfullscreen" value="true" /&gt;' +
            '&lt;/object&gt;';
</code></pre>
<p>And here is the result:</p>
<p><a rel="iBox" href="http://www.youtube.com/watch?v=ZAvk2ZfHXnI"><img src="/images/test_youtube_image.jpg" alt="YouTube Player" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://fisherwebdev.com/wordpress/2009/08/28/youtube-lightbox-embedding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
