<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Blog &#60; MyMind</title>
	<atom:link href="http://extendsmymind.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://extendsmymind.wordpress.com</link>
	<description></description>
	<lastBuildDate>Fri, 09 Dec 2011 16:36:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='extendsmymind.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Blog &#60; MyMind</title>
		<link>http://extendsmymind.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://extendsmymind.wordpress.com/osd.xml" title="Blog &#60; MyMind" />
	<atom:link rel='hub' href='http://extendsmymind.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Criando novas RubyGems com newgem</title>
		<link>http://extendsmymind.wordpress.com/2009/06/05/criando-novas-rubygems-com-newgem/</link>
		<comments>http://extendsmymind.wordpress.com/2009/06/05/criando-novas-rubygems-com-newgem/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 13:52:05 +0000</pubDate>
		<dc:creator>andersondias</dc:creator>
				<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://extendsmymind.wordpress.com/?p=59</guid>
		<description><![CDATA[Olá pessoal, ultimamente recebi tarefas para desenvolver duas APIs de integração dos projetos em que estou alocado e escolhemos fazer a integração entre os vários projetos utilizando gems (para entender um pouco mais sobre rubygems leia: http://rubygems.org/). Fuçando pela internet achei alguns geradores de gem e escolhi utilizar o newgem. O que é newgem e [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=extendsmymind.wordpress.com&amp;blog=3192470&amp;post=59&amp;subd=extendsmymind&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Olá pessoal, ultimamente recebi tarefas para desenvolver duas APIs de integração dos projetos em que estou alocado e escolhemos fazer a integração entre os vários projetos utilizando gems (para entender um pouco mais sobre rubygems leia: <a title="Site oficial do rubygems" href="http://rubygems.org/" target="_blank">http://rubygems.org/</a>).</p>
<p>Fuçando pela internet achei alguns geradores de gem e escolhi utilizar o <a title="Site oficial do newgem" href="http://newgem.rubyforge.org/" target="_blank">newgem</a>.</p>
<h2>O que é newgem e para que serve?</h2>
<p>O newgem tem a função de gerar um esboço para suas gems possibilitando o compartilhamento do seu código no RubyForge.</p>
<h2>Instalando</h2>
<p>Para instalar esta gem é bem simples:</p>
<pre style="padding-left:30px;">sudo gem install newgem</pre>
<h2>Utilização</h2>
<p>É muito simples criar uma nova gem, basta executar:</p>
<pre style="padding-left:30px;">newgem wizzo</pre>
<p>Ao executar este comando você terá o seguinte output:</p>
<pre style="padding-left:30px;">      create
      create  doc
      create  lib
      create  script
      create  tasks
      create  lib/wizzo
      create  History.txt
      create  Rakefile
      create  README.rdoc
      create  PostInstall.txt
      create  lib/wizzo.rb
  dependency  install_test_unit
      create    test
      create    test/test_helper.rb
      create    test/test_wizzo.rb
  dependency  install_website
      create    website/javascripts
      create    website/stylesheets
      create    config
      exists    script
      exists    tasks
      create    website/index.txt
      create    website/index.html
      create    config/website.yml.sample
      create    script/txt2html
  dependency    plain_theme
      exists      website/javascripts
      exists      website/stylesheets
      create      website/template.html.erb
      create      website/stylesheets/screen.css
      create      website/javascripts/rounded_corners_lite.inc.js
  dependency  install_rubigen_scripts
      exists    script
      create    script/generate
      create    script/destroy
      create  script/console
      create  Manifest.txt
      readme  readme
Important
=========

* Open Rakefile
* Update missing details (gem description, dependent gems, etc.)</pre>
<p>É possível utilizar algumas opções ao gerar uma gem que tornam a geração mais interessante.</p>
<p>Por padrão o projeto gerará testes baseados no Test::Unit, caso você queira utilizar RSpec existe a opção: -T rspec</p>
<p>Outras opções interessantes é poder escolher o tipo de versionamento a ser utilizado: -c ou &#8211;svn para utilizar subversion ou -g ou &#8211;git para utilizar git.</p>
<p>A opção -j ou &#8211;jruby criará um esboço de gem para JRuby.</p>
<p>Para verificar as demais possibilidades:</p>
<pre style="padding-left:30px;">newgem --help</pre>
<h2>Configurando</h2>
<p>As configurações da gem serão centralizadas no Rakefile. Elas são feitas usando o Hoe e em sua maioria são de integração com o RubyForge. Para indicarmos que nossa gem possui depedências para poder ser instaladas devemos utilizar a seguinte configuração para o Hoe:</p>
<pre style="padding-left:30px;">$hoe = Hoe.new('wizzo', Wizzo::VERSION) do |p|
  p.extra_deps         = [
    ['activesupport','&gt;= 2.0.2'],
  ]
end</pre>
<p>Neste caso mostrado acima será é necessário existir um versão igual ou superior à 2.0.2 da gem activesupport para que a nossa gem possa ser instalada.</p>
<p>Outro tipo de dependência que pode ser configurada é a dependência no ambiente de desenvolvimento:</p>
<pre style="padding-left:30px;">p.extra_dev_deps = [
  ['newgem', "&gt;= #{::Newgem::VERSION}"],
  ['factory_girl']
]</pre>
<p>Por padrão o newgem coloca ele mesmo como dependência para o este ambiente, e no exemplo acima adicionei o factory_girl como necessário para o ambiente.</p>
<p>É possível omitir alguns arquivos ao gerar a gem para tanto basta setar a seguinte propriedade no Hoe:</p>
<pre style="padding-left:30px;"> p.clean_globs |= %w[**/.DS_Store tmp *.log *.swp nbproject]</pre>
<p>Existe um conjunto de arquivos que são ignorados por padrão; no exemplo acima adicionei os arquivos *.swp e a pasta de projetos gerada pelo Netbeans.</p>
<p>Bom, é isto pessoal. Espero que tenham gostado e curtam o newgem!</p>
<p>Abraços.</p>
<div id="_mcePaste" style="overflow:hidden;position:absolute;left:-10000px;top:267px;width:1px;height:1px;">
<pre>$ cd ~/ruby_projects
$ newgem wizzo
      create
      create  doc
      create  lib
      create  script
      create  tasks
      create  lib/wizzo
      create  History.txt
      create  Rakefile
      create  README.rdoc
      create  PostInstall.txt
      create  lib/wizzo.rb
  dependency  install_test_unit
      create    test
      create    test/test_helper.rb
      create    test/test_wizzo.rb
  dependency  install_website
      create    website/javascripts
      create    website/stylesheets
      create    config
      exists    script
      exists    tasks
      create    website/index.txt
      create    website/index.html
      create    config/website.yml.sample
      create    script/txt2html
  dependency    plain_theme
      exists      website/javascripts
      exists      website/stylesheets
      create      website/template.html.erb
      create      website/stylesheets/screen.css
      create      website/javascripts/rounded_corners_lite.inc.js
  dependency  install_rubigen_scripts
      exists    script
      create    script/generate
      create    script/destroy
      create  script/console
      create  Manifest.txt
      readme  readme
Important
=========

* Open Rakefile
* Update missing details (gem description, dependent gems, etc.)</pre>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/extendsmymind.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/extendsmymind.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/extendsmymind.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/extendsmymind.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/extendsmymind.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/extendsmymind.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/extendsmymind.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/extendsmymind.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/extendsmymind.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/extendsmymind.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/extendsmymind.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/extendsmymind.wordpress.com/59/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/extendsmymind.wordpress.com/59/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/extendsmymind.wordpress.com/59/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=extendsmymind.wordpress.com&amp;blog=3192470&amp;post=59&amp;subd=extendsmymind&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://extendsmymind.wordpress.com/2009/06/05/criando-novas-rubygems-com-newgem/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2be11e3f2bbb9e61af4f9eca288db9f3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">andersondias</media:title>
		</media:content>
	</item>
		<item>
		<title>Usando vim para programar em Rails</title>
		<link>http://extendsmymind.wordpress.com/2009/05/15/usando-vim-para-programar-em-rails/</link>
		<comments>http://extendsmymind.wordpress.com/2009/05/15/usando-vim-para-programar-em-rails/#comments</comments>
		<pubDate>Fri, 15 May 2009 13:36:45 +0000</pubDate>
		<dc:creator>andersondias</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://extendsmymind.wordpress.com/?p=48</guid>
		<description><![CDATA[Decidi começar a utilizar vim para desenvolver aplicações em Ruby. Desde que então criei um novo blog chamado Vi[m] Dojo um site em inglês mostrando o que tenho aprendido no vi desde a lição mais básica. Ultimamente tenho montado um ambiente de desenvolvimento que me ajude na produtividade e para isso é necessário dar hack [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=extendsmymind.wordpress.com&amp;blog=3192470&amp;post=48&amp;subd=extendsmymind&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Decidi começar a utilizar vim para desenvolver aplicações em Ruby. Desde que então criei um novo blog chamado Vi[m] Dojo um site em inglês mostrando o que tenho aprendido no vi desde a lição mais básica. Ultimamente tenho montado um ambiente de desenvolvimento que me ajude na produtividade e para isso é necessário dar hack no vim. Muitos já falaram sobre como fazê-lo, inclusive o <a title="Rails on Vim" href="http://www.akitaonrails.com/2009/01/03/rails-on-vim" target="_blank">Fabio Akita</a>. O que vou mostrar aqui são os passos que precisei seguir para conseguir utilizar o vim para desenvolver em Ruby:</p>
<p><strong>Compilando o vim:</strong></p>
<p>O vim por padrão não vem com o ruby interpreter instalado e é necessário recompilá-lo para incluir este interpretador.Para verificar se o vim instalado na sua máquina está com o ruby interpreter instalado entre no vim e digite :version, caso apareça um -ruby significa que é necessário recompilar.</p>
<p>Para recompilar use:</p>
<pre style="padding-left:30px;">sudo apt-get install libncurses5-dev ctags # Para compilar corretamente o vim e adicionar o ctags
wget ftp://ftp.vim.org/pub/vim/unix/vim-7.2.tar.bz2
wget http://www.linuxfromscratch.org/patches/blfs/svn/vim-7.2-fixes-5.patch
tar -xvjf vim-7.2.tar.bz2
cd vim72
patch -Np1 -i ../vim-7.2-fixes-5.patch &amp;&amp;
echo '#define SYS_VIMRC_FILE "/etc/vimrc"' &gt;&gt; src/feature.h &amp;&amp;
echo '#define SYS_GVIMRC_FILE "/etc/gvimrc"' &gt;&gt; src/feature.h &amp;&amp;
./configure --prefix=/usr --with-features=huge --enable-rubyinterp &amp;&amp;
make
sudo make install

sudo ln -snfv ../vim/vim72/doc /usr/share/doc/vim-7.2
sudo rm /etc/alternatives/vi
sudo rm /etc/alternatives/vim
sudo rm /etc/alternatives/vimdiff
sudo ln -s /usr/bin/vim /etc/alternatives/vi
sudo ln -s /usr/bin/vim /etc/alternatives/vim
sudo ln -s /usr/bin/vimdiff /etc/alternatives/</pre>
<p><strong>Configurando o vim:</strong></p>
<pre style="padding-left:30px;"> git clone git://github.com/akitaonrails/vimfiles.git ~/.vim
 cd ~/.vim/
 git submodule init
 git submodule update
 cp ~/.vim/vimrc ~/.vimrc
 sudo gem install jamis-fuzzy_file_finder</pre>
<p>A forma mais fácil de testar se o seu ambiente foi iniciado é abrir um arquivo de um projeto rails e digitando :help rails, deverá aparecer todos os comandos do plugin. Para testar o FuzzyFinder pressione Ctrl + F, deverá aparecer uma lista de arquivos no lado esquedo.</p>
<p><strong>Update 1:</strong> Antônio Carlos, um grande amigo meu, tentou refazer os passos e descobriu algumas modificações que são necessárias para poder rodar o script acima (linhas 1 e 6). Obrigado pelo feedback!</p>
<p><strong>Update 2:</strong> Gabriel, tentou refazer os passos e identificou que alguns links (linhas 2 e 3) estavam fora do ar, busquei na internet os novos links e agora está corrigido com as URLs mais novas. Obrigado Gabriel.</p>
<p>Sites para referência:</p>
<p><a href="http://www.akitaonrails.com/2009/01/03/rails-on-vim" target="_blank">http://www.akitaonrails.com/2009/01/03/rails-on-vim</a><br />
<a href="http://www.linuxfromscratch.org/blfs/view/svn/postlfs/vim.html">http://www.linuxfromscratch.org/blfs/view/svn/postlfs/vim.html</a><br />
<a href="http://blog.dotkam.com/2008/08/02/make-railsvim-work-compile-vim-from-sources/">http://blog.dotkam.com/2008/08/02/make-railsvim-work-compile-vim-from-sources/</a><br />
<a href="http://dougsland.livejournal.com/51568.html">http://dougsland.livejournal.com/51568.html</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/extendsmymind.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/extendsmymind.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/extendsmymind.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/extendsmymind.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/extendsmymind.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/extendsmymind.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/extendsmymind.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/extendsmymind.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/extendsmymind.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/extendsmymind.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/extendsmymind.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/extendsmymind.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/extendsmymind.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/extendsmymind.wordpress.com/48/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=extendsmymind.wordpress.com&amp;blog=3192470&amp;post=48&amp;subd=extendsmymind&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://extendsmymind.wordpress.com/2009/05/15/usando-vim-para-programar-em-rails/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2be11e3f2bbb9e61af4f9eca288db9f3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">andersondias</media:title>
		</media:content>
	</item>
		<item>
		<title>Inconpatibilidade entre Flash 9 e Pulse Audio</title>
		<link>http://extendsmymind.wordpress.com/2009/04/29/inconpatibilidade-entre-flash-9-e-pulse-audio/</link>
		<comments>http://extendsmymind.wordpress.com/2009/04/29/inconpatibilidade-entre-flash-9-e-pulse-audio/#comments</comments>
		<pubDate>Wed, 29 Apr 2009 16:09:43 +0000</pubDate>
		<dc:creator>andersondias</dc:creator>
				<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://extendsmymind.wordpress.com/?p=46</guid>
		<description><![CDATA[Depois de muito tempo consegui descobrir uma forma de corrigir o erro de incompatibilidade entre o Flash e os meus programas de áudio no Ubuntu 8.04. O erro ocorria após abrir um site de vídeo, como o Youtube por exemplo, se eu tentasse abrir o Songbird ele não conseguia tocar as minhas músicas. E caso [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=extendsmymind.wordpress.com&amp;blog=3192470&amp;post=46&amp;subd=extendsmymind&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Depois de muito tempo consegui descobrir uma forma de corrigir o erro de incompatibilidade entre o Flash e os meus programas de áudio no Ubuntu 8.04.</p>
<p>O erro ocorria após abrir um site de vídeo, como o Youtube por exemplo, se eu tentasse abrir o Songbird ele não conseguia tocar as minhas músicas. E caso abrisse o Songbird e tentasse abrir um video no Youtube ele também não tocava audio.</p>
<p>Eu tinha que reiniar o Firefox para liberar o Pulse Audio e só assim poderia utilizar aplicativos de áudio.</p>
<p>A solução é bem simples.</p>
<ol>
<li>Remova o pacote padrão do flash:<br />
sudo apt-get remove flashplugin-nonfree</li>
<li>Baixe o pacote para o flash player 10 no site da adobe em:
<p>http://fpdownload.macromedia.com/get/flashplayer/current/install_flash_player_10_linux.deb</li>
<li>Instale o pacote</li>
<li>Reinicie o Firefox</li>
</ol>
<p>Este pacote do novo flash player é compatível com Firefox 2.x e 3.x.</p>
<p>Abraços</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/extendsmymind.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/extendsmymind.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/extendsmymind.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/extendsmymind.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/extendsmymind.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/extendsmymind.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/extendsmymind.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/extendsmymind.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/extendsmymind.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/extendsmymind.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/extendsmymind.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/extendsmymind.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/extendsmymind.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/extendsmymind.wordpress.com/46/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=extendsmymind.wordpress.com&amp;blog=3192470&amp;post=46&amp;subd=extendsmymind&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://extendsmymind.wordpress.com/2009/04/29/inconpatibilidade-entre-flash-9-e-pulse-audio/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2be11e3f2bbb9e61af4f9eca288db9f3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">andersondias</media:title>
		</media:content>
	</item>
		<item>
		<title>Enviando e-mail de contato no Radiant</title>
		<link>http://extendsmymind.wordpress.com/2009/04/16/enviando-e-mail-de-contato-no-radiant/</link>
		<comments>http://extendsmymind.wordpress.com/2009/04/16/enviando-e-mail-de-contato-no-radiant/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 14:31:32 +0000</pubDate>
		<dc:creator>andersondias</dc:creator>
				<category><![CDATA[Radiant]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://extendsmymind.wordpress.com/?p=38</guid>
		<description><![CDATA[Depois de muito apanhar consegui configurar a página do oxenterails.com para enviar e-mails por meio do gmail. Para tal tive que fugir da configuração padrão de mailer do radiant, pois não consegui fazer a configuração utilizando o plugin da radiant (http://github.com/radiant/radiant-mailer-extension/tree/master). Primeiramente instalei o fork do plugin do ntalbott: git clone git://github.com/ntalbott/radiant-mailer-extension.git \ vendor/extensions/mailer Para [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=extendsmymind.wordpress.com&amp;blog=3192470&amp;post=38&amp;subd=extendsmymind&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Depois de muito apanhar consegui configurar a página do oxenterails.com para enviar e-mails por meio do gmail.</p>
<p>Para tal tive que fugir da configuração padrão de mailer do radiant, pois não consegui fazer a configuração utilizando o plugin da radiant (http://github.com/radiant/radiant-mailer-extension/tree/master).</p>
<p>Primeiramente instalei o fork do plugin do ntalbott:</p>
<pre>git clone git://github.com/ntalbott/radiant-mailer-extension.git \
          vendor/extensions/mailer</pre>
<p>Para enviar emails por meio do gmail é necessário instalar o plugin action_mailer_optional_tls. O problema que encontrei é que não existe script/plugin para aplicativos radiant. Então rodei o seguinte comando:</p>
<pre>svn export http://svn.douglasfshearer.com/rails/plugins/action_mailer_optional_tls/ \
           vendor/plugins/action_mailer_optional_tls</pre>
<p>Como indicado em <a title="radiant-mailer-extension" href="http://wiki.github.com/radiant/radiant/mailer-extension" target="_blank">http://wiki.github.com/radiant/radiant/mailer-extension</a>, após a linha ResponseCache.defaults[:logger] inseri o seguinte código de setup do ActionMailer:</p>
<pre style="padding-left:30px;">ActionMailer::Base.smtp_settings = {
  :tls =&gt; true,
  :address =&gt; "smtp.gmail.com",
  :port   =&gt; 587,
  :domain =&gt; "mailerserver.com.br",
  :username =&gt; "maileruser@mailerserver.com.br",
  :password =&gt; "mailerserverpassword",
  :authentication =&gt; :plain
}
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.perform_deliveries = true</pre>
<p>O body do mailer ficou no seguinte padrão:</p>
<pre style="padding-left:30px;">&lt;r:mailer:form name="contact"&gt;
  &lt;fieldset&gt;
    &lt;legend&gt;Contato&lt;/legend&gt;
    &lt;r:error on="name"&gt;
      &lt;span class="error"&gt;Nome é necessário!&lt;/span&gt;&lt;br /&gt;
    &lt;/r:error&gt;
    &lt;label for="name"&gt;Nome:&lt;/label&gt;
    &lt;r:text name="name" required="true" /&gt;&lt;br /&gt;

    &lt;r:error on="email"&gt;
      &lt;span class="error"&gt;E-mail é necessário!&lt;/span&gt;&lt;br /&gt;
    &lt;/r:error&gt;
    &lt;label for="email"&gt;E-mail:&lt;/label&gt;
    &lt;r:text name="email" required="true" /&gt;&lt;br /&gt;

    &lt;label for="message"&gt;Mensagem&lt;/label&gt;&lt;br /&gt;
    &lt;r:error on="message"&gt;
      &lt;span class="error"&gt;Por favor digite uma mensagem!&lt;/span&gt;&lt;br/&gt;
    &lt;/r:error&gt;
    &lt;r:textarea name="message" required="true" /&gt;&lt;br /&gt;&lt;br /&gt;

    &lt;input type="submit" value="Enviar!" /&gt;
  &lt;/fieldset&gt;
&lt;/r:mailer:form&gt;</pre>
<p>O yml do mailer ficou no seguinte padrão:</p>
<pre style="padding-left:30px;">subject: Contato
from_field: email
redirect_to: /contact/thank-you/
recipients:
   - contact@mailerserver.com.br</pre>
<p>Atente para o detalhe do redirect_to, criei uma página para retorno.</p>
<p>E o email ficou configurado segundo o padrão:</p>
<pre style="padding-left:30px;">Olá,
&lt;r:mailer:get name="name"/&gt; (&lt;r:mailer:get name="email"/&gt;):
&lt;r:mailer:get name="message"/&gt;</pre>
<p>Com estas configurações consegui fazer o mailer funcionar. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>PS: desculpem pela demora nos posts, tempo é algo muito raro&#8230;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/extendsmymind.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/extendsmymind.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/extendsmymind.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/extendsmymind.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/extendsmymind.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/extendsmymind.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/extendsmymind.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/extendsmymind.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/extendsmymind.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/extendsmymind.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/extendsmymind.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/extendsmymind.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/extendsmymind.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/extendsmymind.wordpress.com/38/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=extendsmymind.wordpress.com&amp;blog=3192470&amp;post=38&amp;subd=extendsmymind&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://extendsmymind.wordpress.com/2009/04/16/enviando-e-mail-de-contato-no-radiant/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2be11e3f2bbb9e61af4f9eca288db9f3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">andersondias</media:title>
		</media:content>
	</item>
		<item>
		<title>Configurando Ubuntu em Dell Vostro 1310 [Microfone externo]</title>
		<link>http://extendsmymind.wordpress.com/2009/03/10/configurando-ubuntu-em-dell-vostro-1310-microfone-externo/</link>
		<comments>http://extendsmymind.wordpress.com/2009/03/10/configurando-ubuntu-em-dell-vostro-1310-microfone-externo/#comments</comments>
		<pubDate>Tue, 10 Mar 2009 18:15:39 +0000</pubDate>
		<dc:creator>andersondias</dc:creator>
				<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://extendsmymind.wordpress.com/?p=28</guid>
		<description><![CDATA[Esses dias recebemos os notebooks novos da empresa, são notebooks Dell Vostro 1310. Ao tentar instalar o Ubuntu 8.04 no notebook encontrei alguns problemas, um destes foi com os microfones. Este modelo vem com dois microfones, um embutido e um microfone externo (para headset por exemplo). Procurei várias formas para fazê-los funcionar, o único que [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=extendsmymind.wordpress.com&amp;blog=3192470&amp;post=28&amp;subd=extendsmymind&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Esses dias recebemos os notebooks novos da empresa, são notebooks Dell Vostro 1310.</p>
<p>Ao tentar instalar o Ubuntu 8.04 no notebook encontrei alguns problemas, um destes foi com os microfones.</p>
<p>Este modelo vem com dois microfones, um embutido e um microfone externo (para headset por exemplo).</p>
<p>Procurei várias formas para fazê-los funcionar, o único que eu consegui foi o microfone externo. Para configurá-lo deve se adicionar a seguinte linha no arquivo /etc/modprobe.d/alsa-base :</p>
<blockquote>
<pre>options snd-hda-intel model=dell</pre>
</blockquote>
<p>É necessário fazer alguns ajustes no Volume Control e pronto! Ready to use.</p>
<p>Estes passos funcionaram na máquina que testei. Por favor, comentem caso funcione ou não na sua máquina.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/extendsmymind.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/extendsmymind.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/extendsmymind.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/extendsmymind.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/extendsmymind.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/extendsmymind.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/extendsmymind.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/extendsmymind.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/extendsmymind.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/extendsmymind.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/extendsmymind.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/extendsmymind.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/extendsmymind.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/extendsmymind.wordpress.com/28/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=extendsmymind.wordpress.com&amp;blog=3192470&amp;post=28&amp;subd=extendsmymind&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://extendsmymind.wordpress.com/2009/03/10/configurando-ubuntu-em-dell-vostro-1310-microfone-externo/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2be11e3f2bbb9e61af4f9eca288db9f3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">andersondias</media:title>
		</media:content>
	</item>
		<item>
		<title>Undefined method &#8216;to_plain_segments&#8217;</title>
		<link>http://extendsmymind.wordpress.com/2008/10/28/undefined-method-to_plain_segments/</link>
		<comments>http://extendsmymind.wordpress.com/2008/10/28/undefined-method-to_plain_segments/#comments</comments>
		<pubDate>Tue, 28 Oct 2008 16:32:08 +0000</pubDate>
		<dc:creator>andersondias</dc:creator>
				<category><![CDATA[errors]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rcov]]></category>
		<category><![CDATA[rspec]]></category>
		<category><![CDATA[rubyonrails]]></category>

		<guid isPermaLink="false">http://extendsmymind.wordpress.com/?p=19</guid>
		<description><![CDATA[Hoje, ao tentar usar o rake spec:rcov para verificar a cobertura do meu código percebi que alguns testes de roteamento estavam falhando e a exceção lançada era a seguinte: undefined method `to_plain_segments' for #&#60;ActionController::Routing::RouteSet:0xb7659174&#62; O mais estranho era que ao executar os testes do RSpec (rake spec) nenhum erro era detectado. Este erro ocorre por [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=extendsmymind.wordpress.com&amp;blog=3192470&amp;post=19&amp;subd=extendsmymind&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Hoje, ao tentar usar o rake spec:rcov para verificar a cobertura do meu código percebi que alguns testes de roteamento estavam falhando e a exceção lançada era a seguinte:</p>
<blockquote>
<pre>undefined method `to_plain_segments'
for #&lt;ActionController::Routing::RouteSet:0xb7659174&gt;</pre>
</blockquote>
<p>O mais estranho era que ao executar os testes do RSpec (rake spec) nenhum erro era detectado.</p>
<p>Este erro ocorre por um bug no rcov 0.8.1.2.0.</p>
<p>Existe um fork do projeto rcov criado pelo usuário <a title="spicycode" href="http://github.com/spicycode/rcov/tree/master" target="_blank">spicycode</a> no github que corrige este erro. Basta usar o comando abaixo para poder ver seus testes de roteamento que estavam falhando voltando a ficar verdes:</p>
<blockquote>
<pre>sudo gem install spicycode-rcov -s http://gems.github.com</pre>
</blockquote>
<p>Agradecimentos ao post do Daniel no <a title="Kopongo" href="http://kopongo.com/2008/9/23/to_segments_error">Kopongo</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/extendsmymind.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/extendsmymind.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/extendsmymind.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/extendsmymind.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/extendsmymind.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/extendsmymind.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/extendsmymind.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/extendsmymind.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/extendsmymind.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/extendsmymind.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/extendsmymind.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/extendsmymind.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/extendsmymind.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/extendsmymind.wordpress.com/19/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=extendsmymind.wordpress.com&amp;blog=3192470&amp;post=19&amp;subd=extendsmymind&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://extendsmymind.wordpress.com/2008/10/28/undefined-method-to_plain_segments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2be11e3f2bbb9e61af4f9eca288db9f3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">andersondias</media:title>
		</media:content>
	</item>
		<item>
		<title>DRier database.yml</title>
		<link>http://extendsmymind.wordpress.com/2008/10/01/drier-databaseyml-e/</link>
		<comments>http://extendsmymind.wordpress.com/2008/10/01/drier-databaseyml-e/#comments</comments>
		<pubDate>Thu, 02 Oct 2008 02:44:00 +0000</pubDate>
		<dc:creator>andersondias</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[dry]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rubyonrails]]></category>
		<category><![CDATA[yml]]></category>

		<guid isPermaLink="false">http://extendsmymind.wordpress.com/?p=10</guid>
		<description><![CDATA[When we create a new Rails project a database.yml is created for us, and it looks like this one: development: adapter: mysql encoding: utf8 database: project_development username: root password: password socket: /var/run/mysqld/mysqld.sock test: adapter: mysql encoding: utf8 database: project_test username: root password: password socket: /var/run/mysqld/mysqld.sock production: adapter: mysql encoding: utf8 database: project_production username: root password: [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=extendsmymind.wordpress.com&amp;blog=3192470&amp;post=10&amp;subd=extendsmymind&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>When we create a new Rails project a database.yml is created for us, and it looks like this one:</p>
<blockquote>
<pre><strong>development:</strong>
  <strong>adapter:</strong> mysql
  <strong>encoding:</strong> utf8
  <strong>database:</strong> project_development
  <strong>username:</strong> root
  <strong>password:</strong> password
  <strong>socket:</strong> /var/run/mysqld/mysqld.sock

<strong>test:</strong>
  <strong>adapter:</strong> mysql
  <strong>encoding:</strong> utf8
  <strong>database:</strong> project_test
  <strong>username:</strong> root
  <strong>password:</strong> password
  <strong>socket:</strong> /var/run/mysqld/mysqld.sock

<strong>production:</strong>
  <strong>adapter:</strong> mysql
  <strong>encoding:</strong> utf8
  <strong>database:</strong> project_production
  <strong>username:</strong> root
  <strong>password:</strong> password
  <strong>socket:</strong> /var/run/mysqld/mysqld.sock</pre>
</blockquote>
<p>But, RoR is strongly based on DRY (Don&#8217;t Repeat Yourself) concept. And, as we can see, we have a lot of duplicated lines here.</p>
<p>If we pay attention, some lines of the database.yml file are repeated on development, test and production databases, and for most of the projects we have this databases on the same local. So, we have some lines repeated:</p>
<blockquote>
<pre>  <strong>adapter:</strong> mysql
  <strong>encoding:</strong> utf8
  <strong>username:</strong> root
  <strong>password:</strong> password
  <strong>socket:</strong> /var/run/mysqld/mysqld.sock</pre>
</blockquote>
<p>Googling, you can find a &#8220;DRY database.yml&#8221; scratched like this one:</p>
<blockquote>
<pre><strong>login:</strong> &amp;login
  <strong>adapter:</strong> mysql
  <strong>username:</strong> root
  <strong>password:</strong> password
  <strong>socket:</strong> /var/run/mysqld/mysqld.sock

<strong>development:</strong>
  <strong>&lt;&lt;:</strong> *login
  <strong>database:</strong> project_development

<strong>test:</strong>
  &lt;&lt;: *login
  <strong>database:</strong> project_test

<strong>production:</strong>
  &lt;&lt;: *login
  <strong>database:</strong> project_production</pre>
</blockquote>
<p>But, for me we still have some duplicated lines, and I don&#8217;t like it. So here goes the &#8220;DRier database.yml&#8221;:</p>
<blockquote>
<pre><strong>login:</strong> &amp;login
  <strong>adapter:</strong> mysql
  <strong>username:</strong> root
  <strong>password:</strong> password
  <strong>host:</strong> localhost

&lt;% [<span style="color:#ff6600;">"development"<span style="color:#000000;">,</span> "test"<span style="color:#000000;">,</span> "production"</span>].each <span style="color:#0000ff;">do</span> |environment| %&gt;
&lt;%= environment %&gt;:
  &lt;&lt;: *login
  <strong>database:</strong> project_&lt;%= environment %&gt;
&lt;% <span style="color:#0000ff;">end</span> %&gt;</pre>
</blockquote>
<p>Enjoy it!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/extendsmymind.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/extendsmymind.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/extendsmymind.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/extendsmymind.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/extendsmymind.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/extendsmymind.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/extendsmymind.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/extendsmymind.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/extendsmymind.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/extendsmymind.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/extendsmymind.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/extendsmymind.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/extendsmymind.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/extendsmymind.wordpress.com/10/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=extendsmymind.wordpress.com&amp;blog=3192470&amp;post=10&amp;subd=extendsmymind&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://extendsmymind.wordpress.com/2008/10/01/drier-databaseyml-e/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2be11e3f2bbb9e61af4f9eca288db9f3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">andersondias</media:title>
		</media:content>
	</item>
		<item>
		<title>DRier database.yml</title>
		<link>http://extendsmymind.wordpress.com/2008/10/01/drier-databaseyml/</link>
		<comments>http://extendsmymind.wordpress.com/2008/10/01/drier-databaseyml/#comments</comments>
		<pubDate>Thu, 02 Oct 2008 02:26:11 +0000</pubDate>
		<dc:creator>andersondias</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[dry]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rubyonrails]]></category>
		<category><![CDATA[yml]]></category>

		<guid isPermaLink="false">http://extendsmymind.wordpress.com/?p=8</guid>
		<description><![CDATA[Ao criar um novo projeto rails é criado juntamente com o projeto um arquivo database.yml parecido com este: development: adapter: mysql encoding: utf8 database: project_development username: root password: password socket: /var/run/mysqld/mysqld.sock test: adapter: mysql encoding: utf8 database: project_test username: root password: password socket: /var/run/mysqld/mysqld.sock production: adapter: mysql encoding: utf8 database: project_production username: root password: password [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=extendsmymind.wordpress.com&amp;blog=3192470&amp;post=8&amp;subd=extendsmymind&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Ao criar um novo projeto rails é criado juntamente com o projeto um arquivo database.yml parecido com este:</p>
<blockquote>
<pre><strong>development:</strong>
  <strong>adapter:</strong> mysql
  <strong>encoding:</strong> utf8
  <strong>database:</strong> project_development
  <strong>username:</strong> root
  <strong>password:</strong> password
  <strong>socket:</strong> /var/run/mysqld/mysqld.sock

<strong>test:</strong>
  <strong>adapter:</strong> mysql
  <strong>encoding:</strong> utf8
  <strong>database:</strong> project_test
  <strong>username:</strong> root
  <strong>password:</strong> password
  <strong>socket:</strong> /var/run/mysqld/mysqld.sock

<strong>production:</strong>
  <strong>adapter:</strong> mysql
  <strong>encoding:</strong> utf8
  <strong>database:</strong> project_production
  <strong>username:</strong> root
  <strong>password:</strong> password
  <strong>socket:</strong> /var/run/mysqld/mysqld.sock</pre>
</blockquote>
<p>Mas, como sempre ouvimos, um dos conceitos base do RoR é o DRY (Don&#8217;t Repeat Yourself &#8211; Não repita a si mesmo). E como podemos ver neste arquivo existem diversas linhas duplicadas.</p>
<p>De uma forma geral as bases de dados de desenvolvimento, produção e teste residem na mesma máquina e portanto temos algumas linhas que sempre iremos repetir:</p>
<blockquote>
<pre>  <strong>adapter:</strong> mysql
  <strong>encoding:</strong> utf8
  <strong>username:</strong> root
  <strong>password:</strong> password
  <strong>socket:</strong> /var/run/mysqld/mysqld.sock</pre>
</blockquote>
<p>Googlando não é nada difícil encontrar o seguinte modelo de database.yml conhecido como &#8220;DRY database.yml&#8221;:</p>
<blockquote>
<pre><strong>login:</strong> &amp;login
  <strong>adapter:</strong> mysql
  <strong>username:</strong> root
  <strong>password:</strong> password
  <strong>socket:</strong> /var/run/mysqld/mysqld.sock

<strong>development:</strong>
  <strong>&lt;&lt;:</strong> *login
  <strong>database:</strong> project_development

<strong>test:</strong>
  &lt;&lt;: *login
  <strong>database:</strong> project_test

<strong>production:</strong>
  &lt;&lt;: *login
  <strong>database:</strong> project_production</pre>
</blockquote>
<p>Mas, concordemos que ainda existe uma certa duplicação de código. Então lá vai a versão DRier do database.yml:</p>
<blockquote>
<pre><strong>login:</strong> &amp;login
  <strong>adapter:</strong> mysql
  <strong>username:</strong> root
  <strong>password:</strong> password
  <strong>host:</strong> localhost

&lt;% [<span style="color:#ff6600;">"development"<span style="color:#000000;">,</span> "test"<span style="color:#000000;">,</span> "production"</span>].each <span style="color:#0000ff;">do</span> |environment| %&gt;
&lt;%= environment %&gt;:
  &lt;&lt;: *login
  <strong>database:</strong> biblemarks_&lt;%= environment %&gt;
&lt;% <span style="color:#0000ff;">end</span> %&gt;</pre>
</blockquote>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/extendsmymind.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/extendsmymind.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/extendsmymind.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/extendsmymind.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/extendsmymind.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/extendsmymind.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/extendsmymind.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/extendsmymind.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/extendsmymind.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/extendsmymind.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/extendsmymind.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/extendsmymind.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/extendsmymind.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/extendsmymind.wordpress.com/8/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=extendsmymind.wordpress.com&amp;blog=3192470&amp;post=8&amp;subd=extendsmymind&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://extendsmymind.wordpress.com/2008/10/01/drier-databaseyml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2be11e3f2bbb9e61af4f9eca288db9f3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">andersondias</media:title>
		</media:content>
	</item>
		<item>
		<title>Writing unit tests for abstract classes</title>
		<link>http://extendsmymind.wordpress.com/2008/05/24/writing-unit-tests-for-abstract-classes/</link>
		<comments>http://extendsmymind.wordpress.com/2008/05/24/writing-unit-tests-for-abstract-classes/#comments</comments>
		<pubDate>Sat, 24 May 2008 16:45:35 +0000</pubDate>
		<dc:creator>andersondias</dc:creator>
				<category><![CDATA[TDD]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[junit]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[unit test]]></category>

		<guid isPermaLink="false">http://extendsmymind.wordpress.com/?p=6</guid>
		<description><![CDATA[If you have created an Abstract Class you may want to test its non abstract methods. But there is one problem: we can&#8217;t instantiate abstract classes. There are two ways to test their non abstract methods: Testing Abstract Classes Through Their Children&#8217;s Suppose we have the following abstract class named Person: public abstract class Person [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=extendsmymind.wordpress.com&amp;blog=3192470&amp;post=6&amp;subd=extendsmymind&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you have created an Abstract Class you may want to test its non abstract methods. But there is one problem: we can&#8217;t instantiate abstract classes.</p>
<p>There are two ways to test their non abstract methods:</p>
<h2>Testing Abstract Classes Through Their Children&#8217;s</h2>
<p>Suppose we have the following abstract class named Person:</p>
<pre>public abstract class Person {
    private String firstName;
    private String lastName;

    public abstract void doAnything();
    public String getFullName(){
        return firstName + " " + lastName;
    }
    // Getters and setters here...
}</pre>
<p>And a Boss class that extends Person:</p>
<pre>public class Boss extends Person{
    @Override
    public void doAnything() {
        System.out.println("Do anything...");
    }
}</pre>
<p>And you want to test the Person.getFullName() method. So you must create the test below:</p>
<pre>public class PersonTest {
    Person person;
    @Before
    public void setUp() {
        person = new <em><strong>Boss()</strong></em>;
        person.setFirstName("Anderson");
        person.setLastName("Dias");
    }
    @Test
    public void getFullName(){
        assertEquals("Anderson Dias", person.getFullName());
    }
}</pre>
<p>On this first case, it will work fine and the test will pass no matter. <span style="color:#000000;"><span style="background:transparent none repeat scroll 0 50%;">But there is a problem, because it&#8217;s been assumed that the Boss class will never override the getFullName() method. If the Boss class changes, the test will fail.</span></span></p>
<pre>public class Boss extends Person {
    <em><strong>@Override
    public String getFullName(){
        return "Mr. " + super.getFullName();
    }</strong></em>
    @Override
    public void doAnything() {
        System.out.println("Do anything...");
    }
}</pre>
<p>So, what to do? Let&#8217;s see another way to test Abstract Classes.</p>
<h2>Creating Mock Implementations for Abstract Classes</h2>
<p style="text-decoration:none;"><span style="color:#000000;"><span style="background:transparent none repeat scroll 0 50%;">There is a simple way to test them. You can create a mock class that simulates the implementation of an abstract class. You will guarantee that the non abstract methods will be the same of the parent abstract class.</span></span></p>
<p style="text-decoration:none;"><span style="color:#000000;"><span style="background:transparent none repeat scroll 0 50%;">Let&#8217;s see a sample Mock implementation:</span></span></p>
<pre>public class MockPerson extends Person {
    @Override
    public void doAnything() { }
}</pre>
<p style="text-decoration:none;"><span style="color:#000000;"><span style="background:transparent none repeat scroll 0 50%;">Notice that you don&#8217;t have to test the Person abstract class methods right now. So you don&#8217;t have to implement the doAnything() method body on the Mock implementation.</span></span></p>
<p>And our Test Case will be:</p>
<pre>public class PersonTest {
    Person person;
    @Before
    public void setUp() {
        person = new <em><strong>MockPerson()</strong></em>;
        person.setFirstName("Anderson");
        person.setLastName("Dias");
    }
    @Test
    public void getFullName(){
        assertEquals("Anderson Dias", person.getFullName());
    }
}</pre>
<p style="text-decoration:none;"><span style="color:#000000;"><span style="background:transparent none repeat scroll 0 50%;">That&#8217;s a simple way to test abstract methods.</span></span></p>
<p>Of course there are some specifics cases that Mock Objects don&#8217;t solve, in those cases you will need to test using the first strategy.</p>
<pre>public abstract class Person {
    private String firstName;
    private String lastName;

    public abstract void doAnything();
    public String getFullName(){
        this.doAnything();
        return firstName + " " + lastName;
    }
    // Getters and setters here...
}</pre>
<p>In this case our non abstract method ( Person.getFullName() ) calls the abstract method ( Person.doAnything() ), and the implementation of Person.doAnything() method may be decisive for the Person.getFullName() return. So, the only way to test it will be by the Person children classes.</p>
<p>I hope you enjoy it.</p>
<p><em>Thanks to Raquel Carsi for help me to write this post.</em></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/extendsmymind.wordpress.com/6/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/extendsmymind.wordpress.com/6/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/extendsmymind.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/extendsmymind.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/extendsmymind.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/extendsmymind.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/extendsmymind.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/extendsmymind.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/extendsmymind.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/extendsmymind.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/extendsmymind.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/extendsmymind.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/extendsmymind.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/extendsmymind.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/extendsmymind.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/extendsmymind.wordpress.com/6/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=extendsmymind.wordpress.com&amp;blog=3192470&amp;post=6&amp;subd=extendsmymind&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://extendsmymind.wordpress.com/2008/05/24/writing-unit-tests-for-abstract-classes/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2be11e3f2bbb9e61af4f9eca288db9f3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">andersondias</media:title>
		</media:content>
	</item>
		<item>
		<title>Rubygems execution error</title>
		<link>http://extendsmymind.wordpress.com/2008/04/23/rubygems-execution-error/</link>
		<comments>http://extendsmymind.wordpress.com/2008/04/23/rubygems-execution-error/#comments</comments>
		<pubDate>Wed, 23 Apr 2008 21:27:58 +0000</pubDate>
		<dc:creator>andersondias</dc:creator>
				<category><![CDATA[errors]]></category>
		<category><![CDATA[gems]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rubygems]]></category>
		<category><![CDATA[rubyonrails]]></category>

		<guid isPermaLink="false">http://extendsmymind.wordpress.com/?p=4</guid>
		<description><![CDATA[When I am trying to use rubygems on Ubuntu 7.10 I took this error: "rubygems/custom_require.rb:27:in `gem_original_require': no such file to load -- sources (LoadError)" This error occurs when GEM_HOME system variable is unset. To solve that first check your gems directory: # locale will find occurrences of gems on the system # look for the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=extendsmymind.wordpress.com&amp;blog=3192470&amp;post=4&amp;subd=extendsmymind&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>When I am trying to use rubygems on Ubuntu 7.10 I took this error:</p>
<pre>"rubygems/custom_require.rb:27:in `gem_original_require':
no such file to load -- sources (LoadError)"</pre>
<p>This error occurs when GEM_HOME system variable is unset. To solve that first check your gems directory:</p>
<pre># locale will find occurrences of gems on the system
# look for the one that points to gems home directory
locate gems</pre>
<p>The default path for rubygems ( ruby version 1.8 ) is &#8220;/var/lib/gems/1.8&#8243;.</p>
<p>So now create the GEM_HOME variable:</p>
<pre># export GEM_HOME="path_to_gems"
export GEM_HOME="/var/lib/gems/1.8/"</pre>
<p>And rubygems will work well.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/extendsmymind.wordpress.com/4/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/extendsmymind.wordpress.com/4/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/extendsmymind.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/extendsmymind.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/extendsmymind.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/extendsmymind.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/extendsmymind.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/extendsmymind.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/extendsmymind.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/extendsmymind.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/extendsmymind.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/extendsmymind.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/extendsmymind.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/extendsmymind.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/extendsmymind.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/extendsmymind.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=extendsmymind.wordpress.com&amp;blog=3192470&amp;post=4&amp;subd=extendsmymind&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://extendsmymind.wordpress.com/2008/04/23/rubygems-execution-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/2be11e3f2bbb9e61af4f9eca288db9f3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">andersondias</media:title>
		</media:content>
	</item>
	</channel>
</rss>
