<?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>Zac Vineyard's Blog</title>
	<atom:link href="http://zacvineyard.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://zacvineyard.com/blog</link>
	<description>code, design, videos, and other nonsense</description>
	<lastBuildDate>Wed, 21 Mar 2012 15:44:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>How to Iterate Through an Array in a Shell Script (Bash)</title>
		<link>http://zacvineyard.com/blog/2012/03/21/how-to-iterate-through-an-array-in-a-shell-script-bash/</link>
		<comments>http://zacvineyard.com/blog/2012/03/21/how-to-iterate-through-an-array-in-a-shell-script-bash/#comments</comments>
		<pubDate>Wed, 21 Mar 2012 15:44:35 +0000</pubDate>
		<dc:creator>Zac</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[shell scripting]]></category>

		<guid isPermaLink="false">http://zacvineyard.com/blog/?p=682</guid>
		<description><![CDATA[I was recently debugging a shell script and had a hard time remembering how to iterate through an array. So, to clarify this issue for other developers out there, I&#8217;ve provided a code example below. I found, too, that it was particularly important to put the items of the array in single quotes. This prevents [...]]]></description>
			<content:encoded><![CDATA[<p>I was recently debugging a shell script and had a hard time remembering how to iterate through an array. So, to clarify this issue for other developers out there, I&#8217;ve provided a code example below. I found, too, that it was particularly important to put the items of the array in single quotes. This prevents the script from hitting a syntax error while iterating over a list of URLs, for example. </p>
<div id="gist-2148486" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="c">#!/bin/bash</span></div><div class='line' id='LC2'><span class="nv">array</span><span class="o">=(</span></div><div class='line' id='LC3'><span class="s1">&#39;first&#39;</span></div><div class='line' id='LC4'><span class="s1">&#39;second&#39;</span></div><div class='line' id='LC5'><span class="s1">&#39;third&#39;</span></div><div class='line' id='LC6'><span class="o">)</span></div><div class='line' id='LC7'><span class="k">for </span>i in <span class="s2">&quot;${array[@]}&quot;</span></div><div class='line' id='LC8'><span class="k">do</span></div><div class='line' id='LC9'><span class="nb">echo</span> <span class="nv">$i</span></div><div class='line' id='LC10'><span class="k">done</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/2148486/5988db1713660a6191241b5188f100a996655250/gistfile1.sh" style="float:right;">view raw</a>
            <a href="https://gist.github.com/2148486#file_gistfile1.sh" style="float:right;margin-right:10px;color:#666">gistfile1.sh</a>
            <a href="https://gist.github.com/2148486">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p>To run the script above in Ubuntu, save the code in a file with a <code>.sh</code> (like script.sh) extension and run it in the terminal using bash.</p>
<pre>
$ bash script.sh
</pre>
]]></content:encoded>
			<wfw:commentRss>http://zacvineyard.com/blog/2012/03/21/how-to-iterate-through-an-array-in-a-shell-script-bash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Android: Target a TextView</title>
		<link>http://zacvineyard.com/blog/2012/03/12/android-target-a-textview/</link>
		<comments>http://zacvineyard.com/blog/2012/03/12/android-target-a-textview/#comments</comments>
		<pubDate>Tue, 13 Mar 2012 05:01:42 +0000</pubDate>
		<dc:creator>Zac</dc:creator>
				<category><![CDATA[Android]]></category>

		<guid isPermaLink="false">http://zacvineyard.com/blog/?p=665</guid>
		<description><![CDATA[In order modify one of it’s properties like, for example, the text it contains, Android developers often rely on targeting views in order modify one of their properties. The small code example in this post targets a view with the ID of humidity and appends some text to it.]]></description>
			<content:encoded><![CDATA[<p>In order modify their properties (like the text they contain) Android developers often rely on targeting views in their code. The small code example below targets a view with the ID of <em>humidity</em> and appends some text to it.</p>
<div id="gist-2026807" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="n">TextView</span> <span class="n">humidityView</span> <span class="o">=</span> <span class="o">(</span><span class="n">TextView</span><span class="o">)</span> <span class="n">findViewById</span><span class="o">(</span><span class="n">R</span><span class="o">.</span><span class="na">id</span><span class="o">.</span><span class="na">humidity</span><span class="o">);</span></div><div class='line' id='LC2'><span class="n">humidityView</span><span class="o">.</span><span class="na">setText</span><span class="o">(</span><span class="s">&quot;Very Humid&quot;</span><span class="o">);</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/2026807/d26571e1a94cb0de4c6269b9e68f448beff98147/gistfile1.java" style="float:right;">view raw</a>
            <a href="https://gist.github.com/2026807#file_gistfile1.java" style="float:right;margin-right:10px;color:#666">gistfile1.java</a>
            <a href="https://gist.github.com/2026807">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

<p>In order to target a view, you have to declare it in a layout XML file. That deceleration would look something like this:</p>
<div id="gist-2026824" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="nt">&lt;TextView</span></div><div class='line' id='LC2'><span class="na">android:id=</span><span class="s">&quot;@+id/humidity&quot;</span></div><div class='line' id='LC3'><span class="na">android:gravity=</span><span class="s">&quot;center_horizontal&quot;</span></div><div class='line' id='LC4'><span class="na">android:layout_width=</span><span class="s">&quot;fill_parent&quot;</span> </div><div class='line' id='LC5'><span class="na">android:layout_height=</span><span class="s">&quot;wrap_content&quot;</span></div><div class='line' id='LC6'><span class="na">android:paddingBottom=</span><span class="s">&quot;30dp&quot;</span></div><div class='line' id='LC7'><span class="na">android:textSize=</span><span class="s">&quot;7pt&quot;</span></div><div class='line' id='LC8'><span class="na">android:textColor=</span><span class="s">&quot;#ffffff&quot;</span></div><div class='line' id='LC9'><span class="nt">/&gt;</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/2026824/d287d325e47bb122b6badfc07ffb77fe0eb30a9f/gistfile1.xml" style="float:right;">view raw</a>
            <a href="https://gist.github.com/2026824#file_gistfile1.xml" style="float:right;margin-right:10px;color:#666">gistfile1.xml</a>
            <a href="https://gist.github.com/2026824">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://zacvineyard.com/blog/2012/03/12/android-target-a-textview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Diablo 3 WordPress Theme</title>
		<link>http://zacvineyard.com/blog/2012/02/22/diablo-3-wordpress-theme/</link>
		<comments>http://zacvineyard.com/blog/2012/02/22/diablo-3-wordpress-theme/#comments</comments>
		<pubDate>Thu, 23 Feb 2012 06:36:28 +0000</pubDate>
		<dc:creator>Zac</dc:creator>
				<category><![CDATA[Misc]]></category>

		<guid isPermaLink="false">http://zacvineyard.com/blog/?p=621</guid>
		<description><![CDATA[In celebration of the upcoming release of Diablo 3, I'd like to announce the release of a Wordpress theme I'm calling the Diablo 3 Graveyard Wordpress Theme. I put this theme together because I was a huge fan of Diablo 2. And now, even though I don't spend much time playing nowadays, I'll install D2 from CD and play it over the Halloween weekend. It was, in fact, October of 2011 that I started working on this project, and I've just now had the time to finish and release it.]]></description>
			<content:encoded><![CDATA[<p>In celebration of the upcoming release of <a href="http://us.battle.net/d3/en/" target="_blank">Diablo 3</a>, I&#8217;d like to announce the release of a WordPress theme I&#8217;m calling the Diablo 3 Graveyard WordPress Theme. I put this theme together because I was a huge fan of Diablo 2. And now, even though I don&#8217;t spend much time playing nowadays, I&#8217;ll install D2 from CD and play it over the Halloween weekend. It was, in fact, October of 2011 that I started working on this project, and I&#8217;ve just now had the time to finish and release it.</p>
<p><img src="http://zacvineyard.com/blog/wp-content/uploads/2012/02/d3_preview.jpg" alt="" title="d3_preview" width="516" height="300" class="aligncenter size-full wp-image-626" /></p>
<p>This theme is straight-forward. No frills.</p>
<h2>Download</h2>
<p>You can <a href="https://github.com/zvineyard/Diablo-3-Graveyard-Wordpress-Theme">download this theme from GitHub</a>.<br />
You can also <a href="http://zacvineyard.com/blog/2012/02/22/diablo-3-wordpress-theme/?theme=d3">preview this theme</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://zacvineyard.com/blog/2012/02/22/diablo-3-wordpress-theme/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Review: PhoneGap Beginner&#8217;s Guide (Packt Publishing) by Andrew Lunny</title>
		<link>http://zacvineyard.com/blog/2012/02/02/review-phonegap-beginners-guide-packt-publishing-by-andrew-lunny/</link>
		<comments>http://zacvineyard.com/blog/2012/02/02/review-phonegap-beginners-guide-packt-publishing-by-andrew-lunny/#comments</comments>
		<pubDate>Fri, 03 Feb 2012 05:39:13 +0000</pubDate>
		<dc:creator>Zac</dc:creator>
				<category><![CDATA[PhoneGap]]></category>

		<guid isPermaLink="false">http://zacvineyard.com/blog/?p=583</guid>
		<description><![CDATA[<em>PhoneGap Beginner's Guide</em> is the most informative source of information I've seen/read about PhoneGap. It is a great resource for learning all the nuances that go into making native PhoneGap applications on mobile devices. If you are looking to use PhoneGap, it would be a good idea to start with this book. It really is a comprehensive yet easy-to-read book on using PhoneGap.]]></description>
			<content:encoded><![CDATA[<p><a href="http://zacvineyard.com/blog/wp-content/uploads/2012/02/pgbg_cover.png"><img class="alignright size-medium wp-image-595" title="pgbg_cover" src="http://zacvineyard.com/blog/wp-content/uploads/2012/02/pgbg_cover-235x300.png" alt="" width="235" height="300" /></a>Language: English<br />
Paperback: 328 pages [ 235mm x 191mm ]<br />
Release Date: September 2011<br />
ISBN: 1849515360<br />
ISBN 13: 978-1-84951-536-8<br />
Author: Andrew Lunny</p>
<p>I often find myself buying a book about a programming when I need to learn something substantial to conquer a problem. Because I am a web developer, when it came to building native mobile apps (Andorid and iOS), I looked for the path of least resistance and started learning, as an alternative to learning Java and/or Objective C, about PhoneGap. My story in learning how to use PhoneGap was troublesome. It was a tangled mess of trial-and-error methodology and questions like &#8220;Why isn&#8217;t this working?&#8221; spoken aloud to my computer at night. Having a book like <em>PhoneGap Beginner&#8217;s Guide</em> from Packt Publishing would have been a big help in learning PhoneGap for the following reasons:</p>
<h2>1. Life is short, man</h2>
<p><em>PhoneGap Beginner&#8217;s Guide</em> gets to the heart of mobile development by showing you how to install the Android, iOS, and Blackberry SDKs. This gets you on the road to building an app quickly. I spent a lot of time just getting Eclipse up and running to build an Android project. One of the great benefits of PhoneGap is that it integrates seamlessly with the iOS, and other, SDKs. Because of this, this guide gets you building a project in no time.</p>
<h2>2. Andrew writes to make friends</h2>
<p>Andrew Lunny&#8217;s light tone throughout the book keeps you interested. Take this for example: &#8220;A confession—you don&#8217;t want to set the width and height of your only top-level element, as<br />
we have done.&#8221; Not only is this fun and quirky, but it helps you learn the nuances of PhoneGap. And, if you have any geek-to-geek sensibility, you&#8217;d probably laugh out loud at that phrase.</p>
<h2>3. Yay, WebKit!</h2>
<p>Initially building and debugging a PhoneGap project in a WebKit browser is recommended in this book. This is a good advantage for all you Google Chrome users out there.</p>
<h2>4. HTML5 for Native Phone Apps</h2>
<p>Andrew is very good at leading users into the new frontier of developing native phone apps using HTML5. At some point, app developers will need a database, making the HTML5 LocalStorage API a natural fit. Andrew thoroughly explains how you tap into many of the new features in HTML5, like LocalStorage, for your app.</p>
<h2>5. All the details are here</h2>
<p><em>PhoneGap Beginner&#8217;s Guide</em> is the most informative source of information I&#8217;ve seen/read about PhoneGap. It is a great resource for learning all the nuances that go into making native PhoneGap applications on mobile devices. If you are looking to use PhoneGap, it would be a good idea to start with this book. It really is a comprehensive yet easy-to-read book on using PhoneGap.</p>
]]></content:encoded>
			<wfw:commentRss>http://zacvineyard.com/blog/2012/02/02/review-phonegap-beginners-guide-packt-publishing-by-andrew-lunny/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Post Data to a Remote Server (Cross-domain) with jQuery in PhoneGap</title>
		<link>http://zacvineyard.com/blog/2011/06/19/post-data-to-a-remote-server-cross-domain-with-jquery-in-phonegap/</link>
		<comments>http://zacvineyard.com/blog/2011/06/19/post-data-to-a-remote-server-cross-domain-with-jquery-in-phonegap/#comments</comments>
		<pubDate>Sun, 19 Jun 2011 19:21:29 +0000</pubDate>
		<dc:creator>Zac</dc:creator>
				<category><![CDATA[PhoneGap]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://zacvineyard.com/blog/?p=510</guid>
		<description><![CDATA[Android and iPhone apps built with PhoneGap are (because of PhoneGap's nature) compiled code, and because this compiled code is not a browser, you can execute cross-domain requests. In this short tutorial, I'll provide some sample code for sending a POST request to a remote server.]]></description>
			<content:encoded><![CDATA[<p><img src="http://zacvineyard.com/blog/wp-content/uploads/2011/06/phonegap_forward.jpg" alt="post json to remote server cross domain phonegap" title="phonegap_forward" width="300" height="300" class="alignright size-full wp-image-656" />Android and iPhone apps built with PhoneGap are (because of PhoneGap&#8217;s nature) compiled code, and because this compiled code is not a browser, you can execute cross-domain requests. The example code I provide below will not work in a browser, but it does work in a phone emulator (whether Android or iPhone) and, of course, on mobile devices. Concerning where you can place data, this opens a whole world of possibilities, including what you can do with user generated content.</p>
<p>PLEASE NOTE:<br />
This example will work on a mobile device and in a mobile device emulator. It will not work in an internet browser.</p>
<h2>The HTML Form</h2>
<p>This example starts with a basic form in HTML, as seen below.<br />
<div id="gist-2018164" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="nt">&lt;form</span> <span class="na">method=</span><span class="s">&quot;post&quot;</span> <span class="na">id=</span><span class="s">&quot;infoForm&quot;</span><span class="nt">&gt;</span></div><div class='line' id='LC2'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nt">&lt;input</span> <span class="na">type=</span><span class="s">&quot;text&quot;</span> <span class="na">name=</span><span class="s">&quot;first_name&quot;</span> <span class="na">id=</span><span class="s">&quot;first_name&quot;</span> <span class="na">value=</span><span class="s">&quot;&quot;</span> <span class="na">placeholder=</span><span class="s">&quot;First Name&quot;</span>  <span class="nt">/&gt;</span></div><div class='line' id='LC3'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nt">&lt;input</span> <span class="na">type=</span><span class="s">&quot;text&quot;</span> <span class="na">name=</span><span class="s">&quot;last_name&quot;</span> <span class="na">id=</span><span class="s">&quot;last_name&quot;</span> <span class="na">value=</span><span class="s">&quot;&quot;</span> <span class="na">placeholder=</span><span class="s">&quot;Last Name&quot;</span>  <span class="nt">/&gt;</span>   </div><div class='line' id='LC4'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nt">&lt;input</span> <span class="na">type=</span><span class="s">&quot;text&quot;</span> <span class="na">name=</span><span class="s">&quot;email&quot;</span> <span class="na">id=</span><span class="s">&quot;email&quot;</span> <span class="na">value=</span><span class="s">&quot;&quot;</span> <span class="na">placeholder=</span><span class="s">&quot;Email&quot;</span>  <span class="nt">/&gt;</span></div><div class='line' id='LC5'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nt">&lt;button</span> <span class="na">type=</span><span class="s">&quot;submit&quot;</span><span class="nt">&gt;</span>Submit<span class="nt">&lt;/button&gt;</span> </div><div class='line' id='LC6'><span class="nt">&lt;/form&gt;</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/2018164/3a0b4bb9d443776b738b51c16f15515183057557/example_html_form.html" style="float:right;">view raw</a>
            <a href="https://gist.github.com/2018164#file_example_html_form.html" style="float:right;margin-right:10px;color:#666">example_html_form.html</a>
            <a href="https://gist.github.com/2018164">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>
</p>
<h2>The Javascript (jQuery)</h2>
<p>Once you have the form, we&#8217;ll need some jQuery to process the form and post the data to a script on a remote server. Make sure you change the <code>postTo</code> variable in the example code below so that it points to your own PHP script.</p>
<p>I am using <code>jQuery.post()</code> to send the data to the server. You can <a href="http://api.jquery.com/jQuery.post/">learn more about <code>jQuery.post()</code> on the jQuery website</a>.<br />
<div id="gist-2018168" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="nx">$</span><span class="p">(</span><span class="s1">&#39;#infoForm&#39;</span><span class="p">).</span><span class="nx">submit</span><span class="p">(</span><span class="kd">function</span><span class="p">()</span> <span class="p">{</span></div><div class='line' id='LC2'><br/></div><div class='line' id='LC3'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="kd">var</span> <span class="nx">postTo</span> <span class="o">=</span> <span class="s1">&#39;http://yourdomain.com/test.php&#39;</span><span class="p">;</span></div><div class='line' id='LC4'><br/></div><div class='line' id='LC5'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">$</span><span class="p">.</span><span class="nx">post</span><span class="p">(</span><span class="nx">postTo</span><span class="p">,({</span><span class="nx">first_name</span><span class="o">:</span> <span class="nx">$</span><span class="p">(</span><span class="s1">&#39;[name=first_name]&#39;</span><span class="p">).</span><span class="nx">val</span><span class="p">(),</span> <span class="nx">last_name</span><span class="o">:</span> <span class="nx">$</span><span class="p">(</span><span class="s1">&#39;[name=last_name]&#39;</span><span class="p">).</span><span class="nx">val</span><span class="p">(),</span> <span class="nx">email</span><span class="o">:</span> <span class="nx">$</span><span class="p">(</span><span class="s1">&#39;[name=email]&#39;</span><span class="p">).</span><span class="nx">val</span><span class="p">()}),</span></div><div class='line' id='LC6'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="kd">function</span><span class="p">(</span><span class="nx">data</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC7'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">alert</span><span class="p">(</span><span class="nx">data</span><span class="p">);</span></div><div class='line' id='LC8'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">if</span><span class="p">(</span><span class="nx">data</span> <span class="o">!=</span> <span class="s2">&quot;&quot;</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC9'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">// do something</span></div><div class='line' id='LC10'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span> <span class="k">else</span> <span class="p">{</span></div><div class='line' id='LC11'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">// couldn&#39;t connect</span></div><div class='line' id='LC12'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC13'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">},</span><span class="s1">&#39;json&#39;</span><span class="p">);</span></div><div class='line' id='LC14'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="k">return</span> <span class="kc">false</span><span class="p">;</span></div><div class='line' id='LC15'><br/></div><div class='line' id='LC16'><span class="p">});</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/2018168/0609ef5c25193d9082633cf2dba83780c1221f88/gistfile1.js" style="float:right;">view raw</a>
            <a href="https://gist.github.com/2018168#file_gistfile1.js" style="float:right;margin-right:10px;color:#666">gistfile1.js</a>
            <a href="https://gist.github.com/2018168">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>
<br />
Essentially this bit of jQuery takes the data from a form with the id attribute of &#8220;infoForm&#8221; and POSTs it to a PHP script as a JSON string. Make sure you build the data string you&#8217;ll submit using <code>jQuery.post()</code> with the names of your form inputs. In other words, make sure you add the data from your form to the JSON data string you&#8217;re building as part of the jQuery POST request.</p>
]]></content:encoded>
			<wfw:commentRss>http://zacvineyard.com/blog/2011/06/19/post-data-to-a-remote-server-cross-domain-with-jquery-in-phonegap/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>How to Change the NS Record on a Domain and Not Interrupt Email Delivery</title>
		<link>http://zacvineyard.com/blog/2011/05/21/how-to-change-the-ns-record-on-a-domain-and-not-interrupt-email-delivery/</link>
		<comments>http://zacvineyard.com/blog/2011/05/21/how-to-change-the-ns-record-on-a-domain-and-not-interrupt-email-delivery/#comments</comments>
		<pubDate>Sun, 22 May 2011 02:48:56 +0000</pubDate>
		<dc:creator>Zac</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[domain]]></category>
		<category><![CDATA[ns records]]></category>
		<category><![CDATA[zone file]]></category>

		<guid isPermaLink="false">http://zacvineyard.com/blog/?p=496</guid>
		<description><![CDATA[I was going to be hosting a web site for a company using GoDaddy, but this company's old site and domain were hosted and controlled somewhere else. With this situation, the problem I faced was that I needed to change the site's DNS record (zone file) to point to the new website (by changing the ns records) but make sure that email delivery didn't get interrupted.]]></description>
			<content:encoded><![CDATA[<p><a href="http://zacvineyard.com/blog/wp-content/uploads/2011/05/internet.jpg"><img src="http://zacvineyard.com/blog/wp-content/uploads/2011/05/internet.jpg" alt="" title="internet" width="300" height="300" class="alignright size-full wp-image-505" /></a>Here was my situation: I was going to be hosting a web site for a company using GoDaddy, but this company&#8217;s old site and domain were hosted and controlled somewhere else. With this situation, the problem I faced was that I needed to change the site&#8217;s DNS record (zone file) to point to the new website (by changing the ns records) but make sure that email delivery didn&#8217;t get interrupted.</p>
<p>So, when you change a ns record on a domain you&#8217;re telling DNS servers that the information about a particular domain is now being housed in a different spot; meaning that the new nameserver for your domain will be the authority on what your domain name does (be the zone file owner). Once the new ns records propagate, your domain will act according to the zone file on the new nameserver.</p>
<p>So, in order to ensure that you don&#8217;t disrupt email for a business when you make a change like this, here are a couple of pointers:</p>
<ol>
<li>Add an A record to the zone file that points to the IP address of the (old) mail server; like<br />
A → mail →  xxx.xxx.xxx.xxx</li>
<li>Add an MX record for mail.yourdomain.com (make sure you use your own domain name) pointing to the new A record for the IP address of the old server</li>
</ol>
<p>Here is a picture that helps explain what I&#8217;m talking about.</p>
<p><a href="http://zacvineyard.com/blog/wp-content/uploads/2011/05/domain_zone_file.jpg"><img class="alignnone size-medium wp-image-498" title="domain_zone_file" src="http://zacvineyard.com/blog/wp-content/uploads/2011/05/domain_zone_file-300x206.jpg" alt="" width="300" height="206" /></a></p>
<div class="warn">Now, this is just one solution to a varying number of ways to fix this problem, so please explore all troubleshooting options when changing a zone file.</div>
]]></content:encoded>
			<wfw:commentRss>http://zacvineyard.com/blog/2011/05/21/how-to-change-the-ns-record-on-a-domain-and-not-interrupt-email-delivery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upload a File to a Remote Server with PhoneGap (revised for version 1.5.0)</title>
		<link>http://zacvineyard.com/blog/2011/03/25/upload-a-file-to-a-remote-server-with-phonegap/</link>
		<comments>http://zacvineyard.com/blog/2011/03/25/upload-a-file-to-a-remote-server-with-phonegap/#comments</comments>
		<pubDate>Sat, 26 Mar 2011 03:54:53 +0000</pubDate>
		<dc:creator>Zac</dc:creator>
				<category><![CDATA[PhoneGap]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[native]]></category>
		<category><![CDATA[phonegap]]></category>
		<category><![CDATA[POST]]></category>
		<category><![CDATA[upload]]></category>

		<guid isPermaLink="false">http://zacvineyard.com/blog/?p=453</guid>
		<description><![CDATA[I recently started looking at <a href="http://www.phonegap.com/" target="_blank">PhoneGap</a> as a way to build native smartphone applications without having to learn another programming language. The process, so far, has been going very well. I've been able to build a basic application with very little trouble. I did, however, hit a big hiccup in development when I decided to try and upload a file from a phone to a remote location. In this post, I want to explain how I was able to upload a photo from a phone, using PhoneGap (and PHP on the remote server), to a remote server.]]></description>
			<content:encoded><![CDATA[<p><img src="http://zacvineyard.com/blog/wp-content/uploads/2011/03/phonegap_plus_php.jpg" alt="" title="phonegap_plus_php" width="300" height="300" class="alignright size-full wp-image-641" />I recently started looking at <a href="http://www.phonegap.com/" target="_blank">PhoneGap</a> as a way to build native smartphone applications without having to learn another programming language. The process, so far, has been going very well. I&#8217;ve been able to build a basic application with very little trouble. I did, however, hit a big hiccup in development when I decided to try and upload a file from a phone to a remote location. The unfortunate part of this hiccup was that I think its primary cause is rooted in poor documentation.</p>
<p>In this post, I want to explain how I was able to upload a photo from a phone, using PhoneGap (and PHP on the remote server), to a remote server. I am going to assume that you have some knowledge of PhoneGap and already have a method, either the Android SDK or the iPhone SDK, to test your native application.</p>
<h2>The HTML / Javascript</h2>
<p>Rather then use a jQuery Ajax call, I am relying on <a href="http://docs.phonegap.com/phonegap_file_file.md.html#FileTransfer" target="_blank">PhoneGap&#8217;s FileTransfer object</a> to post the image to a remote server. The code below is all you need to add to your &#8220;index.html&#8221; PhoneGap file for a basic upload. Make sure, if you use the example code below, to add your server&#8217;s URL in the appropriately marked place.<br />
<div id="gist-1913580" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="cp">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot; &quot;http://www.w3.org/TR/html4/strict.dtd&quot;&gt;</span></div><div class='line' id='LC2'><span class="nt">&lt;html&gt;</span></div><div class='line' id='LC3'><span class="nt">&lt;head&gt;</span></div><div class='line' id='LC4'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nt">&lt;title&gt;</span>File Transfer Example<span class="nt">&lt;/title&gt;</span></div><div class='line' id='LC5'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nt">&lt;script </span><span class="na">type=</span><span class="s">&quot;text/javascript&quot;</span> <span class="na">charset=</span><span class="s">&quot;utf-8&quot;</span> <span class="na">src=</span><span class="s">&quot;phonegap-1.2.0.js&quot;</span><span class="nt">&gt;&lt;/script&gt;</span></div><div class='line' id='LC6'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nt">&lt;script </span><span class="na">type=</span><span class="s">&quot;text/javascript&quot;</span> <span class="na">charset=</span><span class="s">&quot;utf-8&quot;</span><span class="nt">&gt;</span></div><div class='line' id='LC7'>&nbsp;</div><div class='line' id='LC8'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">// Wait for PhoneGap to load</span></div><div class='line' id='LC9'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nb">document</span><span class="p">.</span><span class="nx">addEventListener</span><span class="p">(</span><span class="s2">&quot;deviceready&quot;</span><span class="p">,</span> <span class="nx">onDeviceReady</span><span class="p">,</span> <span class="kc">false</span><span class="p">);</span></div><div class='line' id='LC10'>&nbsp;</div><div class='line' id='LC11'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">// PhoneGap is ready</span></div><div class='line' id='LC12'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="kd">function</span> <span class="nx">onDeviceReady</span><span class="p">()</span> <span class="p">{</span></div><div class='line' id='LC13'>&nbsp;		<span class="c1">// Do cool things here...</span></div><div class='line' id='LC14'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC15'>&nbsp;</div><div class='line' id='LC16'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="kd">function</span> <span class="nx">getImage</span><span class="p">()</span> <span class="p">{</span></div><div class='line' id='LC17'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="c1">// Retrieve image file location from specified source</span></div><div class='line' id='LC18'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">navigator</span><span class="p">.</span><span class="nx">camera</span><span class="p">.</span><span class="nx">getPicture</span><span class="p">(</span><span class="nx">uploadPhoto</span><span class="p">,</span> <span class="kd">function</span><span class="p">(</span><span class="nx">message</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC19'>			<span class="nx">alert</span><span class="p">(</span><span class="s1">&#39;get picture failed&#39;</span><span class="p">);</span></div><div class='line' id='LC20'>		<span class="p">},{</span></div><div class='line' id='LC21'>			<span class="nx">quality</span><span class="o">:</span> <span class="mi">50</span><span class="p">,</span> </div><div class='line' id='LC22'>			<span class="nx">destinationType</span><span class="o">:</span> <span class="nx">navigator</span><span class="p">.</span><span class="nx">camera</span><span class="p">.</span><span class="nx">DestinationType</span><span class="p">.</span><span class="nx">FILE_URI</span><span class="p">,</span></div><div class='line' id='LC23'>			<span class="nx">sourceType</span><span class="o">:</span> <span class="nx">navigator</span><span class="p">.</span><span class="nx">camera</span><span class="p">.</span><span class="nx">PictureSourceType</span><span class="p">.</span><span class="nx">PHOTOLIBRARY</span></div><div class='line' id='LC24'>		<span class="p">}</span></div><div class='line' id='LC25'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">);</span></div><div class='line' id='LC26'>&nbsp;</div><div class='line' id='LC27'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC28'>&nbsp;</div><div class='line' id='LC29'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="kd">function</span> <span class="nx">uploadPhoto</span><span class="p">(</span><span class="nx">imageURI</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC30'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="kd">var</span> <span class="nx">options</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">FileUploadOptions</span><span class="p">();</span></div><div class='line' id='LC31'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">options</span><span class="p">.</span><span class="nx">fileKey</span><span class="o">=</span><span class="s2">&quot;file&quot;</span><span class="p">;</span></div><div class='line' id='LC32'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">options</span><span class="p">.</span><span class="nx">fileName</span><span class="o">=</span><span class="nx">imageURI</span><span class="p">.</span><span class="nx">substr</span><span class="p">(</span><span class="nx">imageURI</span><span class="p">.</span><span class="nx">lastIndexOf</span><span class="p">(</span><span class="s1">&#39;/&#39;</span><span class="p">)</span><span class="o">+</span><span class="mi">1</span><span class="p">);</span></div><div class='line' id='LC33'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">options</span><span class="p">.</span><span class="nx">mimeType</span><span class="o">=</span><span class="s2">&quot;image/jpeg&quot;</span><span class="p">;</span></div><div class='line' id='LC34'>&nbsp;</div><div class='line' id='LC35'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="kd">var</span> <span class="nx">params</span> <span class="o">=</span> <span class="k">new</span> <span class="nb">Object</span><span class="p">();</span></div><div class='line' id='LC36'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">params</span><span class="p">.</span><span class="nx">value1</span> <span class="o">=</span> <span class="s2">&quot;test&quot;</span><span class="p">;</span></div><div class='line' id='LC37'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">params</span><span class="p">.</span><span class="nx">value2</span> <span class="o">=</span> <span class="s2">&quot;param&quot;</span><span class="p">;</span></div><div class='line' id='LC38'>&nbsp;</div><div class='line' id='LC39'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">options</span><span class="p">.</span><span class="nx">params</span> <span class="o">=</span> <span class="nx">params</span><span class="p">;</span></div><div class='line' id='LC40'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">options</span><span class="p">.</span><span class="nx">chunkedMode</span> <span class="o">=</span> <span class="kc">false</span><span class="p">;</span></div><div class='line' id='LC41'>&nbsp;</div><div class='line' id='LC42'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="kd">var</span> <span class="nx">ft</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">FileTransfer</span><span class="p">();</span></div><div class='line' id='LC43'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">ft</span><span class="p">.</span><span class="nx">upload</span><span class="p">(</span><span class="nx">imageURI</span><span class="p">,</span> <span class="s2">&quot;http://yourdomain.com/upload.php&quot;</span><span class="p">,</span> <span class="nx">win</span><span class="p">,</span> <span class="nx">fail</span><span class="p">,</span> <span class="nx">options</span><span class="p">);</span></div><div class='line' id='LC44'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC45'>&nbsp;</div><div class='line' id='LC46'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="kd">function</span> <span class="nx">win</span><span class="p">(</span><span class="nx">r</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC47'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Code = &quot;</span> <span class="o">+</span> <span class="nx">r</span><span class="p">.</span><span class="nx">responseCode</span><span class="p">);</span></div><div class='line' id='LC48'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Response = &quot;</span> <span class="o">+</span> <span class="nx">r</span><span class="p">.</span><span class="nx">response</span><span class="p">);</span></div><div class='line' id='LC49'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Sent = &quot;</span> <span class="o">+</span> <span class="nx">r</span><span class="p">.</span><span class="nx">bytesSent</span><span class="p">);</span></div><div class='line' id='LC50'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">alert</span><span class="p">(</span><span class="nx">r</span><span class="p">.</span><span class="nx">response</span><span class="p">);</span></div><div class='line' id='LC51'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC52'>&nbsp;</div><div class='line' id='LC53'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="kd">function</span> <span class="nx">fail</span><span class="p">(</span><span class="nx">error</span><span class="p">)</span> <span class="p">{</span></div><div class='line' id='LC54'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nx">alert</span><span class="p">(</span><span class="s2">&quot;An error has occurred: Code = &quot;</span> <span class="o">=</span> <span class="nx">error</span><span class="p">.</span><span class="nx">code</span><span class="p">);</span></div><div class='line' id='LC55'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="p">}</span></div><div class='line' id='LC56'>&nbsp;</div><div class='line' id='LC57'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="nt">&lt;/script&gt;</span></div><div class='line' id='LC58'><span class="nt">&lt;/head&gt;</span></div><div class='line' id='LC59'><span class="nt">&lt;body&gt;</span></div><div class='line' id='LC60'>&nbsp;&nbsp;&nbsp;&nbsp;<span class="nt">&lt;button</span> <span class="na">onclick=</span><span class="s">&quot;getImage();&quot;</span><span class="nt">&gt;</span>Upload a Photo<span class="nt">&lt;/button&gt;</span></div><div class='line' id='LC61'><span class="nt">&lt;/body&gt;</span></div><div class='line' id='LC62'><span class="nt">&lt;/html&gt;</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1913580/b6cb854730dc757f44dda7640c476af0f31b3f0a/phonegap_filetransfer_object.html" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1913580#file_phonegap_filetransfer_object.html" style="float:right;margin-right:10px;color:#666">phonegap_filetransfer_object.html</a>
            <a href="https://gist.github.com/1913580">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>
<br />
As you can see, the code above allows you to browse for a photo in the device&#8217;s photo library using the function <code>getImage()</code>. Once a photo is chosen, it gets POSTed as multi-part data to the server. You will notice that you can include some test parameters in the upload data which will be POSTed to your server as well, but these are optional. One very important piece of information discovered by other PhoneGap developers (thank you Ryan and Jeff) is that this script doesn&#8217;t work until you add &#8220;options.chunkedMode = false;&#8221; to the code. If you don&#8217;t append this line of code, data won&#8217;t be readable by your PHP server.</p>
<h2>The PHP</h2>
<p>Now that you are able to find a file and upload it to a server, you&#8217;ll need a server side script to handle the data. Here is a very basic PHP example on handling the multi-part form data (image) that was just sent from the device.<br />
<div id="gist-1921651" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="cp">&lt;?php</span></div><div class='line' id='LC2'><span class="nb">print_r</span><span class="p">(</span><span class="nv">$_FILES</span><span class="p">);</span></div><div class='line' id='LC3'><span class="nv">$new_image_name</span> <span class="o">=</span> <span class="s2">&quot;namethisimage.jpg&quot;</span><span class="p">;</span></div><div class='line' id='LC4'><span class="nb">move_uploaded_file</span><span class="p">(</span><span class="nv">$_FILES</span><span class="p">[</span><span class="s2">&quot;file&quot;</span><span class="p">][</span><span class="s2">&quot;tmp_name&quot;</span><span class="p">],</span> <span class="s2">&quot;/srv/www/upload/&quot;</span><span class="o">.</span><span class="nv">$new_image_name</span><span class="p">);</span></div><div class='line' id='LC5'><span class="cp">?&gt;</span><span class="x"></span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1921651/e951845d12baa3a7dff8f8c5968badf01a0b9104/example_php_upload.php" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1921651#file_example_php_upload.php" style="float:right;margin-right:10px;color:#666">example_php_upload.php</a>
            <a href="https://gist.github.com/1921651">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>
<br />
The above code uses PHP&#8217;s <code><a href="http://php.net/manual/en/function.move-uploaded-file.php" target="_blank">move_uploaded_file()</a></code> to move the uploaded file from a temporary location to a new directory. To make sure it works, change &#8220;/srv/www/upload/&#8221; to a directory on your server. I usually have to pass an absolute file-path as the second variable in the <code>move_uploaded_file()</code> for it to work. You can learn more about PHP uploads in a <a href="http://zacvineyard.com/blog/2010/03/15/a-better-php-upload-and-rename-script/">previous post of mine</a>.</p>
<h2>Source</h2>
<p>If you are developing on an Android device, you can download an example Eclipse project, with PhoneGap 1.5.0, below.<br />
<a href="http://goo.gl/Dv6J9">Download the Eclipse Project</a></p>
]]></content:encoded>
			<wfw:commentRss>http://zacvineyard.com/blog/2011/03/25/upload-a-file-to-a-remote-server-with-phonegap/feed/</wfw:commentRss>
		<slash:comments>96</slash:comments>
		</item>
		<item>
		<title>Responsive Web Design at nnu.edu</title>
		<link>http://zacvineyard.com/blog/2011/03/15/responsive-web-design-at-nnu-edu/</link>
		<comments>http://zacvineyard.com/blog/2011/03/15/responsive-web-design-at-nnu-edu/#comments</comments>
		<pubDate>Wed, 16 Mar 2011 03:33:43 +0000</pubDate>
		<dc:creator>Zac</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[UX]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[media queries]]></category>
		<category><![CDATA[responsive]]></category>

		<guid isPermaLink="false">http://zacvineyard.com/blog/?p=437</guid>
		<description><![CDATA[With a variety of resources in tow, I've been able to quickly release the first chunk of CSS behind a media query on nnu.edu. This process was mostly pain free, fast, and fun; but it came with a few problems to solve, three of which I'd like to quickly overview for web developers who may face similar challenges. ]]></description>
			<content:encoded><![CDATA[<p><img src="http://zacvineyard.com/blog/wp-content/uploads/2011/03/droid_incredible_small.jpg" alt="" title="droid_incredible_small" width="300" height="300" class="alignright size-full wp-image-481" /><br />
Responsive web design is not a new subject, and I believe this quote from <a href="http://ethanmarcotte.com">Ethan Marcotte</a> is gold:</p>
<blockquote><p>Rather than tailoring disconnected designs to each of an ever-increasing number of web devices, we can treat them as facets of the same experience.<sup>1</sup></p></blockquote>
<p>With a variety of resources in tow, I&#8217;ve been able to quickly release the first chunk of CSS behind a media query on <a title="Northwest Nazarene University" href="http://www.nnu.edu">nnu.edu</a>. This process was mostly pain free, fast, and fun; but it came with a few problems to solve, three of which I&#8217;d like to quickly overview for web developers who may face similar challenges. The things I mention below are really for your &#8220;tips &amp; tricks&#8221; toolbox.</p>
<h2>Positioning</h2>
<p>If you are working with a site that doesn&#8217;t have a fluid layout, you will be faced with a positioning problem. A few things to remember when making your static layouts responsive are:</p>
<ul>
<li>Set all wrapper tags to width:100%</li>
<li>You can use the <code>!important</code> tag in CSS to override inline style attributes</li>
<li>Clear content areas accordingly</li>
</ul>
<p>The main goal when making your site responsive, with exception of designs for tablet PCs, is to package all your data into a single column layout, which is representative of the standard smartphone screen.</p>
<h2>Image Resizing</h2>
<p>When I added responsive code to nnu.edu, I wanted images to resize without the use of Javascript. To do this, I set the image size to an EM unit instead of a screen width percentage. This would ensure that my images would change size in relation to text size instead of screen size (zoom). This is a good fix for developers looking to lower their code footprint. Here is a code example:</p>
<blockquote><p><code>div.csc-textpic-single-image {<br />
max-width:100%;<br />
width:12em;<br />
}</code></p></blockquote>
<h2>Scope</h2>
<p>Inevitably you will have to make a choice on what stays in your responsive page content and what goes. If you&#8217;re working on a large website (as I am for NNU), try to keep your pool of content similar from page to page. More custom content leads to more CSS. Brevity is king, so don&#8217;t be afraid to whip out <code>display:none</code> on more than one HTML tag.</p>
<h2>Examples</h2>
<p>Not all of nnu.edu is currently mobile enabled. I&#8217;m currently in the process of rolling all the site&#8217;s pages into new templates. These templates come with the shiny new CSS3 I talked about above. You can see examples of mobile-enables pages at:</p>
<ul>
<li><a href="http://nnu.edu">nnu.edu</a></li>
<li><a href="http://nnu.edu/financialaid">nnu.edu/financialaid</a></li>
<li><a href="http://nnu.edu/religion">nnu.edu/religion</a></li>
<li><a href="http://nnu.edu/gtoe">nnu.edu/gtoe</a></li>
<li><a href="http://nnu.edu/math">nnu.edu/math</a></li>
</ul>
<p><small>1. Responsive Web Design, Ethan Marcotte. <em>A List Apart</em>, May 25, 2010. http://www.alistapart.com/articles/responsive-web-design/</small></p>
]]></content:encoded>
			<wfw:commentRss>http://zacvineyard.com/blog/2011/03/15/responsive-web-design-at-nnu-edu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Working with Google&#8217;s Cr-48 Chrome Notebook: Proof of the Cloud Concept</title>
		<link>http://zacvineyard.com/blog/2011/02/17/working-with-googles-cr-48-chrome-notebook-proof-of-the-cloud-concept/</link>
		<comments>http://zacvineyard.com/blog/2011/02/17/working-with-googles-cr-48-chrome-notebook-proof-of-the-cloud-concept/#comments</comments>
		<pubDate>Fri, 18 Feb 2011 02:36:38 +0000</pubDate>
		<dc:creator>Zac</dc:creator>
				<category><![CDATA[Chrome Cr-48]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[Cr-48]]></category>
		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://zacvineyard.com/blog/?p=402</guid>
		<description><![CDATA[I want to start talking about the Cr-48 with a review, but unlike a huge number of other bloggers and writers who spend time talking about the hardware, I want to talk about proof of the cloud concept. The primary reason, after all, that I received this notebook from Google is to prove whether or not I (or anyone else) can successfully live in the cloud; not to see isf the machine could be cracked open and loaded with Ubuntu.]]></description>
			<content:encoded><![CDATA[<p><img src="http://zacvineyard.com/blog/wp-content/uploads/2011/02/Cr-48-Laptop-con-Chrome-OS.jpg" alt="" title="Cr-48-Laptop-con-Chrome-OS" width="630" height="300" class="aligncenter size-full wp-image-477" /></p>
<p>I want to start talking about the Cr-48 with a review, but unlike a huge number of other bloggers and writers who spend time talking about the hardware, I want to talk about proof of the cloud concept. The primary reason, after all, that I received this notebook from Google is to prove whether or not I (or anyone else) can successfully live in the cloud; not to see if the machine could be cracked open and loaded with Ubuntu. So, for now, I am going to avoid the tempting developer switch on this machine and pretend that I&#8217;m not the go-for-broke nerd others expect me to personify while holding a shiny new notebook.</p>
<h2>The Problem of Minimalism</h2>
<p>The Cr-48 epitomizes minimalism. As a concept, a lifestyle, minimalism is attractive. And the Cr-48&#8242;s appearance is just the sleek cover to a magnificent core of simple software. Other than a limited terminal interface, the user is only presented with a browser. And if you dream in the cloud, then nothing beyond the browser will be required for Chrome OS to survive—and I belive it will. But the world isn&#8217;t ready yet. As a PHP developer, I need to be able to remotely access servers, FTP files to any location, write code, and Skype with my co-workers. These are all essential functions of my work. My question is, knowing full-well that we may all be working on cloud-centric software someday, how do we build the internet on the machine that uses it so well?</p>
<h2>Software Development</h2>
<p>I&#8217;m convinced that with the right tools, I could live on Chrome OS forever. Chrome is fast and jaw-droppingly simple. There just ins&#8217;t enough web based software ready to meet the needs of most users. Yes, Google Docs is awesome and useful, but what about video editing, graphically intense gaming, mobile phone development, and peripheral device connections? It may be a great time to be a web developer.</p>
<h2>The Rain Cloud</h2>
<p>Working with the Cr-48 is a bit like trying to use a computer with one hand. But because of 3G, that hand can always be online. For most users, being comfortable with cloud computing will take a while. This minimalism, I predict, combined with speed and connectivity will ratify our entire computing experience. This is why I think the Cr-48 project is an essential component of future computing. Perhaps we are the Xerox PARC to the future Steve Jobs we lovingly call the world wide web.</p>
]]></content:encoded>
			<wfw:commentRss>http://zacvineyard.com/blog/2011/02/17/working-with-googles-cr-48-chrome-notebook-proof-of-the-cloud-concept/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to Add a www Resolve to Apache for Better SEO</title>
		<link>http://zacvineyard.com/blog/2010/10/19/how-to-add-a-www-resolve-to-apache-for-better-seo/</link>
		<comments>http://zacvineyard.com/blog/2010/10/19/how-to-add-a-www-resolve-to-apache-for-better-seo/#comments</comments>
		<pubDate>Wed, 20 Oct 2010 04:58:22 +0000</pubDate>
		<dc:creator>Zac</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Apache www resolve SEO .htaccess]]></category>

		<guid isPermaLink="false">http://zacvineyard.com/blog/?p=369</guid>
		<description><![CDATA[There is a simple way to resolve your site URLs to include the www in each address. Or drop the www from each address. Why is this important? "Redirecting requests from a non-preferred hostname is important because search engines consider URLs with and without "www" as two different websites" (woorank.com). So, if you don't resolve your www, you are harming your SEO performance.]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-thumbnail wp-image-391" title="InfoIcon" src="http://zacvineyard.com/blog/wp-content/uploads/2010/10/InfoIcon-150x150.png" alt="" width="150" height="150" />There is a simple way to resolve your site URLs to include the www in each address. Or drop the www from each address. Why is this important? &#8220;Redirecting requests from a non-preferred hostname is important because search engines consider URLs with and without &#8220;www&#8221; as two different websites&#8221; (woorank.com). So, if you don&#8217;t resolve your www, you are harming your SEO performance.</p>
<p>Here are the three lines of code you can to a .htaccess file to resolve your www to include the www.</p>
<p>Make sure to place the .htaccess file you build in the root directory of your web site.</p>
<p><code>RewriteEngine on<br />
RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]<br />
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]</code></p>
<p>Here are the three lines of code to use if you want to drop the www.</p>
<p><code>RewriteEngine on<br />
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]<br />
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]</code></p>
<p>Make sure you replace &#8220;example.com&#8221; with your own domain in the sample code.</p>
]]></content:encoded>
			<wfw:commentRss>http://zacvineyard.com/blog/2010/10/19/how-to-add-a-www-resolve-to-apache-for-better-seo/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

