<?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>Chris Danielson&#039;s Blog</title>
	<atom:link href="http://www.chrisdanielson.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.chrisdanielson.com</link>
	<description>Trials and Tribulations of a Software Developer</description>
	<lastBuildDate>Tue, 10 Aug 2010 15:38:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>iPhone users able to build a shinier world, one turd at a time</title>
		<link>http://www.chrisdanielson.com/2010/05/25/iphone-users-able-to-build-a-shinier-world-one-turd-at-a-time/</link>
		<comments>http://www.chrisdanielson.com/2010/05/25/iphone-users-able-to-build-a-shinier-world-one-turd-at-a-time/#comments</comments>
		<pubDate>Tue, 25 May 2010 20:27:16 +0000</pubDate>
		<dc:creator>Chris Danielson</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Entertainment]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[iPod touch]]></category>
		<category><![CDATA[Polish It]]></category>
		<category><![CDATA[Turd Polishing]]></category>

		<guid isPermaLink="false">http://www.chrisdanielson.com/?p=365</guid>
		<description><![CDATA[Turd Polishing has hit the iPhone with a splatter.]]></description>
			<content:encoded><![CDATA[<p>This blog usually focuses on software development, but I can&#8217;t  resist sharing this with all of you out there.  Have a good laugh!</p>
<p><strong>MaxPowerSoft Puts a New Polish on an Old Adage: You Actually Can  Polish a Turd</strong></p>
<p><object width="425" height="355" type="application/x-shockwave-flash" data="http://www.youtube.com/v/6kZxC1WCk3Y"><param name="movie" value="http://www.youtube.com/v/6kZxC1WCk3Y" />This video was embedded using the YouTuber plugin by <a href="http://www.roytanck.com">Roy Tanck</a>. Adobe Flash Player is required to view the video.</object></p>
<p>&#8216;<strong><a href="http://itunes.apple.com/us/app/polish-it/id345199287?mt=8">Polish It</a>&#8216;</strong> now available at the iPhone App Store</p>
<p>SAN DIEGO, CA (May 24, 2010) &#8211; MaxPowerSoft (www.maxpowersoft.com) today announced the release of Polish It, an iPhone application designed to facilitate &#8220;a shinier world, one turd at a time&#8221;. Available for $0.99 at Apple&#8217;s iPhone App Store, ‘Polish It’ is both a literal and cute/comedic take on the old and well-known phrase “You can’t polish a turd”. Your goal is simple: Choose a turd you like, and polish it! Utilize the touchscreen and your finger for polishing, tilt the phone to maneuver, and snap a photo at anytime to share.</p>
<p>&#8220;We wanted to reach out and give frustrated workers, students, and really all curious people in general, the powerful ability to truly polish a turd,&#8221; says Nic Danielson, Director of Marketing. &#8220;MaxPowerSoft has created an innovative new technology that allows one to therapeutically accomplish the task of polishing turds in the palm of your hand, no matter where you are, and on a whim to boot &#8211; most importantly, it can be done without the need for any sanitization processes.  There really is nothing else like it in the market, or the world for that matter.&#8221;</p>
<p>Features of Polish It include:</p>
<ul>
<li>Objects rendered in full 3D.</li>
<li>Choose from over 10 objects to polish.</li>
<li>Simple controls: Touch to polish, Tilt phone to maneuver.</li>
<li>Snap a photo and send to your friends.</li>
<li>More features to come.</li>
</ul>
<p>Pricing and Availability:</p>
<p>Polish It is available for $0.99 at the iPhone App Store:</p>
<p><a href="http://itunes.apple.com/us/app/polish-it/id345199287?mt=8">http://itunes.apple.com/us/app/polish-it/id345199287?mt=8</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrisdanielson.com/2010/05/25/iphone-users-able-to-build-a-shinier-world-one-turd-at-a-time/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Android WebView and the Indeterminant Progress Solution</title>
		<link>http://www.chrisdanielson.com/2010/05/04/android-webview-and-the-indeterminant-progress-solution/</link>
		<comments>http://www.chrisdanielson.com/2010/05/04/android-webview-and-the-indeterminant-progress-solution/#comments</comments>
		<pubDate>Tue, 04 May 2010 16:11:02 +0000</pubDate>
		<dc:creator>Chris Danielson</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[ProgressDialog]]></category>
		<category><![CDATA[WebView]]></category>
		<category><![CDATA[WebViewClient]]></category>

		<guid isPermaLink="false">http://www.chrisdanielson.com/?p=349</guid>
		<description><![CDATA[I&#8217;ve seen a multitude of posts on how to embed the Android WebView object and how to use the built-in feature request PROGRESS, but I&#8217;ve yet to come across a demonstration on just how simple it is to integrate a ProgressDialog object. I specifically needed this for one of my projects because I did not [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve seen a multitude of posts on how to embed the Android WebView object and how to use the built-in feature request PROGRESS, but I&#8217;ve yet to come across a demonstration on just how simple it is to integrate a ProgressDialog object.  I specifically needed this for one of my projects because I did not want the title bar to render in my application.  If the title is not rendered, then the Window Feature Request progress bar and indeterminant functions will not render at all.</p>
<p>So here is how to do it!  Trust me it&#8217;s absolutely simple!</p>
<p>Code snippet basics:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p349code6'); return false;">View Code</a> JAVA</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p3496"><td class="code" id="p349code6"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.app.ProgressDialog</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//in the class...</span>
<span style="color: #000000; font-weight: bold;">private</span> ProgressDialog progressBar<span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//when you want the dialog to show the first time.</span>
progressBar <span style="color: #339933;">=</span> ProgressDialog.<span style="color: #006633;">show</span><span style="color: #009900;">&#40;</span>Main.<span style="color: #000000; font-weight: bold;">this</span>, <span style="color: #0000ff;">&quot;MaxPowerSoft Example&quot;</span>, <span style="color: #0000ff;">&quot;Loading...&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//when you want the progressbar to disappear</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>progressBar.<span style="color: #006633;">isShowing</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   progressBar.<span style="color: #006633;">dismiss</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Here is how it is done in your project.  </p>
<p><strong>/res/values/strings.xml</strong></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.chrisdanielson.com/wp-content/plugins/wp-codebox/wp-codebox.php?p=349&amp;download=strings.xml">strings.xml</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p3497"><td class="code" id="p349code7"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;resources<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;string</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;app_name&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>MaxPowerSoft Example<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/string<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;string</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;webview&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>webview<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/string<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> 
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/resources<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p><strong>AndroidManifest.xml</strong></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.chrisdanielson.com/wp-content/plugins/wp-codebox/wp-codebox.php?p=349&amp;download=AndroidManifest.xml">AndroidManifest.xml</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p3498"><td class="code" id="p349code8"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;manifest</span> <span style="color: #000066;">xmlns:android</span>=<span style="color: #ff0000;">&quot;http://schemas.android.com/apk/res/android&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">package</span>=<span style="color: #ff0000;">&quot;com.maxpowersoft.example&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">android:versionCode</span>=<span style="color: #ff0000;">&quot;1&quot;</span></span>
<span style="color: #009900;">      <span style="color: #000066;">android:versionName</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;application</span> <span style="color: #000066;">android:icon</span>=<span style="color: #ff0000;">&quot;@drawable/icon&quot;</span> <span style="color: #000066;">android:label</span>=<span style="color: #ff0000;">&quot;@string/app_name&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;activity</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;.Main&quot;</span></span>
<span style="color: #009900;">                  <span style="color: #000066;">android:label</span>=<span style="color: #ff0000;">&quot;@string/app_name&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;intent-filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;action</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;android.intent.action.MAIN&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;category</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;android.intent.category.LAUNCHER&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/intent-filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/activity<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/application<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;uses-permission</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;android.permission.INTERNET&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;uses-permission</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;android.permission.ACCESS_NETWORK_STATE&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;uses-sdk</span> <span style="color: #000066;">android:minSdkVersion</span>=<span style="color: #ff0000;">&quot;4&quot;</span></span>
<span style="color: #009900;">              <span style="color: #000066;">android:targetSdkVersion</span>=<span style="color: #ff0000;">&quot;4&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/manifest<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p><strong>/res/layout/main.xml</strong></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.chrisdanielson.com/wp-content/plugins/wp-codebox/wp-codebox.php?p=349&amp;download=main.xml">main.xml</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p3499"><td class="code" id="p349code9"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;LinearLayout</span> <span style="color: #000066;">xmlns:android</span>=<span style="color: #ff0000;">&quot;http://schemas.android.com/apk/res/android&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">android:orientation</span>=<span style="color: #ff0000;">&quot;vertical&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;WebView</span> <span style="color: #000066;">android:id</span>=<span style="color: #ff0000;">&quot;@string/webview&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:layout_width</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:layout_height</span>=<span style="color: #ff0000;">&quot;fill_parent&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">android:layout_weight</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/LinearLayout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p><strong>Main.java</strong></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.chrisdanielson.com/wp-content/plugins/wp-codebox/wp-codebox.php?p=349&amp;download=Main.java">Main.java</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p34910"><td class="code" id="p349code10"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.maxpowersoft.example</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.app.Activity</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.app.AlertDialog</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.app.ProgressDialog</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.content.DialogInterface</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.content.Intent</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.net.Uri</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.os.Bundle</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.util.Log</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.view.Window</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.webkit.WebSettings</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.webkit.WebView</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.webkit.WebViewClient</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">android.widget.Toast</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Main <span style="color: #000000; font-weight: bold;">extends</span> Activity <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">private</span> WebView webview<span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> TAG <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Main&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">private</span> ProgressDialog progressBar<span style="color: #339933;">;</span>  
&nbsp;
    <span style="color: #008000; font-style: italic; font-weight: bold;">/** Called when the activity is first created. */</span>
    @Override
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onCreate<span style="color: #009900;">&#40;</span>Bundle savedInstanceState<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">super</span>.<span style="color: #006633;">onCreate</span><span style="color: #009900;">&#40;</span>savedInstanceState<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        requestWindowFeature<span style="color: #009900;">&#40;</span><a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Awindow+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Window</span></a>.<span style="color: #006633;">FEATURE_NO_TITLE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        setContentView<span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">layout</span>.<span style="color: #006633;">main</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">webview</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>WebView<span style="color: #009900;">&#41;</span>findViewById<span style="color: #009900;">&#40;</span>R.<span style="color: #006633;">string</span>.<span style="color: #006633;">webview</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        WebSettings settings <span style="color: #339933;">=</span> webview.<span style="color: #006633;">getSettings</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        settings.<span style="color: #006633;">setJavaScriptEnabled</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        webview.<span style="color: #006633;">setScrollBarStyle</span><span style="color: #009900;">&#40;</span>WebView.<span style="color: #006633;">SCROLLBARS_OUTSIDE_OVERLAY</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">final</span> AlertDialog alertDialog <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> AlertDialog.<span style="color: #006633;">Builder</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">create</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        progressBar <span style="color: #339933;">=</span> ProgressDialog.<span style="color: #006633;">show</span><span style="color: #009900;">&#40;</span>Main.<span style="color: #000000; font-weight: bold;">this</span>, <span style="color: #0000ff;">&quot;MaxPowerSoft Example&quot;</span>, <span style="color: #0000ff;">&quot;Loading...&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        webview.<span style="color: #006633;">setWebViewClient</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> WebViewClient<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> shouldOverrideUrlLoading<span style="color: #009900;">&#40;</span>WebView view, <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> url<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                Log.<span style="color: #006633;">i</span><span style="color: #009900;">&#40;</span>TAG, <span style="color: #0000ff;">&quot;Processing webview url click...&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                view.<span style="color: #006633;">loadUrl</span><span style="color: #009900;">&#40;</span>url<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
&nbsp;
            <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onPageFinished<span style="color: #009900;">&#40;</span>WebView view, <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> url<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                Log.<span style="color: #006633;">i</span><span style="color: #009900;">&#40;</span>TAG, <span style="color: #0000ff;">&quot;Finished loading URL: &quot;</span> <span style="color: #339933;">+</span>url<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>progressBar.<span style="color: #006633;">isShowing</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                    progressBar.<span style="color: #006633;">dismiss</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
            <span style="color: #009900;">&#125;</span>
&nbsp;
            <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onReceivedError<span style="color: #009900;">&#40;</span>WebView view, <span style="color: #000066; font-weight: bold;">int</span> errorCode, <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> description, <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Astring+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">String</span></a> failingUrl<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                Log.<span style="color: #006633;">e</span><span style="color: #009900;">&#40;</span>TAG, <span style="color: #0000ff;">&quot;Error: &quot;</span> <span style="color: #339933;">+</span> description<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                Toast.<span style="color: #006633;">makeText</span><span style="color: #009900;">&#40;</span>activity, <span style="color: #0000ff;">&quot;Oh no! &quot;</span> <span style="color: #339933;">+</span> description, Toast.<span style="color: #006633;">LENGTH_SHORT</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                alertDialog.<span style="color: #006633;">setTitle</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Error&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                alertDialog.<span style="color: #006633;">setMessage</span><span style="color: #009900;">&#40;</span>description<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                alertDialog.<span style="color: #006633;">setButton</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;OK&quot;</span>, <span style="color: #000000; font-weight: bold;">new</span> DialogInterface.<span style="color: #006633;">OnClickListener</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onClick<span style="color: #009900;">&#40;</span>DialogInterface dialog, <span style="color: #000066; font-weight: bold;">int</span> which<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        <span style="color: #000000; font-weight: bold;">return</span><span style="color: #339933;">;</span>
                    <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                alertDialog.<span style="color: #006633;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        webview.<span style="color: #006633;">loadUrl</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://www.google.com&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.chrisdanielson.com/2010/05/04/android-webview-and-the-indeterminant-progress-solution/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Could not send unregistration request to daemon</title>
		<link>http://www.chrisdanielson.com/2010/03/06/could-not-send-unregistration-request-to-daemon/</link>
		<comments>http://www.chrisdanielson.com/2010/03/06/could-not-send-unregistration-request-to-daemon/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 21:48:59 +0000</pubDate>
		<dc:creator>Chris Danielson</dc:creator>
				<category><![CDATA[iPhone Development]]></category>
		<category><![CDATA[CLClientInvalidate]]></category>
		<category><![CDATA[CLClientRegister]]></category>
		<category><![CDATA[CLLocationManager]]></category>
		<category><![CDATA[GPS]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Objective-C]]></category>

		<guid isPermaLink="false">http://www.chrisdanielson.com/?p=337</guid>
		<description><![CDATA[During a debug process have you seen any of the following lines in your debugger/console logs? void CLClientInvalidate(__CLClient*)",could not send unregistration request to daemon or&#8230; CLClientRegister: could not send registration request to daemon If so, you&#8217;ve probably already seen this Apple support link:  http://discussions.apple.com/message.jspa?messageID=8408930 Well, I&#8217;m just going to validate a few things here for [...]]]></description>
			<content:encoded><![CDATA[<p>During a debug process have you seen any of the following lines in your debugger/console logs?</p>
<pre>void CLClientInvalidate(__CLClient*)",could not send unregistration request to daemon</pre>
<p>or&#8230;</p>
<pre>CLClientRegister: could not send registration request to daemon</pre>
<p>If so, you&#8217;ve probably already seen this Apple support link:  <a href="http://discussions.apple.com/message.jspa?messageID=8408930">http://discussions.apple.com/message.jspa?messageID=8408930</a></p>
<p>Well, I&#8217;m just going to validate a few things here for you.  (Before continuing this&#8230; check your code after briefly reading <a href="http://blog.blackwhale.at/2010/08/error-clclientinvalidate-could-not-send-unregistration-request-to-daemon/">this blog</a>.</p>
<ol>
<li>You will have to <a href="http://support.apple.com/kb/HT1414">restore your iPhone</a>.  (This is the solution that worked for me).  Please post a comment if you find a better solution.</li>
<li>If you are coding using CLLocationManager you will more than likely notice that you only get 1 set of GPS values before the message starts appearing.  Also, the CLLocationManager startUpdatingLocation method will only call your delegate once.  (That is what was happening on my iPhone).</li>
<li>If you dig through your iPhones &#8220;crash logs&#8221; via the Organizer application, you&#8217;ll more than likely witness that many applications are crashing.</li>
</ol>
<p>I tried a multitude of workarounds and the only thing that sadly worked was a &#8220;restore&#8221; which took over 1 hour to complete.  I will say this, my iPhone runs a lot faster now!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrisdanielson.com/2010/03/06/could-not-send-unregistration-request-to-daemon/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Apple iPhone Web Kit with Activity Indicator</title>
		<link>http://www.chrisdanielson.com/2009/12/04/apple-iphone-web-kit-with-activity-indicator/</link>
		<comments>http://www.chrisdanielson.com/2009/12/04/apple-iphone-web-kit-with-activity-indicator/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 16:38:43 +0000</pubDate>
		<dc:creator>Chris Danielson</dc:creator>
				<category><![CDATA[iPhone Development]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[UIActivityIndicatorView]]></category>
		<category><![CDATA[UIWebView]]></category>
		<category><![CDATA[Web Kit]]></category>
		<category><![CDATA[WebKit]]></category>

		<guid isPermaLink="false">http://www.chrisdanielson.com/?p=290</guid>
		<description><![CDATA[Welcome to the club of searching for an overly simple UIWebView a.k.a. WebKit example! In this example, I&#8217;ll show you simply how to hand code a quick UIWebView into your program as well as to add a UIActivityIndicatorView a.k.a. an activity indicator. Without jabbing Apple too hard here, the documentation is pretty bad and that [...]]]></description>
			<content:encoded><![CDATA[<p>Welcome to the club of searching for an overly simple UIWebView a.k.a. WebKit example!  In this example, I&#8217;ll show you simply how to hand code a quick UIWebView into your program as well as to add a UIActivityIndicatorView a.k.a. an activity indicator.  Without jabbing Apple too hard here, the documentation is pretty bad and that is why it&#8217;s nice to have an example just shown to you as-is.  I hope this example helps shine a light on the situation for anyone wanting to implement a nice and quick Apple iPhone WebKit solution.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p290code13'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p29013"><td class="code" id="p290code13"><pre class="objc" style="font-family:monospace;">&nbsp;
<span style="color: #6e371a;">#import &lt;UIKit/UIKit.h&gt;</span>
&nbsp;
<span style="color: #a61390;">@interface</span> FirstViewController <span style="color: #002200;">:</span> UIViewController &lt;UIWebViewDelegate&gt;
<span style="color: #002200;">&#123;</span>
	UIWebView <span style="color: #002200;">*</span>myWebView;
	UIActivityIndicatorView <span style="color: #002200;">*</span>activityIndicator;	
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>


<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p290code14'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p29014"><td class="code" id="p290code14"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">/*
Inside the @implementation FirstViewController ... 
*/</span>
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>viewDidLoad <span style="color: #002200;">&#123;</span> <span style="color: #11740a; font-style: italic;">//We have a NIB file in play here, so I dropped the loadView here.  Just make sure that your loadView is not getting called twice!</span>
    <span style="color: #002200;">&#91;</span>super viewDidLoad<span style="color: #002200;">&#93;</span>;
    <span style="color: #002200;">&#91;</span>self loadView<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>loadView <span style="color: #002200;">&#123;</span>
	UIView <span style="color: #002200;">*</span>contentView <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIView alloc<span style="color: #002200;">&#93;</span> initWithFrame<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIScreen mainScreen<span style="color: #002200;">&#93;</span> applicationFrame<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
	self.view <span style="color: #002200;">=</span> contentView;	
&nbsp;
	CGRect webFrame <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIScreen mainScreen<span style="color: #002200;">&#93;</span> applicationFrame<span style="color: #002200;">&#93;</span>;
	webFrame.origin.y <span style="color: #002200;">=</span> 0.0f;
	myWebView <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIWebView alloc<span style="color: #002200;">&#93;</span> initWithFrame<span style="color: #002200;">:</span>webFrame<span style="color: #002200;">&#93;</span>;
	myWebView.backgroundColor <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIColor blueColor<span style="color: #002200;">&#93;</span>;
	myWebView.scalesPageToFit <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
	myWebView.autoresizingMask <span style="color: #002200;">=</span> <span style="color: #002200;">&#40;</span>UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight<span style="color: #002200;">&#41;</span>;
	myWebView.delegate <span style="color: #002200;">=</span> self;
	<span style="color: #002200;">&#91;</span>self.view addSubview<span style="color: #002200;">:</span> myWebView<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>myWebView loadRequest<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURLRequest_Class/"><span style="color: #400080;">NSURLRequest</span></a> requestWithURL<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/"><span style="color: #400080;">NSURL</span></a> URLWithString<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;http://www.maxpowersoft.com/&quot;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span>;
&nbsp;
	activityIndicator <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIActivityIndicatorView alloc<span style="color: #002200;">&#93;</span>initWithActivityIndicatorStyle<span style="color: #002200;">:</span>UIActivityIndicatorViewStyleGray<span style="color: #002200;">&#93;</span>;
	activityIndicator.frame <span style="color: #002200;">=</span> CGRectMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">0.0</span>, <span style="color: #2400d9;">0.0</span>, <span style="color: #2400d9;">40.0</span>, <span style="color: #2400d9;">40.0</span><span style="color: #002200;">&#41;</span>;
	activityIndicator.center <span style="color: #002200;">=</span> self.view.center;
	<span style="color: #002200;">&#91;</span>self.view addSubview<span style="color: #002200;">:</span> activityIndicator<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>dealloc <span style="color: #002200;">&#123;</span>
	<span style="color: #002200;">&#91;</span>activityIndicator release<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>myWebView release<span style="color: #002200;">&#93;</span>;
        <span style="color: #002200;">&#91;</span>super dealloc<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #6e371a;">#pragma mark WEBVIEW Methods</span>
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>webViewDidStartLoad<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIWebView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>webView
<span style="color: #002200;">&#123;</span>
	<span style="color: #11740a; font-style: italic;">// starting the load, show the activity indicator in the status bar</span>
	<span style="color: #002200;">&#91;</span>UIApplication sharedApplication<span style="color: #002200;">&#93;</span>.networkActivityIndicatorVisible <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
	<span style="color: #002200;">&#91;</span>activityIndicator startAnimating<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>webViewDidFinishLoad<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIWebView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>webView
<span style="color: #002200;">&#123;</span>
	<span style="color: #11740a; font-style: italic;">// finished loading, hide the activity indicator in the status bar</span>
	<span style="color: #002200;">&#91;</span>UIApplication sharedApplication<span style="color: #002200;">&#93;</span>.networkActivityIndicatorVisible <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
	<span style="color: #002200;">&#91;</span>activityIndicator stopAnimating<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><span style="color: #a61390;">void</span><span style="color: #002200;">&#41;</span>webView<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UIWebView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>webView didFailLoadWithError<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSError_Class/"><span style="color: #400080;">NSError</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>error
<span style="color: #002200;">&#123;</span>
	<span style="color: #11740a; font-style: italic;">// load error, hide the activity indicator in the status bar</span>
	<span style="color: #002200;">&#91;</span>UIApplication sharedApplication<span style="color: #002200;">&#93;</span>.networkActivityIndicatorVisible <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
&nbsp;
	<span style="color: #11740a; font-style: italic;">// report the error inside the webview</span>
	<a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a><span style="color: #002200;">*</span> errorString <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> stringWithFormat<span style="color: #002200;">:</span>
							 <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;&lt;html&gt;&lt;center&gt;&lt;br /&gt;&lt;br /&gt;&lt;font size=+5 color='red'&gt;Error&lt;br /&gt;&lt;br /&gt;Your request %@&lt;/font&gt;&lt;/center&gt;&lt;/html&gt;&quot;</span>,
							 error.localizedDescription<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>myWebView loadHTMLString<span style="color: #002200;">:</span>errorString baseURL<span style="color: #002200;">:</span><span style="color: #a61390;">nil</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p>That is all there is to it.  It&#8217;s really simple as you can see.  Feel free to copy and paste accordingly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrisdanielson.com/2009/12/04/apple-iphone-web-kit-with-activity-indicator/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Zend RESTful XML Generic Functions</title>
		<link>http://www.chrisdanielson.com/2009/10/12/zend-restful-xml-generic-functions/</link>
		<comments>http://www.chrisdanielson.com/2009/10/12/zend-restful-xml-generic-functions/#comments</comments>
		<pubDate>Tue, 13 Oct 2009 02:07:58 +0000</pubDate>
		<dc:creator>Chris Danielson</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[recursive]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[Zend]]></category>
		<category><![CDATA[Zend_Rest_Controller]]></category>

		<guid isPermaLink="false">http://www.chrisdanielson.com/?p=275</guid>
		<description><![CDATA[It has been argued that the Zend RESTful API should not only automate the JSON data returned (which it does a fine job of), but automate the XML data. Unfortunately, the Zend engine doesn&#8217;t do this for REST. The solution is left to the developer to implement their own strategy. In my opinion, there is [...]]]></description>
			<content:encoded><![CDATA[<p>It has been argued that the Zend RESTful API should not only automate the JSON data returned (which it does a fine job of), but automate the XML data.  Unfortunately, the Zend engine doesn&#8217;t do this for REST.  The solution is left to the developer to implement their own strategy.  In my opinion, there is no better place for a simple recursive function that will dynamically crawl the returned objects and arrays and generate XML in a way that just makes sense.  As was promised in a comment from one of my <a href="http://www.chrisdanielson.com/2009/09/02/creating-a-php-rest-api-using-the-zend-framework/">previous blogs</a>, here is a set of functions that works well for dynamically generating XML from your PHP objects and arrays.  It&#8217;s been pointed out that this process should have been included in the Zend framework.  As of this writing, I believe that it still has not been implemented.  Anyways, here it is.  <em>Take note that you really only need two functions from this post getXML(&#8230;) and _xmlHelper(&#8230;)</em></p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.chrisdanielson.com/wp-content/plugins/wp-codebox/wp-codebox.php?p=275&amp;download=BaseController.php">BaseController.php</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p27518"><td class="code" id="p275code18"><pre class="php" style="font-family:monospace;">abstract <span style="color: #000000; font-weight: bold;">class</span> BaseController <span style="color: #000000; font-weight: bold;">extends</span> Zend_Rest_Controller
<span style="color: #009900;">&#123;</span>
<span style="color: #666666; font-style: italic;">//Please know that the init() method has been snipped out.	</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> static <span style="color: #000000; font-weight: bold;">function</span> getXML<span style="color: #009900;">&#40;</span><span style="color: #000088;">$obj</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
    	<span style="color: #000088;">$doc</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> DOMDocument<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$doc</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">formatOutput</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$root_element</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$doc</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;response&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$doc</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appendChild</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$root_element</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    	<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$obj</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$var</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        	<span style="color: #000088;">$statusElement</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$doc</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><a href="http://www.php.net/is_array"><span style="color: #990000;">is_array</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$statusElement</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appendChild</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$doc</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">createTextNode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #000088;">$root_element</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appendChild</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$statusElement</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
				BaseController<span style="color: #339933;">::</span>_xmlHelper<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span><span style="color: #000088;">$doc</span><span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span><span style="color: #000088;">$root_element</span><span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span><span style="color: #000088;">$statusElement</span><span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">print</span> <span style="color: #000088;">$doc</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">saveXML</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> static <span style="color: #000000; font-weight: bold;">function</span> _xmlHelper<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span><span style="color: #000088;">$doc</span><span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span><span style="color: #000088;">$root_element</span><span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span><span style="color: #000088;">$statusElement</span><span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/is_array"><span style="color: #990000;">is_array</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$key</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$val</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/is_array"><span style="color: #990000;">is_array</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$val</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					BaseController<span style="color: #339933;">::</span>_xmlHelper<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span><span style="color: #000088;">$doc</span><span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span><span style="color: #000088;">$root_element</span><span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span><span style="color: #000088;">$statusElement</span><span style="color: #339933;">,</span> <span style="color: #000088;">$val</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/is_object"><span style="color: #990000;">is_object</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$val</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
					<span style="color: #000088;">$se</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$doc</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">createElement</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'object'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><a href="http://www.php.net/get_class"><span style="color: #990000;">get_class</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$val</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #000088;">$arr</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/get_object_vars"><span style="color: #990000;">get_object_vars</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$val</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					BaseController<span style="color: #339933;">::</span>_xmlHelper<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span><span style="color: #000088;">$doc</span><span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span><span style="color: #000088;">$root_element</span><span style="color: #339933;">,</span> <span style="color: #339933;">&amp;</span><span style="color: #000088;">$se</span><span style="color: #339933;">,</span> <span style="color: #000088;">$arr</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #000088;">$root_element</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appendChild</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$se</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
				<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
					<span style="color: #666666; font-style: italic;">//print $key . &quot; =&gt; &quot; . $val . &quot;\n&quot;;</span>
					<span style="color: #000088;">$se</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$doc</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #000088;">$se</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appendChild</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$doc</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">createTextNode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$val</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
					<span style="color: #000088;">$statusElement</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appendChild</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$se</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #666666; font-style: italic;">//print_r($value);</span>
		<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$statusElement</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appendChild</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$doc</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">createTextNode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$root_element</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appendChild</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$statusElement</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Now the only thing left to do is show an example implementation.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p275code19'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p27519"><td class="code" id="p275code19"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> VersionController <span style="color: #000000; font-weight: bold;">extends</span> BaseController 
<span style="color: #009900;">&#123;</span> 
<span style="color: #666666; font-style: italic;">/*  implement the methods as show in the blog referenced at the top of this blog post */</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
       <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">hello</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'a'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'1'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'b'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'2'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Now, the last thing to do is edit the view for the XML document which would be in this case:</p>
<pre>
/application/views/scripts/version/index.xml.phtml
</pre>
<p>The index.xml.phtml should then only contain:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p275code20'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p27520"><td class="code" id="p275code20"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
BaseController<span style="color: #339933;">::</span><span style="color: #004000;">getXML</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>This will automate the process of generating the XML data you want returned.  It&#8217;s an easy way to quickly and effectively get XML without having to rebuild the entire wheel.  Feel free to modify and distribute.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrisdanielson.com/2009/10/12/zend-restful-xml-generic-functions/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Creating a PHP REST API Using the Zend Framework</title>
		<link>http://www.chrisdanielson.com/2009/09/02/creating-a-php-rest-api-using-the-zend-framework/</link>
		<comments>http://www.chrisdanielson.com/2009/09/02/creating-a-php-rest-api-using-the-zend-framework/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 16:07:34 +0000</pubDate>
		<dc:creator>Chris Danielson</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[ContextSwitch]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[REST Server]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[Zend]]></category>
		<category><![CDATA[Zend_Rest_Controller]]></category>

		<guid isPermaLink="false">http://www.chrisdanielson.com/?p=219</guid>
		<description><![CDATA[I don&#8217;t know about you, but I spent hours pouring over the Zend documentation and searching the Internet for some sort of understanding or example regarding how to do REST the correct way in PHP.  I found a handful of one-offs, where everyone was writing their own core REST engine from scratch. I figure why [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t know about you, but I spent hours pouring over the Zend documentation and searching the Internet for some sort of understanding or example regarding how to do REST the correct way in PHP.  I found a handful of one-offs, where everyone was writing their own core REST engine from scratch.  I figure why write all the code to handle this, if you already have the Zend Framework in your code base.   I believe that the ideal solution will effectively use the the Zend_Rest_Controller and ContextSwitch objects as well as offering JSON and XML formatting options.  My goal here is simple. I want to give you the building blocks to aid in writing an easily maintainable REST API in PHP using the Zend Framework.  </p>
<p>This code example will support REST data in the format of <strong>XML </strong>and <strong>JSON</strong>.</p>
<p>Prerequisites:</p>
<ol>
<li>PHP version &gt; 5</li>
<li><a href="http://framework.zend.com/releases/ZendFramework-1.9.2/ZendFramework-1.9.2.zip">Zend Framework 1.9.2</a> (at the minimum) The generic download page can found <a href="http://framework.zend.com/download/latest">here</a>.</li>
</ol>
<p><a href="http://www.chrisdanielson.com/wp-content/uploads/2009/09/ZendRestExample.zip">Download ZendRestExample Source</a>.  You will want to download this example in order to effectively run and better understand the project.  Make sure to rename the 1.htaccess file to .htaccess (if interested in using it).  As well, take note that there are other files not listed below that are required to run this project.  These are contained within the zip&#8217;d source code.  Finally, the Zend framework is not zip&#8217;d into the source code.  You&#8217;ll need to download this and install it on your own.</p>
<p>Basic Directory Structure:</p>
<pre>
/
/.htaccess
/index.php
/applications/
/applications/configs/
/applications/controllers/
/applications/forms/
/applications/layouts/
/applications/views/
/library/  (optional where the Zend folder containing the framework should reside)
</pre>
<p>URLS used in this example:</p>
<pre>

http://yourSite/version/format/xml

http://yourSite/version/format/json

//with other parameters you can do:

http://yourSite/version/format/xml/id/1234/param2/6789
</pre>
<p>One of the tricky things with REST is that the URLs need to be formatted properly.  In Apache, all you need is the mod_rewrite module enabled and a .htaccess in the root of your current web project.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.chrisdanielson.com/wp-content/plugins/wp-codebox/wp-codebox.php?p=219&amp;download=.htaccess">.htaccess</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p21927"><td class="code" id="p219code27"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">SetEnv</span> APPLICATION_ENV development
&nbsp;
<span style="color: #00007f;">RewriteEngine</span> <span style="color: #0000ff;">On</span>
<span style="color: #adadad; font-style: italic;">#RewriteBase /~myUserName/myDirectory</span>
<span style="color: #00007f;">RewriteBase</span> /
<span style="color: #00007f;">RewriteCond</span> %{REQUEST_FILENAME} -s [OR]
<span style="color: #00007f;">RewriteCond</span> %{REQUEST_FILENAME} -l [OR]
<span style="color: #00007f;">RewriteCond</span> %{REQUEST_FILENAME} -d
<span style="color: #00007f;">RewriteRule</span> ^.*$ - [NC,L]
<span style="color: #00007f;">RewriteRule</span> ^.*$ index.php [NC,L]</pre></td></tr></table></div>

<p>Now that we have adjusted the .htaccess, let&#8217;s look into the application/configs/application.ini as well as the important Bootstrap.php.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.chrisdanielson.com/wp-content/plugins/wp-codebox/wp-codebox.php?p=219&amp;download=application.ini">application.ini</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p21928"><td class="code" id="p219code28"><pre class="php" style="font-family:monospace;"><span style="color: #009900;">&#91;</span>production<span style="color: #009900;">&#93;</span>
phpSettings<span style="color: #339933;">.</span>display_startup_errors <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span>
phpSettings<span style="color: #339933;">.</span>display_errors <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span>
bootstrap<span style="color: #339933;">.</span>path <span style="color: #339933;">=</span> APPLICATION_PATH <span style="color: #0000ff;">&quot;/Bootstrap.php&quot;</span>
resources<span style="color: #339933;">.</span>frontController<span style="color: #339933;">.</span>controllerDirectory <span style="color: #339933;">=</span> APPLICATION_PATH <span style="color: #0000ff;">&quot;/controllers&quot;</span>
bootstrap<span style="color: #339933;">.</span><span style="color: #000000; font-weight: bold;">class</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Bootstrap&quot;</span>
&nbsp;
<span style="color: #009900;">&#91;</span>staging <span style="color: #339933;">:</span> production<span style="color: #009900;">&#93;</span>
&nbsp;
<span style="color: #009900;">&#91;</span>testing <span style="color: #339933;">:</span> production<span style="color: #009900;">&#93;</span>
phpSettings<span style="color: #339933;">.</span>display_startup_errors <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span>
phpSettings<span style="color: #339933;">.</span>display_errors <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span>
&nbsp;
<span style="color: #009900;">&#91;</span>development <span style="color: #339933;">:</span> production<span style="color: #009900;">&#93;</span>
phpSettings<span style="color: #339933;">.</span>display_startup_errors <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span>
phpSettings<span style="color: #339933;">.</span>display_errors <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span></pre></td></tr></table></div>

<p>The core kick-start of this whole REST application is contained in the applications/Bootstrap.php</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.chrisdanielson.com/wp-content/plugins/wp-codebox/wp-codebox.php?p=219&amp;download=Bootstrap.php">Bootstrap.php</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p21929"><td class="code" id="p219code29"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> Bootstrap <span style="color: #000000; font-weight: bold;">extends</span> Zend_Application_Bootstrap_Bootstrap
<span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000000; font-weight: bold;">function</span> _initAutoload<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$autoloader</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Zend_Application_Module_Autoloader<span style="color: #009900;">&#40;</span><a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span>
            <span style="color: #0000ff;">'namespace'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Default_'</span><span style="color: #339933;">,</span>
            <span style="color: #0000ff;">'basePath'</span>  <span style="color: #339933;">=&gt;</span> <a href="http://www.php.net/dirname"><span style="color: #990000;">dirname</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
        <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$autoloader</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> 
&nbsp;
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000000; font-weight: bold;">function</span> _initRestRoute<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">bootstrap</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Request'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	
		<span style="color: #000088;">$front</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getResource</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'FrontController'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$restRoute</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Zend_Rest_Route<span style="color: #009900;">&#40;</span><span style="color: #000088;">$front</span><span style="color: #339933;">,</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span>
			<span style="color: #0000ff;">'default'</span> <span style="color: #339933;">=&gt;</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'version'</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$front</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRouter</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addRoute</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'rest'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$restRoute</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> 
&nbsp;
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000000; font-weight: bold;">function</span> _initRequest<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">bootstrap</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'FrontController'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$front</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getResource</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'FrontController'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$request</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$front</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRequest</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">null</span> <span style="color: #339933;">===</span> <span style="color: #000088;">$front</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getRequest</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$request</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Zend_Controller_Request_Http<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$front</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setRequest</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$request</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$request</span><span style="color: #339933;">;</span>        
    <span style="color: #009900;">&#125;</span> 		
&nbsp;
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Now we need to wire up the ability for web requests to move through this engine.  We do this in our /index.php file.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.chrisdanielson.com/wp-content/plugins/wp-codebox/wp-codebox.php?p=219&amp;download=index.php">index.php</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p21930"><td class="code" id="p219code30"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">// Define path to application directory</span>
<a href="http://www.php.net/defined"><span style="color: #990000;">defined</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'APPLICATION_PATH'</span><span style="color: #009900;">&#41;</span>
    <span style="color: #339933;">||</span> <a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'APPLICATION_PATH'</span><span style="color: #339933;">,</span> <a href="http://www.php.net/realpath"><span style="color: #990000;">realpath</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/dirname"><span style="color: #990000;">dirname</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/application'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Define application environment</span>
<a href="http://www.php.net/defined"><span style="color: #990000;">defined</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'APPLICATION_ENV'</span><span style="color: #009900;">&#41;</span>
    <span style="color: #339933;">||</span> <a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'APPLICATION_ENV'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/getenv"><span style="color: #990000;">getenv</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'APPLICATION_ENV'</span><span style="color: #009900;">&#41;</span> ? <a href="http://www.php.net/getenv"><span style="color: #990000;">getenv</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'APPLICATION_ENV'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">'production'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Ensure library/ is on include_path</span>
<span style="color: #666666; font-style: italic;">/*
If you do not have the Zend library already included in your PHP installation...
&nbsp;
1.  Create a directory named library and place the Zend Framework into it.
&nbsp;
NOTE: In my instance, I have the Zend library residing under /usr/share/php/   
Because of this, the following lines are commented.
*/</span>
<span style="color: #666666; font-style: italic;">/*set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/library'),
    get_include_path(),
)));
*/</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/** Zend_Application */</span>
<span style="color: #b1b100;">require_once</span> <span style="color: #0000ff;">'Zend/Application.php'</span><span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #666666; font-style: italic;">// Create application, bootstrap, and run</span>
<span style="color: #000088;">$application</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Zend_Application<span style="color: #009900;">&#40;</span>
    APPLICATION_ENV<span style="color: #339933;">,</span> 
    APPLICATION_PATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/configs/application.ini'</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$application</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">bootstrap</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">run</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Well now that the core is in place, all we need is to integrate our controllers.  This is where our business logic will reside.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.chrisdanielson.com/wp-content/plugins/wp-codebox/wp-codebox.php?p=219&amp;download=VersionController.php">VersionController.php</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p21931"><td class="code" id="p219code31"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> VersionController <span style="color: #000000; font-weight: bold;">extends</span> Zend_Rest_Controller
<span style="color: #009900;">&#123;</span>  
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$bootstrap</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getInvokeArg</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'bootstrap'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$options</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$bootstrap</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getOption</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'resources'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$contextSwitch</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_helper<span style="color: #339933;">-&gt;</span><span style="color: #004000;">getHelper</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'contextSwitch'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$contextSwitch</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">addActionContext</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'index'</span><span style="color: #339933;">,</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'xml'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'json'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">initContext</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">//$this-&gt;_helper-&gt;viewRenderer-&gt;setNeverRender();	</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">success</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;true&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">version</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;1.0&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #009933; font-style: italic;">/**
     * The index action handles index/list requests; it should respond with a
     * list of the requested resources.
     */</span> 
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> indexAction<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">//if you want to have access to a particular paramater use the helper function as follows:</span>
		<span style="color: #666666; font-style: italic;">//print $this-&gt;_helper-&gt;getParam('abc');</span>
               <span style="color: #666666; font-style: italic;">//To test with this use:  http://myURL/format/xml/abc/1002</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> listAction<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_forward<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'index'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getAction<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_forward<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'index'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> newAction<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>   	
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_forward<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'index'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> postAction<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_forward<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'index'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> editAction<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>    	 
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_forward<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'index'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> putAction<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_forward<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'index'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> 
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> deleteAction<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_forward<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'index'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Now that we&#8217;ve done this, the URL for format of JSON just works as-is thanks to the Zend ContextSwitch engine.  No other changes are needed.  If you are interested in having the output in XML format, then you&#8217;ll need to make a few additions.  Now that we&#8217;ve taken care of the Controller, we&#8217;re going to have to add in the views to make the XML work with the ContextSwitch.  So under /applications/views/scripts/version/  you&#8217;ll need a file:  index.xml.phtml</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p219code32'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p21932"><td class="code" id="p219code32"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$doc</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> DOMDocument<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$doc</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">formatOutput</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$root_element</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$doc</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;response&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$doc</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appendChild</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$root_element</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$statusElement</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$doc</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;success&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$statusElement</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appendChild</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$doc</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">createTextNode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">success</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$root_element</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appendChild</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$statusElement</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$versionElement</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$doc</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;version&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$versionElement</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appendChild</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$doc</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">createTextNode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">version</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$root_element</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appendChild</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$versionElement</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">print</span> <span style="color: #000088;">$doc</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">saveXML</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>And that is all there is to it.  We&#8217;ve now made a basic index/list REST API for listing the version of your product.  This is an overly simple example of how to integrate quickly the Zend REST engine.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrisdanielson.com/2009/09/02/creating-a-php-rest-api-using-the-zend-framework/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>Release iPhone/iPod Touch FreeSWITCH Console</title>
		<link>http://www.chrisdanielson.com/2009/08/14/release-iphoneipod-touch-freeswitch-console/</link>
		<comments>http://www.chrisdanielson.com/2009/08/14/release-iphoneipod-touch-freeswitch-console/#comments</comments>
		<pubDate>Fri, 14 Aug 2009 15:17:43 +0000</pubDate>
		<dc:creator>Chris Danielson</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[App Store]]></category>
		<category><![CDATA[FreeSWITCH]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[iPod touch]]></category>
		<category><![CDATA[MaxPowerSoft]]></category>
		<category><![CDATA[Release]]></category>

		<guid isPermaLink="false">http://www.chrisdanielson.com/?p=163</guid>
		<description><![CDATA[Well, it has been a long battle.  Fought since June 5th, 2009, but at long last Apple has come through and allowed the FreeSWITCH Console application into the app store. FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=319105221&amp;mt=8"><img class="alignleft size-full wp-image-180" title="fs_logo_57_57" src="http://www.chrisdanielson.com/wp-content/uploads/2009/08/fs_logo_57_57.png" alt="fs_logo_57_57" width="57" height="57" /></a> Well, it has been a long battle.  Fought since June 5th, 2009, but at long last Apple has come through and allowed the <a href="http://freeswitch.org">FreeSWITCH</a> Console application into the app store.</p>
<blockquote><p><span>FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch.  It can be used as a simple switching engine, a PBX, a media gateway or a media server to host IVR applications using simple scripts or XML to control the callflow. </span></p></blockquote>
<p>So without much further ado, here is the iTunes link:  <a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=319105221&amp;mt=8">App Store, FreeSWITCH Console</a>.</p>
<p><a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=319105221&amp;mt=8"><img class="aligncenter size-full wp-image-178" title="FreeSWITCH Console Screenshot" src="http://www.chrisdanielson.com/wp-content/uploads/2009/08/photo.jpg" alt="FreeSWITCH Console Screenshot" width="320" height="480" /></a></p>
<p>The application requires that you have the <a href="http://wiki.freeswitch.org/wiki/Mod_event_socket">event socket layer (ESL)</a> module installed in your FreeSWITCH instance.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrisdanielson.com/2009/08/14/release-iphoneipod-touch-freeswitch-console/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Mounting MobileMe iDisk Using WebDav and Linux</title>
		<link>http://www.chrisdanielson.com/2009/08/13/mounting-mobileme-idisk-using-webdav-and-linux/</link>
		<comments>http://www.chrisdanielson.com/2009/08/13/mounting-mobileme-idisk-using-webdav-and-linux/#comments</comments>
		<pubDate>Thu, 13 Aug 2009 15:39:07 +0000</pubDate>
		<dc:creator>Chris Danielson</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[davfs]]></category>
		<category><![CDATA[davfs2]]></category>
		<category><![CDATA[iDisk]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MobileMe]]></category>
		<category><![CDATA[mount]]></category>
		<category><![CDATA[WebDav]]></category>

		<guid isPermaLink="false">http://www.chrisdanielson.com/?p=124</guid>
		<description><![CDATA[Anyone have a MobileMe account and wondered if you can access the iDisk from a mount command in your Linux environment? It&#8217;s handy for backing up your data and general file sharing. This simple step by step process will allow you to gain read and write access to your MobileMe user account&#8217;s iDisk drive space. [...]]]></description>
			<content:encoded><![CDATA[<p>Anyone have a MobileMe account and wondered if you can access the iDisk from a mount command in your Linux environment?  It&#8217;s handy for backing up your data and general file sharing.</p>
<p>This simple step by step process will allow you to gain read and write access to your MobileMe user account&#8217;s iDisk drive space.  The first pre-cursor you need to fulfill is that you need the <strong>davfs</strong> (on debian/ubuntu flavors just run: <em>apt-get install davfs2</em>) package installed.</p>
<p>Next we&#8217;re going to create a mount point that will be used as a point of reference for the iDisk drive.</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p124code36'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p12436"><td class="code" id="p124code36"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>idisk</pre></td></tr></table></div>

<p>Using the root user account, modify your /etc/fstab file by adding the following at the bottom.  Just change the {account_name} section below:</p>
<pre>https://idisk.mac.com/{account_name}    /mnt/idisk      davfs   rw,noauto,user  0       0</pre>
<p>Now that you&#8217;ve completed the modification of the mount.  Let&#8217;s run a test.</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p124code37'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p12437"><td class="code" id="p124code37"><pre class="bash" style="font-family:monospace;">mydev:<span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #666666; font-style: italic;"># mount /mnt/idisk</span>
&nbsp;
Please enter the username to authenticate with server
  https:<span style="color: #000000; font-weight: bold;">//</span>idisk.mac.com<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>acccount_name<span style="color: #7a0874; font-weight: bold;">&#125;</span>
or hit enter <span style="color: #000000; font-weight: bold;">for</span> none.
Username: <span style="color: #7a0874; font-weight: bold;">&#123;</span>acccount_name<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
Please enter the password to authenticate <span style="color: #7a0874; font-weight: bold;">&#123;</span>acccount_name<span style="color: #7a0874; font-weight: bold;">&#125;</span> with server
  https:<span style="color: #000000; font-weight: bold;">//</span>idisk.me.com<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>acccount_name<span style="color: #7a0874; font-weight: bold;">&#125;</span>
or hit enter <span style="color: #000000; font-weight: bold;">for</span> none.
Password:
mydev:<span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #666666; font-style: italic;"># ls -al /mnt/idisk</span>
total <span style="color: #000000;">11</span>
drwxr-xr-x <span style="color: #000000;">15</span> root root  <span style="color: #000000;">256</span> <span style="color: #000000;">2009</span>-08-<span style="color: #000000;">13</span> 08:<span style="color: #000000;">11</span> .
drwxr-xr-x  <span style="color: #000000;">4</span> root root <span style="color: #000000;">4096</span> <span style="color: #000000;">2009</span>-08-<span style="color: #000000;">13</span> 07:<span style="color: #000000;">59</span> ..
drwxr-xr-x  <span style="color: #000000;">2</span> root root   <span style="color: #000000;">68</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">16</span> <span style="color: #000000;">14</span>:<span style="color: #000000;">33</span> Backup
drwxr-xr-x  <span style="color: #000000;">2</span> root root   <span style="color: #000000;">36</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">16</span> <span style="color: #000000;">14</span>:<span style="color: #000000;">33</span> Documents
drwxr-xr-x  <span style="color: #000000;">2</span> root root   <span style="color: #000000;">68</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">17</span> 07:<span style="color: #000000;">14</span> Groups
drwxr-xr-x  <span style="color: #000000;">5</span> root root  <span style="color: #000000;">132</span> <span style="color: #000000;">2009</span>-07-02 09:<span style="color: #000000;">11</span> iPhone Development
drwxr-xr-x  <span style="color: #000000;">5</span> root root  <span style="color: #000000;">100</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">17</span> 07:<span style="color: #000000;">48</span> Library
drwx------  <span style="color: #000000;">2</span> root root   <span style="color: #000000;">36</span> <span style="color: #000000;">2009</span>-08-<span style="color: #000000;">13</span> 08:<span style="color: #000000;">11</span> lost+found
drwxr-xr-x  <span style="color: #000000;">2</span> root root   <span style="color: #000000;">36</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">16</span> <span style="color: #000000;">14</span>:<span style="color: #000000;">33</span> Movies
drwxr-xr-x  <span style="color: #000000;">2</span> root root   <span style="color: #000000;">36</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">16</span> <span style="color: #000000;">14</span>:<span style="color: #000000;">33</span> Music
drwxr-xr-x  <span style="color: #000000;">2</span> root root   <span style="color: #000000;">36</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">16</span> <span style="color: #000000;">14</span>:<span style="color: #000000;">33</span> Pictures
drwxr-xr-x  <span style="color: #000000;">2</span> root root   <span style="color: #000000;">36</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">17</span> 07:<span style="color: #000000;">49</span> Public
drwxr-xr-x  <span style="color: #000000;">2</span> root root   <span style="color: #000000;">36</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">16</span> <span style="color: #000000;">14</span>:<span style="color: #000000;">33</span> Sites
drwxr-xr-x  <span style="color: #000000;">3</span> root root   <span style="color: #000000;">88</span> <span style="color: #000000;">2008</span>-07-<span style="color: #000000;">10</span> 01:<span style="color: #000000;">11</span> Software
drwxr-xr-x  <span style="color: #000000;">3</span> root root   <span style="color: #000000;">52</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">17</span> 07:<span style="color: #000000;">53</span> Web</pre></td></tr></table></div>

<p>That&#8217;s great isn&#8217;t it?  Now the only trouble is it keeps on prompting you for your username and password.  In my situation I want this automated.  Luckily for us, davfs has a mechanism built into it for managing this.  It&#8217;s located in the /etc/davfs2/secrets file.  So as the root user run the following commands.</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p124code38'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p12438"><td class="code" id="p124code38"><pre class="bash" style="font-family:monospace;">mydev:<span style="color: #000000; font-weight: bold;">/</span><span style="color: #666666; font-style: italic;"># umount /mnt/idisk</span>
mydev:<span style="color: #000000; font-weight: bold;">/</span><span style="color: #666666; font-style: italic;"># echo &quot;https://idisk.mac.com/{account_name}   {account_name}   {account_password}&quot; &gt;&gt; /etc/davfs2/secrets</span>
mydev:<span style="color: #000000; font-weight: bold;">/</span><span style="color: #666666; font-style: italic;"># mount /mnt/idisk</span>
mydev:<span style="color: #000000; font-weight: bold;">/</span><span style="color: #666666; font-style: italic;"># ls -al /mnt/idisk</span>
total <span style="color: #000000;">11</span>
drwxr-xr-x <span style="color: #000000;">15</span> root root  <span style="color: #000000;">256</span> <span style="color: #000000;">2009</span>-08-<span style="color: #000000;">13</span> 08:<span style="color: #000000;">11</span> .
drwxr-xr-x  <span style="color: #000000;">4</span> root root <span style="color: #000000;">4096</span> <span style="color: #000000;">2009</span>-08-<span style="color: #000000;">13</span> 07:<span style="color: #000000;">59</span> ..
drwxr-xr-x  <span style="color: #000000;">2</span> root root   <span style="color: #000000;">68</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">16</span> <span style="color: #000000;">14</span>:<span style="color: #000000;">33</span> Backup
drwxr-xr-x  <span style="color: #000000;">2</span> root root   <span style="color: #000000;">36</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">16</span> <span style="color: #000000;">14</span>:<span style="color: #000000;">33</span> Documents
drwxr-xr-x  <span style="color: #000000;">2</span> root root   <span style="color: #000000;">68</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">17</span> 07:<span style="color: #000000;">14</span> Groups
drwxr-xr-x  <span style="color: #000000;">5</span> root root  <span style="color: #000000;">132</span> <span style="color: #000000;">2009</span>-07-02 09:<span style="color: #000000;">11</span> iPhone Development
drwxr-xr-x  <span style="color: #000000;">5</span> root root  <span style="color: #000000;">100</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">17</span> 07:<span style="color: #000000;">48</span> Library
drwx------  <span style="color: #000000;">2</span> root root   <span style="color: #000000;">36</span> <span style="color: #000000;">2009</span>-08-<span style="color: #000000;">13</span> 08:<span style="color: #000000;">11</span> lost+found
drwxr-xr-x  <span style="color: #000000;">2</span> root root   <span style="color: #000000;">36</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">16</span> <span style="color: #000000;">14</span>:<span style="color: #000000;">33</span> Movies
drwxr-xr-x  <span style="color: #000000;">2</span> root root   <span style="color: #000000;">36</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">16</span> <span style="color: #000000;">14</span>:<span style="color: #000000;">33</span> Music
drwxr-xr-x  <span style="color: #000000;">2</span> root root   <span style="color: #000000;">36</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">16</span> <span style="color: #000000;">14</span>:<span style="color: #000000;">33</span> Pictures
drwxr-xr-x  <span style="color: #000000;">2</span> root root   <span style="color: #000000;">36</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">17</span> 07:<span style="color: #000000;">49</span> Public
drwxr-xr-x  <span style="color: #000000;">2</span> root root   <span style="color: #000000;">36</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">16</span> <span style="color: #000000;">14</span>:<span style="color: #000000;">33</span> Sites
drwxr-xr-x  <span style="color: #000000;">3</span> root root   <span style="color: #000000;">88</span> <span style="color: #000000;">2008</span>-07-<span style="color: #000000;">10</span> 01:<span style="color: #000000;">11</span> Software
drwxr-xr-x  <span style="color: #000000;">3</span> root root   <span style="color: #000000;">52</span> <span style="color: #000000;">2009</span>-06-<span style="color: #000000;">17</span> 07:<span style="color: #000000;">53</span> Web
mydev:<span style="color: #000000; font-weight: bold;">/</span><span style="color: #666666; font-style: italic;"># umount /mnt/idisk</span></pre></td></tr></table></div>

<p>And that is it!  No more prompting for the username and password.  Pretty simple implementation and we&#8217;re off to the races.</p>
<p>EDIT NOTES: Thanks DaveDaveDave for the comment, I changed the <em>https://idisk.me.com</em> to the new and functional <em>https://idisk.mac.com </em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrisdanielson.com/2009/08/13/mounting-mobileme-idisk-using-webdav-and-linux/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Upgrading your iPhone OS 2.0 Application to 3.0 and Deprecation Warnings</title>
		<link>http://www.chrisdanielson.com/2009/08/02/upgrading-your-iphone-os-2-0-application-to-3-0-and-deprecation-warnings/</link>
		<comments>http://www.chrisdanielson.com/2009/08/02/upgrading-your-iphone-os-2-0-application-to-3-0-and-deprecation-warnings/#comments</comments>
		<pubDate>Sun, 02 Aug 2009 18:04:52 +0000</pubDate>
		<dc:creator>Chris Danielson</dc:creator>
				<category><![CDATA[iPhone Development]]></category>
		<category><![CDATA[deprecated calls]]></category>
		<category><![CDATA[OS 2.0]]></category>
		<category><![CDATA[OS 3.0]]></category>
		<category><![CDATA[UITableView]]></category>
		<category><![CDATA[UITableViewCell]]></category>
		<category><![CDATA[Upgrade]]></category>

		<guid isPermaLink="false">http://www.chrisdanielson.com/?p=113</guid>
		<description><![CDATA[I just wanted to post a brief entry here regarding getting rid of deprecated warnings when upgrading your iPhone applications from OS 2.0 to 3.x. The warnings I was getting are as follows: warning: &#8216;setImage:&#8217; is deprecated (declared at /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/ iPhoneSimulator3.0.sdk/System/Library/Frameworks/UIKit.framework/ Headers/UITableViewCell.h:199) warning: &#8216;setText:&#8217; is deprecated (declared at /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/ iPhoneSimulator3.0.sdk/System/Library/Frameworks/UIKit.framework/ Headers/UITableViewCell.h:199) Before&#8230; ?View Code OBJC//This [...]]]></description>
			<content:encoded><![CDATA[<p>I just wanted to post a brief entry here regarding getting rid of deprecated warnings when upgrading your iPhone applications from OS 2.0 to 3.x.</p>
<p>The warnings I was getting are as follows:</p>
<p>warning: &#8216;setImage:&#8217; is deprecated (declared at /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/<br />
iPhoneSimulator3.0.sdk/System/Library/Frameworks/UIKit.framework/<br />
Headers/UITableViewCell.h:199)</p>
<p>warning: &#8216;setText:&#8217; is deprecated (declared at /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/<br />
iPhoneSimulator3.0.sdk/System/Library/Frameworks/UIKit.framework/<br />
Headers/UITableViewCell.h:199)</p>
<p>Before&#8230;</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p113code41'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p11341"><td class="code" id="p113code41"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">//This worked perfect in OS 2.0</span>
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>UITableViewCell <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tableView<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UITableView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tableView cellForRowAtIndexPath<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSIndexPath_Class/"><span style="color: #400080;">NSIndexPath</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>indexPath <span style="color: #002200;">&#123;</span>
     <span style="color: #a61390;">static</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>UserSettingButtonCellIdentifier <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;UserSetting&quot;</span>;
	UITableViewCell <span style="color: #002200;">*</span>cell <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>tableView dequeueReusableCellWithIdentifier<span style="color: #002200;">:</span>UserSettingButtonCellIdentifier<span style="color: #002200;">&#93;</span>;
	<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>cell <span style="color: #002200;">==</span> <span style="color: #a61390;">nil</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
		cell <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UITableViewCell alloc<span style="color: #002200;">&#93;</span> initWithFrame<span style="color: #002200;">:</span>CGRectZero reuseIdentifier<span style="color: #002200;">:</span> UserSettingButtonCellIdentifier<span style="color: #002200;">&#93;</span> autorelease<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#125;</span>
     NSUInteger row <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>indexPath row<span style="color: #002200;">&#93;</span>;
     UserSetting <span style="color: #002200;">*</span>rowData <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>list objectAtIndex<span style="color: #002200;">:</span>row<span style="color: #002200;">&#93;</span>;
     UIImage <span style="color: #002200;">*</span>image <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;bullet_ball_glass_blue.png&quot;</span><span style="color: #002200;">&#93;</span>;
     <span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>row <span style="color: #002200;">!=</span> <span style="color: #2400d9;">0</span><span style="color: #002200;">&#41;</span>
         cell.image <span style="color: #002200;">=</span> image; <span style="color: #11740a; font-style: italic;">//WARNING here</span>
     cell.text <span style="color: #002200;">=</span> rowData.name; <span style="color: #11740a; font-style: italic;">//WARNING here</span>
     <span style="color: #002200;">&#91;</span>rowData release<span style="color: #002200;">&#93;</span>;
     <span style="color: #a61390;">return</span> cell;
<span style="color: #002200;">&#125;</span>
<span style="color: #11740a; font-style: italic;">//the tableView method is completely deprecated.</span>
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>UITableViewCellAccessoryType<span style="color: #002200;">&#41;</span>tableView<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UITableView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tableView accessoryTypeForRowWithIndexPath<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSIndexPath_Class/"><span style="color: #400080;">NSIndexPath</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>indexPath <span style="color: #002200;">&#123;</span>
	<span style="color: #a61390;">return</span> UITableViewCellAccessoryDisclosureIndicator;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p>After, doing the mods to get rid of the deprecated warnings:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p113code42'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p11342"><td class="code" id="p113code42"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>UITableViewCell <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tableView<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UITableView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tableView cellForRowAtIndexPath<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSIndexPath_Class/"><span style="color: #400080;">NSIndexPath</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>indexPath <span style="color: #002200;">&#123;</span>
	<span style="color: #a61390;">static</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>UserSettingButtonCellIdentifier <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;UserSetting&quot;</span>;
	UITableViewCell <span style="color: #002200;">*</span>cell <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>tableView dequeueReusableCellWithIdentifier<span style="color: #002200;">:</span>UserSettingButtonCellIdentifier<span style="color: #002200;">&#93;</span>;
	<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>cell <span style="color: #002200;">==</span> <span style="color: #a61390;">nil</span><span style="color: #002200;">&#41;</span> <span style="color: #002200;">&#123;</span>
		cell <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UITableViewCell alloc<span style="color: #002200;">&#93;</span> initWithFrame<span style="color: #002200;">:</span>CGRectZero reuseIdentifier<span style="color: #002200;">:</span> UserSettingButtonCellIdentifier<span style="color: #002200;">&#93;</span> autorelease<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#125;</span>
	NSUInteger row <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>indexPath row<span style="color: #002200;">&#93;</span>;
	UserSetting <span style="color: #002200;">*</span>rowData <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>list objectAtIndex<span style="color: #002200;">:</span>row<span style="color: #002200;">&#93;</span>;
	UIImage <span style="color: #002200;">*</span>image <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;bullet_ball_glass_blue.png&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #a61390;">if</span> <span style="color: #002200;">&#40;</span>row <span style="color: #002200;">!=</span> <span style="color: #2400d9;">0</span><span style="color: #002200;">&#41;</span>
		cell.imageView.image <span style="color: #002200;">=</span> image; <span style="color: #11740a; font-style: italic;">//FIXED here</span>
	cell.textLabel.text <span style="color: #002200;">=</span> rowData.name; <span style="color: #11740a; font-style: italic;">//FIXED here</span>
&nbsp;
<span style="color: #6e371a;">#ifdef __IPHONE_3_0</span>
        <span style="color: #11740a; font-style: italic;">//This is a replacement for the tableView method</span>
	cell.accessoryType <span style="color: #002200;">=</span>  UITableViewCellAccessoryDisclosureIndicator;
<span style="color: #6e371a;">#endif</span>
&nbsp;
	<span style="color: #002200;">&#91;</span>rowData release<span style="color: #002200;">&#93;</span>;
	<span style="color: #a61390;">return</span> cell;
<span style="color: #002200;">&#125;</span>
<span style="color: #6e371a;">#ifndef __IPHONE_3_0</span>
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>UITableViewCellAccessoryType<span style="color: #002200;">&#41;</span>tableView<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>UITableView <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>tableView accessoryTypeForRowWithIndexPath<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSIndexPath_Class/"><span style="color: #400080;">NSIndexPath</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>indexPath <span style="color: #002200;">&#123;</span>
	<span style="color: #a61390;">return</span> UITableViewCellAccessoryDisclosureIndicator;
<span style="color: #002200;">&#125;</span>
<span style="color: #6e371a;">#endif</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.chrisdanielson.com/2009/08/02/upgrading-your-iphone-os-2-0-application-to-3-0-and-deprecation-warnings/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Apple App Store Scalability Issues and Subjective Rejections</title>
		<link>http://www.chrisdanielson.com/2009/07/28/apple-app-store-scalability-issues-and-subjective-rejections/</link>
		<comments>http://www.chrisdanielson.com/2009/07/28/apple-app-store-scalability-issues-and-subjective-rejections/#comments</comments>
		<pubDate>Tue, 28 Jul 2009 15:24:45 +0000</pubDate>
		<dc:creator>Chris Danielson</dc:creator>
				<category><![CDATA[iPhone Development]]></category>
		<category><![CDATA[3.3.14]]></category>
		<category><![CDATA[App Store]]></category>
		<category><![CDATA[Application Reviewer]]></category>
		<category><![CDATA[FreeSWITCH]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.chrisdanielson.com/?p=94</guid>
		<description><![CDATA[I found a wonderful article by Craig Hockenberry regarding Apple&#8217;s big iPhone and App Store issue. This link says it all regarding the issues with Apple’s inability to keep developers happy. Whenever I think back to what put Microsoft atop the operating system market, the first thing that comes to mind is Microsoft’s support of [...]]]></description>
			<content:encoded><![CDATA[<p>I found a wonderful article by Craig Hockenberry regarding <a href="http://furbo.org/2009/07/10/year-two/">Apple&#8217;s big iPhone and App Store issue</a>.  This link says it all regarding the issues with Apple’s inability to keep developers happy. Whenever I think back to what put Microsoft atop the operating system market, the first thing that comes to mind is Microsoft’s support of the developers. Though many developers agree that the documentation for the Windows API isn’t all that great, it is there and Microsoft does support it. Also, Microsoft allows us to write what we want without any requirement to run our code through a quality control structure. Granted, this is perhaps the reason why there are so many viruses (and junk) written on Windows, but  this has also allowed developers to freely create innovative programs that enable Microsoft to still take a big piece of the operating system market.</p>
<p>Now having a quality control system in place such as Apple&#8217;s iPhone reviewers is a great idea because it prevents <a href="http://en.wikipedia.org/wiki/Malware">malware</a> from getting on your phone.  No one refutes that.  But as soon as you get wrapped into what and how they are reviewing, you quickly find out that the process is a self-defeating one covered with a thick layer of subjective decision making. Take for instance a FreeSWITCH Console application I wrote a few months back.  The application merely does asynchronous socket communication with an open source <a href="http://freeswitch.org">FreeSWITCH</a> server instance that has the &#8220;event socket layer&#8221; module installed.  It&#8217;s a clean pass-through client, built for developers that does nothing more than relay commands that you, the developer, must know.  I submitted the application for review on June 5, 2009.  They just got around to finally responding on July 26, 2009.  What is with this horrible delay?  It speaks clearly that there is a lack of scalability in the Apple reviewer model.  Here is an email I received from the reviewing staff the other day.</p>
<blockquote><p>Hello Chris,</p>
<p>Thank you for your emails and the clarifications.  The account you provided and the instructions you gave do show the application as functional.  However, since the application allows users to connect to any FreeSWITCH server, we need to be able to review all features that a FreeSWITCH server can implement, which include functions such as SIP and PBX.</p>
<p>Please respond to this email with the necessary information, and please upload a new binary to iTunes Connect.</p>
<p>Regards,<br />
iPhone Developer Program<br />
****************************
</p></blockquote>
<p>Let me explain this further. They are asking me to provide them with a SIP/PBX account so that they can go beyond testing my application and begin testing the FreeSWITCH server! If you’ve ever delved into the FreeSWITCH server code itself, you know that it is a well written and scalable telephony application that is incredibly complex. I just want my app in the app store so that other developers can enjoy using their iPhones and iPod Touches to control their developer instances of FreeSWITCH! So why all the trouble, Apple?</p>
<p>As you can see, this has gone well and beyond testing for malware. This is a reviewer subjectively deciding to test a really cool FreeSWITCH server. Now, I have no trouble with that, just don’t do it on my dime. I’ll be re-posting the FreeSWITCH application into the iTunes Connect system in about 3 weeks when my blood has stopped boiling.</p>
<p>I have another application (which will remain unnamed for the time being) that I&#8217;m trying to get into the App Store as well.  First off, I am planning on charging for this one in the Tier 1 model which basically equates to the customer paying $.99.  I posted this app on the store 6 days ago.  Last night, I received the infamous &#8220;taking unexpected additional time for review&#8221; email.  Two hours later, I received the Section 3.3.14 death sentence response::</p>
<blockquote><p>Dear  Mr. Danielson,</p>
<p>Thank you for submitting &#8216;Removed App Name&#8217; to the App Store. We&#8217;ve reviewed &#8216;Removed App Name&#8217; and determined that we cannot post this version of your iPhone application to the App Store because it contains objectionable content and is in violation of Section 3.3.14 from the the iPhone Developer Program License Agreement which states:</p>
<p>&#8220;Applications may be rejected if they contain content or materials of any kind (text, graphics, images, photographs, sounds, etc.) that in Apple&#8217;s reasonable judgement may be found objectionable, for example, materials that may be considered obscene, pornographic, or defamatory.&#8221;</p>
<p>If you believe that you can make the necessary changes so that &#8216;Removed App Name&#8217; does not violate the iPhone Developer Program License Agreement, we encourage you to do so and resubmit it for review.</p>
<p>Regards,<br />
iPhone Developer Program<br />
****************************</p></blockquote>
<p>Wow. My application truly pales in comparison to the likes of Easy-E, Cannibal Corpse, Geto Boys, and any R-rated movies Apple already sells on iTunes, let alone the other similarly themed apps that are already available.  We’re hoping it was our bad luck that we had a reviewer with a dulled sense of humor… anyway we’re now attempting to get it posted into the App Store with some minor revisions.</p>
<p>I’ve really digressed a bit in this blog, but my basic point is that Apple’s App Store Reviewing squad is uncoordinated in their decision making skills. I’ve read online that people with the 3.3.14 issue have only to change their description text and successfully re-submit. If this is the case, then we truly do know that Apple is fraught with subjectivity and developer’s livelihoods are being toyed with. Why not take the high road Apple? Allow applications into the store by merely testing for any sort of malware, and using your already-existing rating system for content. Leave the ultimate purchase decision up to the consumer. Heck, you can hire my company <a href="http://www.maxpowersoft.com">MaxPowerSoft</a> and we’ll even write the grep scripts to automate the red-flagging for any submitted applications. Just don’t cut out your developers – they could be your lifeblood.</p>
<p><em>Special thanks to my brother <a href="http://nicdanielson.com">Nic Danielson</a> for reviewing and editing this post.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.chrisdanielson.com/2009/07/28/apple-app-store-scalability-issues-and-subjective-rejections/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
