<?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>Accent français</title>
	<atom:link href="http://www.battestini.net/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.battestini.net/blog</link>
	<description>French rambling from California</description>
	<lastBuildDate>Wed, 23 Nov 2011 07:48:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Debian and Postgres &#8211; missing  locales</title>
		<link>http://www.battestini.net/blog/2011/11/22/debian-and-postgres-missing-locales/</link>
		<comments>http://www.battestini.net/blog/2011/11/22/debian-and-postgres-missing-locales/#comments</comments>
		<pubDate>Wed, 23 Nov 2011 07:48:36 +0000</pubDate>
		<dc:creator>Agathe Battestini</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[createdb]]></category>
		<category><![CDATA[encoding]]></category>
		<category><![CDATA[en_us]]></category>
		<category><![CDATA[locale]]></category>
		<category><![CDATA[locales]]></category>
		<category><![CDATA[postgres]]></category>
		<category><![CDATA[utf8]]></category>

		<guid isPermaLink="false">http://www.battestini.net/blog/?p=564</guid>
		<description><![CDATA[Problem: (postgres)-# create database "newdb" WITH ENCODING = 'UTF8' LC_CTYPE='en_US.utf8' LC_COLLATE='en_US.utf8' TEMPLATE template0; createdb: database creation failed: ERROR: encoding UTF8 does not match locale en_US DETAIL: The chosen LC_CTYPE setting requires encoding LATIN1. 1 2 3 (postgres)-# create database "newdb" WITH ENCODING = 'UTF8' LC_CTYPE='en_US.utf8' LC_COLLATE='en_US.utf8' TEMPLATE template0; createdb: database creation failed: ERROR: encoding UTF8 [...]]]></description>
			<content:encoded><![CDATA[<div class="al2fb_like_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=316709205009353&amp;xfbml=1" type="text/javascript"></script>
<fb:like href="http://www.battestini.net/blog/2011/11/22/debian-and-postgres-missing-locales/" layout="standard" show_faces="true" width="450" action="like" font="arial" colorscheme="light" ref="AL2FB"></fb:like></div><p>Problem:</p>
<div class="highlight-wrapper sh">
<div class="tools">
<div class="wrap"></div>
</div>
<pre class="raw"><code lang="sh">(postgres)-# create database "newdb" WITH ENCODING = 'UTF8' LC_CTYPE='en_US.utf8' LC_COLLATE='en_US.utf8' TEMPLATE template0;
createdb: database creation failed: ERROR:  encoding UTF8 does not match locale en_US
DETAIL:  The chosen LC_CTYPE setting requires encoding LATIN1.
</code></pre>
<div class="highlighted">
<table class="highlighttable">
<tr>
<td class="linenos">
<div class="linenodiv">
<pre class="nl">1
2
3</pre>
</div>
</td>
<td class="code">
<div class="highlight">
<pre><span class="o">(</span>postgres<span class="o">)</span>-# create database <span class="s2">"newdb"</span> WITH <span class="nv">ENCODING</span> <span class="o">=</span> <span class="s1">'UTF8'</span> <span class="nv">LC_CTYPE</span><span class="o">=</span><span class="s1">'en_US.utf8'</span> <span class="nv">LC_COLLATE</span><span class="o">=</span><span class="s1">'en_US.utf8'</span> TEMPLATE template0;
createdb: database creation failed: ERROR:  encoding UTF8 does not match locale en_US
DETAIL:  The chosen LC_CTYPE setting requires encoding LATIN1.
</pre>
</div>
</td>
</tr>
</table>
</div>
</div>
<p>Check what locales you have</p>
<div class="highlight-wrapper sh">
<div class="tools">
<div class="wrap"></div>
</div>
<pre class="raw"><code lang="sh"># locale -a
C
C.UTF-8
en_US
en_US.iso88591
POSIX
</code></pre>
<div class="highlighted">
<table class="highlighttable">
<tr>
<td class="linenos">
<div class="linenodiv">
<pre class="nl">1
2
3
4
5
6</pre>
</div>
</td>
<td class="code">
<div class="highlight">
<pre><span class="c"># locale -a</span>
C
C.UTF-8
en_US
en_US.iso88591
POSIX
</pre>
</div>
</td>
</tr>
</table>
</div>
</div>
<p>If locales are not installed:</p>
<div class="highlight-wrapper sh">
<div class="tools">
<div class="wrap"></div>
</div>
<pre class="raw"><code lang="sh"># apt-get install debconf</code></pre>
<div class="highlighted">
<table class="highlighttable">
<tr>
<td class="linenos">
<div class="linenodiv">
<pre class="nl">1</pre>
</div>
</td>
<td class="code">
<div class="highlight">
<pre><span class="c"># apt-get install debconf</span>
</pre>
</div>
</td>
</tr>
</table>
</div>
</div>
<p>To add en_US.UTF8, run:</p>
<div class="highlight-wrapper sh">
<div class="tools">
<div class="wrap"></div>
</div>
<pre class="raw"><code lang="sh"># dpkg-reconfigure locales</code></pre>
<div class="highlighted">
<table class="highlighttable">
<tr>
<td class="linenos">
<div class="linenodiv">
<pre class="nl">1</pre>
</div>
</td>
<td class="code">
<div class="highlight">
<pre><span class="c"># dpkg-reconfigure locales</span>
</pre>
</div>
</td>
</tr>
</table>
</div>
</div>
<p>And select the locales you want (en_US.UTF8)</p>
<p>Now:</p>
<div class="highlight-wrapper sh">
<div class="tools">
<div class="wrap"></div>
</div>
<pre class="raw"><code lang="sh"># locale -a
C
C.UTF-8
en_US
en_US.iso88591
en_US.utf8
POSIX
</code></pre>
<div class="highlighted">
<table class="highlighttable">
<tr>
<td class="linenos">
<div class="linenodiv">
<pre class="nl">1
2
3
4
5
6
7</pre>
</div>
</td>
<td class="code">
<div class="highlight">
<pre><span class="c"># locale -a</span>
C
C.UTF-8
en_US
en_US.iso88591
en_US.utf8
POSIX
</pre>
</div>
</td>
</tr>
</table>
</div>
</div>
<p>You need to restart postgres:</p>
<div class="highlight-wrapper sh">
<div class="tools">
<div class="wrap"></div>
</div>
<pre class="raw"><code lang="sh"># /usr/lib/postgresql/8.4/bin/pg_ctl restart -D /var/lib/postgresql/8.4/main
</code></pre>
<div class="highlighted">
<table class="highlighttable">
<tr>
<td class="linenos">
<div class="linenodiv">
<pre class="nl">1</pre>
</div>
</td>
<td class="code">
<div class="highlight">
<pre><span class="c"># /usr/lib/postgresql/8.4/bin/pg_ctl restart -D /var/lib/postgresql/8.4/main</span>
</pre>
</div>
</td>
</tr>
</table>
</div>
</div>
<p>Now rerun:</p>
<div class="highlight-wrapper sh">
<div class="tools">
<div class="wrap"></div>
</div>
<pre class="raw"><code lang="sh">(postgres)-# create database "newdb" WITH ENCODING = 'UTF8' LC_CTYPE='en_US.utf8' LC_COLLATE='en_US.utf8' TEMPLATE template0;</code></pre>
<div class="highlighted">
<table class="highlighttable">
<tr>
<td class="linenos">
<div class="linenodiv">
<pre class="nl">1</pre>
</div>
</td>
<td class="code">
<div class="highlight">
<pre><span class="o">(</span>postgres<span class="o">)</span>-# create database <span class="s2">"newdb"</span> WITH <span class="nv">ENCODING</span> <span class="o">=</span> <span class="s1">'UTF8'</span> <span class="nv">LC_CTYPE</span><span class="o">=</span><span class="s1">'en_US.utf8'</span> <span class="nv">LC_COLLATE</span><span class="o">=</span><span class="s1">'en_US.utf8'</span> TEMPLATE template0;
</pre>
</div>
</td>
</tr>
</table>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.battestini.net/blog/2011/11/22/debian-and-postgres-missing-locales/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick solution for sudo issue with missing pam configuration file</title>
		<link>http://www.battestini.net/blog/2011/11/21/quick-solution-for-sudo-issue-with-missing-pam-configuration-file/</link>
		<comments>http://www.battestini.net/blog/2011/11/21/quick-solution-for-sudo-issue-with-missing-pam-configuration-file/#comments</comments>
		<pubDate>Mon, 21 Nov 2011 21:57:26 +0000</pubDate>
		<dc:creator>Agathe Battestini</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[pam]]></category>
		<category><![CDATA[sudo]]></category>
		<category><![CDATA[system]]></category>

		<guid isPermaLink="false">http://www.battestini.net/blog/?p=558</guid>
		<description><![CDATA[Spent a bit too long fixing a sudo problem right after an apt-get upgrade on a Debian machine. The original problem: # sudo ls sudo: unable to initialize PAM: No such file or directory 1 2 # sudo ls sudo: unable to initialize PAM: No such file or directory Sudo errors are logged with syslog [...]]]></description>
			<content:encoded><![CDATA[<div class="al2fb_like_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=316709205009353&amp;xfbml=1" type="text/javascript"></script>
<fb:like href="http://www.battestini.net/blog/2011/11/21/quick-solution-for-sudo-issue-with-missing-pam-configuration-file/" layout="standard" show_faces="true" width="450" action="like" font="arial" colorscheme="light" ref="AL2FB"></fb:like></div><p>Spent a bit too long fixing a sudo problem right after an apt-get upgrade on a Debian machine.</p>
<p>The original problem:</p>
<div class="highlight-wrapper sh">
<div class="tools">
<div class="wrap"></div>
</div>
<pre class="raw"><code lang="sh"># sudo ls
sudo: unable to initialize PAM: No such file or directory</code></pre>
<div class="highlighted">
<table class="highlighttable">
<tr>
<td class="linenos">
<div class="linenodiv">
<pre class="nl">1
2</pre>
</div>
</td>
<td class="code">
<div class="highlight">
<pre><span class="c"># sudo ls</span>
sudo: unable to initialize PAM: No such file or directory
</pre>
</div>
</td>
</tr>
</table>
</div>
</div>
<p>Sudo errors are logged with syslog by default. Some message should be in one of the /var/log/xx.log files. If you don&#8217;t know which, run</p>
<div class="highlight-wrapper sh">
<div class="tools">
<div class="wrap"></div>
</div>
<pre class="raw"><code lang="sh"># cd /var/log
# grep pam *.log
auth.log:Nov 21 22:35:14 mach sudo: PAM _pam_load_conf_file: unable to open /etc/pam.d/common-session-noninteractive
auth.log:Nov 21 22:35:14 mach sudo: PAM _pam_init_handlers: error reading /etc/pam.d/sudo
auth.log:Nov 21 22:35:14 mach sudo: PAM _pam_init_handlers: [Critical error - immediate abort]
auth.log:Nov 21 22:35:14 mach sudo: PAM pam_start: failed to initialize handlers
auth.log:Nov 21 22:35:14 mach sudo: PAM pam_end: NULL pam handle passed
</code></pre>
<div class="highlighted">
<table class="highlighttable">
<tr>
<td class="linenos">
<div class="linenodiv">
<pre class="nl">1
2
3
4
5
6
7</pre>
</div>
</td>
<td class="code">
<div class="highlight">
<pre><span class="c"># cd /var/log</span>
<span class="c"># grep pam *.log</span>
auth.log:Nov 21 22:35:14 mach sudo: PAM _pam_load_conf_file: unable to open /etc/pam.d/common-session-noninteractive
auth.log:Nov 21 22:35:14 mach sudo: PAM _pam_init_handlers: error reading /etc/pam.d/sudo
auth.log:Nov 21 22:35:14 mach sudo: PAM _pam_init_handlers: <span class="o">[</span>Critical error - immediate abort<span class="o">]</span>
auth.log:Nov 21 22:35:14 mach sudo: PAM pam_start: failed to initialize handlers
auth.log:Nov 21 22:35:14 mach sudo: PAM pam_end: NULL pam handle passed
</pre>
</div>
</td>
</tr>
</table>
</div>
</div>
<p>One configuration file was missing. This <a href="http://www.rjsystems.nl/en/2100-pam-debian.php#deb6">PAM debian page</a> told me what the file was supposed to contain. Somehow that file was not created in the upgrade. </p>
<div class="highlight-wrapper sh">
<div class="tools">
<div class="wrap"></div>
</div>
<pre class="raw"><code lang="sh"># cat /etc/pam.d/common-session-noninteractive
session		[default=1]						pam_permit.so
session		requisite						pam_deny.so
session		required						pam_permit.so
session		required						pam_unix.so
</code></pre>
<div class="highlighted">
<table class="highlighttable">
<tr>
<td class="linenos">
<div class="linenodiv">
<pre class="nl">1
2
3
4
5</pre>
</div>
</td>
<td class="code">
<div class="highlight">
<pre><span class="c"># cat /etc/pam.d/common-session-noninteractive</span>
session		<span class="o">[</span><span class="nv">default</span><span class="o">=</span>1<span class="o">]</span>						pam_permit.so
session		requisite						pam_deny.so
session		required						pam_permit.so
session		required						pam_unix.so
</pre>
</div>
</td>
</tr>
</table>
</div>
</div>
<p>Fixed. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.battestini.net/blog/2011/11/21/quick-solution-for-sudo-issue-with-missing-pam-configuration-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>10 days road trip</title>
		<link>http://www.battestini.net/blog/2011/11/10/10-days-road-trip/</link>
		<comments>http://www.battestini.net/blog/2011/11/10/10-days-road-trip/#comments</comments>
		<pubDate>Thu, 10 Nov 2011 10:09:23 +0000</pubDate>
		<dc:creator>Agathe Battestini</dc:creator>
				<category><![CDATA[maps]]></category>
		<category><![CDATA[Travel]]></category>
		<category><![CDATA[california]]></category>
		<category><![CDATA[flickr]]></category>
		<category><![CDATA[foursquare]]></category>
		<category><![CDATA[map]]></category>
		<category><![CDATA[mashup]]></category>
		<category><![CDATA[oregon]]></category>
		<category><![CDATA[Photos]]></category>
		<category><![CDATA[road trip]]></category>
		<category><![CDATA[travel]]></category>
		<category><![CDATA[washington]]></category>

		<guid isPermaLink="false">http://www.battestini.net/blog/?p=543</guid>
		<description><![CDATA[Last Friday I came back from a 10 day road trip driving from San Francisco to Seattle, and coming back with the Amtrak Coast Starlight train &#8211; as I mentioned earlier. I used Foursquare a bit more than usual (about 50 checkings over 10 days) and took a lot of pictures of rocks, landscapes, forests, [...]]]></description>
			<content:encoded><![CDATA[<div class="al2fb_like_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=316709205009353&amp;xfbml=1" type="text/javascript"></script>
<fb:like href="http://www.battestini.net/blog/2011/11/10/10-days-road-trip/" layout="standard" show_faces="true" width="450" action="like" font="arial" colorscheme="light" ref="AL2FB"></fb:like></div><p>Last Friday I came back from a 10 day road trip driving from San Francisco to Seattle, and coming back with the Amtrak Coast Starlight train &#8211; as I mentioned <a href="http://www.battestini.net/blog/?p=486">earlier</a>.</p>
<p>I used Foursquare a bit more than usual (about 50 checkings over 10 days) and took a lot of pictures of rocks, landscapes, forests, the ocean, etc.<br />
I started making a simple mashups to visualize the overall itinerary I ended up doing.</p>
<p><iframe src="http://battestini.net/projbox/FoursquareFlickrMap/ffmap.html" width="100%" height="500"><img src="http://battestini.net/projbox/FoursquareFlickrMap/screenshot.png" alt=""></iframe></p>
<p><a href="http://battestini.net/projbox/FoursquareFlickrMap/ffmap.html">View full screen</a> (Pink bubbles have photos. Blue bubbles are the checkins on the way to Seattle. Yellow bubbles are the checkins on the way back to San Francisco.)</p>
<p>I have <a href="http://www.flickr.com/photos/agatheb/collections/72157628014891532/" target="bbphotos">photos on Flickr</a>.</p>
<p>Some highlights:</p>
<ul>
<li>1990 miles / 3200 km driven from SF to Seattle in 8 days.</li>
<li>Very nice weather except the day I drived through Crater Lake, which I could not see at all because of the fog.</li>
<li>Not many tourists or anyone on the roads end of October.</li>
<li>I loved all the coastal areas, and especially the <a href="http://www.nps.gov/olym/index.htm">Olympic National Park</a>.</li>
<li>I ended up staying in campgrounds most of the nights, in the middle of a forest or close to the ocean, with barely anyone around. That was awesome.</li>
<li>It&#8217;s not easy to find the cheap / non-RV campgrounds where you can put a tent or just sleep in the car.</li>
<li>All the roads were surprisingly well maintained (I&#8217;m too used to the bad roads of south SF).</li>
<li>I really liked the cities of Bend and Portland in Oregon. Seattle, WA&#8230; not as much but that was at the end of my trip. Redding, CA was weird.</li>
<li>I think I expected a bit more from the train trip (23 hours from Seattle to San Francisco). That was really comfortable but as I was into a good book, and we were going through areas I had driven across, I did not pay much attention to the landscape.</li>
</ul>
<p>I put the code for the mashup on <a href="https://github.com/agathe/FoursquareFlickrMap">github</a>.  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.battestini.net/blog/2011/11/10/10-days-road-trip/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Adding FormAlchemy to an existing Pylons Mapfish project</title>
		<link>http://www.battestini.net/blog/2011/11/09/adding-formalchemy-to-an-existing-pylons-mapfish-project/</link>
		<comments>http://www.battestini.net/blog/2011/11/09/adding-formalchemy-to-an-existing-pylons-mapfish-project/#comments</comments>
		<pubDate>Thu, 10 Nov 2011 01:50:26 +0000</pubDate>
		<dc:creator>Agathe Battestini</dc:creator>
				<category><![CDATA[maps]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[formalchemy]]></category>
		<category><![CDATA[geoformalchemy]]></category>
		<category><![CDATA[map]]></category>
		<category><![CDATA[mapfish]]></category>
		<category><![CDATA[pylons]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[sqlalchemy]]></category>

		<guid isPermaLink="false">http://www.battestini.net/blog/?p=507</guid>
		<description><![CDATA[  Install the packages: % pip install FormAlchemy fa.query GeoFormAlchemy 1 % pip install FormAlchemy fa.query GeoFormAlchemy You have now more templates available: % paster create --list-templates basic_package: A basic setuptools-enabled package geo_fa: Pylons application template with GeoFormAlchemy support mapfish: MapFish application template mapfish_client: MapFish client plugin template paste_deploy: A web application deployed through paste.deploy [...]]]></description>
			<content:encoded><![CDATA[<div class="al2fb_like_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=316709205009353&amp;xfbml=1" type="text/javascript"></script>
<fb:like href="http://www.battestini.net/blog/2011/11/09/adding-formalchemy-to-an-existing-pylons-mapfish-project/" layout="standard" show_faces="true" width="450" action="like" font="arial" colorscheme="light" ref="AL2FB"></fb:like></div><p> </p>
<ul>
<li>Install the packages:</li>
</ul>
<div class="highlight-wrapper sh">
<div class="tools">
<div class="wrap"></div>
</div>
<pre class="raw"><code lang="sh">% pip install FormAlchemy fa.query GeoFormAlchemy</code></pre>
<div class="highlighted">
<table class="highlighttable">
<tr>
<td class="linenos">
<div class="linenodiv">
<pre class="nl">1</pre>
</div>
</td>
<td class="code">
<div class="highlight">
<pre>% pip install FormAlchemy fa.query GeoFormAlchemy
</pre>
</div>
</td>
</tr>
</table>
</div>
</div>
<ul>
<li>You have now more templates available:</li>
</ul>
<div class="highlight-wrapper sh">
<div class="tools">
<div class="wrap"></div>
</div>
<pre class="raw"><code lang="sh">% paster create --list-templates
  basic_package:   A basic setuptools-enabled package
  geo_fa:          Pylons application template with GeoFormAlchemy support
  mapfish:         MapFish application template
  mapfish_client:  MapFish client plugin template
  paste_deploy:    A web application deployed through paste.deploy
  pylons:          Pylons application template
  pylons_fa:       Pylons application template with formalchemy support
  pylons_minimal:  Pylons minimal application template</code></pre>
<div class="highlighted">
<table class="highlighttable">
<tr>
<td class="linenos">
<div class="linenodiv">
<pre class="nl">1
2
3
4
5
6
7
8
9</pre>
</div>
</td>
<td class="code">
<div class="highlight">
<pre>% paster create --list-templates
  basic_package:   A basic setuptools-enabled package
  geo_fa:          Pylons application template with GeoFormAlchemy support
  mapfish:         MapFish application template
  mapfish_client:  MapFish client plugin template
  paste_deploy:    A web application deployed through paste.deploy
  pylons:          Pylons application template
  pylons_fa:       Pylons application template with formalchemy support
  pylons_minimal:  Pylons minimal application template
</pre>
</div>
</td>
</tr>
</table>
</div>
</div>
<ul>
<li>You can run the command to add some of the GeoFormAlchemy or the formalchemy support to your project:</li>
</ul>
<div class="highlight-wrapper sh">
<div class="tools">
<div class="wrap"></div>
</div>
<pre class="raw"><code lang="sh">% paster create -t geo_fa</code></pre>
<div class="highlighted">
<table class="highlighttable">
<tr>
<td class="linenos">
<div class="linenodiv">
<pre class="nl">1</pre>
</div>
</td>
<td class="code">
<div class="highlight">
<pre>% paster create -t geo_fa
</pre>
</div>
</td>
</tr>
</table>
</div>
</div>
<p>Keep the default values except for the first one</p>
<div class="highlight-wrapper sh">
<div class="tools">
<div class="wrap"></div>
</div>
<pre class="raw"><code lang="sh">Enter admin_controller (Add formalchemy's admin controller) [False]: True </code></pre>
<div class="highlighted">
<table class="highlighttable">
<tr>
<td class="linenos">
<div class="linenodiv">
<pre class="nl">1</pre>
</div>
</td>
<td class="code">
<div class="highlight">
<pre>Enter admin_controller <span class="o">(</span>Add formalchemy<span class="err">'</span>s admin controller<span class="o">)</span> <span class="o">[</span>False<span class="o">]</span>: True
</pre>
</div>
</td>
</tr>
</table>
</div>
</div>
<p>And answer no unless  you want to overrite a file:</p>
<div class="highlight-wrapper sh">
<div class="tools">
<div class="wrap"></div>
</div>
<pre class="raw"><code lang="sh">Overwrite ./MyApp/myapp/config/environment.py [y/n/d/B/?] n
[etc ...]</code></pre>
<div class="highlighted">
<table class="highlighttable">
<tr>
<td class="linenos">
<div class="linenodiv">
<pre class="nl">1
2</pre>
</div>
</td>
<td class="code">
<div class="highlight">
<pre>Overwrite ./MyApp/myapp/config/environment.py <span class="o">[</span>y/n/d/B/?<span class="o">]</span> n
<span class="o">[</span>etc ...<span class="o">]</span>
</pre>
</div>
</td>
</tr>
</table>
</div>
</div>
<ul>
<li>If you do not run the paster create command, you&#8217;ll have to add those files directly:</li>
<ul>
<li>Add the file
<pre>myapp/controllers/admin.py</pre>
</li>
<li>Add the file
<pre>myapp/forms/__init__.py</pre>
</li>
<li>Add the template files in (on <a href="https://github.com/FormAlchemy/fa.jquery/tree/master/fa/jquery/templates/forms">githhub-FormAlchemy</a> and <a href="https://github.com/camptocamp/GeoFormAlchemy/tree/master/GeoFormAlchemy/geoformalchemy/pylons/project/+package+/templates/forms">github-GeoFormAlchemy</a>)
<pre>myapp/templates/forms/ fieldset.mako,
fieldset_readonly.mako, grid.mako, grid_readonly.mako, map.mako, map_js.mako,
restfieldset.mako</pre>
</li>
<li>Modify
<pre>myapp/config/routing.py</pre>
</li>
</ul>
</ul>
<ul>
<li>Add the admin controller
<pre>myapp/controllers/admin.py</pre>
</li>
</ul>
<div class="highlight-wrapper python">
<div class="tools">
<div class="wrap"></div>
</div>
<pre class="raw"><code lang="python">### myapp/controllers/admin.py
import logging
from formalchemy.ext.pylons.controller import ModelsController
from webhelpers.paginate import Page
from myapp.lib.base import BaseController, render
from myapp import model
from myapp import forms
from myapp.model import meta

log = logging.getLogger(__name__)

class AdminControllerBase(BaseController):
    model = model # where your SQLAlchemy mappers are
    forms = forms # module containing FormAlchemy fieldsets definitions
    def Session(self): # Session factory
        return meta.Session

    ## customize the query for a model listing
    # def get_page(self):
    #     if self.model_name == 'Foo':
    #         return Page(meta.Session.query(model.Foo).order_by(model.Foo.bar)
    #     return super(AdminControllerBase, self).get_page()

AdminController = ModelsController(AdminControllerBase,
                                   prefix_name='admin',
                                   member_name='model',
                                   collection_name='models',
                                  )</code></pre>
<div class="highlighted">
<table class="highlighttable">
<tr>
<td class="linenos">
<div class="linenodiv">
<pre class="nl"> 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28</pre>
</div>
</td>
<td class="code">
<div class="highlight">
<pre><span class="c">### myapp/controllers/admin.py</span>
<span class="kn">import</span> <span class="nn">logging</span>
<span class="kn">from</span> <span class="nn">formalchemy.ext.pylons.controller</span> <span class="kn">import</span> <span class="n">ModelsController</span>
<span class="kn">from</span> <span class="nn">webhelpers.paginate</span> <span class="kn">import</span> <span class="n">Page</span>
<span class="kn">from</span> <span class="nn">myapp.lib.base</span> <span class="kn">import</span> <span class="n">BaseController</span><span class="p">,</span> <span class="n">render</span>
<span class="kn">from</span> <span class="nn">myapp</span> <span class="kn">import</span> <span class="n">model</span>
<span class="kn">from</span> <span class="nn">myapp</span> <span class="kn">import</span> <span class="n">forms</span>
<span class="kn">from</span> <span class="nn">myapp.model</span> <span class="kn">import</span> <span class="n">meta</span>

<span class="n">log</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">getLogger</span><span class="p">(</span><span class="n">__name__</span><span class="p">)</span>

<span class="k">class</span> <span class="nc">AdminControllerBase</span><span class="p">(</span><span class="n">BaseController</span><span class="p">):</span>
    <span class="n">model</span> <span class="o">=</span> <span class="n">model</span> <span class="c"># where your SQLAlchemy mappers are</span>
    <span class="n">forms</span> <span class="o">=</span> <span class="n">forms</span> <span class="c"># module containing FormAlchemy fieldsets definitions</span>
    <span class="k">def</span> <span class="nf">Session</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> <span class="c"># Session factory</span>
        <span class="k">return</span> <span class="n">meta</span><span class="o">.</span><span class="n">Session</span>

    <span class="c">## customize the query for a model listing</span>
    <span class="c"># def get_page(self):</span>
    <span class="c">#     if self.model_name == 'Foo':</span>
    <span class="c">#         return Page(meta.Session.query(model.Foo).order_by(model.Foo.bar)</span>
    <span class="c">#     return super(AdminControllerBase, self).get_page()</span>

<span class="n">AdminController</span> <span class="o">=</span> <span class="n">ModelsController</span><span class="p">(</span><span class="n">AdminControllerBase</span><span class="p">,</span>
                                   <span class="n">prefix_name</span><span class="o">=</span><span class="s">'admin'</span><span class="p">,</span>
                                   <span class="n">member_name</span><span class="o">=</span><span class="s">'model'</span><span class="p">,</span>
                                   <span class="n">collection_name</span><span class="o">=</span><span class="s">'models'</span><span class="p">,</span>
                                  <span class="p">)</span>
</pre>
</div>
</td>
</tr>
</table>
</div>
</div>
<ul>
<li>Modify
<pre>myapp/config/routing.py</pre>
</li>
</ul>
<div class="highlight-wrapper python">
<div class="tools">
<div class="wrap"></div>
</div>
<pre class="raw"><code lang="python">### In myapp/config/routing.py
    # Map the /admin url to FA's AdminController
    # Map static files
    map.connect('fa_static', '/admin/_static/{path_info:.*}', controller='admin', action='static')
    # Index page
    map.connect('admin', '/admin', controller='admin', action='models')
    map.connect('formatted_admin', '/admin.json', controller='admin', action='models', format='json')
    # Models
    map.resource('model', 'models', path_prefix='/admin/{model_name}', controller='admin')</code></pre>
<div class="highlighted">
<table class="highlighttable">
<tr>
<td class="linenos">
<div class="linenodiv">
<pre class="nl">1
2
3
4
5
6
7
8
9</pre>
</div>
</td>
<td class="code">
<div class="highlight">
<pre><span class="c">### In myapp/config/routing.py</span>
    <span class="c"># Map the /admin url to FA's AdminController</span>
    <span class="c"># Map static files</span>
    <span class="nb">map</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="s">'fa_static'</span><span class="p">,</span> <span class="s">'/admin/_static/{path_info:.*}'</span><span class="p">,</span> <span class="n">controller</span><span class="o">=</span><span class="s">'admin'</span><span class="p">,</span> <span class="n">action</span><span class="o">=</span><span class="s">'static'</span><span class="p">)</span>
    <span class="c"># Index page</span>
    <span class="nb">map</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="s">'admin'</span><span class="p">,</span> <span class="s">'/admin'</span><span class="p">,</span> <span class="n">controller</span><span class="o">=</span><span class="s">'admin'</span><span class="p">,</span> <span class="n">action</span><span class="o">=</span><span class="s">'models'</span><span class="p">)</span>
    <span class="nb">map</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="s">'formatted_admin'</span><span class="p">,</span> <span class="s">'/admin.json'</span><span class="p">,</span> <span class="n">controller</span><span class="o">=</span><span class="s">'admin'</span><span class="p">,</span> <span class="n">action</span><span class="o">=</span><span class="s">'models'</span><span class="p">,</span> <span class="n">format</span><span class="o">=</span><span class="s">'json'</span><span class="p">)</span>
    <span class="c"># Models</span>
    <span class="nb">map</span><span class="o">.</span><span class="n">resource</span><span class="p">(</span><span class="s">'model'</span><span class="p">,</span> <span class="s">'models'</span><span class="p">,</span> <span class="n">path_prefix</span><span class="o">=</span><span class="s">'/admin/{model_name}'</span><span class="p">,</span> <span class="n">controller</span><span class="o">=</span><span class="s">'admin'</span><span class="p">)</span>
</pre>
</div>
</td>
</tr>
</table>
</div>
</div>
<ul>
<li>
<pre>myapp/forms/__init__.py</pre>
</li>
</ul>
<div>
<div class="highlight-wrapper python">
<div class="tools">
<div class="wrap"></div>
</div>
<pre class="raw"><code lang="python">### myapp/forms/__init__.py
from pylons import config
from myapp.model import my_app_points
from myapp.lib.base import render
from formalchemy import config as fa_config
from formalchemy import templates
from formalchemy import validators
from formalchemy import fields
from formalchemy import forms
from formalchemy import tables
from formalchemy.ext.fsblob import FileFieldRenderer
from formalchemy.ext.fsblob import ImageFieldRenderer

from geoformalchemy.base import GeometryFieldRenderer
from geoalchemy import geometry
forms.FieldSet.default_renderers[geometry.Geometry] = GeometryFieldRenderer

fa_config.encoding = 'utf-8'
class TemplateEngine(templates.TemplateEngine):
    def render(self, name, **kwargs):
        return render('/forms/%s.mako' % name, extra_vars=kwargs)
fa_config.engine = TemplateEngine()
class FieldSet(forms.FieldSet):
    pass
class Grid(tables.Grid):
    pass
## Initialize fieldsets
#Foo = FieldSet(model.Foo)
#Reflected = FieldSet(Reflected)
## Initialize grids
#FooGrid = Grid(model.Foo)
#ReflectedGrid = Grid(Reflected)</code></pre>
<div class="highlighted">
<table class="highlighttable">
<tr>
<td class="linenos">
<div class="linenodiv">
<pre class="nl"> 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32</pre>
</div>
</td>
<td class="code">
<div class="highlight">
<pre><span class="c">### myapp/forms/__init__.py</span>
<span class="kn">from</span> <span class="nn">pylons</span> <span class="kn">import</span> <span class="n">config</span>
<span class="kn">from</span> <span class="nn">myapp.model</span> <span class="kn">import</span> <span class="n">my_app_points</span>
<span class="kn">from</span> <span class="nn">myapp.lib.base</span> <span class="kn">import</span> <span class="n">render</span>
<span class="kn">from</span> <span class="nn">formalchemy</span> <span class="kn">import</span> <span class="n">config</span> <span class="k">as</span> <span class="n">fa_config</span>
<span class="kn">from</span> <span class="nn">formalchemy</span> <span class="kn">import</span> <span class="n">templates</span>
<span class="kn">from</span> <span class="nn">formalchemy</span> <span class="kn">import</span> <span class="n">validators</span>
<span class="kn">from</span> <span class="nn">formalchemy</span> <span class="kn">import</span> <span class="n">fields</span>
<span class="kn">from</span> <span class="nn">formalchemy</span> <span class="kn">import</span> <span class="n">forms</span>
<span class="kn">from</span> <span class="nn">formalchemy</span> <span class="kn">import</span> <span class="n">tables</span>
<span class="kn">from</span> <span class="nn">formalchemy.ext.fsblob</span> <span class="kn">import</span> <span class="n">FileFieldRenderer</span>
<span class="kn">from</span> <span class="nn">formalchemy.ext.fsblob</span> <span class="kn">import</span> <span class="n">ImageFieldRenderer</span>

<span class="kn">from</span> <span class="nn">geoformalchemy.base</span> <span class="kn">import</span> <span class="n">GeometryFieldRenderer</span>
<span class="kn">from</span> <span class="nn">geoalchemy</span> <span class="kn">import</span> <span class="n">geometry</span>
<span class="n">forms</span><span class="o">.</span><span class="n">FieldSet</span><span class="o">.</span><span class="n">default_renderers</span><span class="p">[</span><span class="n">geometry</span><span class="o">.</span><span class="n">Geometry</span><span class="p">]</span> <span class="o">=</span> <span class="n">GeometryFieldRenderer</span>

<span class="n">fa_config</span><span class="o">.</span><span class="n">encoding</span> <span class="o">=</span> <span class="s">'utf-8'</span>
<span class="k">class</span> <span class="nc">TemplateEngine</span><span class="p">(</span><span class="n">templates</span><span class="o">.</span><span class="n">TemplateEngine</span><span class="p">):</span>
    <span class="k">def</span> <span class="nf">render</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
        <span class="k">return</span> <span class="n">render</span><span class="p">(</span><span class="s">'/forms/</span><span class="si">%s</span><span class="s">.mako'</span> <span class="o">%</span> <span class="n">name</span><span class="p">,</span> <span class="n">extra_vars</span><span class="o">=</span><span class="n">kwargs</span><span class="p">)</span>
<span class="n">fa_config</span><span class="o">.</span><span class="n">engine</span> <span class="o">=</span> <span class="n">TemplateEngine</span><span class="p">()</span>
<span class="k">class</span> <span class="nc">FieldSet</span><span class="p">(</span><span class="n">forms</span><span class="o">.</span><span class="n">FieldSet</span><span class="p">):</span>
    <span class="k">pass</span>
<span class="k">class</span> <span class="nc">Grid</span><span class="p">(</span><span class="n">tables</span><span class="o">.</span><span class="n">Grid</span><span class="p">):</span>
    <span class="k">pass</span>
<span class="c">## Initialize fieldsets</span>
<span class="c">#Foo = FieldSet(model.Foo)</span>
<span class="c">#Reflected = FieldSet(Reflected)</span>
<span class="c">## Initialize grids</span>
<span class="c">#FooGrid = Grid(model.Foo)</span>
<span class="c">#ReflectedGrid = Grid(Reflected)</span>
</pre>
</div>
</td>
</tr>
</table>
</div>
</div>
<ul>
<li>To test, restart you server, and open and refresh
<pre>/admin</pre>
<p>. Unless you&#8217;ve added models in your
<pre>myapp/models/__init__.py</pre>
<p>, you won&#8217;t see any link to the models.</li>
</ul>
<h2>Adding a model to the Admin view</h2>
<div>One of my models
<pre>myapp/model/my_app_points.py</pre>
<p> was defined as such</p></div>
<div>
<div class="highlight-wrapper python">
<div class="tools">
<div class="wrap"></div>
</div>
<pre class="raw"><code lang="python">###myapp/model/my_app_points.py
from sqlalchemy import Column, types
from geoalchemy import GeometryColumn, Point
from mapfish.sqlalchemygeom import GeometryTableMixIn
from mapfishapp.model.meta import Session, Base

class MyAppPoint(Base, GeometryTableMixIn):
    autoload_with = Session.bind
    __tablename__ = 'my_app_point'
    __table_args__ = {
        "autoload_with": Session.bind,
        "autoload": True,
    }
    way = GeometryColumn(Point(srid=900913))</code></pre>
<div class="highlighted">
<table class="highlighttable">
<tr>
<td class="linenos">
<div class="linenodiv">
<pre class="nl"> 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14</pre>
</div>
</td>
<td class="code">
<div class="highlight">
<pre><span class="c">###myapp/model/my_app_points.py </span>
<span class="kn">from</span> <span class="nn">sqlalchemy</span> <span class="kn">import</span> <span class="n">Column</span><span class="p">,</span> <span class="n">types</span>
<span class="kn">from</span> <span class="nn">geoalchemy</span> <span class="kn">import</span> <span class="n">GeometryColumn</span><span class="p">,</span> <span class="n">Point</span>
<span class="kn">from</span> <span class="nn">mapfish.sqlalchemygeom</span> <span class="kn">import</span> <span class="n">GeometryTableMixIn</span>
<span class="kn">from</span> <span class="nn">mapfishapp.model.meta</span> <span class="kn">import</span> <span class="n">Session</span><span class="p">,</span> <span class="n">Base</span>

<span class="k">class</span> <span class="nc">MyAppPoint</span><span class="p">(</span><span class="n">Base</span><span class="p">,</span> <span class="n">GeometryTableMixIn</span><span class="p">):</span>
    <span class="n">autoload_with</span> <span class="o">=</span> <span class="n">Session</span><span class="o">.</span><span class="n">bind</span>
    <span class="n">__tablename__</span> <span class="o">=</span> <span class="s">'my_app_point'</span>
    <span class="n">__table_args__</span> <span class="o">=</span> <span class="p">{</span>
        <span class="s">"autoload_with"</span><span class="p">:</span> <span class="n">Session</span><span class="o">.</span><span class="n">bind</span><span class="p">,</span>
        <span class="s">"autoload"</span><span class="p">:</span> <span class="bp">True</span><span class="p">,</span>
    <span class="p">}</span>
    <span class="n">way</span> <span class="o">=</span> <span class="n">GeometryColumn</span><span class="p">(</span><span class="n">Point</span><span class="p">(</span><span class="n">srid</span><span class="o">=</span><span class="mi">900913</span><span class="p">))</span>
</pre>
</div>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<p>I&#8217;d get an error by importing that class in
<pre>myapp/model/__init__.py</pre>
<div class="highlight-wrapper python">
<div class="tools">
<div class="wrap"></div>
</div>
<pre class="raw"><code lang="python">from myapp.models.my_app_points import MyAppPoint</code></pre>
<div class="highlighted">
<table class="highlighttable">
<tr>
<td class="linenos">
<div class="linenodiv">
<pre class="nl">1</pre>
</div>
</td>
<td class="code">
<div class="highlight">
<pre><span class="kn">from</span> <span class="nn">myapp.models.my_app_points</span> <span class="kn">import</span> <span class="n">MyAppPoint</span>
</pre>
</div>
</td>
</tr>
</table>
</div>
</div>
<p>would lead to that error:</p>
<div class="highlight-wrapper sh">
<div class="tools">
<div class="wrap"></div>
</div>
<pre class="raw"><code lang="sh">sqlalchemy.exc.UnboundExecutionError: No engine is bound to this Table's MetaData.
Pass an engine to the Table via autoload_with=&lt;someengine&gt;, or associate the MetaData
with an engine via metadata.bind=&lt;someengine&gt;</code></pre>
<div class="highlighted">
<table class="highlighttable">
<tr>
<td class="linenos">
<div class="linenodiv">
<pre class="nl">1
2
3</pre>
</div>
</td>
<td class="code">
<div class="highlight">
<pre>sqlalchemy.exc.UnboundExecutionError: No engine is bound to this Table<span class="err">'</span>s MetaData.
Pass an engine to the Table via <span class="nv">autoload_with</span><span class="o">=</span>&lt;someengine&gt;, or associate the MetaData
with an engine via metadata.bind<span class="o">=</span>&lt;someengine&gt;
</pre>
</div>
</td>
</tr>
</table>
</div>
</div>
<p><a href="http://stackoverflow.com/questions/4526498/sqlalchemy-declarative-syntax-with-autoload-reflection-in-pylons">Modifying</a> <code lang="sh">myapp/model/__init__.py</code> by adding <code lang="python">Base.metadata.bind = engine</code> at the end of <code lang="python">init_model(engine)</code> did not work.</p>
<p>The solution I found after checking the formalchemy code was to modify the <code lang="sh">myapp/controllers/admin.py</code> and pass a list of the model classes to list in the web admin view.</p>
<div class="highlight-wrapper python">
<div class="tools">
<div class="wrap"></div>
</div>
<pre class="raw"><code lang="python">###Modify in myapp/controllers/admin.py
from myapp.model.my_app_points import MyAppPoint

list_models = [MyAppPoint,]
class AdminControllerBase(BaseController):
    model = list_models # where your SQLAlchemy mappers are
    forms = forms # module containing FormAlchemy fieldsets definitions</code></pre>
<div class="highlighted">
<table class="highlighttable">
<tr>
<td class="linenos">
<div class="linenodiv">
<pre class="nl">1
2
3
4
5
6
7</pre>
</div>
</td>
<td class="code">
<div class="highlight">
<pre><span class="c">###Modify in myapp/controllers/admin.py</span>
<span class="kn">from</span> <span class="nn">myapp.model.my_app_points</span> <span class="kn">import</span> <span class="n">MyAppPoint</span>

<span class="n">list_models</span> <span class="o">=</span> <span class="p">[</span><span class="n">MyAppPoint</span><span class="p">,]</span>
<span class="k">class</span> <span class="nc">AdminControllerBase</span><span class="p">(</span><span class="n">BaseController</span><span class="p">):</span>
    <span class="n">model</span> <span class="o">=</span> <span class="n">list_models</span> <span class="c"># where your SQLAlchemy mappers are</span>
    <span class="n">forms</span> <span class="o">=</span> <span class="n">forms</span> <span class="c"># module containing FormAlchemy fieldsets definitions</span>
</pre>
</div>
</td>
</tr>
</table>
</div>
</div>
<p>And finally you can add something like that at the end of your
<pre>myapp/forms/__init__.py</pre>
<div class="highlight-wrapper python">
<div class="tools">
<div class="wrap"></div>
</div>
<pre class="raw"><code lang="python">MyAppPoint = FieldSet(my_app_points.MyAppPoint)
MyAppPoint.configure(options=[MyAppPoint.way.label('Geometry').required()])
MyAppPoint.way.set(options=[
        ('map_srid', 900913),
        ('base_layer', 'new OpenLayers.Layer.OSM("OSM")'),
        ('openlayers_lib', '/lib/openlayers/lib/OpenLayers.js'),
        ('zoom', 14)
    ])</code></pre>
<div class="highlighted">
<table class="highlighttable">
<tr>
<td class="linenos">
<div class="linenodiv">
<pre class="nl">1
2
3
4
5
6
7
8</pre>
</div>
</td>
<td class="code">
<div class="highlight">
<pre><span class="n">MyAppPoint</span> <span class="o">=</span> <span class="n">FieldSet</span><span class="p">(</span><span class="n">my_app_points</span><span class="o">.</span><span class="n">MyAppPoint</span><span class="p">)</span>
<span class="n">MyAppPoint</span><span class="o">.</span><span class="n">configure</span><span class="p">(</span><span class="n">options</span><span class="o">=</span><span class="p">[</span><span class="n">MyAppPoint</span><span class="o">.</span><span class="n">way</span><span class="o">.</span><span class="n">label</span><span class="p">(</span><span class="s">'Geometry'</span><span class="p">)</span><span class="o">.</span><span class="n">required</span><span class="p">()])</span>
<span class="n">MyAppPoint</span><span class="o">.</span><span class="n">way</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="n">options</span><span class="o">=</span><span class="p">[</span>
        <span class="p">(</span><span class="s">'map_srid'</span><span class="p">,</span> <span class="mi">900913</span><span class="p">),</span>
        <span class="p">(</span><span class="s">'base_layer'</span><span class="p">,</span> <span class="s">'new OpenLayers.Layer.OSM("OSM")'</span><span class="p">),</span>
        <span class="p">(</span><span class="s">'openlayers_lib'</span><span class="p">,</span> <span class="s">'/lib/openlayers/lib/OpenLayers.js'</span><span class="p">),</span>
        <span class="p">(</span><span class="s">'zoom'</span><span class="p">,</span> <span class="mi">14</span><span class="p">)</span>
    <span class="p">])</span>
</pre>
</div>
</td>
</tr>
</table>
</div>
</div>
<p> </p>
<p>Sources: <a href="http://dev.mapfish.org/sandbox/tsauerwein/website/trunk/doc/tutorials/geoformalchemy/geoformalchemy.txt">mapfish-geoformalchemy</a>,</p>
]]></content:encoded>
			<wfw:commentRss>http://www.battestini.net/blog/2011/11/09/adding-formalchemy-to-an-existing-pylons-mapfish-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up mapnik2 on Mac with Homebrew</title>
		<link>http://www.battestini.net/blog/2011/11/02/setting-up-mapnik2-on-mac-with-homebrew/</link>
		<comments>http://www.battestini.net/blog/2011/11/02/setting-up-mapnik2-on-mac-with-homebrew/#comments</comments>
		<pubDate>Thu, 03 Nov 2011 05:09:31 +0000</pubDate>
		<dc:creator>Agathe Battestini</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[brew]]></category>
		<category><![CDATA[gis]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[mapnik]]></category>

		<guid isPermaLink="false">http://www.battestini.net/blog/?p=492</guid>
		<description><![CDATA[It seems mapnik is getting easier and easier to setup. I wanted to reinstall mapnik2 on a mac bloated with different versions of python, of macports&#8230; I just left my install of postgres/postgis/osm, and cleaned the system before installing mapnik. You can still expect to run into a frew trouble and may have to update [...]]]></description>
			<content:encoded><![CDATA[<div class="al2fb_like_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=316709205009353&amp;xfbml=1" type="text/javascript"></script>
<fb:like href="http://www.battestini.net/blog/2011/11/02/setting-up-mapnik2-on-mac-with-homebrew/" layout="standard" show_faces="true" width="450" action="like" font="arial" colorscheme="light" ref="AL2FB"></fb:like></div><p>It seems mapnik is getting easier and easier to setup. I wanted to reinstall <a href="https://github.com/mapnik/mapnik">mapnik2</a> on a mac bloated with different versions of python, of macports&#8230; I just left my install of postgres/postgis/osm, and cleaned the system before installing mapnik.</p>
<p>You can still expect to run into a frew trouble and may have to update the formulas.</p>
<p> </p>
<h2>Macports (if installed)</h2>
<p>Careful with the <code>rm</code>&#8230;</p>
<p>Get rid of <a href="http://guide.macports.org/chunked/installing.macports.uninstalling.html">macports</a></p>
<blockquote>
<pre><strong><code>%% sudo port -fp uninstall --follow-dependents installed</code></strong></pre>
</blockquote>
<p>&#8211;edit&#8211; Check that you do not have software installed in /opt/local installed through non macport means:</p>
<blockquote><p><strong><code>%% sudo rm -rf \<br />
/opt/local \<br />
/Applications/DarwinPorts \<br />
/Applications/MacPorts \<br />
/Library/LaunchDaemons/org.macports.* \ /Library/Receipts/DarwinPorts*.pkg \<br />
/Library/Receipts/MacPorts*.pkg \ /Library/StartupItems/DarwinPortsStartup \<br />
/Library/Tcl/darwinports1.0 \<br />
/Library/Tcl/macports1.0 \<br />
~/.macports</code></strong></p></blockquote>
<p>Clean up the system (Python)</p>
<blockquote><p>
<strong><code>%% sudo rm -rf /System/Library/Frameworks/Python.framework \<br />
/usr/bin/python* \<br />
/Library/Frameworks/Python.framework \</code></strong><br />
<code><strong>%% sudo rm -rf /usr/local/lib/python \</strong><strong><br />
</strong> <strong> /usr/bin/easy_install* \</strong><br />
<strong> /usr/bin/pydoc*</strong><br />
</code>
</p></blockquote>
<p>Clean previous installation of GEOS/Mapnik/etc</p>
<blockquote><p><strong><code>%% sudo rm -rf /Library/Frameworks/GDAL.framework \<br />
/Library/Frameworks/FreeType.framework \<br />
/Library/Frameworks/GEOS.framework \<br />
/Library/Frameworks/Mapnik.framework \<br />
/Library/Frameworks/PROJ.framework \<br />
/Library/Frameworks/UnixImageIO.framework</code></strong></p></blockquote>
<p> </p>
<h2>Install Homebrew</h2>
<p><a href="https://github.com/mxcl/homebrew/wiki/installation">Install Homebrew</a></p>
<p>Run</p>
<blockquote><p><strong><code>%% brew doctor<br />
%% brew update</code></strong></p></blockquote>
<p>And fix the issues if any, like adding <code>/usr/local/sbin</code> and <code>/usr/local/bin</code> to your PATH.</p>
<h2>Install Formula</h2>
<blockquote><p><code><strong>%% brew install python</strong></code></p></blockquote>
<p>Modify your  PATH (<code>.bash_profile</code>) to add <strong>/usr/local/share/python</strong></p>
<p> </p>
<p>Install GDAL</p>
<blockquote><p><strong><code>%% easy_install numpy<br />
%% brew install gdal</code></strong></p></blockquote>
<p>You may have to fix some things. I had to install GEOS with</p>
<blockquote><p><strong><code>%% brew install --use-gcc geos</code></strong></p></blockquote>
<p>Install icu4c</p>
<blockquote><p><strong><code>%% brew install icu4c</code></strong></p></blockquote>
<p>Install boost</p>
<blockquote><p><strong><code>%% brew install -v boost</code></strong></p></blockquote>
<p>(It&#8217;s ok if boost is compiled without ICU support)</p>
<p>Install Mapnik: (You might have to update your formula with <a href="https://github.com/mxcl/homebrew/pull/8177/files#r181458">this</a> - <code>brew edit mapnik</code>)</p>
<blockquote><p><strong><code>%% brew install -v mapnik</code></strong></p></blockquote>
<p><code>-v</code> gives you more information about the install. If for instance <code>pg_config</code> is not found, add it to PATH.</p>
<p>To test your installation of mapnik, you can run the <code>mapnik/demo/python/run_demo.py</code> script (from the <code>mapnik-2.x.x.tar.gz</code> install file, which is by default in <code>~/Library/Caches/Homebrew/</code>)</p>
<p> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.battestini.net/blog/2011/11/02/setting-up-mapnik2-on-mac-with-homebrew/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>One year</title>
		<link>http://www.battestini.net/blog/2011/10/25/one-year/</link>
		<comments>http://www.battestini.net/blog/2011/10/25/one-year/#comments</comments>
		<pubDate>Wed, 26 Oct 2011 03:33:04 +0000</pubDate>
		<dc:creator>Agathe Battestini</dc:creator>
				<category><![CDATA[Californian life]]></category>
		<category><![CDATA[Travel]]></category>

		<guid isPermaLink="false">http://www.battestini.net/blog/?p=486</guid>
		<description><![CDATA[What a nice coincidence: One year that this blog had not seen any fresh and spirited content. No longer! I have reclaimed a bit of my freedom by leaving my job at Nokia a week ago, and I&#8217;m now in a position that I can do whatever I like. What should that be, you ask [...]]]></description>
			<content:encoded><![CDATA[<div class="al2fb_like_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=316709205009353&amp;xfbml=1" type="text/javascript"></script>
<fb:like href="http://www.battestini.net/blog/2011/10/25/one-year/" layout="standard" show_faces="true" width="450" action="like" font="arial" colorscheme="light" ref="AL2FB"></fb:like></div><p>What a nice coincidence: One year that this blog had not seen any fresh and spirited content. No longer! I have reclaimed a bit of my freedom by leaving my job at Nokia a week ago, and I&#8217;m now in a position that I can do whatever I like. What should that be, you ask me? A bit of traveling (the US is big, Europe is far), a bit of hacking here and there, and massive amount of meditation in a remote desert (I&#8217;m kidding).<br />
It&#8217;s been a long time that I have not had a longer break than 3 weeks of vacation (I know that it&#8217;s forever for many here), and I&#8217;m really looking forward to getting bored. But then again, if you live in the Bay Area and you get bored, you&#8217;re not doing it right. </p>
<p>I&#8217;m actually leaving on a 10 day road trip tomorrow morning. I&#8217;ll be driving up along the coast of Northern California to Eureka, east towards Lassen Park and Mt Shasta, north again in Oregon territory, zigzagging among the forest park lands to Portland, Bend, then to Seattle. A good friend helped me make the plan, arguing among other things for the mandatory sight of large amount of solidified lava.<br />
The route looks like <a href="http://maps.google.com/maps?f=d&amp;source=s_d&amp;saddr=Park+St,+San+Francisco,+CA+94110&amp;daddr=Eureka,+CA,+United+States+to:Lassen+Volcanic+National+Park,+CA,+United+States+to:Mount+Shasta,+CA,+United+States+to:Klamath+Falls,+OR,+United+States+to:Crater+Lake,+OR,+United+States+to:Bend,+OR,+United+States+to:Portland,+OR,+USA+to:Mount+St.+Helens,+WA,+United+States+to:Seattle,+WA,+USA&amp;hl=en&amp;geocode=FX3PPwIdyBG0-CnLqF3KW36PgDFi71JMwjGN9w%3BFReXbgIdp2mZ-CmnTv_mg__TVDGVBim4ZgeGKg%3BFezjaQIdTYLD-CFCZ2Z6p9g0jw%3BFbNWdgIdWbC1-ClBCAIl0-DNVDEHhkvIAS1qjg%3BFeNMhAIdWsK9-CnjDvJoWdTIVDEml7ko9X-N9A%3BFbwejwIdStu4-CmPnC-ndT7GVDGb1SOxKXAgRw%3BFT1GoAIdEuDE-ClR0tOl_8C4VDG00SDHrOeIEA%3BFfyhtgIdERyw-CkndKl9CwuVVDGRhdH25rk2HA%3BFWDSwAIdIHa3-CmRJopWVpmWVDHHlM-29LTdaQ%3BFcJp1gIdWVy1-ClVM-iTLBCQVDGa1URpRmUlEA&amp;aq=0&amp;sll=45.79817,-122.563477&amp;sspn=10.325783,23.181152&amp;vpsrc=0&amp;mra=ls&amp;ie=UTF8&amp;ll=42.666281,-122.67334&amp;spn=10.887141,23.181152&amp;t=m&amp;z=6&amp;dirflg=d" title="Route on google maps" target="_blank">this (Google maps)</a> at the moment.</p>
<p>I then drop the rental in Seattle, and take the <a href="http://www.amtrak.com/servlet/ContentServer/AM_Route_C/1241245648567/1237405732511" target="_blank">Coast Starlight</a> train (wifi included, thank you Amtrak) all the way down to the Bay Area in one stretch of 22 hours. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.battestini.net/blog/2011/10/25/one-year/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>The internet, the new God?</title>
		<link>http://www.battestini.net/blog/2010/10/25/the-internet-the-new-god/</link>
		<comments>http://www.battestini.net/blog/2010/10/25/the-internet-the-new-god/#comments</comments>
		<pubDate>Tue, 26 Oct 2010 06:50:32 +0000</pubDate>
		<dc:creator>Agathe Battestini</dc:creator>
				<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.battestini.net/blog/?p=479</guid>
		<description><![CDATA[Truth and lies and lives are leaking all over the Internet these days. Be it the Wikileaks reports, or the special report of a Duke student, the daily Facebook tales of misfortune&#8230; today&#8217;s confessions are done on the web, and very smart who can tell who the biggest sinner is. I would not be surprised [...]]]></description>
			<content:encoded><![CDATA[<div class="al2fb_like_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=316709205009353&amp;xfbml=1" type="text/javascript"></script>
<fb:like href="http://www.battestini.net/blog/2010/10/25/the-internet-the-new-god/" layout="standard" show_faces="true" width="450" action="like" font="arial" colorscheme="light" ref="AL2FB"></fb:like></div><p>Truth and lies and lives are leaking all over the Internet these days. Be it the <a href="http://wikileaks.org/">Wikileaks reports</a>, or the <a href="http://jezebel.com/5652114/college-girls-power-point-fuck-list-goes-viral-gallery">special report of a Duke student</a>, the <a href="http://www.newser.com/tag/45940/1/facebook-privacy.html">daily Facebook</a> <a href="http://www.geekologie.com/2009/08/how_to_lose_your_job_via_faceb.php">tales of misfortune</a>&#8230; today&#8217;s confessions are done on the web, and very smart who can tell who the biggest sinner is. I would not be surprised Moms are telling their kids &#8220;be good, or the Internet will know about it, and you&#8217;ll be punished!&#8221;. </p>
<p>The days of an almighty power scaring the shit out of people are gone. Is anybody scared of God anymore? I am guessing those who have been on the Internet&#8217;s receiving end would take God punishment over the very special and very viral attention &#8216;It&#8217; is giving them. There is no purgatory in the Internet, what gets there, stays there, and most likely for a long time. Enough time to embarrass you in all the decades of your life, and those of your kids and grand-kids. Internet&#8217;s memory is infinite and its ways are not that inscrutable. </p>
<p>It sucks, and it&#8217;s probably unfair for a lot of those unlucky bastards. There used to be a time when you could be stupid, foolish, and even dead mad, and get away with it. If human justice did not take care of you, certainly God&#8217;s would &#8211; once you&#8217;re dead. Today, not even the high ranking officials of the top military power on this planet are safe from Internet&#8217;s scrutiny. I suppose that&#8217;s what they call sousveillance. </p>
<p>Now I&#8217;m wondering: when will people switch to the Internet for their source of morality? If you start acting moral because you think the Internet is watching you, then that might be it! </p>
]]></content:encoded>
			<wfw:commentRss>http://www.battestini.net/blog/2010/10/25/the-internet-the-new-god/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Singularity Summit 2010 in San Francisco</title>
		<link>http://www.battestini.net/blog/2010/08/17/singularity-summit-2010-in-san-francisco/</link>
		<comments>http://www.battestini.net/blog/2010/08/17/singularity-summit-2010-in-san-francisco/#comments</comments>
		<pubDate>Wed, 18 Aug 2010 06:00:17 +0000</pubDate>
		<dc:creator>Agathe Battestini</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[sf]]></category>
		<category><![CDATA[singularity]]></category>

		<guid isPermaLink="false">http://www.battestini.net/blog/?p=472</guid>
		<description><![CDATA[The idea of the singularity starts with numbers. Numbers that get bigger and bigger over time, exponentially. As Ray Kurzweil showed it in his presentation, big numbers getting bigger are all over the technological world: Moore&#8217;s law Total bits shipped Magnetic data storage bits per dollar Internet data traffic Internet backbone bandwidth US nanotechnology-related patents [...]]]></description>
			<content:encoded><![CDATA[<div class="al2fb_like_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=316709205009353&amp;xfbml=1" type="text/javascript"></script>
<fb:like href="http://www.battestini.net/blog/2010/08/17/singularity-summit-2010-in-san-francisco/" layout="standard" show_faces="true" width="450" action="like" font="arial" colorscheme="light" ref="AL2FB"></fb:like></div><p>The idea of the <a href="http://en.wikipedia.org/wiki/Technological_singularity">singularity</a> starts with numbers. Numbers that get bigger and bigger over time, exponentially. As <a href="http://en.wikipedia.org/wiki/Ray_Kurzweil">Ray Kurzweil</a> showed it in his presentation, big numbers getting bigger are all over the technological world:</p>
<ul>
<li>Moore&#8217;s law</li>
<li>Total bits shipped</li>
<li>Magnetic data storage bits per dollar</li>
<li>Internet data traffic</li>
<li>Internet backbone bandwidth</li>
<li>US nanotechnology-related patents</li>
</ul>
<p>But also in biology, for instance the cost of sequencing DNA that is dropping exponentially.</p>
<p>Conjecturing what happens next when those numbers get <strong>really</strong> big is what this <a href="http://www.singularitysummit.com/">summit</a> and the groups involved in the singularity are about. Something is bound to happen. Something special, something unforeseen, something beyond any of our wildest prediction. Will it be good (techno-optimist), bad (techno-pessimist), the same (techno-neutral) or good or bad depending on how we get there (techno-volatile)? What is going to happen, to people, to human intelligence, to artificial intelligence, to the biological world? When will the singularity point be past?</p>
<p>So, the singularity is where we&#8217;re going, but the work still needs to be done. And that&#8217;s what computer scientists, biologists, neuroscientists, writers, futurists, psychologists, historians and many other experts come together to discuss.</p>
<p>One main theme is understanding the human body and the brain better. Not just to cure diseases, repair the body, make us immortal, and more intelligent, but also to find principles that guide scientists to make smarter, more powerful technology, such as nano machines that writes and reads DNA, or computer systems that are <a href="http://en.wikipedia.org/wiki/Artificial_general_intelligence">generally intelligent</a>.</p>
<p>With that many different angles and approaches to the singularity, there is no unified view of it and it is hard to even get a more precise idea about what it could be or mean. You get bits and pieces here and there, a glimpse over here. And as they say, one thing that is certain about the future is that you cannot predict it.</p>
<p>Besides the big ideas, was the conference good? Yes, it was nice to attend, listen to some of the guys whose blogs and articles I read from time to time. The distribution was as usual, 4-5 talks I really enjoyed and were thought-provoking to me, a few I could have slept through and the rest in the middle. I enjoyed it overall but I&#8217;m not sure experts would learn that much per se from their own field from the talks, unless you come to network.</p>
<p>The videos should get on the website sometime.<br />
Read the <a href="http://hplusmagazine.com/editors-blog/singularity-summit-2010-day-one">day one</a> and <a href="http://hplusmagazine.com/editors-blog/singularity-summit-2010-day-two">day two</a> report articles from the h+ magazine.</p>
<p><center><br />
<script src="http://widgets.twimg.com/j/2/widget.js"></script><script>
new TWTR.Widget({
  version: 2,
  type: 'search',
  search: '#ss2010',
  interval: 6000,
  title: 'Singularity Summit 2010',
  subject: '',
  width: 400,
  height: 300,
  theme: {
    shell: {
      background: '#8ec1da',
      color: '#ffffff'
    },
    tweets: {
      background: '#ffffff',
      color: '#444444',
      links: '#1985b5'
    }
  },
  features: {
    scrollbar: false,
    loop: true,
    live: true,
    hashtags: true,
    timestamp: true,
    avatars: true,
    toptweets: true,
    behavior: 'default'
  }
}).render().start();
</script><br />
</center></p>
]]></content:encoded>
			<wfw:commentRss>http://www.battestini.net/blog/2010/08/17/singularity-summit-2010-in-san-francisco/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Les meetings entrepreneurs et technologie dans la Silicone Valley</title>
		<link>http://www.battestini.net/blog/2010/06/30/les-meetings-entrepreneurs-et-technologie-dans-la-silicone-valley/</link>
		<comments>http://www.battestini.net/blog/2010/06/30/les-meetings-entrepreneurs-et-technologie-dans-la-silicone-valley/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 23:11:05 +0000</pubDate>
		<dc:creator>Agathe Battestini</dc:creator>
				<category><![CDATA[Californian life]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.battestini.net/blog/?p=460</guid>
		<description><![CDATA[Si vous venez visiter la Bay Area et San Francisco et que vous voulez gouter à l&#8217;esprit high-tech et entrepreneur de la Valley, c&#8217;est facile, il n&#8217;y a qu&#8217;à chercher un peu. Presque tous les jours, vous trouverez des meetings et meetups organisés par les nombreux groupes et associations de la région. Quelques bonnes adresses [...]]]></description>
			<content:encoded><![CDATA[<div class="al2fb_like_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=316709205009353&amp;xfbml=1" type="text/javascript"></script>
<fb:like href="http://www.battestini.net/blog/2010/06/30/les-meetings-entrepreneurs-et-technologie-dans-la-silicone-valley/" layout="standard" show_faces="true" width="450" action="like" font="arial" colorscheme="light" ref="AL2FB"></fb:like></div><p>Si vous venez visiter la Bay Area et San Francisco et que vous voulez gouter à l&#8217;esprit high-tech et entrepreneur de la Valley, c&#8217;est facile, il n&#8217;y a qu&#8217;à chercher un peu. Presque tous les jours, vous trouverez des meetings et meetups organisés par les nombreux groupes et associations de la région.<br />
Quelques bonnes adresses pour commencer:</p>
<ul>
<li>
<a href="http://thestartupdigest.com/">Startup Digest</a>: inscrivez-vous à la mailing list ou lisez leurs <a href="http://thestartupdigest.com/archives/">archives</a> (cherchez <em>SF Bay Area HackersDigest</em>).</li>
<li>
<a href="http://www.eventbrite.com/">Eventbrite</a>: recherchez <a href="http://www.eventbrite.com/search?q=tech&amp;loc=bay+area&amp;page=1">tech dans la Bay Area</a>
</li>
<li>
<a href="http://www.women2.org/">Women2.0</a> propose ses propres événements et tient  à jour son propre listing</li>
</ul>
<p>La plupart des événements organisés sont soit gratuits soit peu cher ($10-$20).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.battestini.net/blog/2010/06/30/les-meetings-entrepreneurs-et-technologie-dans-la-silicone-valley/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Have more to produce more</title>
		<link>http://www.battestini.net/blog/2010/04/27/412/</link>
		<comments>http://www.battestini.net/blog/2010/04/27/412/#comments</comments>
		<pubDate>Tue, 27 Apr 2010 23:42:47 +0000</pubDate>
		<dc:creator>Agathe Battestini</dc:creator>
				<category><![CDATA[Californian life]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[donttakethisseriously]]></category>
		<category><![CDATA[gadgets]]></category>
		<category><![CDATA[iamjoking]]></category>
		<category><![CDATA[productivity]]></category>
		<category><![CDATA[worldbank]]></category>

		<guid isPermaLink="false">http://www.battestini.net/blog/?p=412</guid>
		<description><![CDATA[This article is relatively old (from 2007) but nonetheless interesting. It basically says that a condition for higher productivity is access to intangible wealth. Whereas natural and built capital describe natural resources, pasture land, and machinery, equipment, infrastructure; intangible wealth include such things as trust in society, property rights, education, etc.  And the amount of [...]]]></description>
			<content:encoded><![CDATA[<div class="al2fb_like_button"><div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=316709205009353&amp;xfbml=1" type="text/javascript"></script>
<fb:like href="http://www.battestini.net/blog/2010/04/27/412/" layout="standard" show_faces="true" width="450" action="like" font="arial" colorscheme="light" ref="AL2FB"></fb:like></div><p>This <a href="http://reason.com/archives/2007/10/05/the-secrets-of-intangible-weal">article</a> is relatively old (from 2007) but nonetheless interesting. It basically says that a condition for higher productivity is access to intangible wealth. Whereas natural and built capital describe natural resources, pasture land, and machinery, equipment, infrastructure; intangible wealth include such things as trust in society, property rights, education, etc.  And the amount of intangible wealth is decisive for how productive and creative you will be.</p>
<p>Sounds intuitive enough.</p>
<p>Concretely, what does it mean for you? Well, if you were pondering whether you really need a new computer, a bigger screen, a lighter bike, the newest camera, you can help convince yourself that you&#8217;ll be definitely more productive, says the World Bank. <a href="http://en.wikipedia.org/wiki/Self-deception">Self-deception</a> is a powerful mind trick.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.battestini.net/blog/2010/04/27/412/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

