<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet title="XSL formatting" type="text/xsl" href="http://blog.cosinux.org/feed/rss2/xslt" ?><rss version="2.0"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:wfw="http://wellformedweb.org/CommentAPI/"
  xmlns:content="http://purl.org/rss/1.0/modules/content/"
  xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
  <title>Le-Blog-à-Dam</title>
  <link>http://blog.cosinux.org/</link>
  <atom:link href="http://blog.cosinux.org:82/feed/rss2" rel="self" type="application/rss+xml"/>
  <description></description>
  <language>fr</language>
  <pubDate>Wed, 16 Nov 2011 10:07:27 +0100</pubDate>
  <copyright></copyright>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Dotclear</generator>
  
    
  <item>
    <title>Migration vers Gandi</title>
    <link>http://blog.cosinux.org/post/2010/02/27/Migration-vers-Gandi</link>
    <guid isPermaLink="false">urn:md5:854bf4c8f63f2ce4f09c1295da1bdfe8</guid>
    <pubDate>Sat, 27 Feb 2010 12:46:00 +0100</pubDate>
    <dc:creator>Dam</dc:creator>
            
    <description>    &lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;J'espère pouvoir redonner un peu de vie à ce blog, notamment sur des sujets
techniques. Afin de simplifier la maintenance de celui-ci, je l'ai migré sur la
plateforme &lt;a href=&quot;http://www.gandi.net/&quot;&gt;Gandi Blog&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Pour info, j'enregistre tout mes noms de domaines chez Gandi. Leur service
est excellent et ils ont une approche étique de la gestion des noms de domaines
(pas de pub notamment). Si vous voulez un nom de domaine, un blog, un site web
ou même un serveur virtuel, je ne peux que les recommander.&lt;/p&gt;
&lt;p&gt;Voilà, à bientôt pour de nouvelles aventures...&lt;/p&gt;</description>
    
    
    
          <comments>http://blog.cosinux.org/post/2010/02/27/Migration-vers-Gandi#comment-form</comments>
      <wfw:comment>http://blog.cosinux.org/post/2010/02/27/Migration-vers-Gandi#comment-form</wfw:comment>
      <wfw:commentRss>http://blog.cosinux.org/feed/atom/comments/490437</wfw:commentRss>
      </item>
    
  <item>
    <title>A propos de nos petits sous</title>
    <link>http://blog.cosinux.org/post/2008/09/30/A-propos-de-nos-petits-sous</link>
    <guid isPermaLink="false">urn:md5:2ebbd82e1ad73c2c83270404dddca05f</guid>
    <pubDate>Tue, 30 Sep 2008 06:31:00 +0200</pubDate>
    <dc:creator>Dam</dc:creator>
            
    <description>    Voici un petit article à se mettre sous la dent pour mieux comprendre la
manière dont on se fait entuber tout les jours et particulièrement ses
derniers: &lt;a href=&quot;http://www.courtfool.info/fr_Secrets_d_argent_interets_et_inflation.htm&quot;&gt;Secrets
d'argent, intérêts et inflation&lt;/a&gt;. Et pour mieux comprendre comment on en est
arrivé là, plein d'article par Aline De Diéguez: &lt;a href=&quot;http://pagesperso-orange.fr/aline.dedieguez/mariali/sommaire_textes.html&quot;&gt;voir
les articles sous le point 1&lt;/a&gt;, le dernier est assez intéressant (lire
édifiant). A consommer avec modération...</description>
    
    
    
      </item>
    
  <item>
    <title>Mes 30 ans...</title>
    <link>http://blog.cosinux.org/post/2008/09/06/Mes-30-ans...</link>
    <guid isPermaLink="false">urn:md5:a5cd107a91fceb9d0092e0e1f829c105</guid>
    <pubDate>Sat, 06 Sep 2008 06:27:00 +0200</pubDate>
    <dc:creator>Dam</dc:creator>
            
    <description>    A l'occassion de mon passage dans la trentaine, je vous invite à revivre une
après-midi comme nous en avions l'habitude quand nous avions 20 ans... Au
programme: garden party, bières, concert, bières, musique, bières et soleil
(j'espère!) Rendez-vous le samedi 13 septembre dès 15h chez nous à Clermont,
Les Béolles 2. Concerts et ambiance assurée. Voir programme sur photo
ci-dessous. Pains-saucisses spécials Béolles dès 18h. Possibilité de camping
(prévoir votre tente). Chateau gonflable pour les enfants. A l'intérieur en cas
de pluie. Nous souhaitons une vrai fête avec tous nos amis, pas de chichis, pas
de gâteaux, pas de cadeaux... PAF laissé à votre appréciation selon votre
débit... En espérant vous voir nombreux... Chrystelle</description>
    
    
    
      </item>
    
  <item>
    <title>Suzanne et le trampoline</title>
    <link>http://blog.cosinux.org/post/2008/06/16/Suzanne-et-le-trampoline</link>
    <guid isPermaLink="false">urn:md5:dd472b0aea69207a863af3c4aa07bcfb</guid>
    <pubDate>Mon, 16 Jun 2008 15:34:00 +0200</pubDate>
    <dc:creator>Dam</dc:creator>
            
    <description>    &lt;p&gt;Visiblement, ça lui plait...&lt;/p&gt;
&lt;div style=&quot;margin: auto; text-align: center;&quot;&gt;&lt;object type=&quot;application/x-shockwave-flash&quot; style=&quot;width: 425px; height: 344px;&quot; data=&quot;http://www.youtube.com/v/Qfr2JLtnAuI&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/Qfr2JLtnAuI&quot; /&gt;&lt;/object&gt;&lt;/div&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>Rails tidy release</title>
    <link>http://blog.cosinux.org/post/2008/05/19/Rails-tidy-release</link>
    <guid isPermaLink="false">urn:md5:2f94fac9eb4c2859ebf76cfb979f5af5</guid>
    <pubDate>Mon, 19 May 2008 11:04:00 +0200</pubDate>
    <dc:creator>Dam</dc:creator>
            
    <description>    &lt;p&gt;I've released a new version of my Tidy plugin for rails. This one add
support for rails 2.0 files extensions. The changes were submitted by Danial
Pearce. See &lt;a href=&quot;http://blog.cosinux.org/pages/rails-tidy&quot;&gt;there&lt;/a&gt; for
more informations.&lt;/p&gt;
&lt;p&gt;As a side note, I ordered the book &lt;a href=&quot;http://www.pragprog.com/titles/fr_arr/advanced-rails-recipes&quot;&gt;Advanced Rails
Recipes&lt;/a&gt; and discovered that my plugin is mentioned in the &amp;quot;Automatically
Validate HTML&amp;quot; recipe. I still haven't got the time to read all the book, but
as my plugin is in it, I can only recommend it ;).&lt;/p&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>Des nouvelles</title>
    <link>http://blog.cosinux.org/post/2008/05/19/Des-nouvelles</link>
    <guid isPermaLink="false">urn:md5:bac925ea82437d766eec9ca020dd179d</guid>
    <pubDate>Mon, 19 May 2008 11:00:00 +0200</pubDate>
    <dc:creator>Dam</dc:creator>
            
    <description>    Bon, il est temps de faire revivre un peu cet endroit. Je vais tenter, dans les
prochains jours, de mettre quelques photos récentes des enfants et de la
maison. Comme il faut encore que je les prenne, il va faloir patienter un peu.
En attendant, vous pouvez lire le blog de mon frère; &lt;a href=&quot;http://sophieetlaurent.blogspot.com/&quot;&gt;http://sophieetlaurent.blogspot.com/&lt;/a&gt;.</description>
    
    
    
      </item>
    
  <item>
    <title>Que mange le monde</title>
    <link>http://blog.cosinux.org/post/2007/06/08/Que-mange-le-monde</link>
    <guid isPermaLink="false">urn:md5:7f72a216e5c158cfa05e4a606d707747</guid>
    <pubDate>Fri, 08 Jun 2007 07:43:00 +0200</pubDate>
    <dc:creator>Dam</dc:creator>
            
    <description>    &lt;p&gt;&lt;a href=&quot;http://www.time.com/time/photogallery/0,29307,1626519_1373664,00.html&quot;&gt;What
the world eats&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;maj:&lt;/b&gt; je viens de me rendre compte que le système pour les
commentaires était mis en mode modération, ce que je ne fesait pas. Dorénavant,
les commentaires seront acceptés et les spams filtrés automatiquement. Je
m'excuse pour ceux qui ont commentés et que ça n'a pas marché.&lt;/p&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>Eco-Disco</title>
    <link>http://blog.cosinux.org/post/2007/06/05/Eco-Disco</link>
    <guid isPermaLink="false">urn:md5:185c3892c38e7a17728620c03ef446f9</guid>
    <pubDate>Tue, 05 Jun 2007 10:42:00 +0200</pubDate>
    <dc:creator>Dam</dc:creator>
            
    <description>    &lt;p&gt;&lt;a href=&quot;http://www.flickr.com/photos/cosinux/531250388/&quot;&gt;&lt;img src=&quot;http://farm2.static.flickr.com/1383/531250388_265f9595f6.jpg&quot; height=&quot;375&quot; alt=&quot;00052.jpg&quot; width=&quot;500&quot; /&gt;&lt;/a&gt; C'est flou, c'est normal.&lt;/p&gt;
&lt;p&gt;Voici quelques nouvelles du front...&lt;/p&gt;
&lt;p&gt;Hugo fait 4,1Kg et dort &lt;i&gt;presque&lt;/i&gt; toutes ses nuits. Faites-moi penser à
ajouter une photo.&lt;/p&gt;
&lt;p&gt;Bon anniversaire Panda, je m'excuse de ne pas être venu, la semaine c'est un
peu compliqué.&lt;/p&gt;
&lt;p&gt;Dimanche, je vote &lt;a href=&quot;http://www.ecolo.be/&quot;&gt;Ecolo&lt;/a&gt;.&lt;/p&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>Une photo de Suzanne</title>
    <link>http://blog.cosinux.org/post/2007/03/12/Une-photo-de-Suzanne</link>
    <guid isPermaLink="false">urn:md5:c5408892260fae65bfd278ebad6e7c9a</guid>
    <pubDate>Mon, 12 Mar 2007 16:28:00 +0100</pubDate>
    <dc:creator>Dam</dc:creator>
            
    <description>    Oui je vis toujour et je sais que vous mourrez d'envie de voir une photo
récente de Suzanne.
&lt;div style=&quot;text-align: center&quot;&gt;&lt;img src=&quot;http://www.cosinux.org/%7Edam/suzanne.jpg&quot; /&gt;&lt;/div&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>RubyMTP</title>
    <link>http://blog.cosinux.org/post/2007/02/21/RubyMTP</link>
    <guid isPermaLink="false">urn:md5:f7a0f7fd973263fdf6d9474e0ecfff86</guid>
    <pubDate>Wed, 21 Feb 2007 11:16:00 +0100</pubDate>
    <dc:creator>Dam</dc:creator>
            
    <description>    One month ago, I bought a Creative Zen V Plus mp3 player. It's a nice player
but I missed easy to use access under Linux (I don't use Windows anymore). I
tried the libmtp project but I did not like it much and so I started &lt;a href=&quot;http://rubyforge.org/projects/rubymtp/&quot;&gt;RubyMTP&lt;/a&gt; project. It's a Ruby
library to connect to MTP devices. For now it provides a filesystem access
using Fuse and a podcast application. It need some test so if you feel like it,
give it a try.</description>
    
    
    
      </item>
    
  <item>
    <title>La Flandre indépendante</title>
    <link>http://blog.cosinux.org/post/2006/12/14/La-Flandre-ind%C3%A9pendante</link>
    <guid isPermaLink="false">urn:md5:651bf68f8c10081bff68a330f93adfad</guid>
    <pubDate>Thu, 14 Dec 2006 12:28:00 +0100</pubDate>
    <dc:creator>Dam</dc:creator>
            
    <description>    &lt;p&gt;Alors là je dis bravo la RTBF. Pour ceux qui ne sont pas au courant, la RTBF
a diffusé hier soir un faux JT où de vrais journalistes annonçaient la scission
de la Belgique et l'indépendance de la Flandre. Un panneau annonçait avant
l'émission qu'il s'agissait d'une fiction et après 1/2 heure d'émission, un
bandeau &amp;quot;Ceci est une fiction&amp;quot; était affiché.&lt;/p&gt;
&lt;p&gt;Le résultat: une belle pagaille. Des gens se sont rendus devant le palais
royal pour manifester leur attachement à la Belgique, des ambassades ont
prévenu leur pays de la scission, j'en passe et des meilleures.&lt;/p&gt;
&lt;p&gt;Le débat sur l'indépendance de la Flandre est très intéressant mais ce qui
m'interpelle le plus ici, c'est la réaction des gens. La première chose à faire
lorsqu'on apprend une chose pareille c'est de vérifier ailleur. Zapper sur RTL
pour voir si il y a aussi un flash spécial ou allumer la radio plutôt que
d'envoyer 36 SMS à ses proches pour les prévenir de la fin de la Belgique. Les
gens prenent vraiment les paroles des medias pour du pain bénit. Avec un peu de
jugeotte, on pouvait se dire que si la flandre annonçait son indépendance,&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;la nouvelle ne tomberait pas comme un couperet, il y aurait un minimum de
chahut, d'abord au parlement, etc,&lt;/li&gt;
&lt;li&gt;le premier ministre aurait au moins fait une déclaration devant la
presse,&lt;/li&gt;
&lt;li&gt;elle ne l'annoncerait pas à 20h30, à l'heure où on se met dans son canapé
pour regarder la TV,&lt;/li&gt;
&lt;li&gt;...&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;On se croirait revenu à l'époque des chain-mails: si vous ne transmettez pas
ce message à 10 personnes, votre maison va brûler. Je n'ai jamais fait suivre
ce genre de message, et je suis toujour viv... BOUM ...&lt;/p&gt;
&lt;p&gt;Trève de plaisanteries, je pense plutôt que tout ceux qui ont des
commentaires négatifs sur l'émission se sont bien fait avoir et qu'ils râlent
de s'être fait berner. Au moins, le débat est sur la table.&lt;/p&gt;
&lt;p&gt;Par contre, la RTBF ne sera plus du tout crédible lors de son prochain flash
spécial d'information. François Debrigode a certainement perdu aussi en
crédibilité. Le bandeau &amp;quot;Ceci est une fiction&amp;quot; aurait dû être présent dès le
début, ou alors ils n'avaient qu'à programmer l'émission un 1er avril, personne
n'aurait rien dit.&lt;/p&gt;
&lt;p&gt;En tout cas, ça me fait bien rire. Faites-moi penser à demander à Mr
Debrigode de dire au gens pendant le JT du soir de verser 20€ sur mon compte
sans quoi la Belgique sera à jamais dissolue.&lt;/p&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>you.not_nil? { |you| read.this }</title>
    <link>http://blog.cosinux.org/post/2006/12/07/you.not_nil-%7B-%7Cyou%7C-read.this-%7D</link>
    <guid isPermaLink="false">urn:md5:83767c76656d4cf09c7af74b32050367</guid>
    <pubDate>Thu, 07 Dec 2006 11:03:00 +0100</pubDate>
    <dc:creator>Dam</dc:creator>
            
    <description>    A thing that really annoys me is to check for nil values. For example having to
do, in an ERB template
&lt;h1&gt;my template&lt;/h1&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>Get rid of user passwords in Rails using SSL client certificate</title>
    <link>http://blog.cosinux.org/post/2006/12/07/Get-rid-of-user-passwords-in-Rails-using-SSL-client-certificate</link>
    <guid isPermaLink="false">urn:md5:4d83eb86c8a74b4d675f11704871cf18</guid>
    <pubDate>Thu, 07 Dec 2006 10:35:00 +0100</pubDate>
    <dc:creator>Dam</dc:creator>
            
    <description>    &lt;p&gt;For an application I'm writing, I needed a way to log in without having to
enter a password. You can authenticate a client against a server in Apache
using SSL client certificate validation. The problem was to create a link
between Apache and the Rails application running under Mongrel. Here is what
I've done.&lt;/p&gt;
&lt;h2&gt;Apache and SSL&lt;/h2&gt;
&lt;p&gt;First, you'll need Apache set up with SSL and client certificate validation.
&lt;a href=&quot;http://www.garex.net/apache/&quot;&gt;There&lt;/a&gt; are &lt;a href=&quot;http://www.freebsddiary.org/openssl-client-authentication.php&quot;&gt;howtos&lt;/a&gt; on
the web on how to to that, so I won't explain that in full details here. You'll
need a server private key and certificate and a client certificate issued by
the same authority (or authorities trusting each others). For myself, I use
&lt;a href=&quot;http://www.cacert.org/&quot;&gt;CAcert&lt;/a&gt; which provides free &amp;quot;ethic&amp;quot;
certificates.&lt;/p&gt;
&lt;p&gt;I use Coda Hale great &lt;a href=&quot;http://blog.codahale.com/2006/06/19/time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you/&quot;&gt;
article&lt;/a&gt; to configure my rails apps. Here is what I added to the Apache
configuration for having it working with SSL and client certificate validation.
Please note that only the lines added or changed are listed here. For it to
work, you need to enable the Apache 2 &lt;a href=&quot;http://httpd.apache.org/docs/2.2/mod/mod_ssl.html&quot;&gt;SSL&lt;/a&gt; and &lt;a href=&quot;http://httpd.apache.org/docs/2.2/mod/mod_headers.html&quot;&gt;headers&lt;/a&gt;
modules.&lt;/p&gt;
&lt;pre&gt;
&lt;code&gt;&amp;lt;virtualhost&amp;gt;
  SSLEngine on
  SSLCertificateFile /path/to/cert.pem
  SSLCertificateKeyFile /path/to/private.key
  SSLCACertificateFile /path/to/cacert.pem
  SSLVerifyClient none

  &amp;lt;location&amp;gt;
    SSLVerifyClient require
    SSLVerifyDepth 1
  &amp;lt;/location&amp;gt;

  RequestHeader set X_FORWARDED_PROTO 'https'
  RequestHeader set X_SSL_CLIENT_DN_Email &amp;quot;%{SSL_CLIENT_S_DN_Email}s&amp;quot;
&amp;lt;/virtualhost&amp;gt;&lt;/code&gt;
&lt;/pre&gt;
&lt;p&gt;So what's the meaning of all this ?&lt;/p&gt;
&lt;p&gt;On line 1, we say that this virtual host is for connection on port 443
(don't forget to add a &amp;quot;Listen 443&amp;quot; directive to your Apache config).&lt;/p&gt;
&lt;p&gt;Line 2 to 5, we simply configure server side ssl.&lt;/p&gt;
&lt;p&gt;On line 6 to 12, we configure client certificate validation. The line 6 is
usefull if you want to require validation only for some specific locations (say
'admin' for example). Line 9, we require client certificate validation for the
'/' location. Line 10 says that we need to go up in the authority hierarchy of
1 level maximum (my client and server certificates are issued by the same
authority).&lt;/p&gt;
&lt;p&gt;On line 13, we tell rails that we are using the &amp;quot;https&amp;quot; protocol so that
links outputted by call to &amp;quot;link_to&amp;quot;, &amp;quot;url_for&amp;quot; and the likes need to start
with &amp;quot;https&amp;quot; instead of &amp;quot;http&amp;quot;.&lt;/p&gt;
&lt;h2&gt;SSL, Rails and Mongrel&lt;/h2&gt;
&lt;p&gt;This is the interesting part, specific to using Rails with Mongrel.&lt;/p&gt;
&lt;p&gt;On line 14, we say to Apache to add the &amp;quot;X_SSL_CLIENT_DN_Email&amp;quot; header to
the value of the &amp;quot;DN_Email&amp;quot; field in the SSL client certificate. This is the
only way I have found to forward to Mongrel the SSL client certifcate values
that are of interest to us.&lt;/p&gt;
&lt;p&gt;Now in your controller, to fetch the email of the user connected:&lt;/p&gt;
&lt;table class=&quot;CodeRay&quot;&gt;
&lt;tr&gt;
&lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;
&lt;pre&gt;
1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;5&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;
&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&quot;code&quot;&gt;
&lt;pre&gt;
&lt;span class=&quot;r&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;cl&quot;&gt;ApplicationController&lt;/span&gt; &amp;lt; &lt;span class=&quot;co&quot;&gt;ActionController&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;Base&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  before_filter &lt;span class=&quot;sy&quot;&gt;:ssl_login&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;ssl_login&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      session[&lt;span class=&quot;sy&quot;&gt;:user&lt;/span&gt;] =  &lt;span class=&quot;co&quot;&gt;User&lt;/span&gt;.find_by_email(request.env[&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;HTTP_X_SSL_CLIENT_DN_EMAIL&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;])&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;p&gt;If your Mongrel instances are only listening to your local host network
interface (think 127.0.0.1), this should be secure:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Apache will prevent anybody &lt;strong&gt;not&lt;/strong&gt; having a valid client
certificate to even reach your Mongrel instances,&lt;/li&gt;
&lt;li&gt;for the others, Apache sets the email of the certificate in a header and
&lt;strong&gt;overwrite&lt;/strong&gt; the header if already present (so client are unable
to forge that header),&lt;/li&gt;
&lt;li&gt;assuming a common authentication scheme, if the user email is in your
database, he is allowed to connect.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Please do note that if a hacker is able to connect to your Mongrel instances
via your local host network interface, he can forge the header and pretend to
be someone else. But if he has access to your local host interface, you
probably are already in big troubles.&lt;/p&gt;
&lt;p&gt;I hope you found this useful, any comments are of course welcome.&lt;/p&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>Version 0.2 of the Cache Test plugin</title>
    <link>http://blog.cosinux.org/post/2006/10/17/Version-0.2-of-the-Cache-Test-plugin</link>
    <guid isPermaLink="false">urn:md5:c3b82db7d26a252ea5ac1c16a8b3db48</guid>
    <pubDate>Tue, 17 Oct 2006 18:03:00 +0200</pubDate>
    <dc:creator>Dam</dc:creator>
            
    <description>    &lt;p&gt;As the title implies, I have released a new version of my &lt;a href=&quot;http://blog.cosinux.org/pages/page-cache-test&quot;&gt;cache logic test&lt;/a&gt;
plugin.&lt;/p&gt;
&lt;p&gt;Ok, I must admit I have been a bit motivated by &lt;a href=&quot;http://weblog.rubyonrails.org/2006/10/10/testing-page-caching-with-new-plugin&quot;&gt;
that&lt;/a&gt; post =P, but anyway, here you are with some new features.&lt;/p&gt;
&lt;p&gt;First you are now able to check the actions and fragments caching logic:
there are four new methods:&lt;/p&gt;
&lt;p&gt;- assert\_cache\_actions - assert\_expire\_actions -
assert\_cache\_fragments - assert\_expire\_fragments&lt;/p&gt;
&lt;p&gt;They work quite like the corresponding page method, see the &lt;a href=&quot;http://www.cosinux.org/~dam/projects/page-cache-test/doc/classes/Cosinux/FragmentCacheTest/Assertions.html&quot;&gt;
documentation&lt;/a&gt; for code and examples.&lt;/p&gt;
&lt;p&gt;I also changed the way page caching test works. The &lt;span class=&quot;caps&quot;&gt;API&lt;/span&gt; is still the same, just the internals have changed. Instead
of checking that the page’s cache files are created or removed, I now hijack
the ActionController::Base methods so that they records which page are cached
or expired. I then use this information in the assertions. No more fiddling
with the file system to know if a file is cached or not.&lt;/p&gt;
&lt;p&gt;And finally, this release comes with some unit test cases.&lt;/p&gt;
&lt;p&gt;The fragment code seems to be working, but I have no application that makes
heavy use of fragments so if you find bug in it or have suggestions, don’t
hesitate to tell me!&lt;/p&gt;
&lt;p&gt;&lt;em&gt;update&lt;/em&gt;: I think I have a better idea for the &lt;span class=&quot;caps&quot;&gt;API&lt;/span&gt; something along the line of&lt;/p&gt;
&lt;table class=&quot;CodeRay&quot;&gt;
&lt;tr&gt;
&lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;
&lt;pre&gt;
1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;5&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;11&lt;tt&gt;
&lt;/tt&gt;12&lt;tt&gt;
&lt;/tt&gt;13&lt;tt&gt;
&lt;/tt&gt;14&lt;tt&gt;
&lt;/tt&gt;
&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&quot;code&quot;&gt;
&lt;pre&gt;
&lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;test_caching&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  assert_caching &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    get &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/my/page&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    assert_page_cached &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/my/page&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;    get &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/my/action&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    assert_action_cached &lt;span class=&quot;sy&quot;&gt;:controller&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;my&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;sy&quot;&gt;:action&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;action&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;    get &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/my/fragment&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    assert_fragment_cached &lt;span class=&quot;sy&quot;&gt;:controller&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;my&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;tt&gt;
&lt;/tt&gt;                                            &lt;span class=&quot;sy&quot;&gt;:action&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;fragment&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;,&lt;tt&gt;
&lt;/tt&gt;                                            &lt;span class=&quot;sy&quot;&gt;:fragment&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;foo&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;p&gt;I’ve already implemented it, I’ll wait for some feedback before releasing a
new version.&lt;/p&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>Testing ruby on rails page caching</title>
    <link>http://blog.cosinux.org/post/2006/10/05/Testing-ruby-on-rails-page-caching</link>
    <guid isPermaLink="false">urn:md5:9d1ee154f941c508dfe446c3e71efb2c</guid>
    <pubDate>Thu, 05 Oct 2006 10:21:00 +0200</pubDate>
    <dc:creator>Dam</dc:creator>
            
    <description>    &lt;p&gt;For the new version of &lt;a href=&quot;http://isearch.cosinux.org/&quot;&gt;iSearch&lt;/a&gt;, I
used the &lt;a href=&quot;http://api.rubyonrails.com/classes/ActionController/Caching/Pages.html&quot;&gt;page
caching&lt;/a&gt; feature of &lt;a href=&quot;http://www.rubyonrails.com/&quot;&gt;Ruby on Rails&lt;/a&gt;
a lot. I also needed to refresh those pages when some model where added,
updated or deleted, so I needed to use &lt;a href=&quot;http://api.rubyonrails.com/classes/ActionController/Caching/Sweeping.html&quot;&gt;cache
sweeping&lt;/a&gt; too.&lt;/p&gt;
&lt;p&gt;Now caching is great, but you need to be sure it works, and what's the best
thing you can do to make sure it works? Write tests! But here we have a
problem, as I could not find any information about page caching testing. So I
decided to add some page caching test helpers to my application, and while I'm
at it, released them as a &lt;a href=&quot;http://blog.cosinux.org/pages/page-cache-test&quot;&gt;plugin&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Here, I will explain how the plugin is working. Go to the &lt;a href=&quot;http://blog.cosinux.org/pages/page-cache-test&quot;&gt;plugin&lt;/a&gt; page if you want
more information about how to download, install and use it.&lt;/p&gt;
&lt;p&gt;First let's have a look at the &lt;a href=&quot;http://www.cosinux.org/~dam/projects/page-cache-test/page_cache_test/init.rb&quot;&gt;init.rb&lt;/a&gt;
file:&lt;/p&gt;
&lt;table class=&quot;CodeRay&quot;&gt;
&lt;tr&gt;
&lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;
&lt;pre&gt;
1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;5&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;
&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&quot;code&quot;&gt;
&lt;pre&gt;
&lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;co&quot;&gt;RAILS_ENV&lt;/span&gt; == &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  require &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;page_cache_test&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;co&quot;&gt;Test&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;Unit&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;TestCase&lt;/span&gt;.class_eval &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    include &lt;span class=&quot;co&quot;&gt;Cosinux&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;PageCacheTest&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;p&gt;On line 1, we make sure that we are in the test environment so we don't
interfere with other environments. If it is the case, we first load the
&lt;a href=&quot;http://www.cosinux.org/~dam/projects/page-cache-test/page_cache_test/lib/page_cache_test.rb&quot;&gt;
page_cache_test.rb&lt;/a&gt; file on line 2. Then we include the module
&lt;tt&gt;Cosinux::PageCacheTest&lt;/tt&gt; in the &lt;tt&gt;Test::Unit::TestCase&lt;/tt&gt; on line 4
to 6.&lt;/p&gt;
&lt;p&gt;Now let's go in the &lt;a href=&quot;http://www.cosinux.org/~dam/projects/page-cache-test/page_cache_test/lib/page_cache_test.rb%20file&quot;&gt;
page_cache_test.rb&lt;/a&gt; and see what happens when the
&lt;tt&gt;Cosinux::PageCacheTest&lt;/tt&gt; module is included.&lt;/p&gt;
&lt;table class=&quot;CodeRay&quot;&gt;
&lt;tr&gt;
&lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;
&lt;pre&gt;
1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;5&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;
&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&quot;code&quot;&gt;
&lt;pre&gt;
&lt;span class=&quot;r&quot;&gt;module&lt;/span&gt; &lt;span class=&quot;cl&quot;&gt;Cosinux::PageCacheTest&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;pc&quot;&gt;self&lt;/span&gt;.included(base)&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;co&quot;&gt;ActionController&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;Base&lt;/span&gt;.public_class_method &lt;span class=&quot;sy&quot;&gt;:page_cache_path&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;co&quot;&gt;ActionController&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;Base&lt;/span&gt;.perform_caching = &lt;span class=&quot;pc&quot;&gt;true&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;p&gt;The method &lt;tt&gt;self.included&lt;/tt&gt; on line two, defined in the
&lt;tt&gt;Module&lt;/tt&gt; class is executed each time a module is included. So here it is
executed because of the include we've just seen in the &lt;a href=&quot;http://www.cosinux.org/~dam/projects/page-cache-test/page_cache_test/init.rb&quot;&gt;init.rb&lt;/a&gt;
file.&lt;/p&gt;
&lt;p&gt;In this method, on line 3, we change the visibility of the method
&lt;tt&gt;page_cache_path&lt;/tt&gt; of &lt;tt&gt;ActionController::Base&lt;/tt&gt; so that we can use
it in our assertions. The method is used to get the path of the cached file for
a url.&lt;/p&gt;
&lt;p&gt;Then, on line 4, we ensure that caching is enabled (it is normally disabled
in the test environment).&lt;/p&gt;
&lt;p&gt;So were are we now ? We included the &lt;tt&gt;Cosinux::PageCacheTest&lt;/tt&gt; module
in the &lt;tt&gt;Test::Units::TestCase&lt;/tt&gt; class so each method defined in the
module is available in the class. There are two instance methods defined in the
module:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;tt&gt;assert_cache&lt;/tt&gt;,&lt;/li&gt;
&lt;li&gt;and &lt;tt&gt;assert_expire&lt;/tt&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Let's have a look at both of them.&lt;/p&gt;
&lt;table class=&quot;CodeRay&quot;&gt;
&lt;tr&gt;
&lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;
&lt;pre&gt;
1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;5&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;11&lt;tt&gt;
&lt;/tt&gt;12&lt;tt&gt;
&lt;/tt&gt;13&lt;tt&gt;
&lt;/tt&gt;14&lt;tt&gt;
&lt;/tt&gt;15&lt;tt&gt;
&lt;/tt&gt;16&lt;tt&gt;
&lt;/tt&gt;17&lt;tt&gt;
&lt;/tt&gt;18&lt;tt&gt;
&lt;/tt&gt;19&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;20&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;
&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&quot;code&quot;&gt;
&lt;pre&gt;
&lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;assert_cache&lt;/span&gt;(*urls)&lt;tt&gt;
&lt;/tt&gt;  silence &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    urls.each &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt; |url|&lt;tt&gt;
&lt;/tt&gt;      &lt;span class=&quot;co&quot;&gt;ActionController&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;Base&lt;/span&gt;.expire_page(url)&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; block_given?&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;r&quot;&gt;yield&lt;/span&gt; *urls&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;else&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    urls.each { |url| get url }&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;  urls.each &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt; |url|&lt;tt&gt;
&lt;/tt&gt;    assert_block(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;url.inspect&lt;span class=&quot;dl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt; is not &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; +&lt;tt&gt;
&lt;/tt&gt;                         &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;cached after executing block&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;) &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      &lt;span class=&quot;co&quot;&gt;File&lt;/span&gt;.exists? page_cache_path(url)&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;p&gt;First, on line 3 to 5, we ensure that the urls we are checking are not in
cache by expiring them on line 4. We also make sure that no message is logged
by using the &lt;tt&gt;silence&lt;/tt&gt; method which is defined at the end of the
file.&lt;/p&gt;
&lt;p&gt;Then, on line 8 and 9, if a block is given, we execute it, giving it the
urls as arguments. Otherwise, on line 11, we execute a get request on each of
the given urls.&lt;/p&gt;
&lt;p&gt;Finaly, on line 14 to 18, we make sure that the urls are cached by checking
that the corresponding files exists on the file system.&lt;/p&gt;
&lt;p&gt;Now to the other method.&lt;/p&gt;
&lt;table class=&quot;CodeRay&quot;&gt;
&lt;tr&gt;
&lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;
&lt;pre&gt;
1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;5&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;11&lt;tt&gt;
&lt;/tt&gt;12&lt;tt&gt;
&lt;/tt&gt;13&lt;tt&gt;
&lt;/tt&gt;14&lt;tt&gt;
&lt;/tt&gt;15&lt;tt&gt;
&lt;/tt&gt;16&lt;tt&gt;
&lt;/tt&gt;
&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&quot;code&quot;&gt;
&lt;pre&gt;
&lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;assert_expire&lt;/span&gt;(*urls)&lt;tt&gt;
&lt;/tt&gt;  silence &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    urls.each &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt; |url|&lt;tt&gt;
&lt;/tt&gt;      &lt;span class=&quot;co&quot;&gt;ActionController&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;Base&lt;/span&gt;.cache_page(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;testing&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, url)&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;yield&lt;/span&gt; *urls&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;  urls.each &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt; |url|&lt;tt&gt;
&lt;/tt&gt;    assert_block(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;url.inspect&lt;span class=&quot;dl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt; is cached&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; +&lt;tt&gt;
&lt;/tt&gt;                         &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt; after executing block&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;) &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      ! &lt;span class=&quot;co&quot;&gt;File&lt;/span&gt;.exists? page_cache_path(url)&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;
&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;p&gt;As you can see, it looks quite the same, excepts a few things.&lt;/p&gt;
&lt;p&gt;First it makes sure that the urls are cached by writing &amp;quot;testing&amp;quot; in the
corresponding files on line 4.&lt;/p&gt;
&lt;p&gt;Then we always execute a block, so that the user can take some actions that
should make the urls expire, like triggering an action which defines a
sweeper.&lt;/p&gt;
&lt;p&gt;And finally, on line 12, we assert that the files corresponding to the urls
do not exists anymore.&lt;/p&gt;
&lt;p&gt;That's it. I hope this will explain how this small plugin work and that it
will help somebody. Next time, I will write about my experiments with a plugin
to create multiple page forms.&lt;/p&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>Un petit frère ou une petite soeur ?</title>
    <link>http://blog.cosinux.org/post/2006/10/03/Un-petit-fr%C3%A8re-ou-une-petite-soeur</link>
    <guid isPermaLink="false">urn:md5:4a08552ae234129baa51dd02c5fb8d11</guid>
    <pubDate>Tue, 03 Oct 2006 18:02:00 +0200</pubDate>
    <dc:creator>Dam</dc:creator>
            
    <description>    &lt;p&gt;Ca fait de nouveau longtemps que je n'ai plus donné de nouvelles. En fait,
vu que je rentre tout les jours vers 19h30, je n'ai pas trop le temps de
blogger.&lt;/p&gt;
&lt;p&gt;Pour ceux qui ne sont pas encore au courant (si il y en a encore),
Chrystelle attend famille et nous espérons avoir un petit frère ou une petite
soeur pour Suzanne aux environs de début mai. Jusqu'ici, tout va bien,
Chrystelle est juste un peu fatiguée.&lt;/p&gt;
&lt;p&gt;Le week-end passé, nous sommes allés à Walibi avec la famille: papa, maman,
ma soeur, mon frère, Sophie, Chrystelle, Suzanne, Julien, ma filleule et moi.
La journée a été excellente, et je n'ai même pas été malade bien que Julien
nous ait obligé à aller sur le Dalton Terror, un bazar qui tombe de très haut
très vite et qui vous met le coeur dans les cheveux.&lt;/p&gt;
&lt;p&gt;Ca c'est pour dimanche. Samedi, c'était notre dernier passage en tant
qu'assistants d'unité au scout à Fexhe. Après presque 10 ans dans l'unité, je
lève le pied. Toutes ces années ont été terribles (dans le bon sens) et je
remercie tout les gens que j'ai croisé grâce aux scouts. Et bonne m**** pour la
suite à l'unité Zénon Sacré!&lt;/p&gt;
&lt;p&gt;Le week-end encore avant, je suis allé sauter en parachutte avec mon frère.
Expérience réussie, sensation extraordinaire. Je vais voir ce que je peux faire
pour mettre la video sur le web. En attendant, mon frère a quelques &lt;a href=&quot;http://www.flickr.com/photos/76639518@N00/&quot;&gt;photos&lt;/a&gt;. Il ne reste plus qu'à
trouver 1200€ pour passer le brevet ;)&lt;/p&gt;
&lt;p&gt;En parlant de photo, il m'en reste un paquet à mettre sur le web, je vais
essayer de faire ça un de ses quatres.&lt;/p&gt;
&lt;p&gt;En vous souhaitant bien le bonsoir,&lt;/p&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>new iSearch version</title>
    <link>http://blog.cosinux.org/post/2006/10/03/new-iSearch-version</link>
    <guid isPermaLink="false">urn:md5:cd2120d279bfd514a2cfa59e26735f95</guid>
    <pubDate>Tue, 03 Oct 2006 17:52:00 +0200</pubDate>
    <dc:creator>Dam</dc:creator>
            
    <description>    &lt;p&gt;I have updated my index search engine, you can see (and use) the results at
&lt;a href=&quot;http://isearch.cosinux.org/&quot;&gt;http://isearch.cosinux.org/&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;What's new ?&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;it uses &lt;a href=&quot;http://ferret.davebalmain.com/trac&quot;&gt;Ferret&lt;/a&gt; to search
the links, so you can use ferret search syntax, and search is quicker,&lt;/li&gt;
&lt;li&gt;it uses &lt;a href=&quot;http://code.whytheluckystiff.net/hpricot/&quot;&gt;Hpricot&lt;/a&gt; to
extract the links from the index so you can extract only the needed links,&lt;/li&gt;
&lt;li&gt;and I hope it has a better look.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I have created to plugin for this project that I will release one I find the
time:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;a plugin to creates multiple page form,&lt;/li&gt;
&lt;li&gt;and a plugin to test page caching.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I'll try to blog about that soon.&lt;/p&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>Microformats</title>
    <link>http://blog.cosinux.org/post/2006/09/27/Microformats</link>
    <guid isPermaLink="false">urn:md5:0da02333de8d9ae9708da41bf41e1725</guid>
    <pubDate>Wed, 27 Sep 2006 10:16:00 +0200</pubDate>
    <dc:creator>Dam</dc:creator>
            
    <description>    &lt;p&gt;Have you heard of &lt;a href=&quot;http://www.microformats.org/&quot;&gt;microformats&lt;/a&gt;
?&lt;/p&gt;
&lt;p&gt;Microformats are usings predefined XHTML snippets to show common elements in
web pages. For example to display a contact, you could use the &lt;a href=&quot;http://microformats.org/wiki/hcard&quot;&gt;hCard&lt;/a&gt; which allow you to represent a
vCard (like those used in most email tools).&lt;/p&gt;
&lt;p&gt;Why do that ? The hope is that in the near future, you will be able for
example to drag and drop a contact on a web page directly into your contact
manager application.&lt;/p&gt;
&lt;p&gt;I think I will try to follow those recommendation, so that when the day has
come, I will be microformats ready!&lt;/p&gt;
&lt;p&gt;UPDATE: the day has already come,
(technorati)[http://technorati.com/contacts/] has a small web application that
converts and hCard to a vCard and allows your browser to download it and add it
to your contact manager.&lt;/p&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>Quick Ruby on Rails tip</title>
    <link>http://blog.cosinux.org/post/2006/09/01/Quick-Ruby-on-Rails-tip</link>
    <guid isPermaLink="false">urn:md5:3e02a975394855d14e3a2c11e161e056</guid>
    <pubDate>Fri, 01 Sep 2006 10:29:00 +0200</pubDate>
    <dc:creator>Dam</dc:creator>
            
    <description>    &lt;p&gt;For one of my project, I have a &lt;code&gt;Project&lt;/code&gt; model where project are
referenced by their, hum..., reference. I use this reference to create nice URL
like &lt;code&gt;/project/myproj&lt;/code&gt;. The referenced is stored in the database in
upper case so I always needed to use project.reference.downcase in the
&lt;code&gt;link_to&lt;/code&gt; or &lt;code&gt;url_for&lt;/code&gt; methods.&lt;/p&gt;
&lt;p&gt;I just found out that if you define a to_param method for an object. This
method will be called when the object is given as a parameter for a URL. So I
added&lt;/p&gt;
&lt;pre&gt;
def to_param
  reference.downcase
end
&lt;/pre&gt;
&lt;p&gt;And now I can use &lt;code&gt;url_for(:controller =&amp;gt; &amp;quot;project&amp;quot;, :reference
=&amp;gt; project)&lt;/code&gt;&lt;/p&gt;</description>
    
    
    
      </item>
    
  <item>
    <title>Les photos de l'Islande</title>
    <link>http://blog.cosinux.org/post/2006/08/09/Les-photos-de-l-Islande</link>
    <guid isPermaLink="false">urn:md5:ee9ac4af34ad16dcf2c766a27a33a561</guid>
    <pubDate>Wed, 09 Aug 2006 12:20:00 +0200</pubDate>
    <dc:creator>Dam</dc:creator>
            
    <description>    &lt;p&gt;Il est temps de donner des nouvelles.&lt;/p&gt;
&lt;p&gt;Pour ceux qui ne le savent pas, je suis parti en Islande pour le boulot du 9
au 12 juillet. Les photos sont sur &lt;a href=&quot;http://www.flickr.com/photos/cosinux/tags/iceland/&quot;&gt;Flickr&lt;/a&gt;. L'Islande est
un pays ... surprenant. Très beau mais moins vert que ce à quoi je m'attendais.
Très caillouteux avec bien sûr des volcans partout, de l'eau qui bout au milieu
de nulle part et du soleil à minuit. C'est d'ailleur grâce à ce dernier que
nous avons pu faire une excursion le mardi soir, jusqu'à une heure du matin,
les journées étant bien occupées par les meetings.&lt;/p&gt;
&lt;p&gt;Ensuite, le 21 juillet, nous sommes allés avec la jeep des parents rendre
visite au camp scout. De Clermont jusqu'a Vielsalm par les petits chemins, sous
le soleil et les cheveux aux vent. Le camp était bien situé et tout avait l'air
de bien se passer, sous un soleil de plomb. Et non, on n'a pas passé
l'après-midi à boire des bières.&lt;/p&gt;
&lt;p&gt;Le samedi 29, on a enterré la vie de garçon de Galago. Là aussi on a rien bu
(si si, je vous le jure). La journée a commencé sur le parking Ikea où le preu
chevalier Galago a dû se faire fabriquer son épée. Ensuite, nous avons pris
l'apéro chez Blanche (de l'eau avec de la menthe). Nous avons dîné avec un
sympathique barbecue dans une sympathique maison de Clermont. Maison au
demeurant très jolie et entièrement rénovée avec une très belle terrasse.
Ensuite nous avons pris la direction de Herve pour aller voir l'arrivée du
Ravel, puis retour chez Blanche et enfin, direction la super soirée
mega-dance-tour-de-la-mort-que-c'était-bien-surtout-la-musique, où,
heureusement pour nous, il y avait aussi un bar. N'oubliez pas de me demander
de vous raconter l'une ou l'autre anecdote au sujet de la fin de soirée,
celle-ci s'étant avérée assez cocasse voire épique.&lt;/p&gt;
&lt;p&gt;Enfin, le week-end passé a été bien rempli. Vendredi soir, petite soirée
entre amis avec mon frère, Sophie, Pinpin, Victor, Seb, Chrystelle et Suzanne.
On a été manger des boulettes chez Tchantchès puis boire un verre au Pot et
non, je n'ai rien bu (même si c'est contradictoire).&lt;/p&gt;
&lt;p&gt;Samedi c'était le mariage de Laurence et Galago. On est rentré à 5h30 du
matin et non, je n'ai rien bu. Le mariage était très réussi et comme je leur ai
déjà dis, je suis très heureux pour eux. Je leur souhaite tout le bonheur du
monde, pour aujourd'hui comme pour demain, que leur chemin évite les bombes et
qu'ils vivent d'amour au quotidien (si c'est de moi).&lt;/p&gt;
&lt;p&gt;Enfin, le dimanche était consacré à la fête à Clermont. Soleil et musique,
avec mes parents, mon parrain et Claire, Chri et Oli, Fred et Seb, et
Chrystelle et Suzanne. Je me suis visiblement fait remarquer à la soirée de la
semaine précédente, ceusses de la jeunesse que je connais avait l'air fort
tracassé de mon état. Qu'ils se rassurent, elle s'est très bien terminée (la
soirée) (hum hum).&lt;/p&gt;
&lt;p&gt;Maintenant un petit mot de Suzanne avant de poursuivre:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;cxcsdec rrrrrrrrrrzcdbgtbvg ff dfdððð bvv+ hg
vvvvvvvvvvvvvvvvvvv&amp;amp;qéz&amp;amp;ssssssssssssSSSSsss&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Hoouuuuu s'est mignooooonnnnnn.&lt;/p&gt;
&lt;p&gt;Poursuivons.&lt;/p&gt;
&lt;p&gt;Ah oui, fête à Clermont, puis feu d'artifice très réussi. Je profite de cet
espace d'expression qui m'est offert pour remercier les jeunes de Clermont pour
ce qu'ils font. C'est un sacré boulot.&lt;/p&gt;
&lt;p&gt;Enfin, au jour d'aujourd'hui, je suis dans mon lit avec une gastro (non pas
une gastronome, une entérite). Pour le futur, dimanche c'est le baptême de
Suzanne, puis y'a le 15 août, puis le PukklePop, puis Momalia, puis les
vacances. Joli programme.&lt;/p&gt;
&lt;p&gt;Et enfin, pour rire, mais en anglais: &lt;a href=&quot;http://xkcd.com/comics/centrifugal_force.png&quot;&gt;une petite bd de
physique&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Voilà pour les nouvelles. A bientôt.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;MAJ:&lt;/em&gt; Fred me fait aimablement remarquer qu'il se trouvait à la
soirée au Pot.&lt;/p&gt;</description>
    
    
    
      </item>
    
</channel>
</rss>
