<?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>Rforge</title>
	<atom:link href="http://rforge.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://rforge.org</link>
	<description>open source tools and statistical computing ++</description>
	<lastBuildDate>Wed, 22 May 2013 07:17:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='rforge.org' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Rforge</title>
		<link>http://rforge.org</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://rforge.org/osd.xml" title="Rforge" />
	<atom:link rel='hub' href='http://rforge.org/?pushpress=hub'/>
		<item>
		<title>How to grab you external IP in the bash shell</title>
		<link>http://rforge.org/2013/04/04/how-to-grab-you-external-ip-in-the-bash-shell/</link>
		<comments>http://rforge.org/2013/04/04/how-to-grab-you-external-ip-in-the-bash-shell/#comments</comments>
		<pubDate>Wed, 03 Apr 2013 22:21:10 +0000</pubDate>
		<dc:creator>rforge</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[external]]></category>
		<category><![CDATA[ip]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[wget]]></category>

		<guid isPermaLink="false">http://rforge.org/?p=760</guid>
		<description><![CDATA[Just for the record: I was wondering what command line tool would display my external IP address while surfing the internet. Actually I want to refine my servers security settings and block out IPs for incoming traffic which I would not use. Instead of doing this systematically I want to just list some IPs at [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rforge.org&#038;blog=7577563&#038;post=760&#038;subd=rforge&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Just for the record: I was wondering what command line tool would display my external IP address while surfing the internet. Actually I want to refine my servers security settings and block out IPs for incoming traffic which I would not use. Instead of doing this systematically I want to just list some IPs at different computers I use.</p>
<p>It appears you need some script (PHP, JAVA, etc) to do the job on an external host. Many &#8220;whatsmyip&#8221;-like websites produce a lot of unwanted noise around the information, but tonight i stubled over <a href="http://myip.dnsdynamic.com" target="_blank">myip.dnsdynamic.com</a> which simply displays the IP, so here it goes:</p>
<p>
<pre class="brush: plain; title: ; notranslate">wget myip.dnsdynamic.org -O - -o /dev/null</pre>
</p>
<p> </p>
<p> </p>
<p>Just tonight i stumbled over</p>
<p> </p>
<br />  <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rforge.org&#038;blog=7577563&#038;post=760&#038;subd=rforge&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rforge.org/2013/04/04/how-to-grab-you-external-ip-in-the-bash-shell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/2a4cc3be2c3e1c3b1442535ef7a46f42?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rforge</media:title>
		</media:content>
	</item>
		<item>
		<title>Remove Color Channels from TIFF Using Command Line</title>
		<link>http://rforge.org/2012/08/05/remove-color-channels-from-tiff-using-command-line/</link>
		<comments>http://rforge.org/2012/08/05/remove-color-channels-from-tiff-using-command-line/#comments</comments>
		<pubDate>Sun, 05 Aug 2012 11:15:40 +0000</pubDate>
		<dc:creator>rforge</dc:creator>
				<category><![CDATA[BASH]]></category>
		<category><![CDATA[Statistics]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Use R!]]></category>
		<category><![CDATA[convert]]></category>
		<category><![CDATA[figure]]></category>
		<category><![CDATA[monochrome]]></category>
		<category><![CDATA[plot]]></category>
		<category><![CDATA[R]]></category>
		<category><![CDATA[tiff]]></category>

		<guid isPermaLink="false">http://rforge.org/?p=750</guid>
		<description><![CDATA[The R function tiff() is used a lot to export R graphics e.g. for publication purposes. The tiff includes all 8 color channels and this collides with formatation requirements of most jounals (1200dpi but not more than some MB in size). tiff("Whiskerplot.tiff" , width = 8.8 , height = 8.8 , units = "cm" , [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rforge.org&#038;blog=7577563&#038;post=750&#038;subd=rforge&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>The R function
<pre>tiff()</pre>
<p> is used a lot to export R graphics e.g. for publication purposes. The tiff includes all 8 color channels and this collides with formatation requirements of most jounals (1200dpi but not more than some MB in size).</p>
<p><code>tiff("Whiskerplot.tiff" , width = 8.8 , height = 8.8 , units = "cm" , pointsize = 8 , res = 1200)</code><br />
produces the required 1200 dpi resolution for monochrome plots, but with all 8 color channels (although just one is necessary) this results in 49.4MB for a tiny 8.8&#215;8.8 cm (ca 3.5&#215;3.5 inch) plot. I used GIMP to remove the color channels with
<pre>Image &gt; Mode &gt; Indexed &gt; 1-bit monochrome</pre>
<p> but this required opening GiMP, the file, the menu and saving. And again, when the plot had to be modified.</p>
<p>Since this has to be done for each and every publication figure I looked up a command line solution and here it is:<br />
<code>convert Whiskerplot.tiff -flatten -monochrome Whiskerplot_monochrome.tiff</code><br />
removes all unnecessary colorchannels from Whiskerplot.tiff and saves it as Whiskerplot_monochrome.tiff, reducing the size from 49.4MB to 2.1MB while the result is exactly the same.</p>
<p>Hattip: Paddy Landau on <a href="http://ubuntuforums.org/showthread.php?t=1033366" target="_blank">ubuntuforums</a></p>
<br />  <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rforge.org&#038;blog=7577563&#038;post=750&#038;subd=rforge&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rforge.org/2012/08/05/remove-color-channels-from-tiff-using-command-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/2a4cc3be2c3e1c3b1442535ef7a46f42?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rforge</media:title>
		</media:content>
	</item>
		<item>
		<title>Command line method to copy all files out of a folder tree</title>
		<link>http://rforge.org/2012/07/23/command-line-method-to-copy-all-files-out-of-a-folder-tree/</link>
		<comments>http://rforge.org/2012/07/23/command-line-method-to-copy-all-files-out-of-a-folder-tree/#comments</comments>
		<pubDate>Mon, 23 Jul 2012 12:13:21 +0000</pubDate>
		<dc:creator>rforge</dc:creator>
				<category><![CDATA[BASH]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[archive]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[clean up]]></category>
		<category><![CDATA[copy]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[foto]]></category>

		<guid isPermaLink="false">http://rforge.org/?p=747</guid>
		<description><![CDATA[This is not so much statistics, but I do want to keep this in case I need it again. For years I am collecting pictures and photos in a host of folders. Most pictures are in Pictures with a lot of subfolders and a lot of duplicates. Just today I imported another chunk of pictures [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rforge.org&#038;blog=7577563&#038;post=747&#038;subd=rforge&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>This is not so much statistics, but I do want to keep this in case I need it again. </p>
<p>For years I am collecting pictures and photos in a host of folders. Most pictures are in <em>Pictures</em> with a lot of subfolders and a lot of duplicates. Just today I imported another chunk of pictures with <em>gThumb</em> which has the very nice feature of creating a Year/Month/Day/ folder tree and moves the files there. But: I chose the wrong parent folder, so that I have a lot of /Year/Month/Day/ folders in more than one place. Bummer. And: this might/will happen again.</p>
<p>What I wanted to do is get all picture files out of all folders and sort them in one folder by name. Then have a look at the list (takes time), remove duplicates and move them back into /home/rforge/Pictures/year/month folders (for this I use gThumb, to lazy to research the <em>find</em> way in command line &#8212; if somebody reads this he/she might comment on that).</p>
<p>Anyway:<br />
<code>find /path/to/Pictures -name="*.jpg" -exec cp '{}' '/path/to/temporary_jpg/' ';'</code></p>
<p>finds all <em>.jpg</em> files in the /path/to/Pictures folder and copies (cp) them to a folder <em>temporary_jpg</em> in the home folder (which has to exist before running <em>find</em>.</p>
<p>Since not all files are <em>jpg</em> (case sensitive), like e.g. jpeg, JPEG, BMG, tiff and so on (even .mpg videos are burried in this dreadful old &#8220;Pictures&#8221; folder/dump) one can omit the <em>-name</em> specification and just dump everything in a flat folder sort by extension/file type and clean up:</p>
<p><code>find /path/to/Pictures -exec cp '{}' '/path/to/temporaryPics' ';'</code></p>
<p>Helpful links, which I used:<br />
<a href="http://technofreakatchennai.wordpress.com/2007/10/04/bash-copy-with-find/" target="_blank"><br />
Coding Tiger</a> (with comments)<br />
and for renaming all the filename salad from dozens of cameras to a consistend format, that is Year-Month-day-hour-minute-second.jpg (which I do not cover here): <a href="http://ubuntuforums.org/showpost.php?p=9786795" target="_blank">ak4good</a> on ubuntu Forum (comment #6).</p>
<br />  <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rforge.org&#038;blog=7577563&#038;post=747&#038;subd=rforge&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rforge.org/2012/07/23/command-line-method-to-copy-all-files-out-of-a-folder-tree/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/2a4cc3be2c3e1c3b1442535ef7a46f42?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rforge</media:title>
		</media:content>
	</item>
		<item>
		<title>Windows Server 2008 Remote Desktop access from Ubuntu client</title>
		<link>http://rforge.org/2012/06/23/windows-server-2008-remote-desktop-access-from-ubuntu-client/</link>
		<comments>http://rforge.org/2012/06/23/windows-server-2008-remote-desktop-access-from-ubuntu-client/#comments</comments>
		<pubDate>Sat, 23 Jun 2012 12:59:43 +0000</pubDate>
		<dc:creator>rforge</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[remmina]]></category>
		<category><![CDATA[remote desktop]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[VPN]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://rforge.org/?p=742</guid>
		<description><![CDATA[Tried for weeks and weeks to connect to a Windows 2008 Server via remote desktop from my Xubuntu-12.04 laptop. To no avail. There were some steps required like setting up VPN with fixed IP, finding a remote desktop client and trying to connect to the server, so a lot of potential problem sources. To cut [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rforge.org&#038;blog=7577563&#038;post=742&#038;subd=rforge&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Tried for weeks and weeks to connect to a Windows 2008 Server via remote desktop from my Xubuntu-12.04 laptop. To no avail. There were some steps required like setting up VPN with fixed IP, finding a remote desktop client and trying to connect to the server, so a lot of potential problem sources.</p>
<p>To cut straight to the point:<br />
<code>sudo aptitude install remmina</code><br />
solved the problem.</p>
<p>Fast-IP-VPN was correctly configured, but the Ubuntu default remote desktop client <em>rdesktop</em> was refused by the 2008 server. What made the problem not so obvious was that the connection to another remote desktop at the same institution worked without problem, but that was a XP server. No one was aware of this and event the IT-support suggested <em>rdesktop</em>.</p>
<p>On top <em>remmina</em> comes with a graphical user interface and in Xubuntu an item in the system tray makes connection to a once correctly configured remote desktop a one-click affair.</p>
<p>Hattip to Jonathan Moeller and his <a href="http://www.amazon.com/The-Ubuntu-Beginners-Guide-ebook/dp/B004Y1NMDI" target="_blank"><em>The Ubuntu Beginner&#8217;s Guide</em></a>.</p>
<p>A short howto <em>remmina</em> on <a href="http://www.ubuntugeek.com/remmina-remote-desktop-client.html" target="_blank">ubuntugeek.com</a></p>
<br />  <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rforge.org&#038;blog=7577563&#038;post=742&#038;subd=rforge&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rforge.org/2012/06/23/windows-server-2008-remote-desktop-access-from-ubuntu-client/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/2a4cc3be2c3e1c3b1442535ef7a46f42?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rforge</media:title>
		</media:content>
	</item>
		<item>
		<title>Slow MySQL 5.5.22 database engine</title>
		<link>http://rforge.org/2012/05/16/slow-mysql-5-5-22-database-engine/</link>
		<comments>http://rforge.org/2012/05/16/slow-mysql-5-5-22-database-engine/#comments</comments>
		<pubDate>Wed, 16 May 2012 11:42:27 +0000</pubDate>
		<dc:creator>rforge</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://rforge.org/?p=740</guid>
		<description><![CDATA[Slooooooow UPDATE query with MySQL 5.5 I am using a local MySQL server a lot to handle, prepare and restructure big research tables. Ubuntu Precise uses MySQL server 5.5 while the previous distros used 5.1. I thought that might be good until I tried to import a table with some dozen variables and some thousand [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rforge.org&#038;blog=7577563&#038;post=740&#038;subd=rforge&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<h1>Slooooooow UPDATE query with MySQL 5.5</h1>
<p>I am using a local  MySQL server a lot to handle, prepare and restructure big research tables. Ubuntu Precise uses MySQL server 5.5 while the previous distros used 5.1. I thought that might be good until I tried to import a table with some dozen variables and some thousand rows with and UPDATE statement which took some seconds (10 min!!).</p>
<p><a href="http://forums.mysql.com/read.php?24,408657,408875,quote=1#REPLY" target="_blank">nick rulez on forum.mysql.com</a> quantified this fact and revealed that the default database engine changed from &#8220;MyISAM&#8221; to &#8220;InnoDB&#8221; and that indeed InnoDB is considerably slower in this regard.</p>
<p>So I want MyISAM back.</p>
<p><a href="http://dev.mysql.com/doc/refman/5.1/en/storage-engines.html" target="_blank">To list the available and default engines:<br />
</a></p>
<p><code>show engines</code><br />
which produces<br />
<code><br />
mysql&gt; show engines;<br />
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+<br />
| Engine             | Support | Comment                                                        | Transactions | XA   | Savepoints |<br />
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+<br />
| MyISAM             | YES     | MyISAM storage engine                                          | NO           | NO   | NO         |<br />
| CSV                | YES     | CSV storage engine                                             | NO           | NO   | NO         |<br />
| MRG_MYISAM         | YES     | Collection of identical MyISAM tables                          | NO           | NO   | NO         |<br />
| BLACKHOLE          | YES     | /dev/null storage engine (anything you write to it disappears) | NO           | NO   | NO         |<br />
| MEMORY             | YES     | Hash based, stored in memory, useful for temporary tables      | NO           | NO   | NO         |<br />
| PERFORMANCE_SCHEMA | YES     | Performance Schema                                             | NO           | NO   | NO         |<br />
| ARCHIVE            | YES     | Archive storage engine                                         | NO           | NO   | NO         |<br />
| InnoDB             | DEFAULT | Supports transactions, row-level locking, and foreign keys     | YES          | YES  | YES        |<br />
| FEDERATED          | NO      | Federated MySQL storage engine                                 | NULL         | NULL | NULL       |<br />
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+<br />
9 rows in set (0.00 sec)<br />
</code></p>
<h2><a href="http://dev.mysql.com/doc/refman/5.1/en/storage-engine-setting.html" target="_blank">Setting the database engine</a></h2>
<blockquote><p>
When you create a new table, you can specify which storage engine to use by adding an ENGINE table option to the CREATE TABLE statement:</p>
<p><code>CREATE TABLE t (i INT) ENGINE = INNODB;</code></p>
<p>If you omit the ENGINE option, the default storage engine is used. Normally, this is MyISAM, but you can change it by using the &#8211;default-storage-engine server startup option, or by setting the default-storage-engine option in the my.cnf configuration file.</p>
<p>You can set the default storage engine to be used during the current session by setting the storage_engine variable:</p>
<p><code>SET storage_engine=MYISAM;</code></p>
<p>[...]</p>
<p>To convert a table from one storage engine to another, use an ALTER TABLE statement that indicates the new engine:</p>
<p><code>ALTER TABLE t ENGINE = MYISAM;</code>
</p></blockquote>
<p>I want MyISAM all the time so I decided for the <em>my.cnf</em> option. But where is my.cnf? According to <a href="http://www.debianadmin.com/mysql-database-server-installation-and-configuration-in-ubuntu.html" target="_blank">debianadmin</a>:</p>
<p><code>sudo nano /etc/mysql/my.cnf</code></p>
<p>Now append<br />
<code>default-storage-engine = MyISAM</code><br />
Safe and exit with Ctrl-o, Ctrl-x and restart the server.</p>
<p><code>sudo restart mysql</code></p>
<p>and MyISAM it is.</p>
<br />  <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rforge.org&#038;blog=7577563&#038;post=740&#038;subd=rforge&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rforge.org/2012/05/16/slow-mysql-5-5-22-database-engine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/2a4cc3be2c3e1c3b1442535ef7a46f42?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rforge</media:title>
		</media:content>
	</item>
		<item>
		<title>Data Backup in the AWS Cloud with rsync</title>
		<link>http://rforge.org/2011/11/16/data-backup-in-the-aws-cloud-with-rsync/</link>
		<comments>http://rforge.org/2011/11/16/data-backup-in-the-aws-cloud-with-rsync/#comments</comments>
		<pubDate>Wed, 16 Nov 2011 21:20:39 +0000</pubDate>
		<dc:creator>rforge</dc:creator>
				<category><![CDATA[Amazon Web Services]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[BASH]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[AWS]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[demon]]></category>
		<category><![CDATA[ebs]]></category>
		<category><![CDATA[ec2]]></category>
		<category><![CDATA[rsync]]></category>

		<guid isPermaLink="false">http://rforge.org/?p=722</guid>
		<description><![CDATA[After admitting that of all things Microsoft offers 25GB cloud storage for its Windows Live subscribers I will walk through my latest preliminary experiments regarding backup of important data using the using the Amazon Advanced Web Services. The storage is not free but quite cheap at around 0.1$ per GB and month. If you use [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rforge.org&#038;blog=7577563&#038;post=722&#038;subd=rforge&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>After admitting that of all things Microsoft offers <a href="http://explore.live.com/skydrive">25GB cloud storage</a> for its Windows Live subscribers I will walk through my latest preliminary experiments regarding backup of important data using the using the Amazon <a href="aws.amazon.com">Advanced Web Services</a>. The storage is not free but quite cheap at around 0.1$ per GB and month.</p>
<p>If you use Windows and MS Office a lot use <a href="http://explore.live.com/skydrive">Skydrive</a> and don&#8217;t read on <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  There are posts which describe how to map the Skydrive like a local harddisk using MS Word.</p>
<p>On the long run I would like to mount a EBS storage like a local file tree, probably using WebDAV, but this is my first successful preliminary solution. <tt>s3cmd</tt> does not work for me.</p>
<p>Using Ubuntu/Linux <tt>rsync</tt> is a well established, reliable and easy to use tool to keep data between locations in sync. The following post marries <tt>rsync</tt> with an <a href="http://aws.amazon.com/ec2/">Elastic Cloud (EC2)</a> server instance for an hour or some. One has to set up the so called rsync daemon and attach a persistent <a href="http://aws.amazon.com/ebs/">Elastic Block Storage</a>.</p>
<p>This is another post. I will link to it later. There will also be a small script. There are some holes in this tutorial, only the direct configuration of the rsync daemon (including the script) is complete and working. I filled in some hints how to get to this stage. But will write follow ups on that.</p>
<p><a href="http://a1979shakedown.wordpress.com/2009/01/19/set-up-an-rsync-server-in-ubuntu-for-file-syncing-between-machines/">System Out</a> provided a nice tutorial of how to set up the rsync in demon mode on a server which listens for clients to sync their data.</p>
<p>Here is my version of it, with a short script at the end which should do the job.</p>
<h1>Prerequisites</h1>
<p>Of course  you need to have <tt>rsync</tt> on both machines (the server and the client); since both are Ubuntu this is the case.</p>
<p>I will write another post on how to start the server. It is completely possible and quite intuitive to achieve it in the <a href="http://aws.amazon.com">Amazon web interface</a>. When the server is running and an <em>extra</em> EBS harddisk is attached you have to connect to the server using <tt>ssh</tt><br />
<code>ssh -i PATH/TO/YOUR/PEM-KEY-FILE ubuntu@ec2-xxx-xx-xxx-xxx.compute-1.amazonaws.com</code></p>
<h1>Mount the persistent drive</h1>
<p>There are some posts about the advantages of the xfs filesystem, so I sticked to it. <a href="">Alestic</a> recommends it for all persistent EC2 cloud disks and I trust they know what they are doing. But <tt>xfs</tt> is not per default included in the Ubuntu micro instance I use for my backups. That said, in the <tt>SSH</tt> shell:</p>
<p><code>sudo apt-get install -y xfsprogs<br />
sudo modprobe xfs</code></p>
<p>If the backup volume is newly created then format it:<br />
<code>sudo mkfs.xfs /dev/xvdb</code><br />
<strong>Note:</strong> Only the <em>first</em> time. Otherwise you wipe your data, of course. Note also the device name. I attached it as <tt>/dev/sdb</tt>. Though it showed up in the Ubuntu Oneiric i386 t1.micro instance as <tt>/dev/xvdb</tt>.</p>
<p>Now mount the volume<br />
<code>echo "/dev/xvdb /media/backup xfs noatime 0 0" | sudo tee -a /etc/fstab<br />
sudo mkdir /media/backup<br />
sudo mount /media/backup<br />
sudo chown ubuntu:ubuntu /media/backup<br />
sudo chmod 777 /media/backup</code></p>
<h1>Configuration files</h1>
<p>On the server machine you need to set up a daemon to run in the background and host the <tt>rsync</tt> services.</p>
<p>Before you start the daemon you need to create some <tt>rsync</tt> daemon configuration files in the <tt>/etc</tt> directory.</p>
<p>Three files are necessary:</p>
<ol>
<li><tt>/etc/rsyncd.conf</tt>, the actual configuration file,</li>
<li><tt>/etc/rsyncd.motd</tt>, <strong>M</strong>essage <strong>O</strong>f <strong>T</strong>he <strong>D</strong>ay file (the contents of this file will be displayed by the server when a client machine connects) and </li>
<li><tt>/etc/rsyncd.scrt</tt>, the username and password pairs.</li>
</ol>
<p>To create the files on the server:<br />
<code>sudo nano /etc/rsyncd.conf</code></p>
<p>Now enter the following information into the <tt>rsyncd.conf</tt> file:</p>
<p><code>motd file = /etc/rsyncd.motd<br />
[backup]<br />
path = /media/backup<br />
comment = the path to the backup directory on the server<br />
uid = ubuntu<br />
gid = ubuntu<br />
read only = false<br />
auth users = ubuntu<br />
secrets file = /etc/rsyncd.scrt</code></p>
<p>Hit <tt>Ctrl-o</tt> to save and <tt>Ctrl-x</tt> to close nano.</p>
<p>The <tt>uid, gid, auth users</tt> are the users on the server. In the ssh session on the ec2 instance the user is <tt>ubuntu</tt>.</p>
<p>The format for the <tt>/etc/rsync.scrt</tt> file is<br />
<code>username:whatever_password_you_want</code></p>
<p>Use <tt>nano</tt> to put some arbitrary text into the <tt>/etc/rsync.motd</tt>.</p>
<p>Now you should have all the configuration information necessary, all that&#8217;s left to do is open the <tt>rsync</tt> port and start the daemon.</p>
<p>To open the port, open the <tt>/etc/default/rsync</tt> file, i.e.,</p>
<p><code>sudo nano /etc/default/rsync</code></p>
<p>and set <tt>RSYNC_ENABLE=true</tt>.</p>
<p>Here you might also specify another port than the default 873. Remember to open the port in the security group. Either with the AWS web interface in your browser or in the shell using the <tt>ec2-api-tools</tt>:<br />
<code>ec2-authorize default -p 873</code></p>
<p>Now to start the daemon,<br />
<code>sudo /etc/init.d/rsync restart</code><br />
and exit the <tt>SSH</tt> session.</p>
<h1>Syncing a folder</h1>
<p>Now you can use your local shell to push some folders or files to the server. Update the server side from the client machine with ec2-api-tools installed:<br />
<code>EXIP=`ec2din | grep INSTANCE | grep -v terminated |awk '{print $4}'`<br />
rsync -auv /home/rforge/articles ubuntu@$EXIP::backup/</code><br />
<tt>$EXIP</tt> would be the server ip address</p>
<p>This gets the IP of the server from the <tt>ec2-api-tool</tt> and passes it to <tt>RSYNC</tt>.</p>
<p>Otherwise you have to remember the IP of your instance from the web interface and substitut it for <tt>xxx.xxx.xxx.xxx</tt>:<br />
<code>rsync -auv /PATH/TO/FOLDER/ ubuntu@$xxx.xxx.xxx.xxx::backup/</code></p>
<p><tt>::backup</tt> has to match <tt>[backup]</tt> in the <tt>/etc/rsyncd.conf</tt> file. You will see the <tt>rsyncd.motd</tt> message and get prompted for the password in the <tt>rsyncd.scrt</tt> file. Then rsync starts the upload.</p>
<h1>A Script</h1>
<p>The following script should do the daemon setup after connecting to the server via <tt>ssh</tt> and mounting the volume. Keep me posted if something does not work.</p>
<p><code>echo "motd file = /etc/rsyncd.motd<br />
[backup]<br />
path = /media/backup<br />
comment = the path to the backup directory on the server<br />
uid = ubuntu<br />
gid = ubuntu<br />
read only = false<br />
auth users = ubuntu<br />
secrets file = /etc/rsyncd.scrt" &gt; rsyncd.conf<br />
sudo mv rsyncd.conf /etc/<br />
#<br />
sudo echo "Greetings! Give me the right password! Me want's it!" &gt; rsyncd.motd<br />
sudo mv rsyncd.motd /etc/<br />
#<br />
sudo echo "ubuntu:YourSecretPassword" &gt; rsyncd.scrt<br />
sudo mv rsyncd.scrt /etc/<br />
#<br />
sudo chmod 640 /etc/rsyncd.*<br />
sudo chown root:root /etc/rsyncd.*<br />
#<br />
## enable demon mode in the /etc/default/rsync file<br />
sudo cat /etc/default/rsync | sed 's/RSYNC_ENABLE=false/RSYNC_ENABLE=true/g' &gt; rsync<br />
sudo mv rsync /etc/default/<br />
sudo chown root:root /etc/default/rsync<br />
sudo chmod 644 /etc/default/rsync<br />
#<br />
sudo /etc/init.d/rsync restart # start the demon</code></p>
<br />  <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rforge.org&#038;blog=7577563&#038;post=722&#038;subd=rforge&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rforge.org/2011/11/16/data-backup-in-the-aws-cloud-with-rsync/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/2a4cc3be2c3e1c3b1442535ef7a46f42?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rforge</media:title>
		</media:content>
	</item>
		<item>
		<title>R function to transform continuous variable to categorical factor cut at n-tiles</title>
		<link>http://rforge.org/2011/11/06/r-function-to-transform-continuous-variable-to-categorical-factor-cut-at-n-tiles/</link>
		<comments>http://rforge.org/2011/11/06/r-function-to-transform-continuous-variable-to-categorical-factor-cut-at-n-tiles/#comments</comments>
		<pubDate>Sun, 06 Nov 2011 20:45:13 +0000</pubDate>
		<dc:creator>rforge</dc:creator>
				<category><![CDATA[Statistics]]></category>
		<category><![CDATA[Use R!]]></category>
		<category><![CDATA[categorical]]></category>
		<category><![CDATA[continuous]]></category>
		<category><![CDATA[n-tiles]]></category>
		<category><![CDATA[quantiles]]></category>
		<category><![CDATA[R]]></category>
		<category><![CDATA[transform]]></category>

		<guid isPermaLink="false">http://rforge.org/2011/11/06/r-function-to-transform-continuous-variable-to-categorical-factor-cut-at-n-tiles/</guid>
		<description><![CDATA[The cut() function can be used to transform a continuous variable into a categorical factor variable. The syntax is quite lengthy and if one wishes to cut at quartiles, quintiles or other n-tiles one has to include the quantile() function into the call. This is not very newbee friendly and if included into a model-call [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rforge.org&#038;blog=7577563&#038;post=715&#038;subd=rforge&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>The <tt>cut()</tt> function can be used to transform a continuous variable into a categorical factor variable. The syntax is quite lengthy and if one wishes to cut at quartiles, quintiles or other n-tiles one has to include the <tt>quantile()</tt> function into the call.</p>
<p>This is not very newbee friendly and if included into a model-call nearly ufnreadable.</p>
<p>The function in the code box <tt>cut.at.n.tile()</tt> does the job.</p>
<p><code><br />
cut.at.n.tile &lt;- function(X , n = 4){ cut( X , breaks = quantile( X , probs = (0:n)/n , na.rm = TRUE ) , include.lowest = TRUE )}<br />
</code></p>
<p>In order to cut the continuous variable <tt>Creatinine</tt> in the dataset <tt>Patients</tt> into deciles (n=10) the syntax is:<br />
<code>cut.at.n.tile( Patients$Creatinine , n = 10 )</code></p>
<p>No big deal, but maybe useful&#8230;</p>
<br />  <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rforge.org&#038;blog=7577563&#038;post=715&#038;subd=rforge&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rforge.org/2011/11/06/r-function-to-transform-continuous-variable-to-categorical-factor-cut-at-n-tiles/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/2a4cc3be2c3e1c3b1442535ef7a46f42?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rforge</media:title>
		</media:content>
	</item>
		<item>
		<title>Find BIOS version in Ubuntu</title>
		<link>http://rforge.org/2011/10/04/find-bios-version-in-ubuntu/</link>
		<comments>http://rforge.org/2011/10/04/find-bios-version-in-ubuntu/#comments</comments>
		<pubDate>Tue, 04 Oct 2011 10:45:42 +0000</pubDate>
		<dc:creator>rforge</dc:creator>
				<category><![CDATA[BASH]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[BIOS]]></category>
		<category><![CDATA[dmidecode]]></category>
		<category><![CDATA[number]]></category>
		<category><![CDATA[revision]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://rforge.org/?p=712</guid>
		<description><![CDATA[The dmidecode command line utility dumps a list of SMBIOS specifications to the standard output. In order to get the version number of the currently installed BIOS open a shell and sudo dmidecode --type 0 &#124; grep Revision The &#8211;type 0 option restricts the output to BIOS specific information and grep fishes for the revision [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rforge.org&#038;blog=7577563&#038;post=712&#038;subd=rforge&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>The dmidecode command line utility dumps a list of SMBIOS specifications to the standard output. In order to get the version number of the currently installed BIOS open a shell and<br />
<code>sudo dmidecode --type 0 | grep Revision</code></p>
<p>The &#8211;type 0 option restricts the output to BIOS specific information and grep fishes for the revision number.</p>
<p>On my X61s Thinkpad the resulting output is<br />
<code>BIOS Revision: 2.19<br />
Firmware Revision: 1.3</code></p>
<br />  <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rforge.org&#038;blog=7577563&#038;post=712&#038;subd=rforge&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rforge.org/2011/10/04/find-bios-version-in-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/2a4cc3be2c3e1c3b1442535ef7a46f42?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rforge</media:title>
		</media:content>
	</item>
		<item>
		<title>BASH: Convert Uppercase to Lowercase letters</title>
		<link>http://rforge.org/2011/09/12/bash-convert-uppercase-to-lowercase-letters/</link>
		<comments>http://rforge.org/2011/09/12/bash-convert-uppercase-to-lowercase-letters/#comments</comments>
		<pubDate>Mon, 12 Sep 2011 08:24:14 +0000</pubDate>
		<dc:creator>rforge</dc:creator>
				<category><![CDATA[BASH]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[lowercase]]></category>
		<category><![CDATA[tr]]></category>
		<category><![CDATA[transform]]></category>
		<category><![CDATA[uppercase]]></category>

		<guid isPermaLink="false">http://rforge.org/?p=710</guid>
		<description><![CDATA[Vivek Gite on nixCraft suggests tr to tranform uppercase letters in the textfile input.txt to lowercase and output the transformed text to output.txt. tr '[:upper:]' '[:lower:]' output.txt I needed to clean up a messy old scriptfile where I lost track of my variable naming convention. Very useful indeed<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rforge.org&#038;blog=7577563&#038;post=710&#038;subd=rforge&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.cyberciti.biz/faq/linux-unix-shell-programming-converting-lowercase-uppercase/" target="_blank">Vivek Gite on nixCraft</a> suggests <em>tr</em> to tranform uppercase letters in the textfile <em>input.txt</em> to lowercase and output the transformed text to <em>output.txt</em>.</p>
<p><code>tr '[:upper:]' '[:lower:]'  output.txt</code></p>
<p>I needed to clean up a messy old scriptfile where I lost track of my variable naming convention.</p>
<p>Very useful indeed <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<br />  <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rforge.org&#038;blog=7577563&#038;post=710&#038;subd=rforge&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rforge.org/2011/09/12/bash-convert-uppercase-to-lowercase-letters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/2a4cc3be2c3e1c3b1442535ef7a46f42?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rforge</media:title>
		</media:content>
	</item>
		<item>
		<title>Add public key behind a firewall in Ubuntu Shell</title>
		<link>http://rforge.org/2011/09/07/add-public-key-behind-a-firewall-in-ubuntu-shell/</link>
		<comments>http://rforge.org/2011/09/07/add-public-key-behind-a-firewall-in-ubuntu-shell/#comments</comments>
		<pubDate>Wed, 07 Sep 2011 12:03:10 +0000</pubDate>
		<dc:creator>rforge</dc:creator>
				<category><![CDATA[BASH]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Use R!]]></category>
		<category><![CDATA[apt-key]]></category>
		<category><![CDATA[cran]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[GPG]]></category>
		<category><![CDATA[keyserver]]></category>
		<category><![CDATA[port 80]]></category>
		<category><![CDATA[public key]]></category>
		<category><![CDATA[repository]]></category>

		<guid isPermaLink="false">http://rforge.org/?p=704</guid>
		<description><![CDATA[In short: Use sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80/ --recv-key E084DAB9 instead of sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key E084DAB9 This way you force port 80 which is usually clear. I got the idea from the answer of Phil Bradley on the superuser.com forum. He claimed that this would be fixed in Natty, but it isn&#8217;t [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rforge.org&#038;blog=7577563&#038;post=704&#038;subd=rforge&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>In short: Use<br />
<code>sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80/ --recv-key E084DAB9</code><br />
instead of<br />
<code>sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key E084DAB9</code><br />
This way you force port 80 which is usually clear.</p>
<p>I got the idea from the answer of <a href="http://superuser.com/questions/64922/how-to-work-around-blocked-outbound-hkp-port-for-apt-keys">Phil Bradley</a> on the superuser.com forum. He claimed that this would be fixed in Natty, but it isn&#8217;t although the configuration file he mentions has the port80 specification added by default, apt-key does not use it. The above snippet solves that.</p>
<p>For those Ubuntu users who have no idea what I am talking about:</p>
<p>Installing the newest R-version in Ubuntu requires to append the CRAN repository to you /etc/apt/sources.list. One might hit Alt+F2 and enter<br />
<code>gksu gedit /etc/apt/sources.list</code></p>
<p>With Xubuntu you would use mousepad instead of gedit. In any distro you can use<br />
<code>sudo nano /etc/apt/sources.list</code><br />
in a terminal.</p>
<p>Usually I add the line<br />
<code>deb <a href="http://cran.uib.no/bin/linux/ubuntu" rel="nofollow">http://cran.uib.no/bin/linux/ubuntu</a> natty/</code><br />
at the end of the file and update with<br />
<code>sudo apt-get update</code>.</p>
<p>CRAN at University of Bergen is closest to me. You might want another one (check the r-project.org site for mirrors).</p>
<p>apt-get update answers with a warning<br />
<code>GPG error: <a href="http://cran.uib.no" rel="nofollow">http://cran.uib.no</a> nat/ Release: The folowing signatures coldn't be verified because the public key is not abailable</code></p>
<p>That is not a problem. One can install R and packages anyway, but it is better to have the public key.</p>
<p>Behind a firewall (and many public and open hotspots block several ports) it is not possible to use</p>
<p><code>sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key E084DAB9</code></p>
<p>since the port through which the keyserver is contacted is blocked on most firewalls. You have to force port 80 by:<br />
<code>sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80/ --recv-key E084DAB9</code></p>
<p>After the key is added<br />
<code>sudo apt-get update<br />
sudo apt-get install R-recommended emacs ess</code><br />
proceeds without warning nor error.</p>
<br />  <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=rforge.org&#038;blog=7577563&#038;post=704&#038;subd=rforge&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://rforge.org/2011/09/07/add-public-key-behind-a-firewall-in-ubuntu-shell/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/2a4cc3be2c3e1c3b1442535ef7a46f42?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">rforge</media:title>
		</media:content>
	</item>
	</channel>
</rss>
