<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>Blog de JCastaneyra</title>
	
	<link>http://www.jcastaneyra.com</link>
	<description>Repositorio de ideas</description>
	<lastBuildDate>Sun, 30 May 2010 08:05:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/jcastaneyra" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="jcastaneyra" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Installing RabbitMQ + Stomp in Ubuntu/Mac</title>
		<link>http://www.jcastaneyra.com/2010/05/30/installing-rabbitmq-stomp-in-ubuntumac/</link>
		<comments>http://www.jcastaneyra.com/2010/05/30/installing-rabbitmq-stomp-in-ubuntumac/#comments</comments>
		<pubDate>Sun, 30 May 2010 07:02:05 +0000</pubDate>
		<dc:creator>jcastaneyra</dc:creator>
				<category><![CDATA[OpenSource]]></category>
		<category><![CDATA[comet]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[orbited]]></category>
		<category><![CDATA[rabbitmq]]></category>
		<category><![CDATA[stomp]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.jcastaneyra.com/?p=294</guid>
		<description><![CDATA[En español In the project I&#8217;m working now it was needed to have RabbitMQ running with Stomp as a message queue for Orbited, we know that Orbited comes with MorbidQ, but in our system we already had running RabbitMQ and used by other processes, so, two queue systems at the same time were not needed. [...]]]></description>
			<content:encoded><![CDATA[<p><a name="rabbitmq_stomp_english"></a> <a href="#rabbitmq_stomp_spanish">En español</a></p>
<p><img src="http://www.jcastaneyra.com/wp-content/uploads/2010/05/RabbitMQLogo-300x79.png" alt="" title="RabbitMQLogo" width="300" height="79" class="size-medium wp-image-296" /></p>
<p>In the project I&#8217;m working now it was needed to have RabbitMQ running with Stomp as a message queue for Orbited, we know that Orbited comes with MorbidQ, but in our system we already had running RabbitMQ and used by other processes, so, two queue systems at the same time were not needed.</p>
<p>But, searching for Stomp over RabbitMQ info or some kind of tutorial was difficult and painful, a friend of mine would say &#8220;a real pain in the ass&#8221;, there was info but not too clear. For that reason here is another note to myself, just in case.</p>
<ul>
<li>RabbitMQ 1.6.0 installed, <a href="http://www.jcastaneyra.com/2009/06/07/instalando-rabbitmq/">here there are some steps</a> to install it.</li>
<li>Mercurial is needed to download Stomp code</li>
<li>Download Stomp code</li>
<pre>
hg clone -r rabbitmq_v1_6_0 http://hg.rabbitmq.com/rabbitmq-stomp
</pre>
<li>Compile Stomp (use your RabbitMQ include directory, maybe in Linux /usr/lib/erlang/lib/rabbitmq_server-1.6.0/include , in Mac I have it here /usr/local/lib/erlang/lib/rabbitmq_server-1.6.0/include)</li>
<pre>
cd rabbitmq-stomp
make RABBIT_SERVER_INCLUDE_DIR=/usr/lib/erlang/lib/rabbitmq_server-1.6.0/include
</pre>
<li>Copy your compiled Stomp to the Erlang libraries</li>
<pre>
sudo mkdir -p /usr/lib/erlang/lib/rabbitmq-stomp
sudo cp -R * /usr/lib/erlang/lib/rabbitmq-stomp
</pre>
<li>Add the Stomp configuration for RabbitMQ (also use your correct directory here, in Linux /usr/lib/erlang/lib/rabbitmq-stomp/ebin and in my Mac /usr/local/lib/erlang/lib/rabbitmq-stomp/ebin)</li>
</ul>
<pre>
sudo vim /etc/rabbitmq/rabbitmq.conf
</pre>
<pre>
#Add the lines below
NODENAME=rabbit
NODE_IP_ADDRESS=0.0.0.0
NODE_PORT=5672

LOG_BASE=/var/log/rabbitmq
MNESIA_BASE=/var/lib/rabbitmq/mnesia

SERVER_START_ARGS='
  -pa /usr/lib/erlang/lib/rabbitmq-stomp/ebin
  -rabbit
    stomp_listeners [{"0.0.0.0",61613}]
    extra_startup_steps [{"STOMP-listeners",rabbit_stomp,kickstart,[]}]'
</pre>
<p>And that&#8217;s it, if you start RabbitMQ will see how STOMP-Listeners are starting (In Linux you maybe will need to stop RabbitMQ with the following command <code>sudo /etc/init.d/rabbitmq-server stop</code> before running the next step, in my Mac I use this command to start RabbitMQ <code>sudo /usr/local/lib/erlang/lib/rabbitmq_server-1.6.0/sbin/rabbitmq-server</code>)</p>
<pre>
deploy@localhost:~$ sudo rabbitmq-server
RabbitMQ 1.6.0 (AMQP 8-0)
Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd.
Licensed under the MPL.  See http://www.rabbitmq.com/

node        : rabbit@localhost
log         : /var/log/rabbitmq/rabbit.log
sasl log    : /var/log/rabbitmq/rabbit-sasl.log
database dir: /var/lib/rabbitmq/mnesia/rabbit

starting database             ...done
starting core processes       ...done
starting recovery             ...done
starting persister            ...done
starting guid generator       ...done
starting builtin applications ...done
starting TCP listeners        ...done
starting STOMP-listeners      ...done

broker running
</pre>
<p><a name="rabbitmq_stomp_spanish"></a> <a href="#rabbitmq_stomp_english">In english</a></p>
<p><img src="http://www.jcastaneyra.com/wp-content/uploads/2010/05/RabbitMQLogo-300x79.png" alt="" title="RabbitMQLogo" width="300" height="79" class="size-medium wp-image-296" /></p>
<p>En el proyecto en el que estoy trabajando era necesario tener corriendo RabbitMQ con Stomp para poder hacer conexiones con Orbited, Orbited ya incluye MorbidQ, pero en este caso ya teníamos corriendo RabbitMQ para otros procesos y no era necesario tener un segundo sistema de queues.</p>
<p>Sorprendentemente, encontrar información de cómo agregar Stomp a RabbitMQ resultó algo doloroso, si había información pero como que no indicaba bien que pasos seguir. Entonces como parte de mis notas personales estoy agregando esta receta por si se llega a ofrecer de nueva cuenta.</p>
<ul>
<li>Tener instalado RabbitMQ 1.6.0, <a href="http://www.jcastaneyra.com/2009/06/07/instalando-rabbitmq/">aquí hay unos pasos</a> para instalarlo.</li>
<li>Tener instalado Mercurial para bajar el código de Stomp</li>
<li>Bajar el código de Stomp</li>
<pre>
hg clone -r rabbitmq_v1_6_0 http://hg.rabbitmq.com/rabbitmq-stomp
</pre>
<li>Compilar Stomp (apuntando al directorio de include donde se encuentra RabbitMQ, en Linux /usr/lib/erlang/lib/rabbitmq_server-1.6.0/include y en Mac yo lo tengo en /usr/local/lib/erlang/lib/rabbitmq_server-1.6.0/include)</li>
<pre>
cd rabbitmq-stomp
make RABBIT_SERVER_INCLUDE_DIR=/usr/lib/erlang/lib/rabbitmq_server-1.6.0/include
</pre>
<li>Copiar Stomp compilado al directorio de librerías de Erlang</li>
<pre>
sudo mkdir -p /usr/lib/erlang/lib/rabbitmq-stomp
sudo cp -R * /usr/lib/erlang/lib/rabbitmq-stomp
</pre>
<li>Agregar la configuración de Stomp a RabbitMQ (también apuntar al directorio correcto en la configuración, en Linux /usr/lib/erlang/lib/rabbitmq-stomp/ebin y en mi Mac /usr/local/lib/erlang/lib/rabbitmq-stomp/ebin)</li>
</ul>
<pre>
sudo vim /etc/rabbitmq/rabbitmq.conf
</pre>
<pre>
#Add the lines below
NODENAME=rabbit
NODE_IP_ADDRESS=0.0.0.0
NODE_PORT=5672

LOG_BASE=/var/log/rabbitmq
MNESIA_BASE=/var/lib/rabbitmq/mnesia

SERVER_START_ARGS='
  -pa /usr/lib/erlang/lib/rabbitmq-stomp/ebin
  -rabbit
    stomp_listeners [{"0.0.0.0",61613}]
    extra_startup_steps [{"STOMP-listeners",rabbit_stomp,kickstart,[]}]'
</pre>
<p>Listo, si intentan arrancar RabbitMQ se verá que dice que está levantando los STOMP-Listeners (En Linux talvez necesiten terminar el proceso con <code>sudo /etc/init.d/rabbitmq-server stop</code> antes de correr lo siguiente, y en Mac para levantar el servidor yo ejecuto <code>sudo /usr/local/lib/erlang/lib/rabbitmq_server-1.6.0/sbin/rabbitmq-server</code>)</p>
<pre>
deploy@localhost:~$ sudo rabbitmq-server
RabbitMQ 1.6.0 (AMQP 8-0)
Copyright (C) 2007-2009 LShift Ltd., Cohesive Financial Technologies LLC., and Rabbit Technologies Ltd.
Licensed under the MPL.  See http://www.rabbitmq.com/

node        : rabbit@localhost
log         : /var/log/rabbitmq/rabbit.log
sasl log    : /var/log/rabbitmq/rabbit-sasl.log
database dir: /var/lib/rabbitmq/mnesia/rabbit

starting database             ...done
starting core processes       ...done
starting recovery             ...done
starting persister            ...done
starting guid generator       ...done
starting builtin applications ...done
starting TCP listeners        ...done
starting STOMP-listeners      ...done

broker running
</pre>

<p><a href="http://feedads.g.doubleclick.net/~a/WcmUaEe3Tf1w6qipwF9N27pWOmY/0/da"><img src="http://feedads.g.doubleclick.net/~a/WcmUaEe3Tf1w6qipwF9N27pWOmY/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/WcmUaEe3Tf1w6qipwF9N27pWOmY/1/da"><img src="http://feedads.g.doubleclick.net/~a/WcmUaEe3Tf1w6qipwF9N27pWOmY/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.jcastaneyra.com/2010/05/30/installing-rabbitmq-stomp-in-ubuntumac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bundler gem and Daemons error (The default Gemfile was not found)</title>
		<link>http://www.jcastaneyra.com/2010/02/12/bundler-gem-and-daemons-error-the-default-gemfile-was-not-found/</link>
		<comments>http://www.jcastaneyra.com/2010/02/12/bundler-gem-and-daemons-error-the-default-gemfile-was-not-found/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 07:28:16 +0000</pubDate>
		<dc:creator>jcastaneyra</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[bundler]]></category>
		<category><![CDATA[daemons]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.jcastaneyra.com/?p=282</guid>
		<description><![CDATA[(En español) Some days ago we deployed an application with rails, in this application we are using some daemons (with daemons gem) to take care about some business processes, and recently to have more control with all gems used by our application we started to use bundler. Almost all was done, so, at the moment [...]]]></description>
			<content:encoded><![CDATA[<p><a name="bundler_gem_daemons_error_english"></a> (<a href="#bundler_gem_daemons_error_spanish">En español</a>)</p>
<p>Some days ago we deployed an application with rails, in this application we are using some daemons (with daemons gem) to take care about some business processes, and recently to have more control with all gems used by our application we started to use bundler.</p>
<p>Almost all was done, so, at the moment to start the daemons, we get the following error:</p>
<pre>
/usr/lib/ruby/gems/1.8/gems/bundler-0.9.3/lib/bundler.rb:122:in `default_gemfile': The default Gemfile was not found (Bundler::GemfileNotFound)
	from /usr/lib/ruby/gems/1.8/gems/bundler-0.9.3/lib/bundler.rb:64:in `setup'
</pre>
<p>So, looking for this error in google we didn&#8217;t get anything, and looking into the bundler gem code the solution to this problems was:</p>
<pre>
ENV['BUNDLE_GEMFILE'] ||= File.join(Dir.pwd, 'Gemfile')
</pre>
<p>The complete daemon code here:</p>
<p><script src="http://gist.github.com/302390.js"></script></p>
<p><a name="bundler_gem_daemons_error_spanish"></a> (<a href="#bundler_gem_daemons_error_english">In english</a>)</p>
<p>Hace algunos días hicimos el deployment de una aplicación con rails, con esta aplicación corremos algunos demonios (con la gema daemons) que se hacen cargo de algunas operaciones de negocio, y recientemente para tener más control de las gemas que utilizamos empezamos a usar bundler.</p>
<p>Ya se tenía todo listo, al momento de correr los demonios nos encontramos con el siguiente error:</p>
<pre>
/usr/lib/ruby/gems/1.8/gems/bundler-0.9.3/lib/bundler.rb:122:in `default_gemfile': The default Gemfile was not found (Bundler::GemfileNotFound)
	from /usr/lib/ruby/gems/1.8/gems/bundler-0.9.3/lib/bundler.rb:64:in `setup'
</pre>
<p>Cabe mencionar que buscando en google no se encontró nada de como resolver el problema, así que indagando un poco en el código de bundler, llegamos a la siguiente solución, que fue agregar la siguiente línea al código que levanta nuestro demonio.</p>
<pre>
ENV['BUNDLE_GEMFILE'] ||= File.join(Dir.pwd, 'Gemfile')
</pre>
<p>El código completo del demonio es el siguiente:</p>
<p><script src="http://gist.github.com/302390.js"></script></p>

<p><a href="http://feedads.g.doubleclick.net/~a/dwQz-oku6NjQDP8XDcwrx7XGhVo/0/da"><img src="http://feedads.g.doubleclick.net/~a/dwQz-oku6NjQDP8XDcwrx7XGhVo/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/dwQz-oku6NjQDP8XDcwrx7XGhVo/1/da"><img src="http://feedads.g.doubleclick.net/~a/dwQz-oku6NjQDP8XDcwrx7XGhVo/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.jcastaneyra.com/2010/02/12/bundler-gem-and-daemons-error-the-default-gemfile-was-not-found/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Se busca desarrollador rails</title>
		<link>http://www.jcastaneyra.com/2010/01/21/se-busca-desarrollador-rails/</link>
		<comments>http://www.jcastaneyra.com/2010/01/21/se-busca-desarrollador-rails/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 23:53:04 +0000</pubDate>
		<dc:creator>jcastaneyra</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[jobs]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.jcastaneyra.com/?p=278</guid>
		<description><![CDATA[Descripción Se solicita desarrollador Rails para mantener una aplicación web que está a punto de salir en su versión beta. Tendrá que resolver issues y bugs durante la versión beta, posteriormente será muy probable que tenga que implementar nuevos requerimientos. Conocimiento técnico - Lenguaje de programación Ruby - Conocimientos del framework Ruby On Rails - [...]]]></description>
			<content:encoded><![CDATA[<div id="_mcePaste"><strong>Descripción</strong></div>
<div id="_mcePaste">Se solicita desarrollador Rails para mantener una aplicación web que está a punto de salir en su versión beta. Tendrá que resolver issues y bugs durante la versión beta, posteriormente será muy probable que tenga que implementar nuevos requerimientos.</div>
<div></div>
<div id="_mcePaste"><strong>Conocimiento técnico</strong></div>
<div id="_mcePaste">- Lenguaje de programación Ruby</div>
<div id="_mcePaste">- Conocimientos del framework Ruby On Rails</div>
<div id="_mcePaste">- Conocer MySQL</div>
<div id="_mcePaste">- Conocimientos básicos de web services REST</div>
<div id="_mcePaste">- Javascript y jQuery</div>
<div id="_mcePaste">- HTML, CSS</div>
<div id="_mcePaste">- Conocimiento de Linux</div>
<div id="_mcePaste">- Conocer Git</div>
<div id="_mcePaste">- Conocimientos básicos de objective c (deseable)</div>
<div></div>
<div id="_mcePaste"><strong>Requerimientos</strong></div>
<div id="_mcePaste">- 1+ años de experiencia</div>
<div id="_mcePaste">- Que sea proactivo y muestre interés y pasión por las nuevas tecnologías</div>
<div id="_mcePaste">- Responsable</div>
<div id="_mcePaste">- Vivir en el Distrito Federal, México</div>
<p>Nota: Deja un comentario aquí si estás interesado o bien manda un correo con tu CV a jcastaneyra@gmail.com.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/-Zd5wZ9E7xwKsyaiZ1F0-wix0xU/0/da"><img src="http://feedads.g.doubleclick.net/~a/-Zd5wZ9E7xwKsyaiZ1F0-wix0xU/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/-Zd5wZ9E7xwKsyaiZ1F0-wix0xU/1/da"><img src="http://feedads.g.doubleclick.net/~a/-Zd5wZ9E7xwKsyaiZ1F0-wix0xU/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.jcastaneyra.com/2010/01/21/se-busca-desarrollador-rails/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Table names case insensitive for MySQL Linux</title>
		<link>http://www.jcastaneyra.com/2010/01/07/table-names-case-insensitive-for-mysql-linux/</link>
		<comments>http://www.jcastaneyra.com/2010/01/07/table-names-case-insensitive-for-mysql-linux/#comments</comments>
		<pubDate>Thu, 07 Jan 2010 23:13:57 +0000</pubDate>
		<dc:creator>jcastaneyra</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[OpenSource]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.jcastaneyra.com/?p=276</guid>
		<description><![CDATA[Hola a todos, feliz año 2010, que tal se pasaron estas fechas? descansaron bastante? Pues yo más o menos, unos ratos descansaba y otros trabajaba, y para variar me encontré con esto en el trabajo. Resulta que estaba montando un servidor de Weblogic y MySQL en Linux, para instalar una aplicación que originalmente estaba con [...]]]></description>
			<content:encoded><![CDATA[<p>Hola a todos, feliz año 2010, que tal se pasaron estas fechas? descansaron bastante? Pues yo más o menos, unos ratos descansaba y otros trabajaba, y para variar me encontré con esto en el trabajo.</p>
<p>Resulta que estaba montando un servidor de Weblogic y MySQL en Linux, para instalar una aplicación que originalmente estaba con Weblogic y Oracle, y resulta que al cargar las tablas de esta aplicación en MySQL empecé a encontrarme problemas con los nombres de las tablas (entre otras cosas, como los tipos de datos entre Oracle y MySQL), yo no sabía que MySQL por default en Linux es case sensitive, por lo que me di a la tarea de investigar y buscar como deshabilitar esta función.</p>
<p>Es necesario editar el archivo my.cnf que se puede encontrar en /etc o bien en /etc/mysql, e inmediatamente después de la sección [mysqld], agregar lo siguiente:</p>
<p>lower_case_table_names=1</p>
<p>Guardamos el archivo y reiniciamos MySQL, con esto al momento de crear nuevas tablas estas se harán en minúsculas, y ya no tendremos problemas de si son mayúsculas o minúsculas.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/yvXGaf3uqgJeOOcr0z0W1fwESXM/0/da"><img src="http://feedads.g.doubleclick.net/~a/yvXGaf3uqgJeOOcr0z0W1fwESXM/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/yvXGaf3uqgJeOOcr0z0W1fwESXM/1/da"><img src="http://feedads.g.doubleclick.net/~a/yvXGaf3uqgJeOOcr0z0W1fwESXM/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.jcastaneyra.com/2010/01/07/table-names-case-insensitive-for-mysql-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Como crear un archivo zip con ruby</title>
		<link>http://www.jcastaneyra.com/2009/11/16/como-crear-un-archivo-zip-con-ruby/</link>
		<comments>http://www.jcastaneyra.com/2009/11/16/como-crear-un-archivo-zip-con-ruby/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 08:02:58 +0000</pubDate>
		<dc:creator>jcastaneyra</dc:creator>
				<category><![CDATA[Howto/tutorial]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.jcastaneyra.com/?p=271</guid>
		<description><![CDATA[Hace unos días me encontré con el problema de generar archivos Zip que contuvieran archivos de un curso de SCORM, ¿Cómo hacerlo?, lo primero que me vino a la mente fue Ruby!!! La gema que me sirvió para esto fue rubyzip, y con el siguiente fragmento de código se realizaron los archivos zip: Espero que [...]]]></description>
			<content:encoded><![CDATA[<p>Hace unos días me encontré con el problema de generar archivos Zip que contuvieran archivos de un curso de SCORM, ¿Cómo hacerlo?, lo primero que me vino a la mente fue Ruby!!!</p>
<p>La gema que me sirvió para esto fue rubyzip, y con el siguiente fragmento de código se realizaron los archivos zip:</p>
<p><script src="http://gist.github.com/235735.js"></script></p>
<p>Espero que les sirva como a mi.</p>
<p>Links:</p>
<p><a href="http://ruby-doc.org/core/classes/Dir.html" onclick="urchinTracker('/outgoing/ruby-doc.org/core/classes/Dir.html?referer=');">http://ruby-doc.org/core/classes/Dir.html</a><br />
<a href="http://ruby-doc.org/core/classes/FileUtils.html" onclick="urchinTracker('/outgoing/ruby-doc.org/core/classes/FileUtils.html?referer=');">http://ruby-doc.org/core/classes/FileUtils.html</a><br />
<a href="http://rubyzip.sourceforge.net/" onclick="urchinTracker('/outgoing/rubyzip.sourceforge.net/?referer=');">http://rubyzip.sourceforge.net/</a></p>

<p><a href="http://feedads.g.doubleclick.net/~a/XxVxnHDfLr70_0cXiZInBfWEAS4/0/da"><img src="http://feedads.g.doubleclick.net/~a/XxVxnHDfLr70_0cXiZInBfWEAS4/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/XxVxnHDfLr70_0cXiZInBfWEAS4/1/da"><img src="http://feedads.g.doubleclick.net/~a/XxVxnHDfLr70_0cXiZInBfWEAS4/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.jcastaneyra.com/2009/11/16/como-crear-un-archivo-zip-con-ruby/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Etiquetando código en git/Tagging code in git</title>
		<link>http://www.jcastaneyra.com/2009/11/05/etiquetando-codigo-en-gittagging-code-in-git/</link>
		<comments>http://www.jcastaneyra.com/2009/11/05/etiquetando-codigo-en-gittagging-code-in-git/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 22:07:17 +0000</pubDate>
		<dc:creator>jcastaneyra</dc:creator>
				<category><![CDATA[Lenguajes]]></category>
		<category><![CDATA[Ocio]]></category>

		<guid isPermaLink="false">http://www.jcastaneyra.com/?p=262</guid>
		<description><![CDATA[Etiquetando código en git (English) Resulta que al estar trabajando con nuestro código queremos marcar o etiquetar nuestro código en cierto momento de tiempo, algo así como versionar nuestro código. A decir verdad no soy un experto en git, pero esto es lo que me ha funcionado. Primero que nada tendríamos que etiquetar nuestro código [...]]]></description>
			<content:encoded><![CDATA[<p><a name="tagging_code_git_spanish"><strong>Etiquetando código en git</strong></a> (<a href="#tagging_code_git_english">English</a>)</p>
<p>Resulta que al estar trabajando con nuestro código queremos marcar o etiquetar nuestro código en cierto momento de tiempo, algo así como versionar nuestro código.</p>
<p>A decir verdad no soy un experto en git, pero esto es lo que me ha funcionado. Primero que nada tendríamos que etiquetar nuestro código (ponerle una marca), para esto usamos el comando git tag:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">git tag <span style="color: #660033;">-a</span> <span style="color: #660033;">-m</span> <span style="color: #ff0000;">&quot;My old and ugly style&quot;</span> old_style</pre></div></div>

<p>Para ver nuestros tags locales tenemos que ejecutar</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">git tag <span style="color: #660033;">-l</span></pre></div></div>

<p>Pero como le agregué una descripción a mi tag ejecuto lo siguiente para poder ver el tag junto con su descripción</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">git tag <span style="color: #660033;">-l</span> <span style="color: #660033;">-n1</span></pre></div></div>

<p>Con esto tenemos agregado el tag localmente, pero como yo trabajo con un repositorio remoto, para subir mi tag tengo que hacer</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">git push origin <span style="color: #660033;">--tags</span></pre></div></div>

<p>Ya tengo una etiqueta en mi código, ahora supongamos que pasan dos semanas y que quiero ver algo en mi viejo y feo estilo, sólo tendría que hacer lo siguiente:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">git checkout <span style="color: #660033;">-f</span> <span style="color: #660033;">-b</span> mybranch old_style</pre></div></div>

<p>Así tendría un nuevo branch con mi código que tiene la etiqueta de old_style.</p>
<p>Links:</p>
<p><a href="http://ariejan.net/2009/09/05/git-tag-mini-cheat-sheet-revisited/?doing_wp_cron" onclick="urchinTracker('/outgoing/ariejan.net/2009/09/05/git-tag-mini-cheat-sheet-revisited/?doing_wp_cron&amp;referer=');">http://ariejan.net/2009/09/05/git-tag-mini-cheat-sheet-revisited/?doing_wp_cron</a><br />
<a href="http://polywww.in2p3.fr/~gaycken/Calice/Software/my_git_workflow.html" onclick="urchinTracker('/outgoing/polywww.in2p3.fr/_gaycken/Calice/Software/my_git_workflow.html?referer=');">http://polywww.in2p3.fr/~gaycken/Calice/Software/my_git_workflow.html</a></p>
<p><a name="tagging_code_git_english"><strong>Tagging code in git</strong></a> (<a href="#tagging_code_git_spanish">Español</a>)</p>
<p>When we are working with our code in some time of the project we want to mark or tag the code in order to have control until that time of the project and code, something like versioning.</p>
<p>I&#8217;m not a git expert, but this worked for me. First of all, we need to tag our code, use this command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">git tag <span style="color: #660033;">-a</span> <span style="color: #660033;">-m</span> <span style="color: #ff0000;">&quot;My old and ugly style&quot;</span> old_style</pre></div></div>

<p>In order to see all local tags</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">git tag <span style="color: #660033;">-l</span></pre></div></div>

<p>Since I added a description to my tag it&#8217;s needed to execute the following to see the description</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">git tag <span style="color: #660033;">-l</span> <span style="color: #660033;">-n1</span></pre></div></div>

<p>Until now we have this tag added locally, but if we work with a remote repository we are going to push the tag</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">git push origin <span style="color: #660033;">--tags</span></pre></div></div>

<p>I already have this tag in my code, now suppose that some weeks have been passed and you want to see something in your old and ugly style, you would need to do:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">git checkout <span style="color: #660033;">-f</span> <span style="color: #660033;">-b</span> mybranch old_style</pre></div></div>

<p>With this command you would have a new branch with the code tagged with old_style.</p>
<p>Links:</p>
<p><a href="http://ariejan.net/2009/09/05/git-tag-mini-cheat-sheet-revisited/?doing_wp_cron" onclick="urchinTracker('/outgoing/ariejan.net/2009/09/05/git-tag-mini-cheat-sheet-revisited/?doing_wp_cron&amp;referer=');">http://ariejan.net/2009/09/05/git-tag-mini-cheat-sheet-revisited/?doing_wp_cron</a><br />
<a href="http://polywww.in2p3.fr/~gaycken/Calice/Software/my_git_workflow.html" onclick="urchinTracker('/outgoing/polywww.in2p3.fr/_gaycken/Calice/Software/my_git_workflow.html?referer=');">http://polywww.in2p3.fr/~gaycken/Calice/Software/my_git_workflow.html</a></p>

<p><a href="http://feedads.g.doubleclick.net/~a/BFGC-P_aR5ZjoNEIuOOpYiiDJQA/0/da"><img src="http://feedads.g.doubleclick.net/~a/BFGC-P_aR5ZjoNEIuOOpYiiDJQA/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/BFGC-P_aR5ZjoNEIuOOpYiiDJQA/1/da"><img src="http://feedads.g.doubleclick.net/~a/BFGC-P_aR5ZjoNEIuOOpYiiDJQA/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.jcastaneyra.com/2009/11/05/etiquetando-codigo-en-gittagging-code-in-git/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enviando correo de manera asíncrona en Rails usando Workling, Workling-Mailer y RabbitMQ</title>
		<link>http://www.jcastaneyra.com/2009/06/10/enviando-correo-de-manera-asincrona-en-rails-usando-workling-workling-mailer-y-rabbitmq/</link>
		<comments>http://www.jcastaneyra.com/2009/06/10/enviando-correo-de-manera-asincrona-en-rails-usando-workling-workling-mailer-y-rabbitmq/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 21:22:58 +0000</pubDate>
		<dc:creator>jcastaneyra</dc:creator>
				<category><![CDATA[Howto/tutorial]]></category>
		<category><![CDATA[OpenSource]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[MessageQueues]]></category>
		<category><![CDATA[rabbitmq]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[Workling]]></category>
		<category><![CDATA[Workling-mailer]]></category>

		<guid isPermaLink="false">http://www.jcastaneyra.com/?p=252</guid>
		<description><![CDATA[Enviando correo de manera asíncrona en Rails usando Workling, Workling-Mailer y RabbitMQ (English) El trabajar con message queues es bastante interesante, ya que podemos mandar procesos al background y que estos sean procesados de manera asíncrona, un ejemplo podría ser el envío de correos, aunque también podría servir para realizar otras tareas, por ejemplo, como [...]]]></description>
			<content:encoded><![CDATA[<p><a name="async_mailer_spanish"><strong>Enviando correo de manera asíncrona en Rails usando Workling, Workling-Mailer y RabbitMQ</strong></a> (<a href="#async_mailer_english">English</a>)</p>
<p>El trabajar con message queues es bastante interesante, ya que podemos mandar procesos al background y que estos sean procesados de manera asíncrona, un ejemplo podría ser el envío de correos, aunque también podría servir para realizar otras tareas, por ejemplo, como el envío de mensajes sms, generación de reportes, generación de pdf&#8217;s, etc.</p>
<p>En esta ocasión les quiero presentar como enviar correos de manera asíncrona haciendo una aplicación sencilla haciendo uso de los puglins Workling y workling-mailer y del sistema RabbitMQ, en teoría, con esto se podría ajustar esta solución fácilmente a cualquier otro proceso que se quiera realizar de manera asíncrona.</p>
<p><strong>Aplicación base</strong></p>
<p>Se crea una aplicación básica con restful_authentication, y con la opción de activación.</p>
<p>Lo primero que hacemos es crear la aplicación en rails</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rails mail_async_example <span style="color: #660033;">-d</span> mysql
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">rm</span> public<span style="color: #000000; font-weight: bold;">/</span>index.html
&nbsp;
script<span style="color: #000000; font-weight: bold;">/</span>plugin <span style="color: #c20cb9; font-weight: bold;">install</span> git:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>technoweenie<span style="color: #000000; font-weight: bold;">/</span>restful-authentication.git
&nbsp;
script<span style="color: #000000; font-weight: bold;">/</span>generate authenticated user sessions <span style="color: #660033;">--include-activation</span></pre></div></div>

<p>Creamos nuestra base de datos y migramos</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rake db:create
&nbsp;
rake db:migrate</pre></div></div>

<p>Y hacemos unos pequeños cambios al código de la aplicación para enviar correo según las instrucciones de restful_authentication, así que agregamos lo suguiente:</p>
<p>config/routes.rb</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;">map.<span style="color:#9900CC;">activate</span> <span style="color:#996600;">'activate/:activation_code'</span>, <span style="color:#ff3333; font-weight:bold;">:controller</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'users'</span>, <span style="color:#ff3333; font-weight:bold;">:action</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'activate'</span>, <span style="color:#ff3333; font-weight:bold;">:activation_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">nil</span></pre></div></div>

<p>config/environment.rb</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;">config.<span style="color:#9900CC;">active_record</span>.<span style="color:#9900CC;">observers</span> = <span style="color:#ff3333; font-weight:bold;">:user_observer</span></pre></div></div>

<p>Con esto ya tendríamos nuestra aplicación básica la cuál podríamos probar de inmediato apuntando en el browser a http://localhost:3000/signup</p>
<p>Y agregando algunas cosillas extras, a app/controller/application_controller.rb agregamos la línea:</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">include</span> AuthenticatedSystem</pre></div></div>

<p>Esta misma línea que agregamos al Application controller la removemos de app/controller/sessions_controller.rb y de app/controllers/users_controller.rb</p>
<p>Y creamos un nuevo controlador</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">script<span style="color: #000000; font-weight: bold;">/</span>generate controller portal index</pre></div></div>

<p>Modificamos config/routes.rb para agregar al último como página root</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;">map.<span style="color:#9900CC;">root</span> <span style="color:#ff3333; font-weight:bold;">:controller</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;portal&quot;</span></pre></div></div>

<p>Por último agregamos un layout para nuestra aplicación:</p>
<p>app/views/layouts/application.html.erb</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;
       &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&nbsp;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;en&quot; lang=&quot;en&quot;&gt;
&lt;head&gt;
  &lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html;charset=UTF-8&quot; /&gt;
  &lt;title&gt;Contracts: <span style="color:#006600; font-weight:bold;">&lt;%</span>= controller.<span style="color:#9900CC;">action_name</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>&lt;/title&gt;
  <span style="color:#006600; font-weight:bold;">&lt;%</span>= <span style="color:#5A0A0A; font-weight:bold;">stylesheet_link_tag</span> <span style="color:#996600;">'scaffold'</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>
&lt;/head&gt;
&lt;body&gt;
<span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#9966CC; font-weight:bold;">if</span> current_user <span style="color:#006600; font-weight:bold;">%&gt;</span>
   <span style="color:#006600; font-weight:bold;">&lt;%</span>= <span style="color:#5A0A0A; font-weight:bold;">link_to</span> <span style="color:#996600;">'Logout'</span>, logout_path <span style="color:#006600; font-weight:bold;">%&gt;</span>
<span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#9966CC; font-weight:bold;">else</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>
   <span style="color:#006600; font-weight:bold;">&lt;%</span>= <span style="color:#5A0A0A; font-weight:bold;">link_to</span> <span style="color:#996600;">'Login'</span>, login_path <span style="color:#006600; font-weight:bold;">%&gt;</span>
   <span style="color:#006600; font-weight:bold;">&lt;%</span>= <span style="color:#5A0A0A; font-weight:bold;">link_to</span> <span style="color:#996600;">'Sign up'</span>, signup_path <span style="color:#006600; font-weight:bold;">%&gt;</span>
<span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#9966CC; font-weight:bold;">end</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>
&nbsp;
<span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:error</span>, <span style="color:#ff3333; font-weight:bold;">:warning</span>, <span style="color:#ff3333; font-weight:bold;">:notice</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#5A0A0A; font-weight:bold;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>level<span style="color:#006600; font-weight:bold;">|</span>
    <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#5A0A0A; font-weight:bold;">flash</span><span style="color:#006600; font-weight:bold;">&#91;</span>level<span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">-%&gt;</span>
      &lt;div class=&quot;flash <span style="color:#006600; font-weight:bold;">&lt;%</span>= level.<span style="color:#5A0A0A; font-weight:bold;">to_s</span> <span style="color:#006600; font-weight:bold;">-%&gt;</span>&quot;&gt;<span style="color:#006600; font-weight:bold;">&lt;%</span>= <span style="color:#5A0A0A; font-weight:bold;">flash</span><span style="color:#006600; font-weight:bold;">&#91;</span>level<span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">-%&gt;</span>&lt;/div&gt;
  <span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#9966CC; font-weight:bold;">end</span> <span style="color:#006600; font-weight:bold;">-%&gt;</span>
<span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#9966CC; font-weight:bold;">end</span> <span style="color:#006600; font-weight:bold;">-%&gt;</span>
&nbsp;
<span style="color:#006600; font-weight:bold;">&lt;%</span>= <span style="color:#9966CC; font-weight:bold;">yield</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>
&nbsp;
&lt;/body&gt;
&lt;/html&gt;</pre></div></div>

<p><strong>Instalando amqp, workling y workling_mailer</strong></p>
<p>Ahora bien, antes de instalar Workling, para poder trabajar con RabbitMQ es necesario instalar la gema de amqp, esta gema requiere también de la gema de EventMachine, por lo que al instalar amqp también instalará EventMachine.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gem sources <span style="color: #660033;">-a</span> http:<span style="color: #000000; font-weight: bold;">//</span>gems.github.com<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> tmm1-amqp <span style="color: #660033;">--no-rdoc</span> <span style="color: #660033;">--no-ri</span></pre></div></div>

<p>Vemos nuestro listado de gemas</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> gem list</pre></div></div>

<p>Ahora si, a instalar workling y workling_mailer</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">script<span style="color: #000000; font-weight: bold;">/</span>plugin <span style="color: #c20cb9; font-weight: bold;">install</span> git:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>purzelrakete<span style="color: #000000; font-weight: bold;">/</span>workling.git
&nbsp;
script<span style="color: #000000; font-weight: bold;">/</span>plugin <span style="color: #c20cb9; font-weight: bold;">install</span> git:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>langalex<span style="color: #000000; font-weight: bold;">/</span>workling_mailer.git</pre></div></div>

<p>Para poder utilizar workling con RabbitMQ agregamos al final de config/environment.rb</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;">config.<span style="color:#9900CC;">after_initialize</span> <span style="color:#9966CC; font-weight:bold;">do</span>
<span style="color:#6666ff; font-weight:bold;">Workling::Remote</span>.<span style="color:#9900CC;">invoker</span> = <span style="color:#6666ff; font-weight:bold;">Workling::Remote::Invokers::EventmachineSubscriber</span>
<span style="color:#6666ff; font-weight:bold;">Workling::Remote</span>.<span style="color:#9900CC;">dispatcher</span> = <span style="color:#6666ff; font-weight:bold;">Workling::Remote::Runners::ClientRunner</span>.<span style="color:#5A0A0A; font-weight:bold;">new</span>
<span style="color:#6666ff; font-weight:bold;">Workling::Remote</span>.<span style="color:#9900CC;">dispatcher</span>.<span style="color:#9900CC;">client</span> = <span style="color:#6666ff; font-weight:bold;">Workling::Clients::AmqpClient</span>.<span style="color:#5A0A0A; font-weight:bold;">new</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Posteriormente en app/models/user_mailer.rb añadimos</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">include</span> AsynchMail</pre></div></div>

<p>A la fecha de hoy el plugin de workling tiene un pequeño issue, para resolverlo hacemos lo siguiente en el archivo lib/workling/clients/memcache_queue_client.rb y verificar que contiene:</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'memcache'</span></pre></div></div>

<p>Al principio del archivo, si no lo tienes agrégalo.</p>
<p>Como el amqp corre sobre un ciclo de EventMachine es necesario correr nuestra aplicación con Thin, ya que este servidor soporta EventMachine sin ningún problema. Para instalar Thin corremos</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> thin <span style="color: #660033;">--no-rdoc</span> <span style="color: #660033;">--no-ri</span></pre></div></div>

<p><strong>Instalando RabbitMQ</strong></p>
<p>Checar la instalación aquí <a href="http://www.jcastaneyra.com/2009/06/07/instalando-rabbitmq/">http://www.jcastaneyra.com/2009/06/07/instalando-rabbitmq/</a></p>
<p><strong>A correr todos</strong></p>
<p>Nos aseguramos de que el RabbitMQ esté corriendo.</p>
<p>Iniciamos el cliente de workling</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">script<span style="color: #000000; font-weight: bold;">/</span>workling_client start</pre></div></div>

<p>E iniciamos el servidor thin</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">thin start</pre></div></div>

<p>Apuntamos nuestro browser a http://localhost:3000 y nos registramos con un usuario, al verificar el log de desarrollo veremos que el correo ahora es enviado después de todas las últimas operaciones registradas en el log. Podemos probar quitando la línea de include AsynchMail del UserMailer y ver lo que hace, o bien haciendo nuevo proceso que sea pesado y que se realice en background.</p>
<p>Referencias:</p>
<p><a href="http://github.com/christospappas/workling/commit/063b9849b32e0c6140a5ecdb254357770d9bd28f" onclick="urchinTracker('/outgoing/github.com/christospappas/workling/commit/063b9849b32e0c6140a5ecdb254357770d9bd28f?referer=');">http://github.com/christospappas/workling/commit/063b9849b32e0c6140a5ecdb254357770d9bd28f</a><br />
<a href="http://github.com/purzelrakete/workling/" onclick="urchinTracker('/outgoing/github.com/purzelrakete/workling/?referer=');">http://github.com/purzelrakete/workling/</a><br />
<a href="http://github.com/langalex/workling_mailer/" onclick="urchinTracker('/outgoing/github.com/langalex/workling_mailer/?referer=');">http://github.com/langalex/workling_mailer/</a><br />
<a href="http://github.com/tmm1/amqp/" onclick="urchinTracker('/outgoing/github.com/tmm1/amqp/?referer=');">http://github.com/tmm1/amqp/</a><br />
<a href="http://github.com/technoweenie/restful-authentication/" onclick="urchinTracker('/outgoing/github.com/technoweenie/restful-authentication/?referer=');">http://github.com/technoweenie/restful-authentication/</a><br />
<a href="http://www.rabbitmq.com" onclick="urchinTracker('/outgoing/www.rabbitmq.com?referer=');">http://www.rabbitmq.com</a><br />
<a href="http://code.macournoyer.com/thin/" onclick="urchinTracker('/outgoing/code.macournoyer.com/thin/?referer=');">http://code.macournoyer.com/thin/</a><br />
<a href="http://www.jcastaneyra.com/2009/06/07/instalando-rabbitmq/">http://www.jcastaneyra.com/2009/06/07/instalando-rabbitmq/</a></p>
<p><a name="async_mailer_english"><strong>Sending mails in asynchronous way in Rails using Workling, Workling-Mailer and RabbitMQ</strong></a> (<a href="#async_mailer_spanish">Español</a>)</p>
<p>Working with message queues is so interesting, since we can put processes in the background in order to be processed in asynchronous way, imagine this to send several mails, or maybe for heavy tasks as sms messages, report generation, pdf generation, etc.</p>
<p>So, with this post I want you to show how to send mails in asynchronous way, we are going to make a small application using Workling, Workling-mailer and as message queue RabbitMQ, actually we could adjust this solution to any other problem with async process requirement.</p>
<p><strong>Base application</strong></p>
<p>We create a simple application with restful_authentication and activation option.</p>
<p>First of all we create the rails app</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rails mail_async_example <span style="color: #660033;">-d</span> mysql
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">rm</span> public<span style="color: #000000; font-weight: bold;">/</span>index.html
&nbsp;
script<span style="color: #000000; font-weight: bold;">/</span>plugin <span style="color: #c20cb9; font-weight: bold;">install</span> git:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>technoweenie<span style="color: #000000; font-weight: bold;">/</span>restful-authentication.git
&nbsp;
script<span style="color: #000000; font-weight: bold;">/</span>generate authenticated user sessions <span style="color: #660033;">--include-activation</span></pre></div></div>

<p>Now with rake we create and migrate DB</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rake db:create
&nbsp;
rake db:migrate</pre></div></div>

<p>Following the restful_authentication instructions to send mail we add this:</p>
<p>config/routes.rb</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;">map.<span style="color:#9900CC;">activate</span> <span style="color:#996600;">'activate/:activation_code'</span>, <span style="color:#ff3333; font-weight:bold;">:controller</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'users'</span>, <span style="color:#ff3333; font-weight:bold;">:action</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'activate'</span>, <span style="color:#ff3333; font-weight:bold;">:activation_code</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">nil</span></pre></div></div>

<p>config/environment.rb</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;">config.<span style="color:#9900CC;">active_record</span>.<span style="color:#9900CC;">observers</span> = <span style="color:#ff3333; font-weight:bold;">:user_observer</span></pre></div></div>

<p>Our base app is working now, so to test it we get the url http://localhost:3000/signup in the browser.</p>
<p>Add this in app/controller/application_controller.rb:</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">include</span> AuthenticatedSystem</pre></div></div>

<p>The same line added to Application controller is removed from app/controller/sessions_controller.rb and app/controllers/users_controller.rb</p>
<p>We create a new controller for portal index</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">script<span style="color: #000000; font-weight: bold;">/</span>generate controller portal index</pre></div></div>

<p>And modify config/routes.rb to add portal as root</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;">map.<span style="color:#9900CC;">root</span> <span style="color:#ff3333; font-weight:bold;">:controller</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;portal&quot;</span></pre></div></div>

<p>And last we create a layout for our application:</p>
<p>app/views/layouts/application.html.erb</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;
       &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&nbsp;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;en&quot; lang=&quot;en&quot;&gt;
&lt;head&gt;
  &lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html;charset=UTF-8&quot; /&gt;
  &lt;title&gt;Contracts: <span style="color:#006600; font-weight:bold;">&lt;%</span>= controller.<span style="color:#9900CC;">action_name</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>&lt;/title&gt;
  <span style="color:#006600; font-weight:bold;">&lt;%</span>= <span style="color:#5A0A0A; font-weight:bold;">stylesheet_link_tag</span> <span style="color:#996600;">'scaffold'</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>
&lt;/head&gt;
&lt;body&gt;
<span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#9966CC; font-weight:bold;">if</span> current_user <span style="color:#006600; font-weight:bold;">%&gt;</span>
   <span style="color:#006600; font-weight:bold;">&lt;%</span>= <span style="color:#5A0A0A; font-weight:bold;">link_to</span> <span style="color:#996600;">'Logout'</span>, logout_path <span style="color:#006600; font-weight:bold;">%&gt;</span>
<span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#9966CC; font-weight:bold;">else</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>
   <span style="color:#006600; font-weight:bold;">&lt;%</span>= <span style="color:#5A0A0A; font-weight:bold;">link_to</span> <span style="color:#996600;">'Login'</span>, login_path <span style="color:#006600; font-weight:bold;">%&gt;</span>
   <span style="color:#006600; font-weight:bold;">&lt;%</span>= <span style="color:#5A0A0A; font-weight:bold;">link_to</span> <span style="color:#996600;">'Sign up'</span>, signup_path <span style="color:#006600; font-weight:bold;">%&gt;</span>
<span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#9966CC; font-weight:bold;">end</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>
&nbsp;
<span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:error</span>, <span style="color:#ff3333; font-weight:bold;">:warning</span>, <span style="color:#ff3333; font-weight:bold;">:notice</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#5A0A0A; font-weight:bold;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>level<span style="color:#006600; font-weight:bold;">|</span>
    <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#5A0A0A; font-weight:bold;">flash</span><span style="color:#006600; font-weight:bold;">&#91;</span>level<span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">-%&gt;</span>
      &lt;div class=&quot;flash <span style="color:#006600; font-weight:bold;">&lt;%</span>= level.<span style="color:#5A0A0A; font-weight:bold;">to_s</span> <span style="color:#006600; font-weight:bold;">-%&gt;</span>&quot;&gt;<span style="color:#006600; font-weight:bold;">&lt;%</span>= <span style="color:#5A0A0A; font-weight:bold;">flash</span><span style="color:#006600; font-weight:bold;">&#91;</span>level<span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">-%&gt;</span>&lt;/div&gt;
  <span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#9966CC; font-weight:bold;">end</span> <span style="color:#006600; font-weight:bold;">-%&gt;</span>
<span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#9966CC; font-weight:bold;">end</span> <span style="color:#006600; font-weight:bold;">-%&gt;</span>
&nbsp;
<span style="color:#006600; font-weight:bold;">&lt;%</span>= <span style="color:#9966CC; font-weight:bold;">yield</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>
&nbsp;
&lt;/body&gt;
&lt;/html&gt;</pre></div></div>

<p><strong>Installing amqp, workling and workling_mailer</strong></p>
<p>Now, before using Workling, we need RabbitMQ and amqp is needed, this gem also requires EventMachine gem, so, both gems are installed when amqp is installed.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gem sources <span style="color: #660033;">-a</span> http:<span style="color: #000000; font-weight: bold;">//</span>gems.github.com<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> tmm1-amqp <span style="color: #660033;">--no-rdoc</span> <span style="color: #660033;">--no-ri</span></pre></div></div>

<p>List your installed gems</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> gem list</pre></div></div>

<p>Now, install workling and workling_mailer</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">script<span style="color: #000000; font-weight: bold;">/</span>plugin <span style="color: #c20cb9; font-weight: bold;">install</span> git:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>purzelrakete<span style="color: #000000; font-weight: bold;">/</span>workling.git
&nbsp;
script<span style="color: #000000; font-weight: bold;">/</span>plugin <span style="color: #c20cb9; font-weight: bold;">install</span> git:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>langalex<span style="color: #000000; font-weight: bold;">/</span>workling_mailer.git</pre></div></div>

<p>Add this to config/environment.rb to allow workling to use RabbitMQ</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;">config.<span style="color:#9900CC;">after_initialize</span> <span style="color:#9966CC; font-weight:bold;">do</span>
<span style="color:#6666ff; font-weight:bold;">Workling::Remote</span>.<span style="color:#9900CC;">invoker</span> = <span style="color:#6666ff; font-weight:bold;">Workling::Remote::Invokers::EventmachineSubscriber</span>
<span style="color:#6666ff; font-weight:bold;">Workling::Remote</span>.<span style="color:#9900CC;">dispatcher</span> = <span style="color:#6666ff; font-weight:bold;">Workling::Remote::Runners::ClientRunner</span>.<span style="color:#5A0A0A; font-weight:bold;">new</span>
<span style="color:#6666ff; font-weight:bold;">Workling::Remote</span>.<span style="color:#9900CC;">dispatcher</span>.<span style="color:#9900CC;">client</span> = <span style="color:#6666ff; font-weight:bold;">Workling::Clients::AmqpClient</span>.<span style="color:#5A0A0A; font-weight:bold;">new</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>To app/models/user_mailer.rb add this</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">include</span> AsynchMail</pre></div></div>

<p>Until today I&#8217;ve seen a little issue with workling, to solve it we do the folloging in this file lib/workling/clients/memcache_queue_client.rb; verify that you have:</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'memcache'</span></pre></div></div>

<p>Add it if you don&#8217;t have it.</p>
<p>Amqp runs in an EventMachine cycle, so it is needed to run our app with Thin, since Thin supports EventMachine without any problem. To install Thin run</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> thin <span style="color: #660033;">--no-rdoc</span> <span style="color: #660033;">--no-ri</span></pre></div></div>

<p><strong>Installing RabbitMQ</strong></p>
<p>Follow the instructions here <a href="http://www.jcastaneyra.com/2009/06/07/instalando-rabbitmq/">http://www.jcastaneyra.com/2009/06/07/instalando-rabbitmq/</a></p>
<p><strong>Everybody runs</strong></p>
<p>Cool, naw we ensure that RabbitMQ is running.</p>
<p>Start workling client</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">script<span style="color: #000000; font-weight: bold;">/</span>workling_client start</pre></div></div>

<p>And start Thin server</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">thin start</pre></div></div>

<p>Point with your browser to http://localhost:3000 and sign up a new user, then verify your log and will see that email is sent and registered to the end of log after all operations. We can test removing include AsynchMail from UserMailer and see what happens, it would be great if you test some application with a heavy process working in the background.</p>
<p>Links:</p>
<p><a href="http://github.com/christospappas/workling/commit/063b9849b32e0c6140a5ecdb254357770d9bd28f" onclick="urchinTracker('/outgoing/github.com/christospappas/workling/commit/063b9849b32e0c6140a5ecdb254357770d9bd28f?referer=');">http://github.com/christospappas/workling/commit/063b9849b32e0c6140a5ecdb254357770d9bd28f</a><br />
<a href="http://github.com/purzelrakete/workling/" onclick="urchinTracker('/outgoing/github.com/purzelrakete/workling/?referer=');">http://github.com/purzelrakete/workling/</a><br />
<a href="http://github.com/langalex/workling_mailer/" onclick="urchinTracker('/outgoing/github.com/langalex/workling_mailer/?referer=');">http://github.com/langalex/workling_mailer/</a><br />
<a href="http://github.com/tmm1/amqp/" onclick="urchinTracker('/outgoing/github.com/tmm1/amqp/?referer=');">http://github.com/tmm1/amqp/</a><br />
<a href="http://github.com/technoweenie/restful-authentication/" onclick="urchinTracker('/outgoing/github.com/technoweenie/restful-authentication/?referer=');">http://github.com/technoweenie/restful-authentication/</a><br />
<a href="http://www.rabbitmq.com" onclick="urchinTracker('/outgoing/www.rabbitmq.com?referer=');">http://www.rabbitmq.com</a><br />
<a href="http://code.macournoyer.com/thin/" onclick="urchinTracker('/outgoing/code.macournoyer.com/thin/?referer=');">http://code.macournoyer.com/thin/</a><br />
<a href="http://www.jcastaneyra.com/2009/06/07/instalando-rabbitmq/">http://www.jcastaneyra.com/2009/06/07/instalando-rabbitmq/</a></p>

<p><a href="http://feedads.g.doubleclick.net/~a/z3jbQegvH4uFNxOh3C91st-ZvfE/0/da"><img src="http://feedads.g.doubleclick.net/~a/z3jbQegvH4uFNxOh3C91st-ZvfE/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/z3jbQegvH4uFNxOh3C91st-ZvfE/1/da"><img src="http://feedads.g.doubleclick.net/~a/z3jbQegvH4uFNxOh3C91st-ZvfE/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.jcastaneyra.com/2009/06/10/enviando-correo-de-manera-asincrona-en-rails-usando-workling-workling-mailer-y-rabbitmq/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Instalando RabbitMQ</title>
		<link>http://www.jcastaneyra.com/2009/06/07/instalando-rabbitmq/</link>
		<comments>http://www.jcastaneyra.com/2009/06/07/instalando-rabbitmq/#comments</comments>
		<pubDate>Sun, 07 Jun 2009 21:16:32 +0000</pubDate>
		<dc:creator>jcastaneyra</dc:creator>
				<category><![CDATA[Howto/tutorial]]></category>
		<category><![CDATA[OpenSource]]></category>
		<category><![CDATA[erlang]]></category>
		<category><![CDATA[macos]]></category>
		<category><![CDATA[mq]]></category>
		<category><![CDATA[rabbitmq]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.jcastaneyra.com/?p=241</guid>
		<description><![CDATA[Instalando RabbitMQ (English) RabbitMQ es un sistema de message queue (MQ), el cual provee comunicaciones asíncronas, es decir que el productor y consumidor no tienen la necesidad de interactuar con los mensajes al mismo tiempo, además de que es una implementación del protocolo AMQP (Advanced Message Queuing Protocol), un protocolo para mensajeo de alto rendimiento, [...]]]></description>
			<content:encoded><![CDATA[<p><a name="rabbitmq_spanish"/><strong>Instalando RabbitMQ</strong></a> (<a href="#rabbitmq_english">English</a>)</p>
<p>RabbitMQ es un sistema de message queue (MQ), el cual provee comunicaciones asíncronas, es decir que el productor y consumidor no tienen la necesidad de interactuar con los mensajes al mismo tiempo, además de que es una implementación del protocolo AMQP (Advanced Message Queuing Protocol), un protocolo para mensajeo de alto rendimiento, y por último decir que RabbitMQ está desarrollado con Erlang, Erlang es un lenguaje de programación funcional.</p>
<p><strong>En Ubuntu 9.04</strong></p>
<p>La instalación de RabbitMQ en Ubuntu 9.04 es tan simple como correr el comando</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> rabbitmq-server</pre></div></div>

<p>Y con el cual si no has instalado Erlang te mostrará que paquetes tendrá que instalar para que lo tengas también.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">jcastaneyra<span style="color: #000000; font-weight: bold;">@</span>ubuntu:~<span style="color: #000000; font-weight: bold;">/</span>sources$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> rabbitmq-server
<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #c20cb9; font-weight: bold;">sudo</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> password <span style="color: #000000; font-weight: bold;">for</span> jcastaneyra:
Reading package lists... Done
Building dependency <span style="color: #c20cb9; font-weight: bold;">tree</span>
Reading state information... Done
Reading extended state information
Initializing package states... Done
Writing extended state information... Done
The following NEW packages will be installed:
erlang-base<span style="color: #7a0874; font-weight: bold;">&#123;</span>a<span style="color: #7a0874; font-weight: bold;">&#125;</span> erlang-nox<span style="color: #7a0874; font-weight: bold;">&#123;</span>a<span style="color: #7a0874; font-weight: bold;">&#125;</span> libltdl7<span style="color: #7a0874; font-weight: bold;">&#123;</span>a<span style="color: #7a0874; font-weight: bold;">&#125;</span> odbcinst1debian1<span style="color: #7a0874; font-weight: bold;">&#123;</span>a<span style="color: #7a0874; font-weight: bold;">&#125;</span> unixodbc<span style="color: #7a0874; font-weight: bold;">&#123;</span>a<span style="color: #7a0874; font-weight: bold;">&#125;</span>
The following partially installed packages will be configured:
rabbitmq-server
<span style="color: #000000;">0</span> packages upgraded, <span style="color: #000000;">5</span> newly installed, <span style="color: #000000;">0</span> to remove and <span style="color: #000000;">8</span> not upgraded.
Need to get 28.6MB of archives. After unpacking 46.9MB will be used.
Do you want to <span style="color: #7a0874; font-weight: bold;">continue</span>? <span style="color: #7a0874; font-weight: bold;">&#91;</span>Y<span style="color: #000000; font-weight: bold;">/</span>n<span style="color: #000000; font-weight: bold;">/</span>?<span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></div></div>

<p>Una vez instalado ya está corriendo.</p>
<p><strong>En Mac leopard</strong></p>
<p><strong>UPDATE (27/05/2010): Desde hace un rato que ya estoy usando Homebrew para instalar cosas en Mac, ya existe una fórmula para instalar también RabbitMQ  y por supuesto Erlang, para más información visitar <a href="http://github.com/mxcl/homebrew" onclick="urchinTracker('/outgoing/github.com/mxcl/homebrew?referer=');">http://github.com/mxcl/homebrew</a> y seguir las instrucciones para instalar Homebrew. Con RabbitMQ, incluso si se quiere una versión específica de RabbitMQ se puede modificar la fórmula <img src='http://www.jcastaneyra.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </strong></p>
<p>La instalación es a través de los MacPorts, hay que bajar el instalador de la página www.macports.org/install.php, pero para poder compilar es necesario tener XCode instalado. Los MacPorts son instalados en /opt, por lo que hay que asegurarnos que se tengamos agregados los paths necesarios en el profile para ejecutar los comandos de MacPorts.</p>
<p>En mi caso en .profile (pero también puede ser el .bash_login) debe estar algo así (si no está lo agrego):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># MacPorts Installer addition on 2009-02-25_at_15:37:48: adding an appropriate PATH variable for use with MacPorts.</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PATH</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin:<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>sbin:<span style="color: #007800;">$PATH</span>
<span style="color: #666666; font-style: italic;"># Finished adapting your PATH environment variable for use with MacPorts.</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># MacPorts Installer addition on 2009-02-25_at_15:37:48: adding an appropriate MANPATH variable for use with MacPorts.</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">MANPATH</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">man</span>:<span style="color: #007800;">$MANPATH</span>
<span style="color: #666666; font-style: italic;"># Finished adapting your MANPATH environment variable for use with MacPorts.</span></pre></div></div>

<p>Una vez que están los MacPorts hay que instalar primero erlang, así que ejecutamos</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> port <span style="color: #c20cb9; font-weight: bold;">install</span> erlang</pre></div></div>

<p>Y esperamos un buen rato a que se instale.</p>
<p>Una vez instalado erlang, bajamos la última versión de RabbitMQ</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>rabbitmq <span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000; font-weight: bold;">&amp;</span>amp; <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>rabbitmq
curl <span style="color: #660033;">-O</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.rabbitmq.com<span style="color: #000000; font-weight: bold;">/</span>releases<span style="color: #000000; font-weight: bold;">/</span>rabbitmq-server<span style="color: #000000; font-weight: bold;">/</span>v1.5.5<span style="color: #000000; font-weight: bold;">/</span>rabbitmq-server-generic-unix-1.5.5.tar.gz
<span style="color: #c20cb9; font-weight: bold;">tar</span> xvzf rabbitmq-server-generic-unix-1.5.5.tar.gz
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">mv</span> rabbitmq_server-1.5.5<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>erlang<span style="color: #000000; font-weight: bold;">/</span>lib</pre></div></div>

<p>Ahora ya lo podemos ejecutar.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>erlang<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>rabbitmq_server-1.5.5<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>rabbitmq-server</pre></div></div>

<p><em>Recursos</em></p>
<p><a href="http://www.rabbitmq.com" onclick="urchinTracker('/outgoing/www.rabbitmq.com?referer=');">http://www.rabbitmq.com</a><br />
<a href="http://playtype.net/past/2008/10/9/installing_rabbitmq_on_osx/" onclick="urchinTracker('/outgoing/playtype.net/past/2008/10/9/installing_rabbitmq_on_osx/?referer=');">http://playtype.net/past/2008/10/9/installing_rabbitmq_on_osx/</a></p>
<p><a name="rabbitmq_english"/><strong>Installing RabbitMQ</strong></a> (<a href="#rabbitmq_spanish">Español</a>)</p>
<p>RabbitMQ is a complete and highly reliable Enterprise Messaging system, it provides asynchronous communications,  meaning that the sender and receiver of the message do not need to interact with the message queue at the same time, also it is a AMQP implementation (Advanced Message Queuing Protocol) a protocol for high performance messaging, and last RabbitMQ is developed with Erlang, a functional programming language.</p>
<p><strong>In Ubuntu 9.04</strong></p>
<p>RabbitMQ instalation in Ubuntu 9.04 is so simple, it is just needed to run a command</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> rabbitmq-server</pre></div></div>

<p>With this also install all packages needed by rabbitmq, Erlang is installed also.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">jcastaneyra<span style="color: #000000; font-weight: bold;">@</span>ubuntu:~<span style="color: #000000; font-weight: bold;">/</span>sources$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> rabbitmq-server
<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #c20cb9; font-weight: bold;">sudo</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> password <span style="color: #000000; font-weight: bold;">for</span> jcastaneyra:
Reading package lists... Done
Building dependency <span style="color: #c20cb9; font-weight: bold;">tree</span>
Reading state information... Done
Reading extended state information
Initializing package states... Done
Writing extended state information... Done
The following NEW packages will be installed:
erlang-base<span style="color: #7a0874; font-weight: bold;">&#123;</span>a<span style="color: #7a0874; font-weight: bold;">&#125;</span> erlang-nox<span style="color: #7a0874; font-weight: bold;">&#123;</span>a<span style="color: #7a0874; font-weight: bold;">&#125;</span> libltdl7<span style="color: #7a0874; font-weight: bold;">&#123;</span>a<span style="color: #7a0874; font-weight: bold;">&#125;</span> odbcinst1debian1<span style="color: #7a0874; font-weight: bold;">&#123;</span>a<span style="color: #7a0874; font-weight: bold;">&#125;</span> unixodbc<span style="color: #7a0874; font-weight: bold;">&#123;</span>a<span style="color: #7a0874; font-weight: bold;">&#125;</span>
The following partially installed packages will be configured:
rabbitmq-server
<span style="color: #000000;">0</span> packages upgraded, <span style="color: #000000;">5</span> newly installed, <span style="color: #000000;">0</span> to remove and <span style="color: #000000;">8</span> not upgraded.
Need to get 28.6MB of archives. After unpacking 46.9MB will be used.
Do you want to <span style="color: #7a0874; font-weight: bold;">continue</span>? <span style="color: #7a0874; font-weight: bold;">&#91;</span>Y<span style="color: #000000; font-weight: bold;">/</span>n<span style="color: #000000; font-weight: bold;">/</span>?<span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></div></div>

<p>Once the installation is finished RabbitMQ will be running.</p>
<p><strong>In Mac leopard</strong></p>
<p><strong>UPDATE (27/05/2010): I am using Homebrew to install some stuff in Mac from some months ago, Homebrew has a formula to install RabbitMQ and also Erlang, for more info please visit <a href="http://github.com/mxcl/homebrew" onclick="urchinTracker('/outgoing/github.com/mxcl/homebrew?referer=');">http://github.com/mxcl/homebrew</a> for install instructions. Also if you want to install a different version of RabbitMQ you can do it just editing the formula <img src='http://www.jcastaneyra.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </strong></p>
<p>RabbitMQ installation is done through MacPorts, you need to download the MacPorts installer from www.macports.org/install.php, also XCode is needed. MacPorts are installed in /opt, for that reason we put these paths in the .profile file (could be .bash_login), if you don&#8217;t have these paths add them to your profile file:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># MacPorts Installer addition on 2009-02-25_at_15:37:48: adding an appropriate PATH variable for use with MacPorts.</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PATH</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin:<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>sbin:<span style="color: #007800;">$PATH</span>
<span style="color: #666666; font-style: italic;"># Finished adapting your PATH environment variable for use with MacPorts.</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># MacPorts Installer addition on 2009-02-25_at_15:37:48: adding an appropriate MANPATH variable for use with MacPorts.</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">MANPATH</span>=<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">man</span>:<span style="color: #007800;">$MANPATH</span>
<span style="color: #666666; font-style: italic;"># Finished adapting your MANPATH environment variable for use with MacPorts.</span></pre></div></div>

<p>In order to install erlang execute the following command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> port <span style="color: #c20cb9; font-weight: bold;">install</span> erlang</pre></div></div>

<p>You need to wait some time, maybe several minutes <img src='http://www.jcastaneyra.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Once you have erlang installed, we download the last RabbitMQ version</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>rabbitmq <span style="color: #000000; font-weight: bold;">&amp;</span>amp;<span style="color: #000000; font-weight: bold;">&amp;</span>amp; <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>rabbitmq
curl <span style="color: #660033;">-O</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.rabbitmq.com<span style="color: #000000; font-weight: bold;">/</span>releases<span style="color: #000000; font-weight: bold;">/</span>rabbitmq-server<span style="color: #000000; font-weight: bold;">/</span>v1.5.5<span style="color: #000000; font-weight: bold;">/</span>rabbitmq-server-generic-unix-1.5.5.tar.gz
<span style="color: #c20cb9; font-weight: bold;">tar</span> xvzf rabbitmq-server-generic-unix-1.5.5.tar.gz
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">mv</span> rabbitmq_server-1.5.5<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>erlang<span style="color: #000000; font-weight: bold;">/</span>lib</pre></div></div>

<p>Now we execute rabbitmq-server with this</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>erlang<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>rabbitmq_server-1.5.5<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>rabbitmq-server</pre></div></div>

<p><em>Links</em></p>
<p><a href="http://www.rabbitmq.com" onclick="urchinTracker('/outgoing/www.rabbitmq.com?referer=');">http://www.rabbitmq.com</a><br />
<a href="http://playtype.net/past/2008/10/9/installing_rabbitmq_on_osx/" onclick="urchinTracker('/outgoing/playtype.net/past/2008/10/9/installing_rabbitmq_on_osx/?referer=');">http://playtype.net/past/2008/10/9/installing_rabbitmq_on_osx/</a></p>

<p><a href="http://feedads.g.doubleclick.net/~a/0WSbqldn3aJ7zsEH67_3t0Fv03A/0/da"><img src="http://feedads.g.doubleclick.net/~a/0WSbqldn3aJ7zsEH67_3t0Fv03A/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/0WSbqldn3aJ7zsEH67_3t0Fv03A/1/da"><img src="http://feedads.g.doubleclick.net/~a/0WSbqldn3aJ7zsEH67_3t0Fv03A/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.jcastaneyra.com/2009/06/07/instalando-rabbitmq/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Mostrando el branch de git en el prompt de la consola</title>
		<link>http://www.jcastaneyra.com/2009/05/20/mostrando-el-branch-de-git-en-el-prompt-de-la-consola/</link>
		<comments>http://www.jcastaneyra.com/2009/05/20/mostrando-el-branch-de-git-en-el-prompt-de-la-consola/#comments</comments>
		<pubDate>Wed, 20 May 2009 21:52:07 +0000</pubDate>
		<dc:creator>jcastaneyra</dc:creator>
				<category><![CDATA[scripting]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[shell scripting]]></category>

		<guid isPermaLink="false">http://www.jcastaneyra.com/?p=235</guid>
		<description><![CDATA[Mostrando el branch de git en el prompt de la consola (In english below) Tiene aproximadamente dos meses que empecé a trabajar con git, y la experiencia ha sido muy buena, bastante interesante, pero con los primeros tutoriales que empecé a ver noté que los aliases ayudan a hacer más ágil el trabajo con git, [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Mostrando el branch de git en el prompt de la consola</strong> (In english below)</p>
<p>Tiene aproximadamente dos meses que empecé a trabajar con git, y la experiencia ha sido muy buena, bastante interesante, pero con los primeros tutoriales que empecé a ver noté que los aliases ayudan a hacer más ágil el trabajo con git, curiosamente hasta este momento no los he usado, creo que ha llegado la hora de agregarlos en mi configuración. Así que al final de mi archivo $HOME/.gitconfig agrego:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>color<span style="color: #7a0874; font-weight: bold;">&#93;</span>
        ui = auto
<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">alias</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>
        ci = commit
        <span style="color: #c20cb9; font-weight: bold;">co</span> = checkout
        st = status</pre></div></div>

<p>Por cierto, que la parte de [color] es para mostrar con colores mis cambios cuando le doy git status, aunque ahora con estos cambios ya le podría dar git st.&lt;/p&gt; &lt;p&gt;Otra cosa que noté en mis inicios con git fue que en un screencast de peepcode, en el prompt de la consola aparecía el branch en el que se encontraba trabajando, en ese entonces busqué como hacerlo pero no tuve éxito hasta ahora, entonces para lograr esto hay que agregar un archivo con funciones .bash_functions</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># git-related functions in here</span>
&nbsp;
git_branch <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  <span style="color: #007800;">GIT_BRANCH</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$(git branch --no-color 2&gt; /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)</span>/\1/')&quot;</span>
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$GIT_BRANCH</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;:(<span style="color: #007800;">$GIT_BRANCH</span>) &quot;</span>
  <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
empty_branch <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  <span style="color: #007800;">name</span>=<span style="color: #ff0000;">&quot;$1&quot;</span>
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$name</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;This will create a new empty branch in the current&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;git repository called '<span style="color: #007800;">${name}</span>' ... Continue? [y/N] &quot;</span>
    <span style="color: #c20cb9; font-weight: bold;">read</span> VERIFY
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$VERIFY</span>&quot;</span> = <span style="color: #ff0000;">&quot;Y&quot;</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$VERIFY</span>&quot;</span> = <span style="color: #ff0000;">&quot;y&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
      <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;creating branch '<span style="color: #007800;">$name</span>'&quot;</span>
      git symbolic-ref HEAD refs<span style="color: #000000; font-weight: bold;">/</span>heads<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$name</span>
      <span style="color: #c20cb9; font-weight: bold;">rm</span> .git<span style="color: #000000; font-weight: bold;">/</span>index
      git clean <span style="color: #660033;">-fdx</span>
      <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;you should be on your new empty branch! &quot;</span>
      <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;add/commit files as usual! &quot;</span>
      <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;( your new branch will show up after you commit something to it )&quot;</span>
    <span style="color: #000000; font-weight: bold;">else</span>
      <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;&quot;</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
  <span style="color: #000000; font-weight: bold;">else</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Creates a new empty branch in your git repository.&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Usage: empty_branch [name_of_new_branch]&quot;</span>
  <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># vim:set ft=sh:</span></pre></div></div>

<p>Y dependiendo del archivo de configuración del shell que estén usando agregar en él esto:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># if .bash_functions if a file then source it</span>
<span style="color: #666666; font-style: italic;"># if .bash_functions is a directory, then sourec all its files</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> ~<span style="color: #000000; font-weight: bold;">/</span>.bash_functions <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
  . ~<span style="color: #000000; font-weight: bold;">/</span>.bash_functions
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-d</span> ~<span style="color: #000000; font-weight: bold;">/</span>.bash_functions <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
  <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #000000; font-weight: bold;">in</span> ~<span style="color: #000000; font-weight: bold;">/</span>.bash_functions<span style="color: #000000; font-weight: bold;">/*</span>; <span style="color: #000000; font-weight: bold;">do</span> . <span style="color: #007800;">$function</span>; <span style="color: #000000; font-weight: bold;">done</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># bash prompt</span>
prompt <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;\[\e[34m\]\u\[\e[37m\]@\[\e[36m\]\h\[\e[37m\]:\[\e[31m\]\w\[\e[37m\]<span style="color: #007800;">$(git_branch)</span>$ &quot;</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
<span style="color: #007800;">PROMPT_COMMAND</span>=prompt
<span style="color: #7a0874; font-weight: bold;">export</span> PROMPT_COMMAND</pre></div></div>

<p>En mi caso, en leopard yo estoy usando .profile, pero podría ser .bash_rc o algún otro profile de shell. Ya para cargar la info del profile habría que ejecutar source .profile ó bien salirse de la consola y volverla a abrir para que cargue la nueva configuración.</p>
<p>Todavía falta mucho por aprender de git, pero creo que voy por buen camino, también he aprendido bastante de los flujos que siguen algunos equipos de trabajo ágiles, son muy interesantes.</p>
<p>Recursos:</p>
<p><a href="http://git.or.cz/gitwiki/Aliases" onclick="urchinTracker('/outgoing/git.or.cz/gitwiki/Aliases?referer=');">Aliases</a><br />
<a href="http://github.com/remi/home/blob/9520493b8c2a2c3f290d64a33df13e0763aac50c/.bash_functions/git" onclick="urchinTracker('/outgoing/github.com/remi/home/blob/9520493b8c2a2c3f290d64a33df13e0763aac50c/.bash_functions/git?referer=');">.bash_functions file from Remi </a><br />
<a href="http://github.com/remi/home/blob/9520493b8c2a2c3f290d64a33df13e0763aac50c/.bashrc" onclick="urchinTracker('/outgoing/github.com/remi/home/blob/9520493b8c2a2c3f290d64a33df13e0763aac50c/.bashrc?referer=');">.bash_rc file from Remi</a><br />
<a href="http://reinh.com/blog/2009/03/02/a-git-workflow-for-agile-teams.html" onclick="urchinTracker('/outgoing/reinh.com/blog/2009/03/02/a-git-workflow-for-agile-teams.html?referer=');">Git workflow for agile teams </a></p>
<p><strong>Showing the git branch in the console prompt</strong></p>
<p>I have working with git since started two months ago, the experience have been too good, I must say awesome, when I started to work I saw that you could use aliases with git, it is funny but since then I&#8217;ve never used aliases, so now it&#8217;s time to add them to my configuration file $HOME/.gitconfig</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>color<span style="color: #7a0874; font-weight: bold;">&#93;</span>
        ui = auto
<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">alias</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>
        ci = commit
        <span style="color: #c20cb9; font-weight: bold;">co</span> = checkout
        st = status</pre></div></div>

<p>This [color] section enable colors when I execute git status and see my changes, but now with my aliases I could write git st.&lt;/p&gt; &lt;p&gt;Another nice stuff that I noticed when started to work with git and I was watching a Peepcode screencast was that in the console prompt appeared the git branch, in that moment I googled it but no results got, until now that I found how to do this; one file with the git functions is created .bash_functions</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># git-related functions in here</span>
&nbsp;
git_branch <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  <span style="color: #007800;">GIT_BRANCH</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$(git branch --no-color 2&gt; /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)</span>/\1/')&quot;</span>
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$GIT_BRANCH</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;:(<span style="color: #007800;">$GIT_BRANCH</span>) &quot;</span>
  <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
empty_branch <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  <span style="color: #007800;">name</span>=<span style="color: #ff0000;">&quot;$1&quot;</span>
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$name</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;This will create a new empty branch in the current&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;git repository called '<span style="color: #007800;">${name}</span>' ... Continue? [y/N] &quot;</span>
    <span style="color: #c20cb9; font-weight: bold;">read</span> VERIFY
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$VERIFY</span>&quot;</span> = <span style="color: #ff0000;">&quot;Y&quot;</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$VERIFY</span>&quot;</span> = <span style="color: #ff0000;">&quot;y&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
      <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;creating branch '<span style="color: #007800;">$name</span>'&quot;</span>
      git symbolic-ref HEAD refs<span style="color: #000000; font-weight: bold;">/</span>heads<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$name</span>
      <span style="color: #c20cb9; font-weight: bold;">rm</span> .git<span style="color: #000000; font-weight: bold;">/</span>index
      git clean <span style="color: #660033;">-fdx</span>
      <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;you should be on your new empty branch! &quot;</span>
      <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;add/commit files as usual! &quot;</span>
      <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;( your new branch will show up after you commit something to it )&quot;</span>
    <span style="color: #000000; font-weight: bold;">else</span>
      <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;&quot;</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
  <span style="color: #000000; font-weight: bold;">else</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Creates a new empty branch in your git repository.&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Usage: empty_branch [name_of_new_branch]&quot;</span>
  <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># vim:set ft=sh:</span></pre></div></div>

<p>And depending which shell are you using you add this into it</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># if .bash_functions if a file then source it</span>
<span style="color: #666666; font-style: italic;"># if .bash_functions is a directory, then sourec all its files</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> ~<span style="color: #000000; font-weight: bold;">/</span>.bash_functions <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
  . ~<span style="color: #000000; font-weight: bold;">/</span>.bash_functions
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-d</span> ~<span style="color: #000000; font-weight: bold;">/</span>.bash_functions <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
  <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #000000; font-weight: bold;">in</span> ~<span style="color: #000000; font-weight: bold;">/</span>.bash_functions<span style="color: #000000; font-weight: bold;">/*</span>; <span style="color: #000000; font-weight: bold;">do</span> . <span style="color: #007800;">$function</span>; <span style="color: #000000; font-weight: bold;">done</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># bash prompt</span>
prompt <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  <span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">&quot;\[\e[34m\]\u\[\e[37m\]@\[\e[36m\]\h\[\e[37m\]:\[\e[31m\]\w\[\e[37m\]<span style="color: #007800;">$(git_branch)</span>$ &quot;</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
<span style="color: #007800;">PROMPT_COMMAND</span>=prompt
<span style="color: #7a0874; font-weight: bold;">export</span> PROMPT_COMMAND</pre></div></div>

<p>I&#8217;m using .profile in leopard, but could be .bash_rc. Now to load this new changes from your profile it&#8217;s need to execute source .profile or you also could close your console window and open a new one.</p>
<p>I&#8217;ve learned a lot until now but I still need to learn more (even english <img src='http://www.jcastaneyra.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ), I&#8217;ve learned also from agile workflows that helps with your work.</p>
<p>Notes:</p>
<p><a href="http://git.or.cz/gitwiki/Aliases" onclick="urchinTracker('/outgoing/git.or.cz/gitwiki/Aliases?referer=');">Aliases</a><br />
<a href="http://github.com/remi/home/blob/9520493b8c2a2c3f290d64a33df13e0763aac50c/.bash_functions/git" onclick="urchinTracker('/outgoing/github.com/remi/home/blob/9520493b8c2a2c3f290d64a33df13e0763aac50c/.bash_functions/git?referer=');">.bash_functions file from Remi </a><br />
<a href="http://github.com/remi/home/blob/9520493b8c2a2c3f290d64a33df13e0763aac50c/.bashrc" onclick="urchinTracker('/outgoing/github.com/remi/home/blob/9520493b8c2a2c3f290d64a33df13e0763aac50c/.bashrc?referer=');">.bash_rc file from Remi</a><br />
<a href="http://reinh.com/blog/2009/03/02/a-git-workflow-for-agile-teams.html" onclick="urchinTracker('/outgoing/reinh.com/blog/2009/03/02/a-git-workflow-for-agile-teams.html?referer=');">Git workflow for agile teams </a></p>
<p>Another note:</p>
<p>This is my first try to write in english, I definitely need to learn to be more fluid in my english writing also speaking, but it&#8217;s needed to start in some place. So if this is not understandable you can give some feedback, thanks.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/cd72KF7ga55N4wrLscnE4OTg-NM/0/da"><img src="http://feedads.g.doubleclick.net/~a/cd72KF7ga55N4wrLscnE4OTg-NM/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/cd72KF7ga55N4wrLscnE4OTg-NM/1/da"><img src="http://feedads.g.doubleclick.net/~a/cd72KF7ga55N4wrLscnE4OTg-NM/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.jcastaneyra.com/2009/05/20/mostrando-el-branch-de-git-en-el-prompt-de-la-consola/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Segunda reunión de MXOR</title>
		<link>http://www.jcastaneyra.com/2009/03/17/segunda-reunion-de-mxor/</link>
		<comments>http://www.jcastaneyra.com/2009/03/17/segunda-reunion-de-mxor/#comments</comments>
		<pubDate>Tue, 17 Mar 2009 05:08:39 +0000</pubDate>
		<dc:creator>jcastaneyra</dc:creator>
				<category><![CDATA[OpenSource]]></category>
		<category><![CDATA[comunidad]]></category>
		<category><![CDATA[MexicoOnRails]]></category>
		<category><![CDATA[mxor]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.jcastaneyra.com/?p=230</guid>
		<description><![CDATA[El día de ayer fue la segunda reunión de nuestro grupo de Rails MXOR, en el cuál se hablaron de diversos tópicos en general, pero como todos estamos interesados en aprender de estos tópicos llegamos a la idea de trabajar en un proyecto en donde se pueda trabajar con las cosas que nos interesan y [...]]]></description>
			<content:encoded><![CDATA[<p>El día de ayer fue la segunda reunión de nuestro grupo de Rails MXOR, en el cuál se hablaron de diversos tópicos en general, pero como todos estamos interesados en aprender de estos tópicos llegamos a la idea de trabajar en un proyecto en donde se pueda trabajar con las cosas que nos interesan y que de esto surgan una serie de artículos los cuales puedan servirnos a nosotros como referencia y a las personas interesadas en Rails y de todo lo que está al rededor.</p>
<p>Sobre los tópicos que nos resultaron interesantes son:</p>
<p>- Instalación de Linux desde cero y con los necesario para Rails<br />
- Version de Rails, VM&#8217;s<br />
- Uso de Git con el proyecto<br />
- RedMine como administrador de proyecto<br />
- BDD<br />
- Autenticación<br />
- Servidores Web, App Servers<br />
- Prototype, scriptaculous, JQuery (Edgar dice que es más ligero)<br />
- CSS (blueprint, haml)<br />
- Deployment<br />
- Cache<br />
- Plugins de consulta<br />
- I18N</p>
<p>En la reunión se hizo una lluvia de ideas sobre que proyectos trabajar y sobre el proyecto que se eligió también se fueron aterrizando diversas ideas.</p>
<p><strong>Problema:</strong><br />
Compartir historias de desarrolladores.<br />
<strong>El contenido:</strong><br />
Tutoriales<br />
Errores<br />
Categorización de tutoriales<br />
Categorización de Errores<br />
Como wiki de errores<br />
¿Compartir pasos de recetas?<br />
Solo en español para empezar</p>
<p>Hasta aquí me quedé en las anotaciones ya que tuve que salir temprano, pero hay un podcast con la sesión de principio a fin. En este momento se está seleccionando un nombre para la aplicación, una vez que se haya elegido el nombre se podrá empezar a trabajar en estos tópicos, idealmente la gente involucrada en cada actividad sería la que esté interesada en aprender y no precisamente la que domine el tema. La lista de nombres al momento es:</p>
<div class="im">
<div>* redcipe (3 votos)</div>
<div>* errecipe (1 voto)</div>
<div>* devrecipes (0 votos)</div>
</div>
<div>* devcipe (1 voto)</div>
<div></div>
<div>Por supuesto este es un proyecto open source y abierto a la comunidad interesada en Rails, buscando que a partir de esto surgan artículos e información que en un momento dado nos sea de utilidad, una especie de libro que nos sirva de guía en la realización de una aplicación. Para más información acudir a la <a href="http://mexicoonrails.com.mx/news/12" onclick="urchinTracker('/outgoing/mexicoonrails.com.mx/news/12?referer=');">página del grupo</a>.</div>

<p><a href="http://feedads.g.doubleclick.net/~a/RqC1G8DBIxMJCFJmxyGakrLcH_A/0/da"><img src="http://feedads.g.doubleclick.net/~a/RqC1G8DBIxMJCFJmxyGakrLcH_A/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/RqC1G8DBIxMJCFJmxyGakrLcH_A/1/da"><img src="http://feedads.g.doubleclick.net/~a/RqC1G8DBIxMJCFJmxyGakrLcH_A/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.jcastaneyra.com/2009/03/17/segunda-reunion-de-mxor/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss><!-- Dynamic page generated in 3.827 seconds. --><!-- Cached page generated by WP-Super-Cache on 2010-09-02 12:50:42 -->
