<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>kueda.net</title>
	<atom:link href="http://kueda.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://kueda.net</link>
	<description>I'm Back</description>
	<lastBuildDate>Thu, 02 Feb 2012 19:42:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>rvm gemset issues after rails 3 upgrade</title>
		<link>http://kueda.net/blog/2012/02/02/rvm-gemset-issues-after-rails-3-upgrade/</link>
		<comments>http://kueda.net/blog/2012/02/02/rvm-gemset-issues-after-rails-3-upgrade/#comments</comments>
		<pubDate>Thu, 02 Feb 2012 19:42:04 +0000</pubDate>
		<dc:creator>Ken-ichi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://kueda.net/?p=332</guid>
		<description><![CDATA[I was revisiting a Rails 3 upgrade last night, rolled things back this morning, and realized Rails was requiring all the wrong gems. Turned out the problem was I was using the global RVM gemset for all the Rails 3 gems, which, as the name would suggest, is for gems that are used by all [...]]]></description>
			<content:encoded><![CDATA[<p>I was revisiting a Rails 3 upgrade last night, rolled things back this morning, and realized Rails was requiring all the wrong gems.  Turned out the problem was I was using the global RVM gemset for all the Rails 3 gems, which, as the name would suggest, is for gems that are used by all gemsets.  Silly me.  Solution:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rvm <span style="color: #c20cb9; font-weight: bold;">env</span> <span style="color: #666666; font-style: italic;"># revealed the multiple gem paths</span>
rvm use ruby-1.8.7<span style="color: #000000; font-weight: bold;">@</span>global
&nbsp;
<span style="color: #666666; font-style: italic;"># http://geekystuff.net/2009/01/14/remove-all-ruby-gems/</span>
gem list <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-d</span><span style="color: #ff0000;">&quot; &quot;</span> <span style="color: #660033;">-f1</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">xargs</span> gem uninstall <span style="color: #660033;">-aIx</span>
&nbsp;
rvm gemset create rails3
rvm use ruby-1.8.7<span style="color: #000000; font-weight: bold;">@</span>rails3
<span style="color: #c20cb9; font-weight: bold;">git</span> checkout rails3 <span style="color: #666666; font-style: italic;"># branch for the upgrade w/ Gemfile etc</span>
bundle
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">git</span> checkout master
rvm use ruby-1.8.7<span style="color: #000000; font-weight: bold;">@</span>rails2
<span style="color: #666666; font-style: italic;"># everything back to normal</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://kueda.net/blog/2012/02/02/rvm-gemset-issues-after-rails-3-upgrade/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>integer out of range for Thinking Sphinx and Postgres</title>
		<link>http://kueda.net/blog/2011/07/21/integer-out-of-range-for-thinking-sphinx-and-postgres/</link>
		<comments>http://kueda.net/blog/2011/07/21/integer-out-of-range-for-thinking-sphinx-and-postgres/#comments</comments>
		<pubDate>Thu, 21 Jul 2011 19:18:22 +0000</pubDate>
		<dc:creator>Ken-ichi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[sphinx]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[thinkingsphinx]]></category>

		<guid isPermaLink="false">http://kueda.net/?p=325</guid>
		<description><![CDATA[I was running into the error described here, ERROR: index 'model_name_core': sql_range_query: ERROR: integer out of range so I re-compiled Postgres with 64 bit support and upgraded to a version of Thinking Sphinx that incorporated the patch (1.4.6), but still no dice. After manually re-running the SQL query Sphinx was using many times, I finally [...]]]></description>
			<content:encoded><![CDATA[<p>I was running into the error described <a href="https://github.com/freelancing-god/thinking-sphinx/issues/97">here</a>,</p>
<p><code>ERROR: index 'model_name_core': sql_range_query: ERROR: integer out of range</code></p>
<p>so I re-compiled Postgres with 64 bit support and upgraded to a version of Thinking Sphinx that incorporated the patch (1.4.6), but still no dice.  After manually re-running the SQL query Sphinx was using many times, I finally narrowed the problem down to a row with a date set in the year 8, as in 0008.  TS generates a SQL statement that extracts the epoch from date column and casts them as INTs, but this should have been cast as something bigger.  This was fixed in <a href="https://github.com/freelancing-god/thinking-sphinx/commit/d9f3df980a6f8441a17bc27eba86c079fe3e4d28">d9f3df980a6f8441a17b</a> with the <code>use_64_bit</code> config option, but that&#8217;s fix isn&#8217;t available in the 1.x line of TS, and the 2.x line doesn&#8217;t work with Rails 2.x, so I lose.</p>
<p>The problematic row was erroneous, so I fixed it and that repaired indexing, but I&#8217;m still running a potentially buggy version of TS. Ugh.</p>
<p>However, I did learn that <code>\x</code> enables vertical output in psql, much like <code>\G</code> does in mysql.  Yay.</p>
]]></content:encoded>
			<wfw:commentRss>http://kueda.net/blog/2011/07/21/integer-out-of-range-for-thinking-sphinx-and-postgres/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>curl cheat</title>
		<link>http://kueda.net/blog/2011/06/18/curl-cheat/</link>
		<comments>http://kueda.net/blog/2011/06/18/curl-cheat/#comments</comments>
		<pubDate>Sat, 18 Jun 2011 22:51:49 +0000</pubDate>
		<dc:creator>Ken-ichi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://kueda.net/?p=311</guid>
		<description><![CDATA[# post with HTTP Basic auth and file data curl -H 'X-Requested-With: XMLHttpRequest' --user username:password \ --form &#34;key=value&#34; \ --form file=@filename.jpg \ http://servername.com/endpoint]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># post with HTTP Basic auth and file data</span>
curl <span style="color: #660033;">-H</span> <span style="color: #ff0000;">'X-Requested-With: XMLHttpRequest'</span> <span style="color: #660033;">--user</span> username:password \
  <span style="color: #660033;">--form</span> <span style="color: #ff0000;">&quot;key=value&quot;</span> \
  <span style="color: #660033;">--form</span> <span style="color: #007800;">file</span>=<span style="color: #000000; font-weight: bold;">@</span>filename.jpg \
  http:<span style="color: #000000; font-weight: bold;">//</span>servername.com<span style="color: #000000; font-weight: bold;">/</span>endpoint</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://kueda.net/blog/2011/06/18/curl-cheat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Mapnik on an Ubuntu 8.04 Slice</title>
		<link>http://kueda.net/blog/2009/09/07/installing-mapnik-on-an-ubunto-8-04-slice/</link>
		<comments>http://kueda.net/blog/2009/09/07/installing-mapnik-on-an-ubunto-8-04-slice/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 20:40:18 +0000</pubDate>
		<dc:creator>Ken-ichi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[mapnik]]></category>
		<category><![CDATA[slicehost]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://kueda.net/?p=297</guid>
		<description><![CDATA[Just installed Mapnik on the iNat slice at Slicehost, which runs Ubuntu Hardy (8.04). Since the process was not exactly trivial, here&#8217;s what I ended up doing: # Get up to date and install deps # Docs: http://trac.mapnik.org/wiki/UbuntuInstallationOld aptitude update aptitude install binutils cpp-3.3 g++-3.3 gcc-3.3 gcc-3.3-base libboost-dev libboost-filesystem-dev libboost-filesystem1.34.1 libboost-iostreams-dev libboost-iostreams1.34.1 libboost-program-options-dev libboost-program-options1.34.1 libboost-python-dev [...]]]></description>
			<content:encoded><![CDATA[<p>Just installed Mapnik on the iNat slice at Slicehost, which runs Ubuntu Hardy (8.04).  Since the process was not exactly trivial, here&#8217;s what I ended up doing:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Get up to date and install deps</span>
<span style="color: #666666; font-style: italic;"># Docs: http://trac.mapnik.org/wiki/UbuntuInstallationOld</span>
<span style="color: #c20cb9; font-weight: bold;">aptitude</span> update
<span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> binutils cpp-<span style="color: #000000;">3.3</span> g++-<span style="color: #000000;">3.3</span> gcc-<span style="color: #000000;">3.3</span> gcc-<span style="color: #000000;">3.3</span>-base libboost-dev libboost-filesystem-dev libboost-filesystem1.34.1 libboost-iostreams-dev libboost-iostreams1.34.1 libboost-program-options-dev libboost-program-options1.34.1 libboost-python-dev libboost-python1.34.1 libboost-regex-dev libboost-regex1.34.1 libboost-serialization-dev libboost-serialization1.34.1 libboost-thread-dev libboost-thread1.34.1 libicu-dev libicu38 libstdc++<span style="color: #000000;">5</span> libstdc++<span style="color: #000000;">5</span>-<span style="color: #000000;">3.3</span>-dev python2.5-dev
<span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> libfreetype6 libfreetype6-dev libjpeg62 libjpeg62-dev libltdl3 libltdl3-dev libpng12-<span style="color: #000000;">0</span> libpng12-dev libtiff4 libtiff4-dev libtiffxx0c2 python-imaging python-imaging-dbg proj
<span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> libcairo2 libcairo2-dev python-cairo python-cairo-dev libcairomm-<span style="color: #000000;">1.0</span>-<span style="color: #000000;">1</span> libcairomm-<span style="color: #000000;">1.0</span>-dev libglib2.0-<span style="color: #000000;">0</span> libpixman-<span style="color: #000000;">1</span>-<span style="color: #000000;">0</span> libpixman-<span style="color: #000000;">1</span>-dev libpthread-stubs0 libpthread-stubs0-dev ttf-dejavu ttf-dejavu-core ttf-dejavu-extra
<span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> libgdal-dev python2.5-gdal
<span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> libxslt1.1 libxslt1-dev libxml2-dev libxml2
easy_install jonpy
easy_install lxml
&nbsp;
<span style="color: #666666; font-style: italic;"># Configure and instlall mapnik from source</span>
<span style="color: #666666; font-style: italic;"># Docs: http://trac.mapnik.org/wiki/UsingScons</span>
python scons<span style="color: #000000; font-weight: bold;">/</span>scons.py configure <span style="color: #007800;">INPUT_PLUGINS</span>=shape,gdal,ogr,sqlite
python scons<span style="color: #000000; font-weight: bold;">/</span>scons.py
python scons<span style="color: #000000; font-weight: bold;">/</span>scons.py <span style="color: #c20cb9; font-weight: bold;">install</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Make sure ld knows where to find the new libs</span>
<span style="color: #666666; font-style: italic;"># Thanks to http://www.drazzib.com/projets:openstreetmap:postgis_mapnik_tile_server</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;/usr/local/lib64&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>ld.so.conf.d<span style="color: #000000; font-weight: bold;">/</span>local.conf
ldconfig</pre></div></div>

<p>My main mistake was thinking that the python-mapnik package in Aptitude was going to cut mustard.  Didn&#8217;t even include OGR support!  Luckily the most recent Mapnik release (0.6.1) built just fine.  Still easier that installing under OS X.</p>
]]></content:encoded>
			<wfw:commentRss>http://kueda.net/blog/2009/09/07/installing-mapnik-on-an-ubunto-8-04-slice/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Moving a Rails app to Ruby Enterprise Edition</title>
		<link>http://kueda.net/blog/2009/08/28/moving-a-rails-app-to-ruby-enterprise-edition/</link>
		<comments>http://kueda.net/blog/2009/08/28/moving-a-rails-app-to-ruby-enterprise-edition/#comments</comments>
		<pubDate>Fri, 28 Aug 2009 20:03:25 +0000</pubDate>
		<dc:creator>Ken-ichi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[slicehost]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://kueda.net/?p=286</guid>
		<description><![CDATA[I just put iNaturalist.org on Ruby Enterprise Edition. Unfortunately, I&#8217;m really not seeing any savings in memory consumption, aside from the Passenger ApplicationSpawner taking up a few less MB. Kind of dissapointed. However, installing REE on my Mac was slightly less trivial than I was led to believe. Suffice it to say the REE installer [...]]]></description>
			<content:encoded><![CDATA[<p>I just put <a href="http://inaturalist.org">iNaturalist.org</a> on <a href="http://www.rubyenterpriseedition.com/">Ruby Enterprise Edition</a>.  Unfortunately, I&#8217;m really not seeing any savings in memory consumption, aside from the Passenger ApplicationSpawner taking up a few less MB.  Kind of dissapointed.</p>
<p>However, installing REE on my Mac was slightly less trivial than I was led to believe.  Suffice it to say the REE installer assumes you have dependent libs in <code>/usr</code> or <code>/usr/local</code>, and if you don&#8217;t, there aren&#8217;t any flags you can pass in to change that.  However, you can set ENV vars, so I was able to get the installer to work like this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">CC</span>=<span style="color: #c20cb9; font-weight: bold;">gcc</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">CXX</span>=<span style="color: #c20cb9; font-weight: bold;">g++</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> .<span style="color: #000000; font-weight: bold;">/</span>installer</pre></div></div>

<p>Basically, the REE installer checks deps by using Ruby to write and compile a C file, but it&#8217;s default path to gcc was not the same as the gcc I normally use.</p>
<p>After that, I had to make sure all my gems were in place.  I ended up installing rails, Hpricot, and ruby-debug (the latter 2 require compiled C) using REE&#8217;s own copy of rubygems, and I made sure the rest of our gems were vendorized.  REE&#8217;s rubygems is just like normal:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>ree<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>gem <span style="color: #c20cb9; font-weight: bold;">install</span> rails ruby-debug hpricot</pre></div></div>

<p>If you run into problems, make sure you&#8217;re tailing Apache&#8217;s error log and not just the Rails log, b/c that&#8217;s where Passenger will moan about its problems.</p>
<p>As I said, memory gains seem non-existent on our Ubuntu production machine, which is weird because I saw a 25% reduction in memory usage on my Macbook. </p>
]]></content:encoded>
			<wfw:commentRss>http://kueda.net/blog/2009/08/28/moving-a-rails-app-to-ruby-enterprise-edition/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using MySQL lat/lon Columns as a Mapnik Datasource</title>
		<link>http://kueda.net/blog/2009/05/04/mysql-as-mapnik-datasource/</link>
		<comments>http://kueda.net/blog/2009/05/04/mysql-as-mapnik-datasource/#comments</comments>
		<pubDate>Mon, 04 May 2009 05:07:28 +0000</pubDate>
		<dc:creator>Ken-ichi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[google maps]]></category>
		<category><![CDATA[inaturalist]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mapnik]]></category>
		<category><![CDATA[maps]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[ogr]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://kueda.net/?p=259</guid>
		<description><![CDATA[With the gracious help of Dane Springmeyer, I recently got Mapnik up and running on my Mac, so naturally the first thing I wanted to do was to plot iNaturalist observations. Mapnik will talk with a PostGIS database just fine, but it wont&#8217;t pull points from a MySQL database table, at least not directly. What [...]]]></description>
			<content:encoded><![CDATA[<p>With the gracious help of <a href="http://dbsgeo.com/" title="dbsgeo.com">Dane Springmeyer</a>, I recently got <a href="http://mapnik.org/" title="Mapnik C++/Python GIS Toolkit | Welcome">Mapnik</a> up and running on my Mac, so naturally the first thing I wanted to do was to plot <a href="http://inaturalist.org/" title="iNaturalist.org &middot; A Community for Naturalists">iNaturalist</a> observations.  Mapnik will talk with a PostGIS database just fine, but it wont&#8217;t pull points from a MySQL database table, at least not directly.  What it <em>does</em> support, though, is the all-powerful <a href="http://www.gdal.org/ogr/" title="OGR: OGR Simple Feature Library">OGR</a>.  Back when I used to use Mapserver, I had used OGR a few times to act as a bridge between simple lat/lon columns in a MySQL table and Mapserver (great description <a href="http://mapserver.org/input/vector/mysql.html" title="MySQL &mdash; MapServer 5.4.0 documentation">here</a>), so I figured the same would be possible in Mapnik.</p>
<p><span id="more-259"></span><br />
<h3>First Hurdle: Getting Mapnik to Show Anything At All</h3>
<p>First I made an OVF file so OGR would know how to talk to my database:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;OGRVRTDataSource<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;OGRVRTLayer</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;observations&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;SrcDataSource<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>MYSQL:inaturalist_development,user=root,tables=observations<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/SrcDataSource<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> 
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;SrcSQL<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>SELECT id, latitude, longitude, iconic_taxon_id FROM observations<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/SrcSQL<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> 
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;GeometryType<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>wkbPoint<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/GeometryType<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;GeometryField</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;PointFromColumns&quot;</span> <span style="color: #000066;">x</span>=<span style="color: #ff0000;">&quot;longitude&quot;</span> <span style="color: #000066;">y</span>=<span style="color: #ff0000;">&quot;latitude&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span> 
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/OGRVRTLayer<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/OGRVRTDataSource<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>and made sure it was working:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mapnik-inat <span style="color: #000000; font-weight: bold;">&gt;</span> ogrinfo inat.ovf
ERROR <span style="color: #000000;">4</span>: Update access not supported <span style="color: #000000; font-weight: bold;">for</span> VRT datasources.
Had to open data <span style="color: #7a0874; font-weight: bold;">source</span> read-only.
INFO: Open of <span style="color: #000000; font-weight: bold;">`</span>inat.ovf<span style="color: #ff0000;">'
      using driver `VRT'</span> successful.
<span style="color: #000000;">1</span>: observations <span style="color: #7a0874; font-weight: bold;">&#40;</span>Point<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>Then I basically modified the Mapnik tutorial to use the OGR virtual data source:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> mapnik
&nbsp;
<span style="color: #808080; font-style: italic;"># Setup the datasource and layer</span>
ds = mapnik.<span style="color: black;">Ogr</span><span style="color: black;">&#40;</span><span style="color: #008000;">file</span>=<span style="color: #483d8b;">&quot;inat.ovf&quot;</span>, layer=<span style="color: #483d8b;">&quot;observations&quot;</span><span style="color: black;">&#41;</span>
lyr = mapnik.<span style="color: black;">Layer</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'test lyr'</span><span style="color: black;">&#41;</span>
lyr.<span style="color: black;">datasource</span> = ds
&nbsp;
<span style="color: #808080; font-style: italic;"># Style the points using a simple PNG</span>
m = mapnik.<span style="color: black;">Map</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">600</span>, <span style="color: #ff4500;">300</span>, <span style="color: #483d8b;">&quot;+proj=latlong +datum=WGS84&quot;</span><span style="color: black;">&#41;</span>
s = mapnik.<span style="color: black;">Style</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
r = mapnik.<span style="color: black;">Rule</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
symbolizer = mapnik.<span style="color: black;">PointSymbolizer</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'mm_8_stemless_iNatGreen.png'</span>, <span style="color: #483d8b;">'png'</span>, <span style="color: #ff4500;">8</span>, <span style="color: #ff4500;">8</span><span style="color: black;">&#41;</span>
symbolizer.<span style="color: black;">allow_overlap</span> = <span style="color: #008000;">True</span>
r.<span style="color: black;">symbols</span>.<span style="color: black;">append</span><span style="color: black;">&#40;</span>symbolizer<span style="color: black;">&#41;</span>
s.<span style="color: black;">rules</span>.<span style="color: black;">append</span><span style="color: black;">&#40;</span>r<span style="color: black;">&#41;</span>
m.<span style="color: black;">append_style</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'My Style'</span>, s<span style="color: black;">&#41;</span>
lyr.<span style="color: black;">styles</span>.<span style="color: black;">append</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'My Style'</span><span style="color: black;">&#41;</span>
m.<span style="color: black;">layers</span>.<span style="color: black;">append</span><span style="color: black;">&#40;</span>lyr<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Zoom to the extent of the data and write the map to a PNG</span>
m.<span style="color: black;">zoom_to_box</span><span style="color: black;">&#40;</span>lyr.<span style="color: black;">envelope</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
mapnik.<span style="color: black;">render_to_file</span><span style="color: black;">&#40;</span>m, <span style="color: #483d8b;">'test.png'</span>, <span style="color: #483d8b;">'png'</span><span style="color: black;">&#41;</span></pre></div></div>

<p>And then I got a map!</p>
<p><img src="http://kueda.net/wp-content/uploads/2009/05/test.png" alt="test" title="test" width="600" height="300" class="aligncenter size-full wp-image-264" /></p>
<p>Ok, a kind of crappy map of test data, but actual, real, visible pixels!  So much better than arcane error messages!</p>
<h3>Second Hurdle: Google</h3>
<p>Of course, it&#8217;s just a map of some test points, but still, it worked.  Yay.  Next thing I wanted to do was to see how easy it would be to lay these points over a Google map, since one of the things I&#8217;d like to do with Mapnik is have a layer showing ALL observations on the iNat observation browser.  Turns out this was a piece of cake using <a href="http://bitbucket.org/springmeyer/tilelite/wiki/Home" title="springmeyer / TileLite / wiki / Home &mdash; bitbucket.org">tilelite</a>.</p>
<p>First I put my map configuration in an XML file, adding a bit of complexity using SQL filters to show different markers for different kinds of points (here corresponding to the IDs for different iconic taxa, e.g. plants, animals, fungi, etc.).</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Map</span> <span style="color: #000066;">srs</span>=<span style="color: #ff0000;">&quot;+proj=latlong +datum=WGS84&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Style</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;observationsStyle&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Rule<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>[iconic_taxon_id] = 47126<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;PointSymbolizer</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;mm_8_stemless_iNatGreen.png&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;png&quot;</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;8&quot;</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;8&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Rule<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Rule<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>[iconic_taxon_id] = 1 or [iconic_taxon_id] = 47178 or [iconic_taxon_id] = 3 or [iconic_taxon_id] = 20978 or [iconic_taxon_id] = 26036 or [iconic_taxon_id] = 40151<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;PointSymbolizer</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;mm_8_stemless_DodgerBlue.png&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;png&quot;</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;8&quot;</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;8&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Rule<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Rule<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>[iconic_taxon_id] = 47115 or [iconic_taxon_id] = 47119 or [iconic_taxon_id] = 47158<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;PointSymbolizer</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;mm_8_stemless_OrangeRed.png&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;png&quot;</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;8&quot;</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;8&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Rule<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Rule<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>[iconic_taxon_id] = 47170<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Filter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;PointSymbolizer</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;mm_8_stemless_DeepPink.png&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;png&quot;</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;8&quot;</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;8&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Rule<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Rule<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ElseFilter</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;PointSymbolizer</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;mm_8_stemless_unknown.png&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;png&quot;</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;8&quot;</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;8&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Rule<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Style<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Layer</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;observationsLayer&quot;</span> <span style="color: #000066;">srs</span>=<span style="color: #ff0000;">&quot;+proj=latlong +datum=WGS84&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;StyleName<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>observationsStyle<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/StyleName<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Datasource<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Parameter</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;type&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>ogr<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Parameter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Parameter</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;file&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>inat.ovf<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Parameter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Parameter</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;layer&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>observations<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Parameter<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Datasource<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Layer<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Map<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Then I fired up tilelite:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">tilelite <span style="color: #000000; font-weight: bold;">&gt;</span> python liteserv.py ~<span style="color: #000000; font-weight: bold;">/</span>projects<span style="color: #000000; font-weight: bold;">/</span>mapnik-inat<span style="color: #000000; font-weight: bold;">/</span>inatmap.xml
Using mapfile: <span style="color: #ff0000;">'/Users/kueda/projects/mapnik-inat/inatmap.xml'</span>
Listening on port <span style="color: #000000;">8000</span>...</pre></div></div>

<p>and added a new GTileLayer to my map:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> myCopyright <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> GCopyrightCollection<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> allObsLyr <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> GTileLayer<span style="color: #009900;">&#40;</span>myCopyright<span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">12</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>
  isPNG<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span>
  tileUrlTemplate<span style="color: #339933;">:</span> <span style="color: #3366CC;">'http://localhost:8000/{Z}/{X}/{Y}.png'</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> allObsOverlay <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> GTileLayerOverlay<span style="color: #009900;">&#40;</span>allObsLyr<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
map.<span style="color: #660066;">addOverlay</span><span style="color: #009900;">&#40;</span>window.<span style="color: #660066;">allObsOverlay</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>et voila:</p>
<p><a href="http://kueda.net/wp-content/uploads/2009/05/picture-1.png"><img src="http://kueda.net/wp-content/uploads/2009/05/picture-1-300x236.png" alt="Mapnik-rendered observation points on an iNat map." title="Mapnik-rendered observation points on an iNat map." width="300" height="236" class="aligncenter size-medium wp-image-265" /></a></p>
<p>I have no idea how scalable this kind of solution is, but I just wanted to show that it works.  It was my first real experiment with Mapnik, and I&#8217;m pretty happy with how simple things were after the decidedly unsimple installation process.</p>
]]></content:encoded>
			<wfw:commentRss>http://kueda.net/blog/2009/05/04/mysql-as-mapnik-datasource/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Backing up remote files with launchd and rsync</title>
		<link>http://kueda.net/blog/2009/01/06/backing-up-remote-files-with-launchd-and-rsync/</link>
		<comments>http://kueda.net/blog/2009/01/06/backing-up-remote-files-with-launchd-and-rsync/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 08:01:50 +0000</pubDate>
		<dc:creator>Ken-ichi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[launchd]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[rsync]]></category>

		<guid isPermaLink="false">http://kueda.net/?p=243</guid>
		<description><![CDATA[So I recently realized I was foolishly not backing up the database dumps for a project, and figured a good stopgap / semi-permanent solution would be to just rsync the backups that were stored on the server on a regular basis. Of course, the way to run periodic scripts in OS X is launchd, not [...]]]></description>
			<content:encoded><![CDATA[<p>So I recently realized I was foolishly <em>not</em> backing up the database dumps for a project, and figured a good stopgap / semi-permanent solution would be to just rsync the backups that were stored on the server on a regular basis.  Of course, the way to run periodic scripts in OS X is <a href="http://developer.apple.com/MacOsX/launchd.html" title="Getting Started with launchd">launchd</a>, not cron, so I figured I&#8217;d use this as an excuse to try that route.</p>
<p><span id="more-243"></span>I had everything seemingly set up, but I kept getting permission denied errors from rsync, even when exactly the same rsync command run manually from the command line worked fine.  The problem turned out to be that my private SSH key was password-protected.  I had forgotten about this b/c Terminal and Keychain had been magically handling that password for some time.  So I deleted that entry in Keychain and made a new public/private key pair.  Once that was done, all went smoothly.</p>
<p>Here&#8217;s a summary of what I did.</p>
<ol>
<li>
    Set up <a href="http://blogs.translucentcode.org/mick/archives/000230.html">passwordless SSH</a> <strong>without a password on the private key</strong>.
  </li>
<li>
    Added the following plist to ~/Library/LaunchAgents/</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #00bbdd;">&lt;!DOCTYPE plist PUBLIC </span>
<span style="color: #00bbdd;">  &quot;-//Apple Computer//DTD PLIST 1.0//EN&quot;  </span>
<span style="color: #00bbdd;">  &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;plist</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dict<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>  
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;key<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Label<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/key<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;string<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.projectname.backup<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/string<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;key<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>ProgramArguments<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/key<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;array<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;string<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/opt/local/bin/rsync<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/string<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;string<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>-avz<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/string<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;string<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>projectname.org:/path/to/backup/<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/string<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;string<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/path/to/local/backup/<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/string<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/array<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;key<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>LowPriorityIO<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/key<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;true</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;key<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Nice<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/key<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;integer<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/integer<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;key<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>StartCalendarInterval<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/key<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dict<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>  
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;key<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Hour<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/key<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;integer<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>22<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/integer<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;key<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Minute<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/key<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;integer<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>00<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/integer<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dict<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dict<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/plist<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

</li>
<li>
    Loaded the daemon script into launchd:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">launchctl load ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>LaunchAgents<span style="color: #000000; font-weight: bold;">/</span>org.projectname.backup</pre></div></div>

</li>
<li>
    Tested it and watched the log in Console:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">launchctl start org.projectname.backup</pre></div></div>

</li>
</ol>
<p>Now it should run every day at 10pm.</p>
<p>Here are some resources I found useful:</p>
<ul>
<li><a href="http://developer.apple.com/MacOsX/launchd.html" title="Getting Started with launchd">Getting Started with launchd</a></li>
<li><a href="http://developer.apple.com/documentation/Darwin/Reference/ManPages/man5/launchd.plist.5.html#//apple_ref/doc/man/5/launchd.plist" title="Mac OS X<br />
   Manual Page For launchd.plist(5)">man page for the launchd plist format</a></li>
<li>This <a href="http://discussions.apple.com/message.jspa?messageID=8668322">Apple Support discussion</a> lead me on the path to my problem</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://kueda.net/blog/2009/01/06/backing-up-remote-files-with-launchd-and-rsync/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple Shell Script for Installing TextMate Bundles</title>
		<link>http://kueda.net/blog/2008/10/14/simple-shell-script-for-installing-textmate-bundles/</link>
		<comments>http://kueda.net/blog/2008/10/14/simple-shell-script-for-installing-textmate-bundles/#comments</comments>
		<pubDate>Wed, 15 Oct 2008 01:56:27 +0000</pubDate>
		<dc:creator>Ken-ichi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://kueda.net/?p=225</guid>
		<description><![CDATA[You need to have svn installed, of course. If you want to improve it, here&#8217;s the gist. #!/bin/bash tmsupportpath=&#34;/Library/Application Support/TextMate&#34; bundlepath=&#34;$tmsupportpath/Bundles&#34; if &#91; ! -d &#34;$bundlepath&#34; &#93; then echo &#34;First time, eh? Making $bundlepath...&#34; mkdir -p &#34;$bundlepath&#34; fi &#160; if &#91; ! -d &#34;$tmsupportpath/Support&#34; &#93; then cd &#34;$tmsupportpath&#34; echo &#34;Checking out the most recent Support [...]]]></description>
			<content:encoded><![CDATA[<p>You need to have svn installed, of course.  If you want to improve it, <a href="http://gist.github.com/16739">here&#8217;s the gist</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #007800;">tmsupportpath</span>=<span style="color: #ff0000;">&quot;/Library/Application Support/TextMate&quot;</span>
<span style="color: #007800;">bundlepath</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$tmsupportpath</span>/Bundles&quot;</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$bundlepath</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
  <span style="color: #000000; font-weight: bold;">then</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;First time, eh?  Making <span style="color: #007800;">$bundlepath</span>...&quot;</span>
  <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$bundlepath</span>&quot;</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$tmsupportpath</span>/Support&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
  <span style="color: #000000; font-weight: bold;">then</span> 
  <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$tmsupportpath</span>&quot;</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Checking out the most recent Support folder...&quot;</span>
  <span style="color: #c20cb9; font-weight: bold;">svn</span> <span style="color: #c20cb9; font-weight: bold;">co</span> http:<span style="color: #000000; font-weight: bold;">//</span>macromates.com<span style="color: #000000; font-weight: bold;">/</span>svn<span style="color: #000000; font-weight: bold;">/</span>Bundles<span style="color: #000000; font-weight: bold;">/</span>trunk<span style="color: #000000; font-weight: bold;">/</span>Support
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$bundlepath</span>&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">svn</span> <span style="color: #c20cb9; font-weight: bold;">co</span> http:<span style="color: #000000; font-weight: bold;">//</span>macromates.com<span style="color: #000000; font-weight: bold;">/</span>svn<span style="color: #000000; font-weight: bold;">/</span>Bundles<span style="color: #000000; font-weight: bold;">/</span>trunk<span style="color: #000000; font-weight: bold;">/</span>Bundles<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$1</span>.tmbundle
<span style="color: #c20cb9; font-weight: bold;">svn</span> up <span style="color: #000000; font-weight: bold;">*</span>.tmbundle
osascript <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'tell app &quot;TextMate&quot; to reload bundles'</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$tmsupportpath</span>/Support&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">svn</span> up</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://kueda.net/blog/2008/10/14/simple-shell-script-for-installing-textmate-bundles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Living in a Shipping Container &#8230; On a Boat</title>
		<link>http://kueda.net/blog/2008/10/06/living-in-a-shipping-container-on-a-boat/</link>
		<comments>http://kueda.net/blog/2008/10/06/living-in-a-shipping-container-on-a-boat/#comments</comments>
		<pubDate>Tue, 07 Oct 2008 03:40:30 +0000</pubDate>
		<dc:creator>Ken-ichi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[future]]></category>
		<category><![CDATA[ideas]]></category>
		<category><![CDATA[stories]]></category>
		<category><![CDATA[writing]]></category>

		<guid isPermaLink="false">http://kueda.net/?p=221</guid>
		<description><![CDATA[Andrew and I were recalling BBC&#8217;s The Box today when I wondered if people have tried living in shipping containers.  I know there have been many efforts to sell prefab homes based on shipping containers as low-cost, eco-friendly housing solutions, but I&#8217;ve never heard of someone living in one while it was shipped around the [...]]]></description>
			<content:encoded><![CDATA[<p>Andrew and I were recalling BBC&#8217;s <a href="http://news.bbc.co.uk/2/hi/in_depth/629/629/7600053.stm">The Box</a> today when I wondered if people have tried living in shipping containers.  I know there have <a href="http://www.fabprefab.com/fabfiles/containerbayhome.htm">been</a> <a href="http://www.pfnc.net/residence.htm">many</a> <a href="http://www.shipping-container-housing.com/">efforts</a> to sell prefab homes based on shipping containers as low-cost, eco-friendly housing solutions, but I&#8217;ve never heard of someone living in one while it was shipped around the world.</p>
<p>I thought this might be a cool idea for a story: who lives in shipping container communities on boats and at port?  What kind of relationships and norms form under such fleeting conditions?  Could this ever be economically feasible if <a href="http://wiki.answers.com/Q/How_much_does_it_cost_to_ship_a_full_40-foot_or_12-meter_container_from_China_to_the_US">shipping a container from China to the US costs $8000</a>?  Any ship carrying house containers could carry freight beneath them, but I guess the only way it could work is if passengers were willing to pay as much or more than their weight in freight was worth.</p>
<p>I also started thinking about how this might work in space.  Rotating container bays for simulated gravity?  Completely self-sufficient shipping container space homes?</p>
]]></content:encoded>
			<wfw:commentRss>http://kueda.net/blog/2008/10/06/living-in-a-shipping-container-on-a-boat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deleting Unversioned SVN Files</title>
		<link>http://kueda.net/blog/2008/09/19/deleting-unversioned-svn-files/</link>
		<comments>http://kueda.net/blog/2008/09/19/deleting-unversioned-svn-files/#comments</comments>
		<pubDate>Fri, 19 Sep 2008 05:47:39 +0000</pubDate>
		<dc:creator>Ken-ichi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://kueda.net/?p=216</guid>
		<description><![CDATA[Here&#8217;s a silly bash trick that will delete all unversioned SVN files svn st &#124; grep &#34;^?&#34; &#124; sed s/?&#91;&#91;:space:&#93;&#93;*// &#124; xargs rm -rf Use with care, obviously. If there&#8217;s a more concise method, please let me know. And here&#8217;s how you might use similar commands to apply fmresolve to all conflicted files, and then [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a silly bash trick that will delete all unversioned SVN files</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">svn</span> st <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;^?&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> s<span style="color: #000000; font-weight: bold;">/</span>?<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>:space:<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #000000; font-weight: bold;">*//</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-rf</span></pre></div></div>

<p>Use with care, obviously.  If there&#8217;s a more concise method, please let me know.</p>
<p>And here&#8217;s how you might use similar commands to apply <code>fmresolve</code> to all conflicted files, and then resolve them.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">for</span> f <span style="color: #000000; font-weight: bold;">in</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">svn</span> st <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;^C&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> s<span style="color: #000000; font-weight: bold;">/</span>C<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>:space:<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #000000; font-weight: bold;">*//</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>; <span style="color: #000000; font-weight: bold;">do</span> fmresolve <span style="color: #007800;">$f</span>; <span style="color: #000000; font-weight: bold;">done</span>
<span style="color: #c20cb9; font-weight: bold;">svn</span> st <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;^C&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> s<span style="color: #000000; font-weight: bold;">/</span>C<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>:space:<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #000000; font-weight: bold;">*//</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #c20cb9; font-weight: bold;">svn</span> resolved</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://kueda.net/blog/2008/09/19/deleting-unversioned-svn-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

