<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Never Say Never</title>
	<atom:link href="http://jensendarren.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://jensendarren.wordpress.com</link>
	<description>&#34;There&#039;s always a way&#34;</description>
	<lastBuildDate>Mon, 28 Feb 2011 02:08:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='jensendarren.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Never Say Never</title>
		<link>http://jensendarren.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://jensendarren.wordpress.com/osd.xml" title="Never Say Never" />
	<atom:link rel='hub' href='http://jensendarren.wordpress.com/?pushpress=hub'/>
		<item>
		<title>A New Blog is born: Tweetegy</title>
		<link>http://jensendarren.wordpress.com/2011/02/24/a-new-blog-is-born-tweetegy/</link>
		<comments>http://jensendarren.wordpress.com/2011/02/24/a-new-blog-is-born-tweetegy/#comments</comments>
		<pubDate>Thu, 24 Feb 2011 03:13:12 +0000</pubDate>
		<dc:creator>jensendarren</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jensendarren.wordpress.com/?p=255</guid>
		<description><![CDATA[Please note that I am no longer updating &#8220;Never Say Never&#8221; blog here on WordPress.com. Instead, I have launched a new blog which I am hosting myself. Welcome to Tweetegy! The blog is called &#8220;Tweetegy&#8221; and can be found at the above link.This new blog basically continues where this one left off! Enjoy.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jensendarren.wordpress.com&amp;blog=8454922&amp;post=255&amp;subd=jensendarren&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>Please note that I am no longer updating &#8220;Never Say Never&#8221; blog here on WordPress.com. Instead, I have launched a new blog which I am hosting myself. </h2>
<h2><a href='http://www.tweetegy.com/'>Welcome to Tweetegy!</a></h2>
<h3>The blog is called &#8220;Tweetegy&#8221; and can be found at the above link.This new blog basically continues where this one left off! Enjoy.</h3><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jensendarren.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jensendarren.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jensendarren.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jensendarren.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jensendarren.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jensendarren.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jensendarren.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jensendarren.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jensendarren.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jensendarren.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jensendarren.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jensendarren.wordpress.com/255/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jensendarren.wordpress.com/255/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jensendarren.wordpress.com/255/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jensendarren.wordpress.com&amp;blog=8454922&amp;post=255&amp;subd=jensendarren&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jensendarren.wordpress.com/2011/02/24/a-new-blog-is-born-tweetegy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d12a93274f2a88831aefe517eeab6ab0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jensendarren</media:title>
		</media:content>
	</item>
		<item>
		<title>Never Say Never: One Year On!</title>
		<link>http://jensendarren.wordpress.com/2010/07/31/never-say-never-one-year-on/</link>
		<comments>http://jensendarren.wordpress.com/2010/07/31/never-say-never-one-year-on/#comments</comments>
		<pubDate>Sat, 31 Jul 2010 05:34:06 +0000</pubDate>
		<dc:creator>jensendarren</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[freetime]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[writing]]></category>

		<guid isPermaLink="false">http://jensendarren.wordpress.com/?p=245</guid>
		<description><![CDATA[It has been a year since I started this blog. It was really a test for myself to see if I can post regularly (at least once a month) to my own, personal blog. I think the experiment has been a success! Not only have I achieved this posting frequency but I am actually generating [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jensendarren.wordpress.com&amp;blog=8454922&amp;post=245&amp;subd=jensendarren&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>It has been a year since I started this blog. It was really a test for myself to see if I can post regularly (at least once a month) to my own, personal blog. I think the experiment has been a success! Not only have I achieved this posting frequency but I am actually generating a modicum of traffic flow to this blog (about 30 visits per day). OK, that is not too high but I have plans for the future now anyway! </p>
<p>What I am going to do is move this blog to a dedicated host (I&#8217;ll probably use <a href='http://www.slicehost.com/'>Slicehost&#8217;s 256 Slice</a>) and I&#8217;ll probably re-launch under a new name (not sure yet what to call the new blog). </p>
<p>Anyway, my new plan is to post at least once a week and try and achieve a traffic flow of 100+ unique visits per day (for starters). I hope to blog about anything that I am currently working on or am interested in. So this would include a mixture of programming (Linux/Ubuntu, Rails, Ruby, Flex, JavaScript, RDF, MySql, NoSql, Graph Databases), business ventures that I am involved in (<a href='http://www.yoolk.com'>Yoolk</a>, <a href='http://www.mangomap.com'>MangoMap</a>, <a href='http://www.upstarthq.com'>Upstart</a> and <a href='http://www.adflickr.com/'>AdFlickr</a>) and personal activities (Piano, Mountain Biking, Eating Out and Reading).</p>
<p>Next month, I&#8217;ll post to this blog for the last time, which will probably be an announcement of the launch of my new blog.</p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jensendarren.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jensendarren.wordpress.com/245/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jensendarren.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jensendarren.wordpress.com/245/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jensendarren.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jensendarren.wordpress.com/245/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jensendarren.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jensendarren.wordpress.com/245/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jensendarren.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jensendarren.wordpress.com/245/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jensendarren.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jensendarren.wordpress.com/245/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jensendarren.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jensendarren.wordpress.com/245/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jensendarren.wordpress.com&amp;blog=8454922&amp;post=245&amp;subd=jensendarren&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jensendarren.wordpress.com/2010/07/31/never-say-never-one-year-on/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d12a93274f2a88831aefe517eeab6ab0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jensendarren</media:title>
		</media:content>
	</item>
		<item>
		<title>Using Google Analytics API in a Ruby on Rails project</title>
		<link>http://jensendarren.wordpress.com/2010/06/17/using-google-analytics-api-in-a-ruby-on-rails-project/</link>
		<comments>http://jensendarren.wordpress.com/2010/06/17/using-google-analytics-api-in-a-ruby-on-rails-project/#comments</comments>
		<pubDate>Thu, 17 Jun 2010 02:52:31 +0000</pubDate>
		<dc:creator>jensendarren</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[google analytics api]]></category>
		<category><![CDATA[metrics]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://jensendarren.wordpress.com/?p=225</guid>
		<description><![CDATA[Ingredients A new Rails project The Garb gem A Google Analytics Account Preparation I assume you know about Rails already&#8230;.Garb can be installed as follows: gem install garb Go to your Google Analytics account and fetch the Account Id and Profile Id that your interested in. You will find your Account Id on your account [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jensendarren.wordpress.com&amp;blog=8454922&amp;post=225&amp;subd=jensendarren&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h3>Ingredients</h3>
<ul>
<li>A new Rails project
<li><a href="http://github.com/vigetlabs/garb/">The Garb gem</a>
<li>A Google Analytics Account
</ul>
<h3>Preparation</h3>
<p>I assume you know about Rails already&#8230;.Garb can be installed as follows:</p>
<pre class="brush: bash;">
gem install garb
</pre>
<p>Go to your Google Analytics account and fetch the <b>Account Id</b> and <b>Profile Id</b> that your interested in. You will find your Account Id on your account home page under the link &#8220;Edit account settings&#8221;, it is the number after the &#8220;UA-&#8221;. You will find your Profile Id, by going back to your account home page, finding the profile in the table, then click the &#8220;Edit&#8221; link in that row&#8230;.the Profile Id is at the top of this page&#8230;.phew!</p>
<p>If you are not familiar with the Google Analytics API, then you will find the <a href="http://code.google.com/apis/analytics/docs/gdata/gdataExplorer.html">Data Feed Query Explorer</a> tool useful.</p>
<h3>The Task: Record and display Unique Pageviews from a set list of pages</h3>
<p>Now for the fun part! Lets build something that records Unique Page Views from a list of pages in a local database. We need to create a model to store these pages and the unique pageviews. Change into your rails project directory and run the following scaffold script:</p>
<pre class="brush: bash;">
script/generate scaffold page url:string unique_pageviews:integer
</pre>
<p>Open up the pages controller that was just generated and add the following method, which sets the class instance variable @profile to an instance of your Google Analytics profile based on the Account Id and Profile Id. </p>
<pre class="brush: ruby;">
 def get_analytics_profile
    Garb::Session.login(your_google_analytics_username,your_google_analytics_password)
    accounts = Garb::Account.all
    #Loop all Accounts for account_id
    accounts.each do |account|
      if account.id == your_google_analytics_account_id
        #Loop all Profiles for profile_id
        account.profiles.each do |profile|
         if profile.id == your_google_analytics_profile_id
           @profile = profile
           break
         end
       end
      end
    end
  end
</pre>
<p>Basically, Garb::Session.login is called passing your username and password to authenticate the session. Next we fetch all accounts and iterate the array until we find the account that matches your Account Id. Then we need to iterate all the profiles within that account until we find the profile that matches your Profile Id.</p>
<p>Now add this method which will update all the unique pageviews in your list of pages:</p>
<pre class="brush: ruby;">
def update_all
    @pages = Page.all
    @pages.each do |page|
        get_analytics_profile if !@profile
        report = Garb::Report.new(@profile)
        report.metrics :unique_pageviews
        report.dimensions :page_path
        report.filters :page_path.contains =&gt; page.url
        page.unique_pageviews = report.results.first.unique_pageviews
        page.save
      end
    end
  end
</pre>
<p>Since you have used a scaffold to create this controller, there should already be an index method present. Add a call to the <i>update_all</i> method at the top of the index method so that everytime the index method is called the <i>update_all</i> method is called. Here is how your index method should look:</p>
<pre class="brush: ruby;">
 def index
    update_all
    @pages = Page.all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render : xml =&gt; @pages }
    end
  end
</pre>
<h3>Final Touches</h3>
<p>Now all that remains is a little configuration, add some fixtures and we&#8217;re done! You should already have fixtures for your page model. Note that the url does not need to include the domain name, so <b>/pricing/</b> or <b>/sign-up/</b> are the sorts of values you should put here (obviously ones that exist in your Analytics profile!). The configuration is simply to add: </p>
<pre class="brush: ruby;">config.gem &quot;garb&quot;</pre>
<p>in the appropriate place of your environment.rb file.</p>
<h3>Get those metrics!</h3>
<p>Now fire up your rails app and navigate to the index for your pages <a href="http://localhost:3000/pages/" rel="nofollow">http://localhost:3000/pages/</a>. The call to <b>update_all</b> will be made which will update your local database with the metrics and then render the data in the browser in the usual Rails table format.</p>
<h3>Conclusion</h3>
<p>Using the <a href="http://github.com/vigetlabs/garb/">Garb gem</a> makes it extremely easy to work with the Google Analytics API in a Rails project. Obviously this example application can be improved to include caching, error handling (it will bomb out if the Id&#8217;s or urls are not found in your Analytics account) as well as other improvements that you might want to make.</p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jensendarren.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jensendarren.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jensendarren.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jensendarren.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jensendarren.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jensendarren.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jensendarren.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jensendarren.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jensendarren.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jensendarren.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jensendarren.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jensendarren.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jensendarren.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jensendarren.wordpress.com/225/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jensendarren.wordpress.com&amp;blog=8454922&amp;post=225&amp;subd=jensendarren&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jensendarren.wordpress.com/2010/06/17/using-google-analytics-api-in-a-ruby-on-rails-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d12a93274f2a88831aefe517eeab6ab0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jensendarren</media:title>
		</media:content>
	</item>
		<item>
		<title>Hudson setup to execute scripts with root privileges (safely)</title>
		<link>http://jensendarren.wordpress.com/2010/05/14/hudson-setup-to-execute-scripts-with-root-privileges-safely/</link>
		<comments>http://jensendarren.wordpress.com/2010/05/14/hudson-setup-to-execute-scripts-with-root-privileges-safely/#comments</comments>
		<pubDate>Fri, 14 May 2010 13:30:17 +0000</pubDate>
		<dc:creator>jensendarren</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[hudson]]></category>
		<category><![CDATA[linux. root]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[sudoers]]></category>

		<guid isPermaLink="false">http://jensendarren.wordpress.com/?p=204</guid>
		<description><![CDATA[There is a lot out there on the web about how to setup and install Hudson. In fact that process is very easy so I will just provide a script to explain that (see the end of this post). What I found to be an interesting challenge is getting Hudson to execute my scripts with [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jensendarren.wordpress.com&amp;blog=8454922&amp;post=204&amp;subd=jensendarren&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>There is a lot out there on the web about how to setup and install <a href="http://hudson-ci.org/">Hudson</a>. In fact that process is very easy so I will just provide a script to explain that (see the end of this post). What I found to be an interesting challenge is getting Hudson to execute my scripts with root privileges&#8230;</p>
<p>The first time I execute the script (without sudo), my job fails and I am informed that the user hudson does not have permission to execute apt-get. So naturally, I prefix the script with sudo and my job fails again, this time with an incorrect password. So how to get Hudson to execute my script with root privileges?. After a lot of searching I managed to <a title="Blog Flex" href="http://fbflex.wordpress.com/2008/05/02/howto-setting-up-a-continous-integration-server-for-grails-with-hudson-on-vmware/" target="_self">find one blog post</a> which mentions adding the user (in my case user hudson) to the sudoers file and giving the user full access without being promted for a password. Using visudo, I added this line to my sudoers file:</p>
<pre class="brush: bash;">
hudson  ALL=(ALL) NOPASSWD:ALL
</pre>
<p>However, I was most concerned about giving hudson the rights to do what it wanted without requiring a password as this leaves an obvious security hole. So I <a title="Serverfault Question Husdon Root" href="http://serverfault.com/questions/141439/execute-build-task-in-hudson-with-root-privilages" target="_self">posted my concern on ServerFault.com</a> and fortunately I was informed that it is possible to lock down the commands and the parameters that can be used by a user without requiring a password. So I changed my entry in sudoers file to this:</p>
<pre class="brush: bash;">
hudson  ALL=(ALL) NOPASSWD:/var/scripts/the-script-I-want-to-run.bash
</pre>
<p>Now all hudson can do (without being prompted for a password) is to execute sudo /var/scripts/the-script-I-want-to-run.bash. This makes be feel safe and my build works a treat each and every time too! I thought I would share this since I could not find a clear solution to this issue.</p>
<p>By the way, if you want to install hudson on your linux server, here is the script I prepared earlier!</p>
<pre class="brush: bash;">
#Install Hudson
#NOTE: You MUST manually add hudson user to the sudoers account using visudo,
#specifying all the scripts that you want hudson to be able to run without requiring a root password, for example:
#hudson  ALL=(ALL) NOPASSWD:/var/scripts/the-script-I-want-to-run.bash
wget -O - http:// hudson-ci.org/debian/hudson-ci.org.key | sudo apt-key add -
if ! grep -q &quot;http:// hudson-ci.org/debian binary/&quot; /etc/apt/sources.list ; then
    echo &quot;deb http:// hudson-ci.org/debian binary/&quot; &gt;&gt; /etc/apt/sources.list
fi
#NOTE: On a fresh install, you will have to run this script twice since the first time the script will not know about sources.list update
apt-get install hudson
#Install Hudson Plugins
if test ! -f /var/lib/hudson/plugins/mercurial.hpi ; then
    wget -P /var/lib/hudson/plugins http:// hudson-ci.org/download/plugins/mercurial/1.28/mercurial.hpi
    chown hudson:nogroup /var/lib/hudson/plugins/mercurial.hpi
fi
</pre>
<p>Additionally, if you want Hudson to be accessible at <a href="http://hudson.yourserver.com" rel="nofollow">http://hudson.yourserver.com</a> while keeping Hudson running on port 8080 and you are running Apache then run the following script!</p>
<pre class="brush: bash;">
SITE_CONFIG_PATH=&quot;/etc/apache2/sites-available/default&quot;

if ! grep -q &quot;ServerName hudson.yourserver.com&quot; $SITE_CONFIG_PATH
then
	echo &quot;Configuring...&quot;
	echo &quot;&quot; &gt;&gt; $SITE_CONFIG_PATH
	echo &quot;# Hudson virtual host&quot; &gt;&gt; $SITE_CONFIG_PATH
	echo &quot;&lt;VirtualHost *:80&gt;&quot; &gt;&gt; $SITE_CONFIG_PATH
	echo &quot;  ServerName hudson.yourserver.com&quot; &gt;&gt; $SITE_CONFIG_PATH
	echo &quot;  ProxyPass / http:// localhost:8080/&quot; &gt;&gt; $SITE_CONFIG_PATH
	echo &quot;  ProxyPassReverse / http:// localhost:8080/&quot; &gt;&gt; $SITE_CONFIG_PATH
	echo &quot;  ProxyPreserveHost on&quot; &gt;&gt; $SITE_CONFIG_PATH
	echo &quot;  &lt;Proxy *&gt;&quot; &gt;&gt; $SITE_CONFIG_PATH
	echo &quot;   allow from all&quot; &gt;&gt; $SITE_CONFIG_PATH
	echo &quot;  &lt;/Proxy&gt;&quot; &gt;&gt; $SITE_CONFIG_PATH
	echo &quot;&lt;/VirtualHost&gt;&quot; &gt;&gt; $SITE_CONFIG_PATH

	#Create symlink to proxy module
	ln -s ../mods-available/proxy.load /etc/apache2/mods-enabled/proxy.load
	ln -s ../mods-available/proxy.conf /etc/apache2/mods-enabled/proxy.conf
	ln -s ../mods-available/proxy_http.load /etc/apache2/mods-enabled/proxy_http.load

	echo &quot;Restarting apache&quot;

	#Restart Apache
	/etc/init.d/apache2 restart
else
	echo &quot;Already configured!&quot;
fi
</pre><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jensendarren.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jensendarren.wordpress.com/204/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jensendarren.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jensendarren.wordpress.com/204/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jensendarren.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jensendarren.wordpress.com/204/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jensendarren.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jensendarren.wordpress.com/204/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jensendarren.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jensendarren.wordpress.com/204/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jensendarren.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jensendarren.wordpress.com/204/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jensendarren.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jensendarren.wordpress.com/204/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jensendarren.wordpress.com&amp;blog=8454922&amp;post=204&amp;subd=jensendarren&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jensendarren.wordpress.com/2010/05/14/hudson-setup-to-execute-scripts-with-root-privileges-safely/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d12a93274f2a88831aefe517eeab6ab0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jensendarren</media:title>
		</media:content>
	</item>
		<item>
		<title>How to return content from an application running on a specific port in apache</title>
		<link>http://jensendarren.wordpress.com/2010/05/14/how-to-return-content-from-an-hidden-application-running-on-a-specific-port-in-apache/</link>
		<comments>http://jensendarren.wordpress.com/2010/05/14/how-to-return-content-from-an-hidden-application-running-on-a-specific-port-in-apache/#comments</comments>
		<pubDate>Fri, 14 May 2010 13:25:36 +0000</pubDate>
		<dc:creator>jensendarren</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://jensendarren.wordpress.com/?p=193</guid>
		<description><![CDATA[Continuing on from the previous post where I explain how to show content from a different root folder depending on the sub domain e.g. http://foo.example.com will actually return content from http://example.com/foo (without changing the URL). Today I will extend this idea to show content from a separate service running on a different port within the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jensendarren.wordpress.com&amp;blog=8454922&amp;post=193&amp;subd=jensendarren&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Continuing on from the <a href="http://http://jensendarren.wordpress.com/2010/04/14/how-to-subdomain-redirect-using-apache-virtual-host/">previous post</a> where I explain how to show content from a different root folder depending on the sub domain e.g. <a href="http://foo.example.com" rel="nofollow">http://foo.example.com</a> will actually return content from <a href="http://example.com/foo" rel="nofollow">http://example.com/foo</a> (without changing the URL). Today I will extend this idea to show content from a separate service running on a different port within the same server. So in this case a call to <a href="http://foo.example.com" rel="nofollow">http://foo.example.com</a> returns <a href="http://example.com:port." rel="nofollow">http://example.com:port.</a></p>
<p>As in the previous post, we assume that you already have your sub domain DNS settings correctly configured and the subdomain now points to the IP address of your server, you should do the following in Apache running on an Ubuntu server.</p>
<p>Open the configuration file for your site. In this example, we will use the default site.</p>
<pre class="brush: bash;">
nano /etc/apache2/sites-available/default
</pre>
<p>Add the following additional VirtualHost configuration to the end of the file (change the port number on localhost if you need to, of course!)</p>
<pre class="brush: xml;">
&lt;VirtualHost *:80&gt;
  ServerName foo.example.com
  ProxyPass / http:// localhost:3000/
  ProxyPassReverse / http:// localhost:3000/
  ProxyPreserveHost on
  &lt;Proxy *&gt;
   allow from all
  &lt;/Proxy&gt;
&lt;/VirtualHost&gt;
</pre>
<p>Now restart apache and your all done!</p>
<pre class="brush: bash;">
 /etc/init.d/apache2 restart
</pre><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jensendarren.wordpress.com/193/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jensendarren.wordpress.com/193/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jensendarren.wordpress.com/193/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jensendarren.wordpress.com/193/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jensendarren.wordpress.com/193/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jensendarren.wordpress.com/193/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jensendarren.wordpress.com/193/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jensendarren.wordpress.com/193/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jensendarren.wordpress.com/193/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jensendarren.wordpress.com/193/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jensendarren.wordpress.com/193/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jensendarren.wordpress.com/193/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jensendarren.wordpress.com/193/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jensendarren.wordpress.com/193/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jensendarren.wordpress.com&amp;blog=8454922&amp;post=193&amp;subd=jensendarren&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jensendarren.wordpress.com/2010/05/14/how-to-return-content-from-an-hidden-application-running-on-a-specific-port-in-apache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d12a93274f2a88831aefe517eeab6ab0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jensendarren</media:title>
		</media:content>
	</item>
		<item>
		<title>How to subdomain redirect using Apache Virtual Host</title>
		<link>http://jensendarren.wordpress.com/2010/04/14/how-to-subdomain-redirect-using-apache-virtual-host/</link>
		<comments>http://jensendarren.wordpress.com/2010/04/14/how-to-subdomain-redirect-using-apache-virtual-host/#comments</comments>
		<pubDate>Wed, 14 Apr 2010 09:52:00 +0000</pubDate>
		<dc:creator>jensendarren</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[redirect]]></category>
		<category><![CDATA[subdomain]]></category>
		<category><![CDATA[virtual host]]></category>
		<category><![CDATA[virtualhost]]></category>

		<guid isPermaLink="false">http://jensendarren.wordpress.com/?p=178</guid>
		<description><![CDATA[Do you want to setup a website subdomain so that, for example, http://foo.example.com will actually, without the end user realizing, return content from http://example.com/foo ? In this short, but useful blog post, I will show you how you can redirect a subdomain to a server directory without anyone (except you) knowing! Assuming that you already [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jensendarren.wordpress.com&amp;blog=8454922&amp;post=178&amp;subd=jensendarren&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Do you want to setup a website subdomain so that, for example, <a href="http://foo.example.com" rel="nofollow">http://foo.example.com</a> will actually, without the end user realizing, return content from <a href="http://example.com/foo" rel="nofollow">http://example.com/foo</a> ? In this short, but useful blog post, I will show you how you can redirect a subdomain to a server directory without anyone (except you) knowing!</p>
<p>Assuming that you already have your subdomain DNS settings correctly configured and the subdomain now points to the IP address of your server, you should do the following in Apache running on an Ubuntu server.</p>
<p>Open the configuration file for your site. In this example, we will use the default site.</p>
<pre class="brush: bash;">
nano /etc/apache2/sites-available/default
</pre>
<p>Add the following additional VirtualHost configuration to the end of the file.</p>
<pre class="brush: xml;">
&lt;VirtualHost *:80&gt;
  ServerName foo.example.com
  DocumentRoot /var/www/foo
&lt;/VirtualHost&gt;
</pre>
<p>Now restart apache and your all done! </p>
<pre class="brush: bash;">
 /etc/init.d/apache2 restart
</pre>
<p>If you point your browser to <a href="http://foo.example.com" rel="nofollow">http://foo.example.com</a> you will see the content from <a href="http://example.com/foo" rel="nofollow">http://example.com/foo</a> ! Note: You do, of course, have to create the folder /var/www/foo and put a index.html file there with some content like &#8220;Here be foo!&#8221; so you can test it actually works!</p>
<p><strong>Extra Bonus Script Time!</strong><br />
As an added bonus, I have included a setup script that you can use to perform the above in one shot. Use it if you wish. Change foo and example.com to your domain and subdomain names.</p>
<pre class="brush: bash;">
#!/bin/bash

SITE_CONFIG_PATH=&quot;/etc/apache2/sites-available/default&quot;

echo &quot;Configure default site with foo virtual host&quot;
if ! grep -q &quot;ServerName foo.example.com&quot; $SITE_CONFIG_PATH
then
	echo &quot;Configuring...&quot;
	echo &quot;&quot; &gt;&gt; $SITE_CONFIG_PATH
	echo &quot;# foo virtual host&quot; &gt;&gt; $SITE_CONFIG_PATH
	echo &quot;&lt;VirtualHost *:80&gt;&quot; &gt;&gt; $SITE_CONFIG_PATH
	echo &quot;  ServerName foo.example.com&quot; &gt;&gt; $SITE_CONFIG_PATH
	echo &quot;  DocumentRoot /var/www/foo&quot; &gt;&gt; $SITE_CONFIG_PATH
	echo &quot;&lt;/VirtualHost&gt;&quot; &gt;&gt; $SITE_CONFIG_PATH
	echo &quot;Restart apache&quot;
	/etc/init.d/apache2 restart
else
	echo &quot;Already configured!&quot;
fi
</pre><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jensendarren.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jensendarren.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jensendarren.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jensendarren.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jensendarren.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jensendarren.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jensendarren.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jensendarren.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jensendarren.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jensendarren.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jensendarren.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jensendarren.wordpress.com/178/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jensendarren.wordpress.com/178/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jensendarren.wordpress.com/178/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jensendarren.wordpress.com&amp;blog=8454922&amp;post=178&amp;subd=jensendarren&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jensendarren.wordpress.com/2010/04/14/how-to-subdomain-redirect-using-apache-virtual-host/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d12a93274f2a88831aefe517eeab6ab0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jensendarren</media:title>
		</media:content>
	</item>
		<item>
		<title>Step by step guide to setting up a client server workstation on Ubuntu and VirtualBox</title>
		<link>http://jensendarren.wordpress.com/2010/03/19/step-by-step-guide-to-setting-up-a-client-server-workstation-on-ubuntu-and-virtualbox/</link>
		<comments>http://jensendarren.wordpress.com/2010/03/19/step-by-step-guide-to-setting-up-a-client-server-workstation-on-ubuntu-and-virtualbox/#comments</comments>
		<pubDate>Fri, 19 Mar 2010 02:03:29 +0000</pubDate>
		<dc:creator>jensendarren</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[client-server]]></category>
		<category><![CDATA[software development]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[Ubuntu Desktop 9.10]]></category>
		<category><![CDATA[Ubuntu Server 9.04]]></category>
		<category><![CDATA[virtualbox]]></category>

		<guid isPermaLink="false">http://jensendarren.wordpress.com/?p=160</guid>
		<description><![CDATA[I work on a number of different software projects. During the week I work on project called Yoolk and during the evenings and weekends I might work on AdFlickr or some other new project! Either of these main projects might also have sub-projects. The cleanest way to separate all of these projects is to develop [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jensendarren.wordpress.com&amp;blog=8454922&amp;post=160&amp;subd=jensendarren&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I work on a number of different software projects. During the week I work on project called <a title="Yoolk" href="http://www.yoolk.com" target="_blank">Yoolk</a> and during the evenings and weekends I might work on <a title="adflickr global ad archive database" href="http://www.adflickr.com" target="_blank">AdFlickr</a> or some other new project! Either of these main projects might also have sub-projects. The cleanest way to separate all of these projects is to develop the software using a guest OS running in VirtualBox. It makes sense, of course, that the guest OS matches your production environment as much as possible. Some of the benefits of doing this are:</p>
<ul>
<li>Complete separation of all your project dependencies. Change a setting on the guest development server for one project has absolutely no affect on your other projects.</li>
<li>Allows much more freedom to experiment with different dependencies, try out new software and generally just screw around without worrying about having to clean up your mess after (just take snapshots or re-install your guest OS!).</li>
<li>During development your are running your application in an environment which (at OS level at least) should be exactly the same as production. Therefore, this minimizes surprises during deployment.</li>
<li>Allows you to keep your client OS the way you want it so that your development experience is just the way you like it. For example, installing different text editors, music libraries, video libraries, browsers etc etc without worrying that it will affect the application your building.</li>
</ul>
<p>While the benefits are great, there is a little work to be done to set this up initially (but it&#8217;s not too much). The longest step is installing the guest OS on VirtualBox. Obviously this depends on which guest OS you install. I use Ubuntu 9.04 Server Edition. By the way, my host OS is currently Ubuntu 9.10 but I know that this also works on Ubuntu 9.04 (since I used to run that before).</p>
<p>Below is a step by step guide to setting this up. Notice that you will be alternating between the client (your desktop OS) and the server (the guest OS in VirtualBox):</p>
<ol>
<li><strong>client</strong>: install server on virtualbox (make the default user the same name as client user name)</li>
<li><strong>client</strong>: configure virtualbox to use bridged networking and start server</li>
<li><strong>server</strong>: sudo apt-get update</li>
<li><strong>server</strong>: sudo apt-get install openssh-server</li>
<li><strong>server</strong>: ifconfig (and note the ip address)</li>
<li><strong>client</strong>: ssh into the server using the IP address you recorded in the previous step</li>
<li><strong>server</strong>: mkdir .ssh</li>
<li><strong>client</strong>: ssh-keygen (don&#8217;t enter any values, press return three times, yes passwords should be blank)</li>
<li><strong>client</strong>: cat ~/.ssh/id_rsa.pub &#8211; copy the output to the clipboard (very carefully, no pre/trailing white space)</li>
<li><strong>server</strong>: touch .ssh/authorized_keys</li>
<li><strong>server</strong>: sudo nano .ssh/authorized_keys &#8211; paste clipboard contents</li>
<li><strong>client</strong>: sudo nano /etc/hosts &#8211; add line: 192.168.???.??? myappname.dev <a href="http://www.myappname.dev" rel="nofollow">http://www.myappname.dev</a> (get ip from ifconfig)</li>
<li><strong>client</strong>: sudo /etc/init.d/networking restart (refresh new data in /etc/hosts)</li>
<li><strong>client</strong>: In nautilus go to ssh://myappname.dev then add the location to bookmarks</li>
<li><strong>client</strong>: In your web browser, go to <a href="http://myappname.dev" rel="nofollow">http://myappname.dev</a> and add the location to bookmarks (you will not get a response unless you have a web server running your application on your guest OS, of course!).</li>
</ol>
<p>After you have completed the above steps when logging in via ssh you shouldn&#8217;t be prompted for a password! Note, if IP address of the server changes, you should edit /etc/hosts to reflect that change.</p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jensendarren.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jensendarren.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jensendarren.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jensendarren.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jensendarren.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jensendarren.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jensendarren.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jensendarren.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jensendarren.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jensendarren.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jensendarren.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jensendarren.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jensendarren.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jensendarren.wordpress.com/160/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jensendarren.wordpress.com&amp;blog=8454922&amp;post=160&amp;subd=jensendarren&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jensendarren.wordpress.com/2010/03/19/step-by-step-guide-to-setting-up-a-client-server-workstation-on-ubuntu-and-virtualbox/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d12a93274f2a88831aefe517eeab6ab0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jensendarren</media:title>
		</media:content>
	</item>
		<item>
		<title>command to ftp in linux bash script</title>
		<link>http://jensendarren.wordpress.com/2010/02/27/command-to-ftp-in-linux-bash-script/</link>
		<comments>http://jensendarren.wordpress.com/2010/02/27/command-to-ftp-in-linux-bash-script/#comments</comments>
		<pubDate>Sat, 27 Feb 2010 08:58:57 +0000</pubDate>
		<dc:creator>jensendarren</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[bash ftp example]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[ftp]]></category>
		<category><![CDATA[ftp command line example]]></category>
		<category><![CDATA[ftp scripts]]></category>
		<category><![CDATA[line]]></category>
		<category><![CDATA[upload]]></category>

		<guid isPermaLink="false">http://jensendarren.wordpress.com/?p=151</guid>
		<description><![CDATA[Command line ftp scripts are often unappreciated. Often, when a requirement to ftp files arises it makes sense to write a ftp command file which automates this. The question is what is the best approach? Out of the box, most Linux and Unix ftp commands are limited. In particular, recursive folder creation on the ftp [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jensendarren.wordpress.com&amp;blog=8454922&amp;post=151&amp;subd=jensendarren&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Command line ftp scripts are often unappreciated. Often, when a requirement to ftp files arises it makes sense to write a ftp command file which automates this. The question is what is the best approach? Out of the box, most Linux and Unix ftp commands are limited. In particular, recursive folder creation on the ftp server is not possible with the basic linux / unix ftp tool. It lacks a command in ftp that offers this recursive functionality. So what is the solution if you require a bash script ftp for upload of files and folders?</p>
<p>I recommend you download ,install and use <a href="http://www.ncftp.com">ncftp</a>. This is a far superior option compared with the basic set of ftp commands that comes with the installed ftp program with linux.</p>
<p>It would not be fair to leave without providing an example so here is one! Imagine that you have a set of nested folders, some which are empty and some which contain files. You want to ftp the entire folder structure (including the files, of course!) to a remote ftp server. Here is a ftp bash script to do just that (replace with your settings where appropriate).</p>
<pre class="brush: bash;">
FTP_HOST=ftp.yoursite.com
FTP_LOGIN=yourusername
FTP_PASSWORD=yourpassword

ncftp &lt;&lt;EOF
open -u $FTP_LOGIN -p $FTP_PASSWORD $FTP_HOST
cd somefolder/onyourserver
lcd &quot;somefolder/onyourclient&quot;
put -R *
bye
EOF
</pre>
<p>Save the above script in a file named <strong>ftp-example.sh</strong> and execute it in your terminal as you would any shell script. The key command in this example which creates all the folders recursively is <strong>put -R *</strong>. The rest of the example is pretty straight forward.</p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jensendarren.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jensendarren.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jensendarren.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jensendarren.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jensendarren.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jensendarren.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jensendarren.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jensendarren.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jensendarren.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jensendarren.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jensendarren.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jensendarren.wordpress.com/151/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jensendarren.wordpress.com/151/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jensendarren.wordpress.com/151/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jensendarren.wordpress.com&amp;blog=8454922&amp;post=151&amp;subd=jensendarren&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jensendarren.wordpress.com/2010/02/27/command-to-ftp-in-linux-bash-script/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d12a93274f2a88831aefe517eeab6ab0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jensendarren</media:title>
		</media:content>
	</item>
		<item>
		<title>Create a WCF Rest Application using .NET 3.5</title>
		<link>http://jensendarren.wordpress.com/2010/01/29/create-a-wcf-rest-application-using-net-3-5/</link>
		<comments>http://jensendarren.wordpress.com/2010/01/29/create-a-wcf-rest-application-using-net-3-5/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 01:31:39 +0000</pubDate>
		<dc:creator>jensendarren</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[.net 3.5]]></category>
		<category><![CDATA[MS]]></category>
		<category><![CDATA[UriTemplate]]></category>
		<category><![CDATA[WCF]]></category>

		<guid isPermaLink="false">http://jensendarren.wordpress.com/?p=144</guid>
		<description><![CDATA[In this post, I will explain how to create a simple read only Rest service using WCF .NET 3.5 WebGet endpoints. I will also explain a little bit about the wonderful UriTemplate class. First create a new &#8220;WCF Service Application&#8221; Create a new &#8220;WCF Service Application&#8221; project. This will provide you with the standard example [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jensendarren.wordpress.com&amp;blog=8454922&amp;post=144&amp;subd=jensendarren&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In this post, I will explain how to create a simple read only Rest service using WCF .NET 3.5 WebGet endpoints. I will also explain a little bit about the wonderful UriTemplate class.</p>
<p><strong>First create a new &#8220;WCF Service Application&#8221;</strong></p>
<p>Create a new &#8220;WCF Service Application&#8221; project. This will provide you with the standard example files for WCF that contain the <em>string GetData(int value)</em> and <em>CompositeType GetDataUsingDataContract(CompositeType composite)</em> signatures.</p>
<p>Now this application is not yet Rest enabled. You need to do a few more things. No doubt, of course you can turn this into your own Visual Studio project template later on if you need to.</p>
<p><strong>Rest enable the WCF Application</strong></p>
<p>Go ahead and add a reference to <em>System.ServiceModel.Web dll.</em> Now add the <em>WebGetAttribute</em> on the method you want to expose. Let&#8217;s just use the supplied <em>GetData</em> method to keep things simple. However, notice that I have to change the data type of the input parameter to string since this is what the <em>UriTemplate</em> expects. This method signature in the <em>IService1</em> Interface should look something like this:</p>
<pre class="brush: csharp;">
[OperationContract]
[WebGet( UriTemplate = &quot;somepath/{value}&quot;)]
string GetData(string value);
</pre>
<p>Then, in the web.config file that we create, we must also include the following entry (put this within the behaviors tag):</p>
<pre class="brush: xml;">
&lt;endpointBehaviors&gt;
&lt;behavior name=&quot;WebBehavior&quot;&gt;
&lt;webHttp /&gt;
&lt;/behavior&gt;
&lt;/endpointBehaviors&gt;
</pre>
<p>Now look within the services tag for the endpoint tag that describes the service you are building. You need to change the binding to &#8220;webHttpBinding&#8221; and add the attribute behaviorConfiguration=&#8221;WebBehavior&#8221; to this tag. The endpoint tag for your service should now look something like this:</p>
<pre class="brush: xml;">
&lt;endpoint address=&quot;&quot; binding=&quot;webHttpBinding&quot;
contract=&quot;WcfService1.IService1&quot;
behaviorConfiguration=&quot;WebBehavior&quot; /&gt;
</pre>
<p>At this point you are ready to run the service, so hit F5. Your browser window should open to the service description page. Please then change the path following the &#8220;localhost&#8221; root to: ./Service1.svc/somepath/sqlserverdotnet and you should then see an XML response from the service as follows:</p>
<pre class="brush: xml;">
&lt;string&gt;You entered: never say never&lt;/string&gt;
</pre>
<p>Now you are free to modify this service method as you want. Perhaps to connect to a database and return a collection as serialized XML for example. Obviously you can remove the .svc extension from the url by using a HttpModule. There are many examples of url re-writing on the web which demonstrate exactly how to do this.</p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jensendarren.wordpress.com/144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jensendarren.wordpress.com/144/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jensendarren.wordpress.com/144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jensendarren.wordpress.com/144/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jensendarren.wordpress.com/144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jensendarren.wordpress.com/144/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jensendarren.wordpress.com/144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jensendarren.wordpress.com/144/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jensendarren.wordpress.com/144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jensendarren.wordpress.com/144/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jensendarren.wordpress.com/144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jensendarren.wordpress.com/144/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jensendarren.wordpress.com/144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jensendarren.wordpress.com/144/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jensendarren.wordpress.com&amp;blog=8454922&amp;post=144&amp;subd=jensendarren&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jensendarren.wordpress.com/2010/01/29/create-a-wcf-rest-application-using-net-3-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d12a93274f2a88831aefe517eeab6ab0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jensendarren</media:title>
		</media:content>
	</item>
		<item>
		<title>The easy way to create a new Ruby Gem!</title>
		<link>http://jensendarren.wordpress.com/2010/01/11/the-easy-way-to-create-a-new-ruby-gem/</link>
		<comments>http://jensendarren.wordpress.com/2010/01/11/the-easy-way-to-create-a-new-ruby-gem/#comments</comments>
		<pubDate>Mon, 11 Jan 2010 07:35:06 +0000</pubDate>
		<dc:creator>jensendarren</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[gem]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[jeweler]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[spec]]></category>

		<guid isPermaLink="false">http://jensendarren.wordpress.com/?p=125</guid>
		<description><![CDATA[If you want to make a Ruby Gem and want to do it in a very easy way then here&#8217;s is one very good option &#8211; use Jeweler! Thanks to John Nunemaker at RailsTips for pointing me in the right direction with his post Building API Wrapping Gems Install git core apt-get install git-core Install [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jensendarren.wordpress.com&amp;blog=8454922&amp;post=125&amp;subd=jensendarren&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you want to make a Ruby Gem and want to do it in a very easy way then here&#8217;s is one very good option &#8211; use <a title="Jeweler Gem" href="http://github.com/technicalpickles/jeweler" target="_self">Jeweler</a>! Thanks to <a title="RailsTips" href="http://railstips.org/" target="_self">John Nunemaker at RailsTips</a> for pointing me in the right direction with his post <a title="Building API Wrapping Gems" href="http://railstips.org/blog/archives/2009/03/25/building-api-wrapping-gems-could-not-get-much-easier/" target="_self">Building API Wrapping Gems</a></p>
<ol>
<li><strong>Install git core</strong>
<pre class="brush: bash;">apt-get install git-core</pre>
</li>
<li><strong>Install jeweler gem</strong>
<pre class="brush: bash;">gem install jeweler</pre>
</li>
<li><strong>Now add the following line to your bashrc file to ensure that you always use spec (that if you <em>do</em> use spec). Otherwise the default is shoulda and if your happy using that then you can skip this part.</strong>
<pre class="brush: bash;">export JEWLER_OPTS = &quot;--spec&quot;</pre>
</li>
<li><strong>Setup your global username and email for git</strong>
<pre class="brush: bash;">git config --global user.name &quot;Your Company Name&quot;
git config --global user.email &quot;yourname@yourcompanyname.com&quot;</pre>
</li>
<li><strong>Script your new gem using jeweler</strong>
<pre class="brush: bash;">jeweler your_shiny_new_gem</pre>
</li>
<li><strong>Set your init version</strong>. <strong>I do this so that I can easily generate the gemspec later.</strong>
<pre class="brush: bash;">rake version:write MAJOR=0 MINOR=1 PATCH=0</pre>
</li>
<li><strong>Modify the new gem rake file to add the meta info for your project</strong>
<pre class="brush: ruby;">
begin
  require 'jeweler'
  Jeweler::Tasks.new do |gem|
    gem.name = &quot;your_shiny_new_gem&quot;
    gem.summary = %Q{A simple gem to access the Shiny API}
    gem.description = %Q{Use this gem to access our Shiny API !!}
    gem.email = &quot;yourname@yourcompanyname.com&quot;
    gem.homepage = &quot;<a href="http://bitbucket.org/yourrepo/your_shiny_new_gem&#038;quot" rel="nofollow">http://bitbucket.org/yourrepo/your_shiny_new_gem&#038;quot</a>;
    gem.authors = [&quot;Your Company Name&quot;]
    gem.add_development_dependency &quot;rspec&quot;, &quot;&gt;= 1.2.9&quot;
    # gem is a Gem::Specification... see <a href="http://www.rubygems.org/read/chapter/20" rel="nofollow">http://www.rubygems.org/read/chapter/20</a> for additional settings
  end
  Jeweler::GemcutterTasks.new
rescue LoadError
  puts &quot;Jeweler (or a dependency) not available. Install it with: gem install jeweler&quot;
end
</pre>
</li>
<li><strong>Generate the gemspec</strong>
<pre class="brush: bash;">rake gemspec</pre>
</li>
<li><strong>Write the code that goes into your gem. This is where your own imagination comes in! See the <a title="Google Weather API Gem" href="http://github.com/jnunemaker/google-weather" target="_self">Google Weather API Gem</a> for an example. When your gem is finished (including all your tests passing!) move on to building and testing the installation of the Gem. </strong><strong> </strong>
<pre class="brush: bash;">code.write!</pre>
</li>
<li><strong>Build the gem</strong>
<pre class="brush: bash;">rake build</pre>
</li>
<li><strong>Install the gem</strong>
<pre class="brush: bash;">rake install</pre>
</li>
</ol>
<p>You can deploy to github (the easiest solution when using Jeweler). However, you can still deploy to other repositories like Bitbucket for example. Then, as recommended by the author of Jeweler, <a title="Josh Nichols" href="http://technicalpickles.com/about/" target="_self">Josh Nichols</a>, have a delicious beverage!</p>
<p>Happy Gem stone cutting!</p><br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jensendarren.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jensendarren.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jensendarren.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jensendarren.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jensendarren.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jensendarren.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jensendarren.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jensendarren.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jensendarren.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jensendarren.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jensendarren.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jensendarren.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jensendarren.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jensendarren.wordpress.com/125/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jensendarren.wordpress.com&amp;blog=8454922&amp;post=125&amp;subd=jensendarren&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jensendarren.wordpress.com/2010/01/11/the-easy-way-to-create-a-new-ruby-gem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d12a93274f2a88831aefe517eeab6ab0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">jensendarren</media:title>
		</media:content>
	</item>
	</channel>
</rss>
