<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>6502.fr &#187; Programming</title>
	<atom:link href="http://www.6502.fr/category/programming/feed" rel="self" type="application/rss+xml" />
	<link>http://www.6502.fr</link>
	<description>L&#039;Avant-dernier cri de la technologie</description>
	<lastBuildDate>Thu, 27 Jan 2011 14:23:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Comment faire le ménage sous Subversion</title>
		<link>http://www.6502.fr/comment-faire-le-menage-sous-subversion/381</link>
		<comments>http://www.6502.fr/comment-faire-le-menage-sous-subversion/381#comments</comments>
		<pubDate>Thu, 27 Jan 2011 14:23:19 +0000</pubDate>
		<dc:creator>Christian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Subversion]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[ligne de commande]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://www.6502.fr/?p=381</guid>
		<description><![CDATA[Vous avez besoin de faire du ménage dans votre projet géré sous Subversion ? Si vous avez quelques fichiers à supprimer, la commande à passer est simple : $ svn rm admin/images/graphs/THUMB~JT.DBE D admin/images/graphs/THUMB~JT.DBE C&#8217;est fastidieux au-delà de quelques fichiers. Dans ce cas détruisez les fichiers par la méthode qui vous convient (par exemple une [...]]]></description>
			<content:encoded><![CDATA[<p>Vous avez besoin de faire du ménage dans votre projet géré sous <a href="http://subversion.apache.org/" title="Apache Subversion">Subversion</a> ? Si vous avez quelques fichiers à supprimer, la commande à passer est simple :</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">svn</span> <span style="color: #c20cb9; font-weight: bold;">rm</span> admin<span style="color: #000000; font-weight: bold;">/</span>images<span style="color: #000000; font-weight: bold;">/</span>graphs<span style="color: #000000; font-weight: bold;">/</span>THUMB~JT.DBE
D         admin<span style="color: #000000; font-weight: bold;">/</span>images<span style="color: #000000; font-weight: bold;">/</span>graphs<span style="color: #000000; font-weight: bold;">/</span>THUMB~JT.DBE</pre></div></div>


<p>C&#8217;est fastidieux au-delà de quelques fichiers. Dans ce cas détruisez les fichiers par la méthode qui vous convient (par exemple une synchronisation avec <a href="http://www.scootersoftware.com/" title="BeyondCompare">BeyondCompare</a>). Ensuite, un <code>svn status</code> vous donnera l&#8217;état des lieux.</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">svn</span> st
D       admin<span style="color: #000000; font-weight: bold;">/</span>images<span style="color: #000000; font-weight: bold;">/</span>graphs<span style="color: #000000; font-weight: bold;">/</span>THUMB~JT.DBE
<span style="color: #000000; font-weight: bold;">!</span>       admin<span style="color: #000000; font-weight: bold;">/</span>images<span style="color: #000000; font-weight: bold;">/</span>graphs<span style="color: #000000; font-weight: bold;">/</span>Thumbs.db
<span style="color: #000000; font-weight: bold;">!</span>       admin<span style="color: #000000; font-weight: bold;">/</span>images<span style="color: #000000; font-weight: bold;">/</span>graphs<span style="color: #000000; font-weight: bold;">/</span>dummy
<span style="color: #000000; font-weight: bold;">!</span>       admin<span style="color: #000000; font-weight: bold;">/</span>images<span style="color: #000000; font-weight: bold;">/</span>graphs<span style="color: #000000; font-weight: bold;">/</span>.cvsignore
M       images<span style="color: #000000; font-weight: bold;">/</span>ramey-noir.jpg</pre></div></div>


<p>Les fichiers manquants sont marqués par un <em>bang</em> (un point d&#8217;exclamation, en <em>hacker</em>). Le fichier que nous avons déjà détruit est signalé par un <strong>D</strong>, les fichiers modifiés par un <strong>M</strong>. Nous allons filtrer les lignes qui commencent par <strong>!</strong> (^! pour grep) et récupérer le nom de fichier, qui est le deuxième élément de la ligne ($2 pour <em>awk</em>).</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">svn</span> st<span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">'^!'</span><span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $2}'</span>
admin<span style="color: #000000; font-weight: bold;">/</span>images<span style="color: #000000; font-weight: bold;">/</span>graphs<span style="color: #000000; font-weight: bold;">/</span>Thumbs.db
admin<span style="color: #000000; font-weight: bold;">/</span>images<span style="color: #000000; font-weight: bold;">/</span>graphs<span style="color: #000000; font-weight: bold;">/</span>dummy
admin<span style="color: #000000; font-weight: bold;">/</span>images<span style="color: #000000; font-weight: bold;">/</span>graphs<span style="color: #000000; font-weight: bold;">/</span>.cvsignore</pre></div></div>


<p>Plutôt que de les regarder, nous allons les supprimer du repository.</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">svn</span> st<span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">'^!'</span><span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $2}'</span><span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #c20cb9; font-weight: bold;">svn</span> <span style="color: #c20cb9; font-weight: bold;">rm</span>
D         admin<span style="color: #000000; font-weight: bold;">/</span>images<span style="color: #000000; font-weight: bold;">/</span>graphs<span style="color: #000000; font-weight: bold;">/</span>Thumbs.db
D         admin<span style="color: #000000; font-weight: bold;">/</span>images<span style="color: #000000; font-weight: bold;">/</span>graphs<span style="color: #000000; font-weight: bold;">/</span>dummy
D         admin<span style="color: #000000; font-weight: bold;">/</span>images<span style="color: #000000; font-weight: bold;">/</span>graphs<span style="color: #000000; font-weight: bold;">/</span>.cvsignore</pre></div></div>


<p>Finalement, on commite le tout :</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">svn</span> ci <span style="color: #660033;">-m</span><span style="color: #ff0000;">&quot;Ménage fait !&quot;</span></pre></div></div>


<p>Et hop !</p>
]]></content:encoded>
			<wfw:commentRss>http://www.6502.fr/comment-faire-le-menage-sous-subversion/381/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installer mcrypt pour PHP sur Mac OS X Snow Leopard</title>
		<link>http://www.6502.fr/installer-mcrypt-pour-php-sur-mac-os-x-snow-leopard/335</link>
		<comments>http://www.6502.fr/installer-mcrypt-pour-php-sur-mac-os-x-snow-leopard/335#comments</comments>
		<pubDate>Sat, 18 Dec 2010 13:10:52 +0000</pubDate>
		<dc:creator>Christian</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Outils]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[mcrypt]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Snow Leopard]]></category>

		<guid isPermaLink="false">http://www.6502.fr/?p=335</guid>
		<description><![CDATA[Mcrypt est une librairie qui remplace crypt. Voici comment l&#8217;installer sur Mac OS X Snow Leopard. Vous aurez besoin de : Xcode (disponible sur le DVD d&#8217;installation de Snow Leopard) Libmcrypt version 2.5.8, téléchargeable ici Le code source de votre version de PHP, par exemple 5.3.3, téléchargeable ici Décomprimez libmcrypt et passez les commandes suivantes [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://mcrypt.sourceforge.net/" title="MCrypt [en anglais]">Mcrypt</a> est une librairie qui remplace <em>crypt</em>. Voici comment l&#8217;installer sur <strong>Mac OS X Snow Leopard</strong>.</p>

<p>Vous aurez besoin de :</p>

<ul>
<li>Xcode (disponible sur le DVD d&#8217;installation de <strong>Snow Leopard</strong>)</li>
<li>Libmcrypt version 2.5.8, téléchargeable <a href="http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/" title="/Libmcrypt/2.5.8 at SourceForge.net">ici</a></li>
<li>Le code source de votre version de PHP, par exemple 5.3.3, téléchargeable <a href="http://fr.php.net/get/php-5.3.3.tar.bz2/from/a/mirror" title="PHP 5.3.3 sur php.net">ici</a></li>
</ul>

<p>Décomprimez libmcrypt et passez les commandes suivantes :</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">cd</span> libmcrypt-2.5.8
$ <span style="color: #007800;">MACOSX_DEPLOYMENT_TARGET</span>=<span style="color: #000000;">10.6</span> <span style="color: #007800;">CFLAGS</span>=<span style="color: #ff0000;">'-O3 -fno-common -arch i386 -arch x86_64'</span> <span style="color: #007800;">LDFLAGS</span>=<span style="color: #ff0000;">'-O3 -arch i386 -arch x86_64'</span> <span style="color: #007800;">CXXFLAGS</span>=<span style="color: #ff0000;">'-O3 -fno-common -arch i386 -arch x86_64'</span> .<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--disable-dependency-tracking</span>
$ <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #660033;">-j6</span>
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>


<p>Terminé pour mcrypt, passons à PHP.</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">cd</span> php-5.3.3
$ <span style="color: #7a0874; font-weight: bold;">cd</span> ext<span style="color: #000000; font-weight: bold;">/</span>mcrypt
$ phpize
$ <span style="color: #007800;">MACOSX_DEPLOYMENT_TARGET</span>=<span style="color: #000000;">10.6</span> <span style="color: #007800;">CFLAGS</span>=<span style="color: #ff0000;">'-O3 -fno-common -arch i386 -arch x86_64'</span> <span style="color: #007800;">LDFLAGS</span>=<span style="color: #ff0000;">'-O3 -arch i386 -arch x86_64'</span> <span style="color: #007800;">CXXFLAGS</span>=<span style="color: #ff0000;">'-O3 -fno-common -arch i386 -arch x86_64'</span> .<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--with-php-config</span>=<span style="color: #000000; font-weight: bold;">/</span>Developer<span style="color: #000000; font-weight: bold;">/</span>SDKs<span style="color: #000000; font-weight: bold;">/</span>MacOSX10.6.sdk<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>php-config
$ <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #660033;">-j6</span>
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>


<p>Vérifiez dans <em>php.ini</em> que <code>enable_dl = On</code>. Déclarez <em>mcrypt</em>  dans la section <strong>Dynamic Extensions</strong> en ajoutant <code>extension=mcrypt.so</code>.</p>

<p>Relancez Apache, vous pouvez maintenant vérifier avec <code>phpinfo()</code> que <em>mcrypt</em> est bien disponible.</p>

<p><img src="/wp-content/uploads/2010/12/phpinfo_mcrypt-480x260.jpg" alt="mcrypt sous phpinfo" /></p>

<p>Application exemple : installation de Prestashop, avant :</p>

<p><img src="/wp-content/uploads/2010/12/prestashop_mcrypt_off.gif" alt="Installation de Prestashop sans mcrypt" /></p>

<p>Après :</p>

<p><img src="/wp-content/uploads/2010/12/prestashop_mcrypt_on.gif" alt="Installation de Prestashop avec mcrypt" /></p>

<p>Et hop !</p>

<p>Merci à <a href="http://michaelgracie.com/2009/09/23/plugging-mcrypt-into-php-on-mac-os-x-snow-leopard-10.6.1/" title="Plugging mcrypt into PHP, on Mac OS X Snow Leopard 10.6.1 [en anglais]">Michael Gracie</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.6502.fr/installer-mcrypt-pour-php-sur-mac-os-x-snow-leopard/335/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Éditer les gems avec gemedit</title>
		<link>http://www.6502.fr/editer-les-gems-avec-gemedit/289</link>
		<comments>http://www.6502.fr/editer-les-gems-avec-gemedit/289#comments</comments>
		<pubDate>Sun, 17 Oct 2010 13:03:59 +0000</pubDate>
		<dc:creator>Christian</dc:creator>
				<category><![CDATA[Outils]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Editor]]></category>
		<category><![CDATA[Gem]]></category>

		<guid isPermaLink="false">http://www.6502.fr/?p=289</guid>
		<description><![CDATA[La gem que vous utilisez a un comportement inattendu ? Allez lire le code ! Mais il est parfois fastidieux de trouver où est la gem, et gemedit facilite la vie en ajoutant une commande edit à gem. $ sudo gem install gemedit $ gem edit gemedit Vous pouvez indiquer l&#8217;éditeur que vous voulez lancer [...]]]></description>
			<content:encoded><![CDATA[<p>La <em>gem</em> que vous utilisez a un comportement inattendu ? <strong>Allez lire le code !</strong></p>

<p>Mais il est parfois fastidieux de trouver où est la <em>gem</em>, et <a href="http://gemedit.rubyforge.org/" title="[en anglais] Warning, colour attack!">gemedit</a> facilite la vie en ajoutant une commande <em>edit</em> à <em>gem</em>.</p>


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


<p>Vous pouvez indiquer l&#8217;éditeur que vous voulez lancer grâce aux variables d&#8217;environnement $GEMEDITOR, $VISUAL ou $EDITOR. Pour utiliser TextMate, ajoutez cette ligne dans votre <em>.profile</em> :</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">GEMEDITOR</span>=mate</pre></div></div>


<p><img src="/wp-content/uploads/2010/10/TextMate.gif" alt="Gem gemedit opened in TextMate" /></p>

<p>Ou pour Xcode :</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">GEMEDITOR</span>=xed</pre></div></div>


<p>C&#8217;est tout de même plus rapide de taper <code>gem edit gemedit</code> que
<code>mate /usr/local/lib/ruby/gems/1.8/gems/gemedit-0.9.0</code> !</p>

<p><a href="http://gemedit.rubyforge.org/" title="[en anglais] Warning, colour attack!"><em>GEM Editor</em></a> via <a href="http://railstips.org/blog/archives/2010/10/14/stop-googling/" title="[en anglais]"><em>Stop Googling</em> (John Nunemaker)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.6502.fr/editer-les-gems-avec-gemedit/289/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Les ressources dans l&#8217;architecture REST : la source</title>
		<link>http://www.6502.fr/les-ressources-dans-l-architecture-rest-traduction/200</link>
		<comments>http://www.6502.fr/les-ressources-dans-l-architecture-rest-traduction/200#comments</comments>
		<pubDate>Wed, 01 Sep 2010 15:33:24 +0000</pubDate>
		<dc:creator>Christian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[RESTful]]></category>
		<category><![CDATA[Roy Fielding]]></category>

		<guid isPermaLink="false">http://www.6502.fr/?p=200</guid>
		<description><![CDATA[Traduction de la section « Resources and Resource Identifiers » de la thèse de Roy T. Fielding. 5.2.1.1 Ressources et identificateurs de ressources La ressource est le fondement de l&#8217;abstraction de l&#8217;information dans REST. Toute information qui peut être nommée peut être une ressource : un document ou une image, un service momentané (par exemple [...]]]></description>
			<content:encoded><![CDATA[<p>Traduction de la section « <a title="5.2.1.1 Resources and Resource Identifiers [en anglais]" href="http://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm#sec_5_2_1_1">Resources and Resource Identifiers</a> » de la thèse de Roy T. Fielding.</p>

<h3>5.2.1.1 Ressources et identificateurs de ressources</h3>

<p>La <em>ressource</em> est le fondement de l&#8217;abstraction de l&#8217;information dans REST. Toute information qui peut être nommée peut être une ressource : un document ou une image, un service momentané (par exemple « le temps à Los Angeles aujourd&#8217;hui »), un ensemble d&#8217;autres ressources, un objet non virtuel (par exemple une personne), etc. Autrement dit, tout concept pouvant être la cible d&#8217;un lien hypertexte répond nécessairement à la définition de ressource. Une ressource est la référence conceptuelle<sup><a href="http://www.6502.fr/les-ressources-dans-l-architecture-rest-traduction/200#footnote_0_200" id="identifier_0_200" class="footnote-link footnote-identifier-link" title="a conceptual mapping">1</a></sup> vers un ensemble d&#8217;entités, pas une entité qui correspondrait à la référence à un instant donné.</p>

<p>Plus précisément, une ressource <em>R</em> est une fonction d&#8217;appartenance<sup><a href="http://www.6502.fr/les-ressources-dans-l-architecture-rest-traduction/200#footnote_1_200" id="identifier_1_200" class="footnote-link footnote-identifier-link" title="membership function">2</a></sup> <em>M</em><sub><small>R</small></sub><em>(t)</em>, qui au temps <em>t</em> associe un ensemble d&#8217;entités, ou de valeurs, qui sont équivalentes. Les valeurs de cet ensemble peuvent être des représentation de ressources<sup><a href="http://www.6502.fr/les-ressources-dans-l-architecture-rest-traduction/200#footnote_2_200" id="identifier_2_200" class="footnote-link footnote-identifier-link" title="resources representations">3</a></sup> ou des identifiants de ressources<sup><a href="http://www.6502.fr/les-ressources-dans-l-architecture-rest-traduction/200#footnote_3_200" id="identifier_3_200" class="footnote-link footnote-identifier-link" title="resource identifiers">4</a></sup>. Une ressource peut être associée à l&#8217;ensemble vide, ce qui permet de faire référence à un concept avant qu&#8217;aucune réalisation de ce concept n&#8217;existe — une notion étrangère à la plupart des systèmes hypertextes avant le Web. Certaines ressources sont statiques dans le sens où, examinées à tout moment après leur création, elles correspondent toujours au même ensemble de valeurs. D&#8217;autres ont un degré de variabilité élevé dans le temps. La seule chose qui doit être statique pour une ressource est la sémantique de la référence, puisque la sémantique est ce qui distingue une ressource d&#8217;une autre.</p>

<p>Par exemple, la « version préférée de l&#8217;auteur » d&#8217;une publication académique est une référence dont la valeur varie dans le temps, alors que la « version publiée dans les actes du colloque X » est statique. Ce sont deux ressources distinctes, même si elles font référence à la même valeur à un instant donné. La distinction est nécessaire pour que les deux ressources puissent être identifiées et classées indépendamment. Un exemple similaire dans le domaine de l&#8217;ingénierie logicielle est l&#8217;identification distincte d&#8217;un fichier de code source dans un système de gestion de versions, comme la « dernière révision », la « révision numéro 1.2.7 » ou la « révision incluse dans la version Orange ».</p>

<p>Cette définition abstraite d&#8217;une ressource rend possible des fonctions essentielles de l&#8217;architecture du Web. Premièrement, elle généralise en englobant plusieurs sources d&#8217;information sans les distinguer artificiellement par type ou par implémentation. Deuxièmement, elle autorise l&#8217;attachement tardif<sup><a href="http://www.6502.fr/les-ressources-dans-l-architecture-rest-traduction/200#footnote_4_200" id="identifier_4_200" class="footnote-link footnote-identifier-link" title="late binding">5</a></sup> de la référence à une représentation, ce qui rend possible une négociation de contenu<sup><a href="http://www.6502.fr/les-ressources-dans-l-architecture-rest-traduction/200#footnote_5_200" id="identifier_5_200" class="footnote-link footnote-identifier-link" title="content negociation">6</a></sup> basée sur les caractéristiques de la requête. Finalement, elle permet à l&#8217;auteur de référencer le concept plutôt qu&#8217;une représentation singulière de ce concept, supprimant ainsi le besoin de modifier tous les liens existants à chaque fois que la représentation change (en supposant que l&#8217;auteur a utilisé les bons identificateurs).</p>

<p>REST utilise un identificateur de ressource<sup><a href="http://www.6502.fr/les-ressources-dans-l-architecture-rest-traduction/200#footnote_6_200" id="identifier_6_200" class="footnote-link footnote-identifier-link" title="resource identifier">7</a></sup> pour identifier la ressource impliquée dans une interaction entre composants. Les connecteurs REST offrent une interface générique pour atteindre et manipuler l&#8217;ensemble de valeurs d&#8217;une ressource, indépendamment de la manière dont la fonction d&#8217;appartenance est définie ou du logiciel qui traite la requête. L&#8217;autorité de nommage qui a affecté l&#8217;identificateur de ressource, rendant possible le référencement de celle-ci, a la responsabilité du maintien de la validité sémantique de la référence<sup><a href="http://www.6502.fr/les-ressources-dans-l-architecture-rest-traduction/200#footnote_7_200" id="identifier_7_200" class="footnote-link footnote-identifier-link" title="mapping">8</a></sup> dans le temps (c&#8217;est-à-dire de s&#8217;assurer que la fonction d&#8217;appartenance ne change pas).</p>

<p>Les systèmes hypertextes traditionnels, qui opèrent typiquement en environnement clos ou local, utilisent des nœuds uniques ou des identificateurs de documents qui changent à chaque fois que l&#8217;information change, s&#8217;appuyant sur des serveurs de liens pour maintenir la référence séparément du contenu. Comme les serveurs de liens centralisés sont un anathème pour les exigences pluri-organisationnelles et à échelle gigantesque du Web, REST se repose au contraire sur l&#8217;auteur pour choisir l&#8217;identificateur de ressource qui convient le mieux à la nature du concept identifié. Naturellement, la qualité d&#8217;un identificateur est souvent proportionnelle à l&#8217;argent dépensé pour maintenir sa validité, ce qui conduit aux liens brisés, au fur et à mesure de la disparition ou du déplacement d&#8217;information éphémère ou peu maintenue.</p>
<h4>Notes</h4><ol class="footnotes"><li id="footnote_0_200" class="footnote"><em>a conceptual mapping</em></li><li id="footnote_1_200" class="footnote"><em>membership function</em></li><li id="footnote_2_200" class="footnote"><em>resources representations</em></li><li id="footnote_3_200" class="footnote"><em>resource identifiers</em></li><li id="footnote_4_200" class="footnote"><em>late binding</em></li><li id="footnote_5_200" class="footnote"><em>content negociation</em></li><li id="footnote_6_200" class="footnote"><em>resource identifier</em></li><li id="footnote_7_200" class="footnote"><em>mapping</em></li></ol>]]></content:encoded>
			<wfw:commentRss>http://www.6502.fr/les-ressources-dans-l-architecture-rest-traduction/200/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gérer plusieurs versions de Ruby sur Leopard</title>
		<link>http://www.6502.fr/plusieurs-versions-de-ruby-sur-leopard-avec-rvm/246</link>
		<comments>http://www.6502.fr/plusieurs-versions-de-ruby-sur-leopard-avec-rvm/246#comments</comments>
		<pubDate>Mon, 12 Jul 2010 14:15:34 +0000</pubDate>
		<dc:creator>Christian</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Outils]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.6502.fr/?p=246</guid>
		<description><![CDATA[Un jour ou l&#8217;autre vous allez avoir besoin d&#8217;une gem qui exige une version plus récente de Ruby. Par exemple sqlite3. $ sudo gem install sqlite3 Password: ERROR: Error installing sqlite3: sqlite3 requires Ruby version &#62;= 1.9.1. Mais vous utilisez des gems qui ne sont pas compatibles avec Ruby&#160;1.9 et vous devez donc faire cohabiter [...]]]></description>
			<content:encoded><![CDATA[<p>Un jour ou l&#8217;autre vous allez avoir besoin d&#8217;une <i>gem</i> qui exige une version plus récente de Ruby. Par exemple <i>sqlite3</i>.</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> sqlite3
Password:
ERROR:  Error installing sqlite3:
	sqlite3 requires Ruby version <span style="color: #000000; font-weight: bold;">&gt;</span>= 1.9.1.</pre></div></div>


<p>Mais vous utilisez des <i>gems</i> qui ne sont pas compatibles avec Ruby&nbsp;1.9 et vous devez donc faire cohabiter plusieurs versions de Ruby. C&#8217;est là que <a title="RVM: Ruby Version Manager [en anglais]" href="http://rvm.beginrescueend.com/rvm/install/">RVM</a> intervient.</p>

<h3>Installer RVM sur Leopard</h3>

<p>Passez la commande suivante dans une fenêtre de Terminal&nbsp;:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">bash</span> <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight: bold;">&lt;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span> curl http:<span style="color: #000000; font-weight: bold;">//</span>rvm.beginrescueend.com<span style="color: #000000; font-weight: bold;">/</span>releases<span style="color: #000000; font-weight: bold;">/</span>rvm-install-head <span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>


<p>Puis ajoutez cette ligne à la fin de votre fichier <i>~/.profile</i>&nbsp;:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-s</span> <span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>.rvm<span style="color: #000000; font-weight: bold;">/</span>scripts<span style="color: #000000; font-weight: bold;">/</span>rvm <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">source</span> <span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>.rvm<span style="color: #000000; font-weight: bold;">/</span>scripts<span style="color: #000000; font-weight: bold;">/</span>rvm</pre></div></div>


<p>Pour tous les détails additionnels, allez <a title="RVM: Ruby Version Manager - Installing RVM [en anglais]" href="http://rvm.beginrescueend.com/rvm/install/">à la source</a>.</p>

<h3>Utiliser RVM</h3>

<p>Vous pouvez maintenant utiliser rvm, par exemple pour installer Ruby&nbsp;1.9.1.</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ rvm <span style="color: #c20cb9; font-weight: bold;">install</span> 1.9.1 ; rvm 1.9.1
$ ruby <span style="color: #660033;">-v</span>
ruby 1.9.1p378 <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">2010</span>-01-<span style="color: #000000;">10</span> revision <span style="color: #000000;">26273</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>i386-darwin9.8.0<span style="color: #7a0874; font-weight: bold;">&#93;</span>
$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> sqlite3
Building native extensions.  This could take a while...
...
Successfully installed sqlite3-0.1.1</pre></div></div>


<p>Pour revenir à la version d&#8217;origine&nbsp;:</p>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ rvm system
$ ruby <span style="color: #660033;">-v</span>
ruby 1.8.7 <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">2009</span>-06-<span style="color: #000000;">12</span> patchlevel <span style="color: #000000;">174</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>i686-darwin9.8.0<span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.6502.fr/plusieurs-versions-de-ruby-sur-leopard-avec-rvm/246/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RSpec : tester le contenu d&#8217;un content_for</title>
		<link>http://www.6502.fr/rspec-tester-le-contenu-de-content_for/198</link>
		<comments>http://www.6502.fr/rspec-tester-le-contenu-de-content_for/198#comments</comments>
		<pubDate>Sun, 02 Nov 2008 15:38:55 +0000</pubDate>
		<dc:creator>Christian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[RSpec]]></category>

		<guid isPermaLink="false">http://www.6502.fr/?p=198</guid>
		<description><![CDATA[Une spécification de vue sous RSpec pourrait ressembler à ça&#160;: it &#34;should render column titles&#34; do render &#34;/feeds/index.html.erb&#34; response.should have_tag&#40;&#34;tr&#62;th&#34;, &#34;name&#34;&#41; response.should have_tag&#40;&#34;tr&#62;th&#34;, &#34;url&#34;&#41; end Mais cette méthode ne permet pas de tester les bribes de HTML qui sont produites dans un content_for. En effet, ces bribes sont incluses directement dans le layout, pas dans [...]]]></description>
			<content:encoded><![CDATA[<p>Une spécification de vue sous RSpec pourrait ressembler à ça&nbsp;:</p>


<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  it <span style="color:#996600;">&quot;should render column titles&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    render <span style="color:#996600;">&quot;/feeds/index.html.erb&quot;</span>
    response.<span style="color:#9900CC;">should</span> have_tag<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;tr&gt;th&quot;</span>, <span style="color:#996600;">&quot;name&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    response.<span style="color:#9900CC;">should</span> have_tag<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;tr&gt;th&quot;</span>, <span style="color:#996600;">&quot;url&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>


<p>Mais cette méthode ne permet pas de tester les bribes de HTML qui sont produites dans un <em>content_for</em>. En effet, ces bribes sont incluses directement dans le layout, pas dans la production de la vue. Pour ce faire, ajouter dans <em>spec_helper.rb</em>&nbsp;:</p>


<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  <span style="color:#9966CC; font-weight:bold;">def</span> content_for<span style="color:#006600; font-weight:bold;">&#40;</span>name<span style="color:#006600; font-weight:bold;">&#41;</span>
    response.<span style="color:#9900CC;">template</span>.<span style="color:#9900CC;">instance_variable_get</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;@content_for_#{name}&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>


<p>Puis dans les specs&nbsp;:</p>


<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">  it <span style="color:#996600;">&quot;should render a 'New feed' link&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span>
    render <span style="color:#996600;">&quot;/feeds/index.html.erb&quot;</span>
    content_for<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:somewhere</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">should</span> have_tag<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;a[href=?]&quot;</span>, new_feed_path<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>


<p>Merci à <a title="rspec-users mailing list [en anglais]" href="http://rubyforge.org/pipermail/rspec-users/2007-June/001954.html">Carl-Johan Kihlbom</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.6502.fr/rspec-tester-le-contenu-de-content_for/198/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Une commande Ubiquity pour accéder directement à l&#8217;API Ruby</title>
		<link>http://www.6502.fr/commande-ubiquity-acces-direct-api-ruby/166</link>
		<comments>http://www.6502.fr/commande-ubiquity-acces-direct-api-ruby/166#comments</comments>
		<pubDate>Fri, 12 Sep 2008 10:02:33 +0000</pubDate>
		<dc:creator>Christian</dc:creator>
				<category><![CDATA[Outils]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ubiquity]]></category>

		<guid isPermaLink="false">http://www.6502.fr/?p=166</guid>
		<description><![CDATA[Jack Dempsey a créé une commande Ubiquity pour accéder directement à l&#8217;API Ruby sur APIdock. Vous pouvez l&#8217;installer en collant le code dans l&#8217;éditeur de commandes Ubiquity. ou en vous abonnant (le bouton apparaît en haut à droite du bandeau). L&#8217;utilisation est simple : invoquer Ubiquity (alt-espace sur mon Mac), taper ruby &#60;nom-de-fonction&#62; puis &#60;Enter&#62; [...]]]></description>
			<content:encoded><![CDATA[<p><a title="Profil de Jack Dempsey sur Github [anglais]" href="http://github.com/jackdempsey">Jack Dempsey</a> a créé une <a title="ruby-search.ubiquity-command.js [javascript]" href="http://gist.github.com/8132">commande Ubiquity</a> pour accéder directement à l&#8217;API Ruby sur <a title="APIdock [anglais]" href="http://apidock.com/">APIdock</a>. Vous pouvez l&#8217;installer en collant le code dans l&#8217;<a title="Éditeur de commande Ubiquity [Firefox local]" href="chrome://ubiquity/content/editor.html">éditeur de commandes Ubiquity</a>. ou en vous abonnant (le bouton apparaît en haut à droite du bandeau).</p>

<p>L&#8217;utilisation est simple : invoquer Ubiquity (alt-espace sur mon Mac), taper <code>ruby &lt;nom-de-fonction&gt;</code> puis &lt;Enter&gt; et la page s&#8217;ouvre dans un nouvel onglet.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.6502.fr/commande-ubiquity-acces-direct-api-ruby/166/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ressources sur les Test fixtures</title>
		<link>http://www.6502.fr/ressources-sur-les-test-fixtures/156</link>
		<comments>http://www.6502.fr/ressources-sur-les-test-fixtures/156#comments</comments>
		<pubDate>Tue, 09 Sep 2008 14:18:15 +0000</pubDate>
		<dc:creator>Christian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[fixtures]]></category>
		<category><![CDATA[test]]></category>

		<guid isPermaLink="false">http://www.6502.fr/?p=156</guid>
		<description><![CDATA[Les informations La base : le chapitre 7 du manuel, The Lo-Down on Fixtures et la référence. Une bonne introduction aux fixtures dans Rails 2.0 : Fixtures in Rails 2.0 Si vous n&#8217;aimez pas les screencasts, la même info dans un blog : What&#8217;s New in Edge Rails: Fixtures Just Got a Whole Lot Easier [...]]]></description>
			<content:encoded><![CDATA[<h3>Les informations</h3>

<p>La base : le chapitre 7 du manuel, <a href="http://manuals.rubyonrails.com/read/chapter/26" title="The Lo-Down on Fixtures [anglais]">The Lo-Down on Fixtures</a> et la <a href="http://api.rubyonrails.org/classes/Fixtures.html" title="API [anglais]">référence</a>.</p>

<p>Une bonne introduction aux fixtures dans Rails 2.0 : <a title="Screen cast : Fixtures in Rails 2.0 [anglais]" href="http://railscasts.com/episodes/81">Fixtures in Rails 2.0</a></p>

<p>Si vous n&#8217;aimez pas les screencasts, la même info dans un blog : <a href="http://ryandaigle.com/articles/2007/10/26/what-s-new-in-edge-rails-fixtures-just-got-a-whole-lot-easier" title="Fixtures Just Got a Whole Lot Easier par Ryan Dailge [anglais]">What&#8217;s New in Edge Rails: Fixtures Just Got a Whole Lot Easier</a></p>

<h3>Les avis</h3>

<p>Le titre de l&#8217;article se passe de commentaire : <a href="http://glu.ttono.us/articles/2006/08/07/why-fixtures-suck-and-how-we-can-fix-them" title="Why Fixtures Suck [anglais]">Why Fixtures Suck (And How We Can Fix Them)</a>. Un peu vieux, il date du mois d&#8217;août 2006</p>

<p><a href="http://www.dcmanges.com/blog/">Daniel Manges</a> propose de <a href="http://www.dcmanges.com/blog/38">remplacer les fixtures par des factories</a>. <a href="http://www.pgrs.net/">Paul Gross</a> propose un <a href="http://www.pgrs.net/2008/5/8/factory-pattern-with-syntactic-sugar">raffinement de la méthode</a>. À creuser.</p>

<p><a href="http://errtheblog.com/" title="Err the blog [anglais]">Chris Wanstrath</a> propose des <a href="http://errtheblog.com/posts/61-fixin-fixtures" title="Fixin' fixtures [anglais]">Fixtures scenarios</a>. Les commentaires qui suivent sont particulièrement intéressants.</p>

<h3>Les outils</h3>

<p><a href="http://fabien.jakimowicz.com/" title="Blog de Fabien Jakimowicz - blog.name.nil?">Fabien Jakimowicz</a> vous propose des tâches rake qui construisent vos fixtures à partir d&#8217;une base de données dans son article <a href="http://fabien.jakimowicz.com/articles/2008/06/26/named_fixtures_exporter" title="Rails plugin: named fixtures exporter [français]">Rails plugin: named fixtures exporter</a></p>

<h3>Clefs étrangères et intégrité référentielle</h3>

<p>Les clefs étrangères présentent une difficulté : il n&#8217;est plus possible d&#8217;insérer ni de supprimer les enregistrements dans la base dans un ordre quelconque. <a href="http://techpolesen.blogspot.com/" title="Ancien blog de Per Olesen - Old Tech Per">Per Olesen</a> propose une technique pour résoudre ce problème dans son article <a href="http://techpolesen.blogspot.com/2007/04/rails-fixture-tips.html" title="Intégrité référentielle et fixtures dans Rails [anglais]"><em>Rails Fixtures Tips</em></a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.6502.fr/ressources-sur-les-test-fixtures/156/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Le carrefour du Zen et du test</title>
		<link>http://www.6502.fr/carrefour-du-zen-et-du-test/158</link>
		<comments>http://www.6502.fr/carrefour-du-zen-et-du-test/158#comments</comments>
		<pubDate>Mon, 08 Sep 2008 16:13:44 +0000</pubDate>
		<dc:creator>Christian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[test]]></category>
		<category><![CDATA[zen]]></category>

		<guid isPermaLink="false">http://www.6502.fr/?p=158</guid>
		<description><![CDATA[La voie de Testivus — la sagesse du test unitaire dans une ancienne startup. Don’t get stuck on unit testing dogma Embrace unit testing karma Le même article en pdf.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.artima.com/weblogs/viewpost.jsp?thread=203994" title="The Way of Testivus - Unit Testing Wisdom From An Ancient Software Start-up [anglais]">La voie de Testivus — la sagesse du test unitaire dans une ancienne startup</a>.</p>

<blockquote><em>Don’t get stuck on unit testing dogma
Embrace unit testing karma</em></blockquote>

<p>Le même article en <a href="http://www.agitar.com/downloads/TheWayOfTestivus.pdf">pdf</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.6502.fr/carrefour-du-zen-et-du-test/158/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Test fixtures et reformatage</title>
		<link>http://www.6502.fr/test-fixtures-et-reformatage/151</link>
		<comments>http://www.6502.fr/test-fixtures-et-reformatage/151#comments</comments>
		<pubDate>Sun, 07 Sep 2008 10:00:17 +0000</pubDate>
		<dc:creator>Christian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[fixtures]]></category>
		<category><![CDATA[vi]]></category>
		<category><![CDATA[yaml]]></category>

		<guid isPermaLink="false">http://www.6502.fr/?p=151</guid>
		<description><![CDATA[Les tests fixtures sont un des moyens de gérer les données nécessaires aux tests. Le système de test fixtures de Ruby on Rails se distingue par sa grande facilité d&#8217;écriture. Les données sont saisies dans des fichiers YAML, et le système de test gère les id, les relations 1-n et les relations n-n. Parfois les [...]]]></description>
			<content:encoded><![CDATA[<p>Les <a title="Test Fixtures sur Wikipedia [anglais]" href="http://en.wikipedia.org/wiki/Test_fixture"><em>tests fixtures</em></a> sont un des moyens de gérer les données nécessaires aux tests. Le système de <a title="The Lo-Down on Fixtures  [anglais]" href="http://manuals.rubyonrails.com/read/chapter/26"><em>test fixtures</em></a> de <a title="Ruby on Rails [anglais]" href="http://www.rubyonrails.org/">Ruby on Rails</a> se distingue par sa grande facilité d&#8217;écriture. Les données sont saisies dans des fichiers <a title="Site officiel de YAML [anglais]" href="http://www.yaml.org/">YAML</a>, et le système de test gère les <em>id</em>, les relations <em>1-n</em> et les relations <em>n-n</em>.</p>

<p>Parfois les données brutes ne sont pas disponibles dans le bon format. L&#8217;éditeur <em>vi</em> (ou <em>vim</em>), disponible sur toutes les bonnes plateformes, dispose d&#8217;une commande d&#8217;édition par expressions régulières très puissante. Prenons un exemple. J&#8217;ai donc besoin de convertir une liste d&#8217;ATA au format YAML.</p>

<h3>Format liste</h3>


<div class="wp_syntax"><div class="code"><pre class="yaml" style="font-family:monospace;">21 : Air conditioning
22 : Auto flight
23 : Communications</pre></div></div>


<h3>Format YAML</h3>


<div class="wp_syntax"><div class="code"><pre class="yaml" style="font-family:monospace;">21:
  number: 21
  description: Air conditioning
&nbsp;
22:
  number: 22
  description: Auto flight
&nbsp;
23:
  number: 23
  description: Communications</pre></div></div>


<h3>La commande vi de substitution</h3>

<p>Une « simple » commande suffit:</p>


<div class="wp_syntax"><div class="code"><pre class="vi" style="font-family:monospace;">:%s/\([0-9][0-9]\) : \(.*\)/\1:\r  number: \1\r  description: \2\r/</pre></div></div>


<p>Ça paraît un peu rude, mais c&#8217;est facile à décortiquer. Prenons la commande dans l&#8217;ordre.</p>

<ul>
    <li><code>%</code> toutes les lignes du fichier</li>
    <li><code>s/.../.../</code> la commande de substitution qui va être appliquée à chaque ligne</li>
    <li><code>[0-9][0-9]</code> deux chiffres ; je mémorise le numéro dans \1 en le mettant entre \( et \)</li>
    <li><code> : </code> deux points entre deux espace</li>
    <li><code>.*</code> tout le reste de la ligne, que je \(mémorise\) dans \2</li>
    <li>maintenant le remplacement : je récupère le numéro avec \1, que j&#8217;insère suivi de : et d&#8217;un saut de ligne</li>
    <li>insertion de <code> number:</code> puis le numéro</li>
    <li>insertion de <code> description:</code> puis le texte récupéré</li>
</ul>

<p>Facile, non ?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.6502.fr/test-fixtures-et-reformatage/151/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

