<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
 
 <title>cantorrodista.com | Alfredo Solano</title>
 <link href="http://cantorrodista.com/atom.xml" rel="self"/>
 <link href="http://cantorrodista.com/"/>
 <updated>2010-06-09T00:48:52+02:00</updated>
 <id>http://cantorrodista.com/</id>
 <author>
   <name>Alfredo Solano</name>
   <email>alfredo@cantorrodista.com</email>
 </author>
 
 
 <entry>
   <title>Lanzando Metroroto, un sistema colaborativo para traquear incidencias en el metro de madrid</title>
   <link href="http://cantorrodista.com/2010/06/09/lanzando-metroroto-sistema-traqueo-incidencias-metro-madrid.html"/>
   <updated>2010-06-09T00:00:00+02:00</updated>
   <id>http://cantorrodista.com/2010/06/09/lanzando-metroroto-sistema-traqueo-incidencias-metro-madrid</id>
   <content type="html">&lt;p&gt;&lt;img src=&quot;http://metroroto.com/images/logo.gif&quot; title=&quot;Metroroto&quot; alt=&quot;metroroto&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Hoy, después de un mes de desarrollo a ratos libres en &lt;a href=&quot;http://twitter.com/larubyroom&quot;&gt;@larubyrrom&lt;/a&gt;, hemos lanzado por fin &lt;a href=&quot;http://metroroto.com&quot;&gt;Metroroto&lt;/a&gt;. Metroroto es un sistema colaborativo para intentar traquear las incidencias y averías del metro de madrid al instante. Es colaborativo porque las incidencias son reportadas por los propios usuarios a través de diferentes canales, como &lt;a href=&quot;http://twitter.com&quot;&gt;twitter&lt;/a&gt; o desde la propia &lt;a href=&quot;http://metrorot.com#content&quot;&gt;web&lt;/a&gt;. Próximamente también lanzaremos una aplicación para android, para poder seguir las incidencias al minuto ( y también reportarlas ;) )&lt;/p&gt;

&lt;p&gt;El funcionamiento es bastante sencillo, cuando un usuario sufre una incidencia en el metro, puede reportarla directamente en el &lt;a href=&quot;http://metrorot.com#content&quot;&gt;formulario&lt;/a&gt; de nuestra web, o twitteando haciendo uso de los hashtags &lt;strong&gt;#metroroto #numerodelinea #nombredeestación&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Ejemplos:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;php&quot;&gt;&lt;span class=&quot;x&quot;&gt;  &lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;    #metroroto #l3 #legazpi Tren ardiendo en el anden&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;    &lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;    Tren detenido por 20 min #metroroto #l6 #carpetana&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;    &lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;    #metroroto #L3 #sol Tren averiado durante 10 minutos&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;    &lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;    &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Trucos::&lt;/p&gt;

&lt;p&gt;Los hashtags pueden ir al principio o al final del twitt, pero siempre en el orden #metroroto #linea #estacion&lt;/p&gt;

&lt;p&gt;Si por la estación donde ha ocurrido la avería, solo pasa una sola línea, no es necesario incluir el hashtag de la línea (#l6)&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;php&quot;&gt;&lt;span class=&quot;x&quot;&gt;  #metroroto #alvarado Metro parado por un rato largo&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;    &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;El hashtag de la linea, debe ir siempre precedido de una ele mayúscula o minúscula (#L2 o #l2).&lt;/p&gt;

&lt;p&gt;Para que no se nos escape ninguna incidencia, intenta evitar poner espacios en el hashtag de la estación, sustitúyelos por guiones medios (-) o directamente, ponlo todo junto&lt;/p&gt;

&lt;p&gt;Ejemplos&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;php&quot;&gt;&lt;span class=&quot;x&quot;&gt;  #metroroto #avenida-de-america Metro parado por un rato largo&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;    &lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;    #metroroto #avenidadeamerica Metro parado por un rato largo&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;    &lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Poco a poco iremos entrenando nuestro sistema de parseo de twitts, para que no se nos escape ninguno (incluso si no usas los hashtags de la linea y la estación :) ), pero hay que tener paciencia, y al menos siempre usar el hashtag &lt;strong&gt;#metroroto&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Para enterarte de las incidencias tienes varias opciones: verlas directamente en nuestra &lt;a href=&quot;http://metroroto.com&quot;&gt;web&lt;/a&gt;, seguir a nuestro usuario de twitter, &lt;a href=&quot;http://twitter.com/metroroto&quot;&gt;@metroroto&lt;/a&gt;, leer nuestro &lt;a href=&quot;http://metroroto.com/?format=atom&quot;&gt;feed&lt;/a&gt; o suscribirte por email en nuestra &lt;a href=&quot;http://metroroto.com&quot;&gt;web&lt;/a&gt;, dónde podrás elegir si quieres recibir notificaciones de todas las lineas o sólo de las que coges a diario.&lt;/p&gt;

&lt;p&gt;También puedes utilizar tu cliente de twitter favorito para suscribirte a ciertas búsquedas para limitar el número de incidencias que recibes, puedes probar a suscribirte a &quot;#metroroto #l2&quot; si sólo estas interesado en las averías de la linea 2 del metro.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Mostrar flashes en rails con jquery</title>
   <link href="http://cantorrodista.com/2010/03/20/rails-flashes-con-jquery.html"/>
   <updated>2010-03-20T00:00:00+01:00</updated>
   <id>http://cantorrodista.com/2010/03/20/rails-flashes-con-jquery</id>
   <content type="html">&lt;p&gt;En entornos con una política de cache fuerte, puede ser un problema mostrar los típicos mensajes de flash para dar feedback al usuario después de haber realizado algún tipo de acción. Digo que puede ser un problema, porque puede ocurrir que nuestro sistema de cache (de página, fragmentos, etc) guarde la versión con el mensaje de flash y todos los usuarios verán esa versión.&lt;/p&gt;

&lt;p&gt;Hay muchas maneras de evitar éste comportamiento, pero la última que he usado, es mostrar el mensaje de flash por javascript, una vez que la pagina ha cargado, con lo que nuestro sistema de cache nunca guardara la versión con el mensaje de flash.&lt;/p&gt;

&lt;p&gt;Para hacerlo, primero debemos establecer una cookie en nuestro controlador, con el mensaje de flash en cuestión, en vez de asignarselo directamente al famoso &lt;em&gt;flash[:notice]&lt;/em&gt; o &lt;em&gt;flash[:error]&lt;/em&gt;.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;n&quot;&gt;success&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;html&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;cookies&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;delete&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;flash_notice&amp;#39;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;cookies&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;flash_notice&amp;#39;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;blank?&lt;/span&gt;
   &lt;span class=&quot;n&quot;&gt;cookies&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;flash_notice&amp;#39;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:value&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;Hemos recibido tu mensaje :) &amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; 
   &lt;span class=&quot;n&quot;&gt;redirect_to&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;new&amp;quot;&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Con esto, primero vacíamos la cookie en cuestión, por si acaso tiene algún contenido y después guardamos nuestro mensaje en ella.&lt;/p&gt;

&lt;p&gt;Luego solo nos queda mostrar nuestro mensaje de flash por javascript:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;myapp&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    
    &lt;span class=&quot;nx&quot;&gt;load_flashes&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;notice_cookie&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;error_cookie&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
            &lt;span class=&quot;nx&quot;&gt;notice&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;cookie&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;notice_cookie&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/\+/g&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39; &amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;   
            &lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;cookie&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;error_cookie&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;/\+/g&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39; &amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;   
            
           &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;notice&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;noticeExplanation&amp;#39;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
                &lt;span class=&quot;nx&quot;&gt;content&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;notice&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
                &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;cookie&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;notice_cookie&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
             &lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;errorExplanation&amp;#39;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
                &lt;span class=&quot;nx&quot;&gt;content&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
                &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;cookie&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;error_cookie&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                &lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
                &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;#flmessages&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addClass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;flashmsg&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
                &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;#flmessages&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;addClass&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
                &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;#flmessages&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;
    
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Suponiendo que nuestro mensaje de flash lo vamos a mostrar en un div con id &lt;em&gt;flmessages&lt;/em&gt;, lo que hacemos es dependiendo de que tipo de mensaje flash tengamos que mostrar, le añadimos la clase &lt;em&gt;noticeExplanation&lt;/em&gt; o &lt;em&gt;errorExplanation&lt;/em&gt; y el contenido de nuestra cookie a ese contenedor (ademas de la clase genérica &lt;em&gt;flashmsg&lt;/em&gt;). Ademas también vaciamos la cookie que hemos leído para mostrar el mensaje.&lt;/p&gt;

&lt;p&gt;Sólo nos quedaría cargar éste javascript en el &lt;em&gt;document.ready&lt;/em&gt; de nuestra aplicación:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt; &lt;span class=&quot;nx&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ready&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;myapp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;load_flashes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;flash_notice&amp;#39;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;flash_error&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
 &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;



</content>
 </entry>
 
 <entry>
   <title>Envío de emails con archivos adjuntos en Rails con ActionMailer</title>
   <link href="http://cantorrodista.com/2010/03/09/action-mailer-y-archivos-adjuntos.html"/>
   <updated>2010-03-09T00:00:00+01:00</updated>
   <id>http://cantorrodista.com/2010/03/09/action-mailer-y-archivos-adjuntos</id>
   <content type="html">&lt;p&gt;Sólo a modo de recordatorio y para que quede constancia en algun lado para el futuro, voy a explicar la manera super simple que he usado para hacer
el típico formulario de contacto (en mi caso para ofertas de trabajo) en el que se pueden adjuntar varios archivos (imágenes, pdf's, etc) y no queremos tener
un modelo que gestione este tipo de recursos, ya sea porque no tiene la suficiente importancia en nuestra aplicación o porque preferimos recibir solo toda esa informacion por
email.&lt;/p&gt;

&lt;p&gt;Para gestionar los attachments con actionmailer, es tan simple como usar el método 'attachment' incluido en la api de rails, dentro de nuestro método en la clase 'ActionMailer::Base':&lt;/p&gt;

&lt;p&gt;La manera en lo que yo lo he usado ha sido la siguiente:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;    &lt;span class=&quot;n&quot;&gt;attachs&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;each&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;attachment&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;application/octet-stream&amp;quot;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;attachment&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;|&lt;/span&gt;
          &lt;span class=&quot;n&quot;&gt;attachment&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;body&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;read&lt;/span&gt;
          &lt;span class=&quot;n&quot;&gt;attachment&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;filename&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;original_filename&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;unless&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;file&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;blank?&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;dónde simplemente recibimos un array, 'attachs', que contiene los ficheros temporales recibidos en nuestro controller, e iteramos sobre ellos, llamando
al método 'attachment', pasandole el content_type de 'application/octet-stream' (aqui podemos pasarle el content_type exacto si lo sabemos, pero como en mi caso dejo subir
cualquier cosa, pongo este que es el más genérico) y un bloque donde leemos con un 'read' el archivo temporal recibido y le asignamos el nombre de fichero original.&lt;/p&gt;

&lt;p&gt;Tan simple como eso, así la próxima vez que lo tenga que usar se dónde buscarlo facilmente ;)&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Bug en chrome en llamadas ajax con Jquery</title>
   <link href="http://cantorrodista.com/2010/03/05/bug-en-chrome-con-llamadas-ajax-en-jquery.html"/>
   <updated>2010-03-05T00:00:00+01:00</updated>
   <id>http://cantorrodista.com/2010/03/05/bug-en-chrome-con-llamadas-ajax-en-jquery</id>
   <content type="html">&lt;p&gt;El otro día descubrí en una aplicación un error al realizar una llamada ajax:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;no&quot;&gt;Error&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;occurred&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;parsing&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;request&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;parameters&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;
&lt;span class=&quot;no&quot;&gt;Contents&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;undefined&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;sr&quot;&gt;/!\ FAILSAFE /&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;\&lt;/span&gt;  &lt;span class=&quot;mi&quot;&gt;28&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;mo&quot;&gt;01&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2010&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;09&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;47&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;38&lt;/span&gt;
  &lt;span class=&quot;no&quot;&gt;Status&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;500&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Internal&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Server&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Error&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;undefined&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;method&lt;/span&gt; &lt;span class=&quot;sb&quot;&gt;`name&amp;#39; for nil:NilClass&lt;/span&gt;
&lt;span class=&quot;sb&quot;&gt;    /usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/whiny_nil.rb:52:in `&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;method_missing&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;&lt;/span&gt;
&lt;span class=&quot;s1&quot;&gt;    /usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/xml_mini/rexml.rb:29:in `merge_element!&amp;#39;&lt;/span&gt;&lt;span class=&quot;sr&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;sr&quot;&gt;    /usr/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lib64&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ruby&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;gems&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;gems&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;activesupport&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lib&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;active_support&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;xml_mini&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rexml&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rb&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;18&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:in&lt;/span&gt; &lt;span class=&quot;sb&quot;&gt;`parse&amp;#39;&lt;/span&gt;
&lt;span class=&quot;sb&quot;&gt;    /usr/lib64/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/xml_mini.rb:12:in `&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;__send__&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;&amp;#39;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Este error sólo se reproducia utilizando chrome y ocurria al realizar una llamada ajax de tipo POST como la siguiente:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;&lt;span class=&quot;nx&quot;&gt;jQuery&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ajax&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;/ratings?rating=5&amp;amp;rateable_type=MyModel&amp;amp;rateable_id=myid&amp;#39;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;post&amp;#39;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Es un llamada ajax normal, con la particularidad de que en vez de pasarle los parametros a la request con un 'data', se
los estaba pasando como si fuera un GET, y eso parecia no gustarle a rails, de hecho, el error que soltaba era un error de parseo
en los parametros de la request.&lt;/p&gt;

&lt;p&gt;Si la llamada anterior se usaba en su manera estandar, pasandole los parametros con un 'data' todo parecía funcionar a la perfección:&lt;/p&gt;

&lt;p&gt;jQuery.ajax({&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;url: '/ratings',
type: 'post',
data: {
    rating: '5',
    rateable_type: 'MyModel'
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;});&lt;/p&gt;

&lt;p&gt;El error parece estar como comentan por &lt;a href=&quot;http://dev.jquery.com/ticket/5123&quot;&gt;aquí&lt;/a&gt; en un bug ya &lt;a href=&quot;http://code.google.com/p/chromium/issues/detail?id=33062&quot;&gt;reportado&lt;/a&gt;
en el navegador chrome, que ocurre cuando se envia un XMLHttpRequest con el cuerpo vacio, y chrome envia un 'undefined' en el mismo.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>En busca de la feature perdida en Authlogic</title>
   <link href="http://cantorrodista.com/2010/02/26/en-busca-de-la-feature-perdida-en-authlogic.html"/>
   <updated>2010-02-26T00:00:00+01:00</updated>
   <id>http://cantorrodista.com/2010/02/26/en-busca-de-la-feature-perdida-en-authlogic</id>
   <content type="html">&lt;p&gt;El otro día me tope con algo, cuanto menos curioso. Acababa de poner una aplicación todavía en desarrollo en staging, es decir,
había colgado una versión preliminar bajo usuario y clave. Ésta autenticación, un basic http, la había puesto en el servidor web por comodidad, en mi caso apache.&lt;/p&gt;

&lt;p&gt;Mi aplicación a su vez cuenta con un back de administración, dónde uso &lt;a href=&quot;http://github.com/binarylogic/authlogic&quot;&gt;authlogic&lt;/a&gt; para la autenticación, y para evitar problemas a la persona que iba a verificar el correcto funcionamiento de
todo el site, decidí crear el usuario admin de mi aplicación en base de datos, con los mismo datos de acceso que los usados por la autenticación http del apache.&lt;/p&gt;

&lt;p&gt;Cual fué mi sorpresa, cuando una vez deployada mi aplicación, accedí a mi url provisional, puse el usuario y contraseña en la autenticacion que me pedia mi navegador,
la del apache, y vi que estaba logado en la aplicación como administrador. Pensé, upss, que extraño, e intenté cerrar sesión. Y digo intente, porque aunque daba a cerrar sesión,
yo seguia siempre logado como administrador, y aparentemente la aplicación me estaba borrando mi sesión bien: en los logs la peticion al destroy de mi user_session se procesaba sin problemas,
y me sacaba el típico mensaje de flash como que habia sido deslogueado de la aplicación, pero no era asi, yo seguia logado.&lt;/p&gt;

&lt;p&gt;Y efectivamente, éste es el momento en el que todos decimos: ¡Cachis!, mi primer bug, no se donde está, pero seguro que es un bug.&lt;/p&gt;

&lt;p&gt;Pero no era así, no había ningún bug ni en mi aplicación, ni en authlogic ni mucho menos. Era tan simple como que authlogic, por defecto, da soporte para autenticación http. Por lo tanto,
estaba ocurriendo lo siguiente: yo, al meter las credenciales en mi navegador para la autenticación http, estaba mandando en cada petición que se hacía las credenciales, que
por casualidad eran las mismas que las de el usuario administardor de base de datos. Authlogic, el muy listo de él, en  Authlogic::Session::Base carga los siguientes modulos en éste orden:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;      &lt;span class=&quot;kp&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Params&lt;/span&gt;
      &lt;span class=&quot;kp&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Cookies&lt;/span&gt;
      &lt;span class=&quot;kp&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Session&lt;/span&gt;
      &lt;span class=&quot;kp&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;HttpAuth&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Entonces, por orden, authlogic lo primero que hace es intertar autenticar al usuario por Params, es decir, intenta autenticar al usuario através de una url única generada para ese fin. Si ese no es el caso,
entonces intenta autenticarlo por cookies, sino lo intenta por sesión, y por ultimo lo intenta por autenticación http.&lt;/p&gt;

&lt;p&gt;En mi caso, yo estaba simplemente accediendo a la home, por lo que no estaba accediendo con una url única de inicio de sesión, ni tenia cookies para autenticar la usuario, ni estaba intentado crear una sesión para el.
Simplemente, mi señor navegador, en cada request estaba mandando las credenciales de la autenticacion al apache, que se propagan evidentemente hasta mi app, y el authlogic las ve, e intenta
buscar el usuario recibido y autenticarlo con la clave recibida. Como he dicho, yo tenia mi usuario en base de datos, que era administrador, con las mismas credenciales, y
acababa siempre logado como tal :). Una buena feature de authlogic.&lt;/p&gt;

&lt;p&gt;Se me ocurren varias utilidades de ésta feature, pero la mas evidente y rapida, es la posibilidad de autenticar a los usuarios de nuestra aplicacion sin necesidad
de tener un controlador asociado a ello. Solo con tener nuestro modelo 'User' y 'UserSession':&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;User&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;ActiveRecord&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Base&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;acts_as_authentic&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;UserSession&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Authlogic&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Session&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Base&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;y en nuestro application_controller :&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;  &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;current_user_session&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;vi&quot;&gt;@current_user_session&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;defined?&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;vi&quot;&gt;@current_user_session&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;vi&quot;&gt;@current_user_session&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;UserSession&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;find&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;current_user&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;vi&quot;&gt;@current_user&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;defined?&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;vi&quot;&gt;@current_user&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;vi&quot;&gt;@current_user&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;current_user_session&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;current_user_session&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;user&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;podemos automaticamente poner una autenticacion http en nuestro servidor web, y authlogic se encargara de recibir esas credenciales, que van en cada request,
y establecer un current_user si procede (si encuentra un usuario en nuestra BD y lo puede autenticar), con lo que conseguimos un sistema
de autenticación rapido y ligero. Incluso si no queremos tener la autenticacion en el servidor web, con mandar las credenciales en cada peticion también nos valdria:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;n&quot;&gt;http&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:/&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;username&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:password&lt;/span&gt;&lt;span class=&quot;vi&quot;&gt;@example&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;com&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Asi a bote pronto, se me ocurre que es un método rápido para usar autenticación en cualquier tipo de API ligera.&lt;/p&gt;

&lt;p&gt;Ultimamente me ha pasado también que a veces, tienes un site en staging o  preprodución, con una autenticacion en tu apache, pero necesitas
que ciertas acciones no lleven esa autenticación para poder hacer ciertas pruebas de una nueva feature, como por ejemplo, una nueva mega aplicación de facebook que
has integrado dentro de tu aplicación rails, y quieres probar contra tu servidor de staging, para lo que necesitas dar acceso a ciertas acciones a las peticiones de facebook. Pues simplemente quitando la autenticacion del apache y con un before_filter se me ocurre que esto se podria conseguir facilmente:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;n&quot;&gt;before_filter&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:authorize_request&lt;/span&gt;

&lt;span class=&quot;kp&quot;&gt;private&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;authorize_request&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;false&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;unless&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;current_user&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:controller&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;facebook_controller&amp;#39;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Si depués de todo ésto, decidís que viviríais mas tranquilos sin esta featura simplemente podéis desactivarla:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;UserSession&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Authlogic&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Session&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Base&lt;/span&gt;
  &lt;span class=&quot;n&quot;&gt;allow_http_basic_auth&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kp&quot;&gt;false&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;



</content>
 </entry>
 
 <entry>
   <title>Cosas que no funcionan en la api de facebook (Parte I)</title>
   <link href="http://cantorrodista.com/2010/02/12/cosas-que-no-funcionan-en-la-api-de-facebook-parte-i.html"/>
   <updated>2010-02-12T00:00:00+01:00</updated>
   <id>http://cantorrodista.com/2010/02/12/cosas-que-no-funcionan-en-la-api-de-facebook-parte-i</id>
   <content type="html">&lt;p&gt;Creo que cualquiera que haya desarrollado con la api de facebook vera que éste tema da mucho de sí, de ahí que lo haya dividido en partes y cada día voy a hablar de algún punto en particular.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;&lt;a href=&quot;http://wiki.developers.facebook.com/index.php/Comments_Box&quot;&gt;Widget de Comentarios&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Ampliamente usado en muchísimos sites pero con una gran pega (al menos para algunos): no permite la pre-moderación de comentarios, bueno, o si según ellos, ya que permiten a partir de la variable &lt;em&gt;numposts&lt;/em&gt; fijar el número de comentarios máximo mostrado por el widget, con lo que poniendo éste numero a 0, nunca se mostraran los comentarios de los usuarios en el widget en el momento de hacerlos, y se podría realizar una premoderación sobre ellos. Pues bien, esto no funciona en el widget. Por mucho que nos empeñemos en cambiar ese número, se lo pasa por ahí, y siempre muestra el número de comentarios por defecto, en este caso 10.&lt;/p&gt;

&lt;p&gt;Ésto esta reportado en su &lt;a href=&quot;http://forum.developers.facebook.com/viewtopic.php?pid=200071&quot;&gt;foro de desarrolladores&lt;/a&gt; desde hace por lo menos un mes, pero hasta la fecha no han hecho mucho caso...&lt;/p&gt;

&lt;p&gt;Una funcionalidad muy ligada a la anterior es la de consultar a través de &lt;a href=&quot;http://wiki.developers.facebook.com/index.php/FQL&quot;&gt;FQL&lt;/a&gt; todos los comentarios que los usuarios han dejado en nuestro site con el widget. No esta soportado por la api un método para poder recuperar todos los comentarios de un site, sino que hay que ir pidiendo los comentarios para cada uno de los &lt;em&gt;xid&lt;/em&gt; con los que hayamos registrado nuestros widgets de comentarios. Pero &lt;a href=&quot;http://wiki.developers.facebook.com/index.php/Comments.get&quot;&gt;según la documentacion&lt;/a&gt; del método usado para pedir los comentarios, &lt;em&gt;Comments.get&lt;/em&gt;, se puede hacer una query directamente a la &lt;a href=&quot;http://wiki.developers.facebook.com/index.php/Comment_%28FQL%29&quot;&gt;tabla de comentarios&lt;/a&gt; para pedir los comentarios de todos los &lt;em&gt;xid&lt;/em&gt; que queramos, pudiendo bajar de una vez todos los comentarios del site. Pues bien, otra de las cosas que no funcionan, o más bien que su documentación dice que se puede hacer y no es así. Según su documentación, teniendo una sesión valida, podríamos hacer lo siguiente:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;n&quot;&gt;session&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;post&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;facebook.fql.query&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:query&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;select xid,text,id,fromid,time from comment &lt;/span&gt;
&lt;span class=&quot;s2&quot;&gt;where xid IN (&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ids&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;,&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;)&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;donde el array &lt;em&gt;ids&lt;/em&gt; contendría todos los &lt;em&gt;xid&lt;/em&gt; usados por nuestros widgets de comentarios. Si ese array contiene mas de 20 elementos (aproximadamente, tampoco es una cienca exacta :) ) ese petición falla, devolviendo un error. Por lo tanto tenemos que escalonar nuestras peticiones limitando en cada query a 20 (mas o menos) el numero de &lt;em&gt;xid&lt;/em&gt; pedidas.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;n&quot;&gt;session&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Facebooker&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Session&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;create&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;offset&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;offset&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Item&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;count&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;do&lt;/span&gt;  
    &lt;span class=&quot;n&quot;&gt;items&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Item&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;find&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:all&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:select&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:limit&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:offset&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;offset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;session&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;post&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;facebook.fql.query&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:query&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;select xid,text,id,fromid,time from &lt;/span&gt;
&lt;span class=&quot;s2&quot;&gt;   comment where xid IN (&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;items&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;,&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;)&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;offset&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;20&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Si en nuestro site, tenemos mucho contenido, con lo que tendremos muchísimos widgets de comentarios, ésta tarea puede ser laboriosa  y costosa en tiempo y recursos.&lt;/p&gt;

&lt;p&gt;Una última funcionalidad de la que no te puedes fiar mucho tampoco, es la posibilidad de que te notifiquen cada vez que algún usuario comenta en tu site con el widget. Se supone que te mandan una notificación a tu cuenta de facebook, cosa que yo he visto funcionar algunas veces y otras muchas no.&lt;/p&gt;

&lt;p&gt;Hay un &lt;a href=&quot;http://forum.developers.facebook.com/viewtopic.php?id=29112&quot;&gt;hilo&lt;/a&gt; de foro de desarrolladores bastante interesante alrededor del widget de comentarios, que intenta aclarar muchas de las dudas que los usuarios tienen alrededor de él, y que ha juzgar por el numero de respuestas del hilo, son muchísimas :) ...&lt;/p&gt;

&lt;p&gt;¿Para cuando un simple método que nos devuelva todos los comentarios de nuestro site? ¿Tan difícil es?&lt;/p&gt;

&lt;p&gt;Y vosotros, ¿os habeís encontrado con mas fallos básicos en la api de facebook?&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Facebook empieza a dar los emails de sus usuarios a los desarrolladores</title>
   <link href="http://cantorrodista.com/2010/02/10/facebook-cede-email-usuarios-aplicaciones-connect.html"/>
   <updated>2010-02-10T00:00:00+01:00</updated>
   <id>http://cantorrodista.com/2010/02/10/facebook-cede-email-usuarios-aplicaciones-connect</id>
   <content type="html">&lt;p&gt;Como &lt;a href=&quot;http://developers.facebook.com/news.php?blog=1&amp;amp;story=355&quot;&gt;anunció&lt;/a&gt; facebook en su &lt;a href=&quot;http://developers.facebook.com/news.php&quot;&gt;blog para desarrolladores&lt;/a&gt; el pasado
mes de enero, van a empezar a ceder el email de los usuarios a todas aquellas aplicaciones que lo solicten, previa autorización de los mismos.&lt;/p&gt;

&lt;p&gt;Hasta ahora esto no era posible. Cuando desde un site se queria hacer una integración con facebook, através de &lt;a href=&quot;http://developers.facebook.com/connect.php&quot;&gt;facebook connect&lt;/a&gt; por ejemplo,
se podia conseguir que los usuarios iniciaran una sesión valida en nuestro site através de las credenciales de facebook, pero en ningún
caso podiamos enviar notificaciones a los usuarios a su email. El único canal existente para comunicarnos con los usuarios de facebook era através del &lt;a href=&quot;http://wiki.developers.facebook.com/index.php/Proxied_Email&quot;&gt;proxied email&lt;/a&gt;
donde dependias del propio facebook para hacer llegar tus notificaciones a los usuarios.&lt;/p&gt;

&lt;p&gt;Ahora todo esto ha cambiado, y lo mejor de todo es que también funciona ;-). Através de un &lt;a href=&quot;http://wiki.developers.facebook.com/index.php/Extended_permissions&quot;&gt;simple permiso&lt;/a&gt; llamado
'email' podemos solicitar a nuestros usuarios que compartan, incluso de manera obligatoria si así lo deseamos, su dirección de email en facebook con nuestro site.&lt;/p&gt;

&lt;p&gt;A partir de ahora, podremos conseguir registrar a los usuarios en nuestro site de una manera mucho mas autónoma, sin tener que pedir campos adicionales una vez que se han logueado con facebook connect.&lt;/p&gt;

&lt;p&gt;Para los desarrolladores de facebook bajo rails que usen el plugin &lt;a href=&quot;http://github.com/mmangino/facebooker&quot;&gt;facebooker&lt;/a&gt; ya pueden conseguir los email de los usuarios de
la siguiente manera. Al inicializar facebook connect en nuestra vista, podemos pedir el permiso especial:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sx&quot;&gt;%= init_fb_connect &amp;quot;XFBML&amp;quot; , :app_settings =&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:permsToRequestOnConnect&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;email&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;con lo que conseguiremos, que una vez el usuario haya hecho login en facebook, le salga la siguiente petición de permisos:&lt;/p&gt;

&lt;div class=&quot;image_center&quot;&gt;
&lt;img src=&quot;/images/blog/facebook_email_permission.png&quot; alt=&quot;email facebook permission&quot;&gt;
&lt;/div&gt;


&lt;p&gt;Una vez que el usuario ha aceptado los permisos, podemos acceder a su email con una simple FQL (&lt;a href=&quot;http://wiki.developers.facebook.com/index.php/FQL&quot;&gt;Facebook Query Language&lt;/a&gt;:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;SELECT email FROM user WHERE uid=&amp;#39;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;facebook_session&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;#39;&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;o através del método directo de facebooker:&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;ruby&quot;&gt; &lt;span class=&quot;vi&quot;&gt;@user&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;email&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;facebook_session&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;user&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;email&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;



</content>
 </entry>
 
 <entry>
   <title>Customizando jekyll</title>
   <link href="http://cantorrodista.com/2010/02/03/mi-fork-de-jekyll.html"/>
   <updated>2010-02-03T00:00:00+01:00</updated>
   <id>http://cantorrodista.com/2010/02/03/mi-fork-de-jekyll</id>
   <content type="html">&lt;p&gt;Como ya comente, este blog esta montado sobre &lt;a href=&quot;http://github.com/mojombo/jekyll&quot;&gt;jekyll&lt;/a&gt; pero por defecto la última versión, la 0.5.7, no soporta ciertas funcionalidades que para mi son bastante interesantes: generación dinámica de páginas para tags, generación de paginas de archivos (historial de posts) y posibilidad de tener una entradilla o resumen para cada entrada del blog.&lt;/p&gt;

&lt;p&gt;Afortunadamente jekyll es un projecto muy apoyado por la comunidad y tiene un montón de forks en github, donde al final puedes encontrar muchísimas funcionalidades interesantes. Yo he creado mi propio &lt;a href=&quot;http://github.com/cantorrodista/jekyll&quot;&gt;fork&lt;/a&gt; donde he integrado todas las funcionalidades que me hacían falta en la última version de jekyll.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Inaugurando mi blog</title>
   <link href="http://cantorrodista.com/2010/01/31/inaugurando-mi-blog.html"/>
   <updated>2010-01-31T00:00:00+01:00</updated>
   <id>http://cantorrodista.com/2010/01/31/inaugurando-mi-blog</id>
   <content type="html">&lt;p&gt;Después de mucho tiempo pensando en empezar a escribir, por fin me he decidido. Pretendo escribir sobre mi día a día en el mundo del desarrollo web en &lt;a href=&quot;http://the-cocktail.com/&quot;&gt;The Cocktail&lt;/a&gt; y como freelance, y también sobre otras idas y venidas de olla.&lt;/p&gt;

&lt;p&gt;A modo de introducción decir que éste site esta desarrollado con &lt;a href=&quot;http://github.com/mojombo/jekyll&quot;&gt;jekyll&lt;/a&gt; por recomendación directa de &lt;a href=&quot;http://hronia.blogalia.com/&quot;&gt;pantulis&lt;/a&gt; lo que me costo tirar a la basura toda una tarde de desarrollo en rails. La gracia de jekyll esta en que los posts los escribes en &lt;a href=&quot;http://en.wikipedia.org/wiki/Markdown&quot;&gt;markdown&lt;/a&gt; y los deployas directamente a producción, jekyll se encarga de generarte los html estáticos para ti. He incluido un par de widgets de facebook, tanto para compartir cualquier contenido, como para comentarlo.&lt;/p&gt;

&lt;p&gt;Para el deploy en producción de cada post he creado un alias en mi .bash_login:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;alias deploy_blog=&quot;cd path/to/jekyll/code &amp;amp;&amp;amp; echo 'Creando Html...' &amp;amp;&amp;amp; jekyll --pygments 
&amp;amp;&amp;amp; echo 'Pushing...' &amp;amp;&amp;amp; rsync -avz --delete _site/ user@server.domain:path/to/directory &quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;El código al completo del blog lo tenéis disponible &lt;a href=&quot;http://github.com/cantorrodista/my-jekyll-blog&quot;&gt;aquí&lt;/a&gt;.&lt;/p&gt;
</content>
 </entry>
 
 
</feed>