<?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"
	>

<channel>
	<title>Peleteiro</title>
	<atom:link href="http://www.peleteiro.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.peleteiro.net</link>
	<description>Just another WordPress weblog</description>
	<pubDate>Tue, 04 Nov 2008 00:52:04 +0000</pubDate>
	
	<language>en</language>
			<item>
		<title>Nota mental - render :collection</title>
		<link>http://www.peleteiro.net/nota-mental-render-collection/</link>
		<comments>http://www.peleteiro.net/nota-mental-render-collection/#comments</comments>
		<pubDate>Tue, 04 Nov 2008 00:52:04 +0000</pubDate>
		<dc:creator>Peleteiro</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[nota mental]]></category>

		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.peleteiro.net/?p=24</guid>
		<description><![CDATA[Em Rails quando usamos:
&#160;
&#60;%= render :partial =&#62; &#34;nome_do_partial&#34;, :collections =&#62; colecao %&#62;
&#160;
dentro do partial existe uma variável implicita colecao_counter começando de zero. 
]]></description>
			<content:encoded><![CDATA[<p>Em Rails quando usamos:</p>
<pre class="ruby">&nbsp;
&lt;%= render <span style="color:#ff3333; font-weight:bold;">:partial</span> =&gt; <span style="color:#996600;">&quot;nome_do_partial&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:collections</span> =&gt; colecao %&gt;
&nbsp;</pre>
<p>dentro do partial existe uma variável implicita <code>colecao_counter</code> começando de zero. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.peleteiro.net/nota-mental-render-collection/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Installing CouchDB on Ubuntu 8</title>
		<link>http://www.peleteiro.net/installing-couchdb-on-ubuntu-8/</link>
		<comments>http://www.peleteiro.net/installing-couchdb-on-ubuntu-8/#comments</comments>
		<pubDate>Wed, 27 Aug 2008 23:07:47 +0000</pubDate>
		<dc:creator>Peleteiro</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.peleteiro.net/?p=3</guid>
		<description><![CDATA[Apache CouchDB is a very nice schema-free document-oriented database that I'm playing with lately.
Here's a quick guide to get CouchDB running on Ubuntu 8:
Prepare your environment
sudo aptitude install automake autoconf libtool subversion-tools help2man spidermonkey-bin build-essential erlang erlang-manpages libicu38 libicu-dev libreadline5-dev checkinstall libmozjs-dev wget
Create a couchdb user
sudo adduser --no-create-home --disabled-password --disabled-login couchdb
Download and build the latests [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://incubator.apache.org/couchdb" target="_blank" onclick="javascript:pageTracker._trackPageview ('/outbound/incubator.apache.org');">Apache CouchDB</a> is a very nice schema-free document-oriented database that I'm playing with lately.<br />
Here's a quick guide to get CouchDB running on Ubuntu 8:</p>
<p><strong>Prepare your environment</strong><br />
<code>sudo aptitude install automake autoconf libtool subversion-tools help2man spidermonkey-bin build-essential erlang erlang-manpages libicu38 libicu-dev libreadline5-dev checkinstall libmozjs-dev wget</code></p>
<p><strong>Create a couchdb user</strong><br />
<code>sudo adduser --no-create-home --disabled-password --disabled-login couchdb</code></p>
<p><strong>Download and build the latests version</strong><br />
<code>wget http://mirrors.uol.com.br/pub/apache/incubator/couchdb/0.8.1-incubating/apache-couchdb-0.8.1-incubating.tar.gz</code></p>
<p><code>tar -xzvf apache-couchdb-0.8.1-incubating.tar.gz</code></p>
<p><code>./configure --bindir=/usr/bin --sbindir=/usr/sbin --localstatedir=/var --sysconfdir=/etc</code></p>
<p><code>make</code></p>
<p><strong>Install it</strong><br />
<code>sudo make install</code></p>
<p><code>sudo chown couchdb:couchdb -R /var/lib/couchdb /var/log/couchdb</code></p>
<p><code>sudo update-rc.d couchdb defaults</code></p>
<p><strong>Start the service</strong><br />
<code>sudo /etc/init.d/couchdb start</code></p>
<p>CouchDB will be running on port 5984. By default it listens only for connections from the local host. To change that edit <code>/etc/couchdb/couch.ini</code> and restart CouchDB.</p>
<p>Sample code (Ruby):</p>
<pre class="ruby"><span style="color:#008000; font-style:italic;">#!/usr/bin/env ruby</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># Setup</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">&quot;rubygems&quot;</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">&quot;couchrest&quot;</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">&quot;test/unit/assertions&quot;</span>
<span style="color:#9966CC; font-weight:bold;">include</span> <span style="color:#6666ff; font-weight:bold;">Test::Unit::Assertions</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># Database</span>
couchdb = CouchRest.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;http://localhost:5984&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
couchdb.<span style="color:#9900CC;">database</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'helloworlds'</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">delete</span>! <span style="color:#9966CC; font-weight:bold;">rescue</span> <span style="color:#0000FF; font-weight:bold;">nil</span>
&nbsp;
db = couchdb.<span style="color:#9900CC;">create_db</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'helloworlds'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># Create</span>
db.<span style="color:#9900CC;">bulk_save</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#91;</span>
  <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#996600;">&quot;_id&quot;</span> =&gt; <span style="color:#996600;">&quot;en&quot;</span>, <span style="color:#996600;">&quot;helloworld&quot;</span> =&gt; <span style="color:#996600;">&quot;Hello world&quot;</span><span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#996600;">&quot;_id&quot;</span> =&gt; <span style="color:#996600;">&quot;pt&quot;</span>, <span style="color:#996600;">&quot;helloworld&quot;</span> =&gt; <span style="color:#996600;">&quot;Ola mundo&quot;</span><span style="color:#006600; font-weight:bold;">&#125;</span>
<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># Retrive</span>
document = db.<span style="color:#9900CC;">get</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;pt&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
assert_equal <span style="color:#996600;">&quot;Ola mundo&quot;</span>, document<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;helloworld&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># Update</span>
document<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;helloworld&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#996600;">&quot;Olá mundo!!!&quot;</span>
db.<span style="color:#9900CC;">save</span><span style="color:#006600; font-weight:bold;">&#40;</span>document<span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># Retrive again</span>
assert_equal <span style="color:#996600;">&quot;Olá mundo!!!&quot;</span>, db.<span style="color:#9900CC;">get</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;pt&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;helloworld&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># Fails to delete, since variable msg is an only snapshot of the data</span>
assert_raise<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#6666ff; font-weight:bold;">RestClient::RequestFailed</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> db.<span style="color:#9900CC;">delete</span><span style="color:#006600; font-weight:bold;">&#40;</span>document<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># But working with a last revision of the document</span>
document_last_revision = db.<span style="color:#9900CC;">get</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;pt&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
assert_not_equal document<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;_rev&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span>, document_last_revision<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;_rev&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span>
assert_nothing_raised <span style="color:#006600; font-weight:bold;">&#123;</span> db.<span style="color:#9900CC;">delete</span><span style="color:#006600; font-weight:bold;">&#40;</span>document_last_revision<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># Schema free</span>
db.<span style="color:#9900CC;">bulk_save</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#91;</span>
  <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#996600;">&quot;name&quot;</span> =&gt; <span style="color:#996600;">&quot;Maria Hernandes&quot;</span>, <span style="color:#996600;">&quot;helloworld&quot;</span> =&gt; <span style="color:#996600;">&quot;Oi!&quot;</span><span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#996600;">&quot;name&quot;</span> =&gt; <span style="color:#996600;">&quot;John Wisky&quot;</span>, <span style="color:#996600;">&quot;helloworld&quot;</span> =&gt; <span style="color:#996600;">&quot;Whatzup!&quot;</span>, <span style="color:#996600;">&quot;age&quot;</span> =&gt; <span style="color:#006666;">24</span><span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#996600;">&quot;helloworld&quot;</span> =&gt; <span style="color:#996600;">&quot;Duuuude!&quot;</span>, <span style="color:#996600;">&quot;age&quot;</span> =&gt; <span style="color:#006666;">18</span>, <span style="color:#996600;">&quot;country&quot;</span> =&gt; <span style="color:#996600;">&quot;Australia&quot;</span><span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#996600;">&quot;name&quot;</span> =&gt; <span style="color:#996600;">&quot;Peleteiro&quot;</span>, <span style="color:#996600;">&quot;age&quot;</span> =&gt; <span style="color:#006666;">29</span>, <span style="color:#996600;">&quot;country&quot;</span> =&gt; <span style="color:#996600;">&quot;Brazil&quot;</span>, <span style="color:#996600;">&quot;helloworld&quot;</span> =&gt; <span style="color:#996600;">&quot;Olá&quot;</span><span style="color:#006600; font-weight:bold;">&#125;</span>,
  <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#996600;">&quot;helloworld&quot;</span> =&gt; <span style="color:#996600;">&quot;Hi guys&quot;</span>, <span style="color:#996600;">&quot;name&quot;</span> =&gt; <span style="color:#996600;">&quot;Michel&quot;</span>, <span style="color:#996600;">&quot;country&quot;</span> =&gt; <span style="color:#996600;">&quot;USA&quot;</span><span style="color:#006600; font-weight:bold;">&#125;</span>
<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.peleteiro.net/installing-couchdb-on-ubuntu-8/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
