<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;D0EGQHw8fCp7ImA9WxNUF0U.&quot;"><id>tag:blogger.com,1999:blog-10596376</id><updated>2009-11-09T06:53:41.274-10:00</updated><title>Ruby's Cube</title><subtitle type="html">Ruby (le langage de programmation) et Rails. (made in  Toulouse)</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://rubyscube.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://rubyscube.blogspot.com/" /><link rel="hub" href="http://pubsubhubbub.appspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Benjamin Francisoud</name><uri>http://www.blogger.com/profile/14823114858391962141</uri><email>noreply@blogger.com</email></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>177</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><link rel="self" href="http://rubyscube.blogspot.com/atom.xml" type="application/atom+xml" /><feedburner:browserFriendly>This is an XML content feed. It is intended to be viewed in a newsreader or syndicated to another site, subject to copyright and fair use.</feedburner:browserFriendly><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><entry gd:etag="W/&quot;AkQAQnc8fip7ImA9WxNQEE0.&quot;"><id>tag:blogger.com,1999:blog-10596376.post-6729960142183698689</id><published>2009-09-14T23:34:00.005-10:00</published><updated>2009-09-14T23:52:23.976-10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-09-14T23:52:23.976-10:00</app:edited><title>Zlib::BufError et repository de gems down</title><content type="html">&lt;div&gt;J'ai aidé aujourd'hui quelqu'un qui n'arrivait pas à installer watir sous windows, pourtant il faisait tout comme il faut ?! (install ruby one click installer + "gem install watir")&lt;/div&gt;
&lt;div&gt;Il avait toujours le message d'erreur suivant: Zlib::BufError buffer error&lt;/div&gt;
&lt;div&gt;En essayant sur ma machine, qui avait déjà watir installé, je me suis rendu compte que j'avais le même problème!&lt;/div&gt;
&lt;code&gt;&lt;pre&gt;
C:\&gt;gem update watir --debug
Exception `NameError' at c:/ruby/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:161 - uninitialized constant Gem::Commands::UpdateCommand
Exception `Gem::LoadError' at c:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:827 - Could not find RubyGem test-unit (&gt;= 0)

Updating installed gems
Exception `Gem::LoadError' at c:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:827 - RubyGem version error: sources(0.0.1 not &gt; 0.0.1)

Exception `Zlib::BufError' at c:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:578 - buffer error
ERROR:  While executing gem ... (Zlib::BufError)
    buffer error
        c:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:578:in `read'
        c:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:578:in `gunzip'
        c:/ruby/lib/ruby/site_ruby/1.8/rubygems/remote_fetcher.rb:165:in `fetch_path'
        c:/ruby/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:219:in `load_specs'
        c:/ruby/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:192:in `list'
        c:/ruby/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:188:in `each'
        c:/ruby/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:188:in `list'
        c:/ruby/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:123:in `find_matching'
        c:/ruby/lib/ruby/site_ruby/1.8/rubygems/commands/update_command.rb:169:in `which_to_update'
        c:/ruby/lib/ruby/site_ruby/1.8/rubygems/commands/update_command.rb:161:in `each'
        c:/ruby/lib/ruby/site_ruby/1.8/rubygems/commands/update_command.rb:161:in `which_to_update'
        c:/ruby/lib/ruby/site_ruby/1.8/rubygems/commands/update_command.rb:75:in `execute'
        c:/ruby/lib/ruby/site_ruby/1.8/rubygems/command.rb:257:in `invoke'
        c:/ruby/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:132:in `process_args'
        c:/ruby/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:102:in `run'
        c:/ruby/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:58:in `run'
        c:/ruby/bin/gem:21
&lt;/pre&gt;&lt;/code&gt;

&lt;div&gt;Je me suis douté que &lt;span style="font-weight:bold;"&gt;le serveur de gems était down&lt;/span&gt; même si le message d'erreur n'est pas clair du tout!&lt;/div&gt;
&lt;div&gt;J'ai trouvé une astuce! On peut transformer sa machine en serveur de gem (mirroir) en lançant la commande:
&lt;code&gt;&lt;pre&gt;gem server&lt;/pre&gt;&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;On peut voir le résultat aux addresses suivantes:&lt;ul&gt;&lt;li&gt;&lt;a href="http://localhost:8808/"&gt;http://localhost:8808/&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://localhost:8808/gems"&gt;http://localhost:8808/gems&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;
&lt;div&gt;L'autre personne a juste eu à faire:
&lt;code&gt;&lt;pre&gt;gem install watir --source http://xxx.xxx.xxx.xxx:8808/&lt;/pre&gt;&lt;/code&gt; où xxx.xxx.xxx.xxx est l'ip de la machine où "gem server" a été lancé&lt;/div&gt;
&lt;div&gt;Rem: je n'ai pas trouvé l'url que rubygems utilise mais je pense qu'il s'agit de &lt;a href="http://gems.rubyforge.org/"&gt;http://gems.rubyforge.org/&lt;/a&gt; et effectivement &lt;a href="http://gems.rubyforge.org/gems"&gt;http://gems.rubyforge.org/gems&lt;/a&gt; renvoie une 403 forbidden :(&lt;/div&gt;
&lt;div&gt;&lt;i&gt;Technorati tags: &lt;a href="http://technorati.com/tag/rails" rel="tag"&gt;rails&lt;/a&gt; &lt;a href="http://technorati.com/tag/gem" rel="tag"&gt;gem&lt;/a&gt; &lt;a href="http://technorati.com/tag/watir" rel="tag"&gt;watir&lt;/a&gt; &lt;a href="http://technorati.com/tag/ruby" rel="tag"&gt;ruby&lt;/a&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10596376-6729960142183698689?l=rubyscube.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/RubysCube/~4/jI_x8LzUJD0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://rubyscube.blogspot.com/feeds/6729960142183698689/comments/default" title="Publier les commentaires" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=10596376&amp;postID=6729960142183698689" title="1 commentaires" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/6729960142183698689?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/6729960142183698689?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RubysCube/~3/jI_x8LzUJD0/zlibbuferror-et-repository-de-gems-down.html" title="Zlib::BufError et repository de gems down" /><author><name>Benjamin Francisoud</name><uri>http://www.blogger.com/profile/14823114858391962141</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="13057970757532367135" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total><feedburner:origLink>http://rubyscube.blogspot.com/2009/09/zlibbuferror-et-repository-de-gems-down.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0YGQHw-fCp7ImA9WxNRFEU.&quot;"><id>tag:blogger.com,1999:blog-10596376.post-4922296373778059336</id><published>2009-09-08T22:17:00.004-10:00</published><updated>2009-09-08T22:32:01.254-10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-09-08T22:32:01.254-10:00</app:edited><title>Javascript: Orienté Objet</title><content type="html">&lt;div&gt;J'ai enfin trouver le temps de regarder comment "bien" programmer en Javascript :)&lt;br/&gt;&lt;br/&gt;
Je ne suis pas sûr que ça me serve beaucoup, je suis plutôt un &lt;a href="http://en.wikipedia.org/wiki/Script_kiddie"&gt;"script kiddies"&lt;/a&gt; du javascript. Générallement je récupère une lib, je fais quelques lignes de javascript pour faire un petit effet (fade...) et c'est tout!&lt;br/&gt;&lt;br/&gt;
Mais par curiosité personnelle, je voulais voir comment Javascript gérait l'héritage etc...&lt;/div&gt;&lt;br/&gt;
&lt;div&gt;En fait c'est assez simple, il suffit de définir une classe et d'utiliser le mot clef "prototype" pour dire que la classe fille hérite de la classe mère.&lt;br/&gt;
Je trouve que le concept d'héritage en Javascript ressemble beaucoup à ce qui se passe en ruby avec le mot clef "include".&lt;/div&gt;&lt;br/&gt;
&lt;div&gt;En tout cas je vous conseille le tutorial que j'ai fait et que je trouve très bien: &lt;ul&gt;&lt;li&gt;&lt;a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide"&gt;Sommaire&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Class-Based_vs._Prototype-Based_Languages"&gt;Le concept de prototype&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide%3aThe_Employee_Example"&gt;Le début du tutorial sur l'héritage&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;br/&gt;
&lt;div&gt;&lt;i&gt;Technorati tags: &lt;a href="http://technorati.com/tag/javascript" rel="tag"&gt;javascript&lt;/a&gt; &lt;a href="http://technorati.com/tag/objectoriented" rel="tag"&gt;objectoriented&lt;/a&gt; &lt;a href="http://technorati.com/tag/ruby" rel="tag"&gt;ruby&lt;/a&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10596376-4922296373778059336?l=rubyscube.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/RubysCube/~4/uPriPfJcYNI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://rubyscube.blogspot.com/feeds/4922296373778059336/comments/default" title="Publier les commentaires" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=10596376&amp;postID=4922296373778059336" title="0 commentaires" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/4922296373778059336?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/4922296373778059336?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RubysCube/~3/uPriPfJcYNI/javascript-oriente-objet.html" title="Javascript: Orienté Objet" /><author><name>Benjamin Francisoud</name><uri>http://www.blogger.com/profile/14823114858391962141</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="13057970757532367135" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://rubyscube.blogspot.com/2009/09/javascript-oriente-objet.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CU4ERHc-fSp7ImA9WxNSE0s.&quot;"><id>tag:blogger.com,1999:blog-10596376.post-6608616669687280015</id><published>2009-08-26T22:51:00.005-10:00</published><updated>2009-08-26T23:05:05.955-10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-08-26T23:05:05.955-10:00</app:edited><title>Disparition de why et Ma présence online</title><content type="html">&lt;div&gt;&lt;/div&gt;Je viens de découvrir que why (un fameux codeur ruby) a "disparu".
&lt;br/&gt;&lt;br/&gt;
Il aurait apparemment supprimé ses comptes en ligne (twitter, blogs etc...)
&lt;a href="http://ejohn.org/blog/eulogy-to-_why/"&gt;http://ejohn.org/blog/eulogy-to-_why/&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;

J'y pense de plus en plus également pour une raison assez simple: je sens que&lt;span style="font-weight: bold;"&gt; j'ai de moins en moins la maîtrise de ce qui est publié sur moi&lt;/span&gt;.
&lt;br/&gt;&lt;br/&gt;
J'ai toujours choisi de parler de sujet "professionnel" mais avec l'avènement de réseaux tels que facebook, google social api, web semantic... font que les "fuites" sur ma vie privée sont de plus en plus nombreuses.
&lt;br/&gt;&lt;br/&gt;
Typiquement je n'ai pas envie de voir ma famille, mes amis ou même mes vacances sur internet...&lt;br/&gt;
Globalement ces informations sont noyées dans la masse mais si on veut on peut trouver déjà beaucoup (trop) de choses sur moi...
&lt;br/&gt;&lt;br/&gt;
Tout comme simon, j'essaye de dissocié au maximum &lt;a href="http://feedproxy.google.com/%7Er/simonsmess/%7E3/e4pwEq3IYoY/"&gt;vie privée / vie publique&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
En plus ces informations peuvent être obsolète ou même completement fausse comme par exemple sur 123people, cf &lt;a href="http://francisoud.blogspot.com/2009/05/when-automatic-information-gathering.html"&gt;mon post sur le sujet&lt;/a&gt;.&lt;br/&gt;&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10596376-6608616669687280015?l=rubyscube.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/RubysCube/~4/gQiBN8r70lE" height="1" width="1"/&gt;</content><link rel="related" href="http://www.simonsmess.com/business/vie-privee-vie-publique/" title="Disparition de why et Ma présence online" /><link rel="replies" type="application/atom+xml" href="http://rubyscube.blogspot.com/feeds/6608616669687280015/comments/default" title="Publier les commentaires" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=10596376&amp;postID=6608616669687280015" title="0 commentaires" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/6608616669687280015?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/6608616669687280015?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RubysCube/~3/gQiBN8r70lE/disparition-de-why-et-ma-presence.html" title="Disparition de why et Ma présence online" /><author><name>Benjamin Francisoud</name><uri>http://www.blogger.com/profile/14823114858391962141</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="13057970757532367135" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://rubyscube.blogspot.com/2009/08/disparition-de-why-et-ma-presence.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CU4BSX4yeSp7ImA9WxJaEEo.&quot;"><id>tag:blogger.com,1999:blog-10596376.post-990141836968485124</id><published>2009-07-21T12:17:00.009-10:00</published><updated>2009-07-31T10:59:18.091-10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-07-31T10:59:18.091-10:00</app:edited><title>Découverte de Python</title><content type="html">Cela faisait un petit moment que je voulais apprendre les bases de python...


Quelques remarques que j'ai notées pendant  que je déroulais le &lt;a href="http://docs.python.org/3.1/tutorial/"&gt;tutorial officiel&lt;/a&gt;



&lt;div style="font-weight: bold;font-size:130%;"&gt;Général&lt;/div&gt;

&lt;ul&gt;&lt;li&gt;Le nom Python vient des 'Monthy Python' pas du serpent &gt; ce qui rend le laguage tout de suite plus sympatique ;)&lt;/li&gt;&lt;li&gt;Ca semble s'inspirer assez du C
&lt;br/&gt;Ex: le print() me rappelle le print du C avec des améliorations&lt;/li&gt;&lt;li&gt;Utilisation de l'indentation plutôt que les {}...
&lt;br/&gt;pourquoi pas, au moins ça évite les troll interminables sur les { à la fin d'une ligne ou au début de la ligne suivante :p
&lt;br/&gt;Troll qui a dû au moins me prendre 2 journées de ma vie si on cumule toutes les discussions inutiles&lt;/li&gt;&lt;li&gt;Les types de base : list (qui sont aussi des stack, queue), set, dictionary (alias map en java) mais je n'ai pas compris la difference avec les tuples&lt;/li&gt;&lt;li&gt;Je trouve étrange d'introduire les complexes (i) dans le tutorial ?! Même si cette fonctionnalité est intéressante, elle ne sert pas tout les jours (jamais ?!)
&lt;/li&gt;&lt;/ul&gt;
&lt;span style="font-weight: bold;font-size:130%;" &gt;Les plus&lt;/span&gt;
&lt;ul&gt;&lt;li&gt;List/Tableau = même combat
&lt;br/&gt;Contrairement à Java ou les 2 types de classes sont clairement séparées
&lt;br/&gt;En Python ou Ruby la différence à beaucoup moins d'importance et c'est mieux
&lt;/li&gt;&lt;li&gt;On peut itérer dans les chaines de caractères comme dans un tableau:
&lt;/li&gt;&lt;/ul&gt;&lt;code&gt;&lt;/code&gt;&lt;pre&gt;b = 'azerty'
for x in b:
print(x)&lt;/pre&gt;&lt;ul&gt;&lt;li&gt;String indice ou slice
&lt;br/&gt;Un peu surpris au début par la manipulation de chaines avec les indices (slices) mais on s'y habitue bien :)
&lt;br/&gt;Et même ça me semble assez puissant ! (a voir si c'est lisible dans un programme plus complexe ou écrit par quelqu'un d'autre...)
&lt;/li&gt;&lt;/ul&gt;&lt;code&gt;&lt;/code&gt;&lt;pre&gt;&gt;&gt;&gt; word = 'Help' + 'A'
&gt;&gt;&gt; word[4]
'A'
&gt;&gt;&gt; word[0:2]
'He'
&gt;&gt;&gt; word[2:4]
'lp'
&gt;&gt;&gt; word[:2]    # The first two characters
'He'
&gt;&gt;&gt; word[2:]    # Everything except the first two characters
'lpA'&lt;/pre&gt;
&lt;ul&gt;&lt;li&gt;Une boucle for peut avoir un else
&lt;br/&gt;Ca semble intéressant mais si je ne vois pas bien l'utilité (cas où il y a un break dans le for)
&lt;/li&gt;&lt;/ul&gt;&lt;code&gt;&lt;/code&gt;&lt;pre&gt;for x in range(2, n):
if n % x == 0:
  print(n, 'equals', x, '*', n//x)
  break
else:
  # loop fell through without finding a factor
  print(n, 'is a prime number')&lt;/pre&gt;

&lt;span style="font-weight: bold;font-size:130%;" &gt;Les moins&lt;/span&gt;

&lt;ul&gt;&lt;li&gt;Pas de switch / case mais if ... elif ... elif ...
&lt;br/&gt;Je trouve que les switch/case (même si je ne les utilise pas souvent) expriment mieux ce qu'on veut faire dans ces cas là et la synthaxe est plus concise...
&lt;br/&gt;En java j'ai tendance à considérer pleins de elseif comme un code smell qu'il faudrait autre chose: un switch/case dans le cas les plus simple ou un pattern type builder ou command pour les cas les plus complexe
&lt;br/&gt;Peut-etre juste un habitude à prendre&lt;/li&gt;&lt;li&gt;Ruby semble plus orienté object, exemple taille d'une chaine de char
&lt;/li&gt;&lt;/ul&gt;&lt;pre&gt;python: len('azerty')
ruby: 'azerty'.size&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10596376-990141836968485124?l=rubyscube.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/RubysCube/~4/hIT9C_GL6bg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://rubyscube.blogspot.com/feeds/990141836968485124/comments/default" title="Publier les commentaires" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=10596376&amp;postID=990141836968485124" title="1 commentaires" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/990141836968485124?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/990141836968485124?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RubysCube/~3/hIT9C_GL6bg/decouverte-de-python.html" title="Découverte de Python" /><author><name>Benjamin Francisoud</name><uri>http://www.blogger.com/profile/14823114858391962141</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="13057970757532367135" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total><feedburner:origLink>http://rubyscube.blogspot.com/2009/07/decouverte-de-python.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUYNSXczeSp7ImA9WxJWE0w.&quot;"><id>tag:blogger.com,1999:blog-10596376.post-8378676023330879872</id><published>2009-06-17T22:15:00.003-10:00</published><updated>2009-06-17T22:19:58.981-10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-06-17T22:19:58.981-10:00</app:edited><title>Résistance sociale &amp; langage de script</title><content type="html">&lt;div&gt;&lt;/div&gt;Justement en lisant cet article: &lt;a href="http://www.artima.com/weblogs/viewpost.jsp?thread=260578"&gt;"Why ? Language Archaelogy..."&lt;/a&gt; de &lt;span class="as"&gt;Bruce Eckel, ça fait écho à ce que disait dans mon &lt;a href="http://rubyscube.blogspot.com/2009/06/ruby-at-thoughtworks.html"&gt;post précédent&lt;/a&gt; à propos de la résistance sociale lié au langage de script:&lt;/span&gt;&lt;blockquote&gt;Like Smalltalk, everything in Ruby is fungible (this is the very thing that makes dynamic languages so scary to folks who are used to static languages)&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10596376-8378676023330879872?l=rubyscube.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/RubysCube/~4/6tV65aSJUzo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://rubyscube.blogspot.com/feeds/8378676023330879872/comments/default" title="Publier les commentaires" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=10596376&amp;postID=8378676023330879872" title="0 commentaires" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/8378676023330879872?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/8378676023330879872?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RubysCube/~3/6tV65aSJUzo/resistance-sociale-langage-de-script.html" title="Résistance sociale &amp; langage de script" /><author><name>Benjamin Francisoud</name><uri>http://www.blogger.com/profile/14823114858391962141</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="13057970757532367135" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://rubyscube.blogspot.com/2009/06/resistance-sociale-langage-de-script.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkMGQ3w4eyp7ImA9WxJWEUk.&quot;"><id>tag:blogger.com,1999:blog-10596376.post-2525733570927687621</id><published>2009-06-15T23:10:00.002-10:00</published><updated>2009-06-15T23:27:02.233-10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-06-15T23:27:02.233-10:00</app:edited><title>Ruby at ThoughtWorks</title><content type="html">&lt;div&gt;Excellent article (comme presque toujours) de Martin Fowler: &lt;a href="http://martinfowler.com/articles/rubyAtThoughtWorks.html"&gt;Ruby at ThoughtWorks&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;Le sommaire devrait suffire pour vous donner envie de le lire:
&lt;pre&gt;
Contents
    * The Shape of Our Projects
    * Questions About Ruby
          o Was Ruby the Right Choice?
          o Is Ruby More Productive?
          o Is Ruby Slow?
          o Is a Ruby Code-base Hard to Understand?
          o Is Ruby a Viable Platform
    * Some Development Tips
          o Testing with Active Record
          o Active Record Leaks
          o Long Running Requests
          o Deployment
          o Controlling Gems
          o Schedule Time for Updates
          o Developing on Windows
&lt;/pre&gt;&lt;/div&gt;
&lt;div&gt;Les points qui m'ont interessé au vue de mon expérience avec ruby:
&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight:bold;"&gt;Développer sous Windows, c'est faisable mais pas évident&lt;/span&gt; (c'est d'autant plus frustrant lorsqu'on a fait beaucoup de java et que globalement toutes les lib en java sont indépendantes de l'os). &lt;br/&gt; la plus grande partie des problèmes que j'ai rencontré vient de l'utilisation dans des scripts Rake de commande système qui n'existent que sous *nix (ssh, etc...). &lt;br/&gt;Oui il y a cygwin mais bof&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight:bold;"&gt;Le problème de l'adoption de ruby en entreprise&lt;/span&gt; est lié à 2 facteurs: &lt;br/&gt;&lt;span style="font-weight:bold;"&gt;langage de script&lt;/span&gt; perçu comme impossible à maintenir par rapport à un langage compilé (alors que j'ai tant de fois vu des programmes java impossible à maintenir tellement ils sont mal écrit...) et &lt;br/&gt;&lt;span style="font-weight:bold;"&gt;résistance sociale au changemen&lt;/span&gt;t (peur de se lancer dans une techno s'il n'y a pas eu déjà 200 articles dans "01 informatique")&lt;/li&gt;&lt;/ul&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10596376-2525733570927687621?l=rubyscube.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/RubysCube/~4/AzMpe50X4DQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://rubyscube.blogspot.com/feeds/2525733570927687621/comments/default" title="Publier les commentaires" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=10596376&amp;postID=2525733570927687621" title="2 commentaires" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/2525733570927687621?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/2525733570927687621?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RubysCube/~3/AzMpe50X4DQ/ruby-at-thoughtworks.html" title="Ruby at ThoughtWorks" /><author><name>Benjamin Francisoud</name><uri>http://www.blogger.com/profile/14823114858391962141</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="13057970757532367135" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total><feedburner:origLink>http://rubyscube.blogspot.com/2009/06/ruby-at-thoughtworks.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkANR3k_fCp7ImA9WxJRF08.&quot;"><id>tag:blogger.com,1999:blog-10596376.post-4284310150420048226</id><published>2009-05-18T22:01:00.009-10:00</published><updated>2009-05-18T22:13:16.744-10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-05-18T22:13:16.744-10:00</app:edited><title>Ruby sous PSPad</title><content type="html">J'utilise &lt;a href="http://www.pspad.com/"&gt;PsPad&lt;/a&gt; comme éditeur de fichier, il y en a pleins d'autres mais j'aime bien celui-là, je trouve qu'il marche bien ;)
&lt;div&gt;Par contre je n'avais pas la coloration syntaxique pour ruby mais en fait tout est déjà fait, il suffit juste de l'activer!&lt;/div&gt;
&lt;div&gt;L'explication est disponible sur le forum de &lt;a href="http://forum.pspad.com/read.php?2,38179"&gt;PsPad&lt;/a&gt;.

&lt;/div&gt;&lt;div&gt;En images ça donne :
&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_cuBSZBHps00/ShJo_8mlQuI/AAAAAAAAAK4/JsFdzbcBupk/s1600-h/01-menu.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 155px;" src="http://1.bp.blogspot.com/_cuBSZBHps00/ShJo_8mlQuI/AAAAAAAAAK4/JsFdzbcBupk/s320/01-menu.png" alt="" id="BLOGGER_PHOTO_ID_5337443956196459234" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_cuBSZBHps00/ShJpGSZDNyI/AAAAAAAAALA/J4kQjuTMS-c/s1600-h/02-slot.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 225px;" src="http://1.bp.blogspot.com/_cuBSZBHps00/ShJpGSZDNyI/AAAAAAAAALA/J4kQjuTMS-c/s320/02-slot.png" alt="" id="BLOGGER_PHOTO_ID_5337444065124497186" border="0" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_cuBSZBHps00/ShJpMoQ387I/AAAAAAAAALI/T6U8LfhiF1Y/s1600-h/03-slot.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 225px;" src="http://2.bp.blogspot.com/_cuBSZBHps00/ShJpMoQ387I/AAAAAAAAALI/T6U8LfhiF1Y/s320/03-slot.png" alt="" id="BLOGGER_PHOTO_ID_5337444174074999730" border="0" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_cuBSZBHps00/ShJpVC8ldxI/AAAAAAAAALQ/CDd6L32r1Ds/s1600-h/04-color.png"&gt;&lt;img style="cursor: pointer; width: 320px; height: 189px;" src="http://2.bp.blogspot.com/_cuBSZBHps00/ShJpVC8ldxI/AAAAAAAAALQ/CDd6L32r1Ds/s320/04-color.png" alt="" id="BLOGGER_PHOTO_ID_5337444318676612882" border="0" /&gt;&lt;/a&gt;
&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10596376-4284310150420048226?l=rubyscube.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/RubysCube/~4/ZBdYIn5uDsg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://rubyscube.blogspot.com/feeds/4284310150420048226/comments/default" title="Publier les commentaires" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=10596376&amp;postID=4284310150420048226" title="0 commentaires" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/4284310150420048226?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/4284310150420048226?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RubysCube/~3/ZBdYIn5uDsg/ruby-sous-pspad.html" title="Ruby sous PSPad" /><author><name>Benjamin Francisoud</name><uri>http://www.blogger.com/profile/14823114858391962141</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="13057970757532367135" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_cuBSZBHps00/ShJo_8mlQuI/AAAAAAAAAK4/JsFdzbcBupk/s72-c/01-menu.png" height="72" width="72" /><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://rubyscube.blogspot.com/2009/05/ruby-sous-pspad.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0EHRHo7eSp7ImA9WxJREkU.&quot;"><id>tag:blogger.com,1999:blog-10596376.post-5028298529539904965</id><published>2009-05-13T22:03:00.005-10:00</published><updated>2009-05-13T22:27:15.401-10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-05-13T22:27:15.401-10:00</app:edited><title>Railsconf 2009 (Trop ?)</title><content type="html">&lt;div&gt;En regardant cette vidéo résumant la &lt;a href="http://www.railsenvy.com/2009/5/13/railsconf-video-2"&gt;Railsconf 2009&lt;/a&gt;, j'ai plusieurs impressions contradictoires...&lt;br/&gt;

&lt;span style="font-weight:bold;"&gt;Les positives:&lt;/span&gt;&lt;br/&gt;
&lt;ol&gt;&lt;li&gt;il y a beaucoup d'activité dans la communauté rails&lt;/li&gt;&lt;li&gt;il y a plein de sujets très variés qui sont adressés (donc l'argument comme quoi java possède plus de librairies que ruby s'effrite de plus en plus)&lt;/li&gt;&lt;li&gt;La communauté grandit de plus en plus et donc les chances de faire du ruby tous les jours au  boulot augmente&lt;/li&gt;&lt;/ol&gt;
&lt;span style="font-weight:bold;"&gt;Les négatives:&lt;/span&gt;&lt;br/&gt;
&lt;ol&gt;&lt;li&gt;Ca part dans tous les sens&lt;/li&gt;&lt;li&gt;Tout le monde essaye d'inventer son framework pour avoir un peu de gloire&lt;/li&gt;&lt;li&gt;La plupart des frameworks/lib présentés vont tomber dans l'oubli dans l'année qui arrive&lt;/li&gt;&lt;li&gt;Je n'ai pas le temps (et pas l'envie) de suivre tout ce qui se passe&lt;/li&gt;&lt;li&gt;On est plus a l'époque des pionniers où il fallait créer soit même les librairies de base; ce temps est révolue (nostalgie)&lt;/li&gt;&lt;/ol&gt;
&lt;/div&gt;

En résumé, il y a trop de choses et je n'ai pas le temps / l'envie de suivre tout ça...&lt;br/&gt;&lt;br/&gt;
Je vais me limité à ce que je fais actuellement c'est à dire suivre les sujets qui m'intéressent au moment où j'en ai besoin pour me libérer du temps pour autre chose que l'informatique ;)
&lt;br/&gt;&lt;br/&gt;
Sinon la video est bien mais un peu trop longue (34 min)
&lt;br/&gt;&lt;br/&gt;
Un sujet qui a attiré mon attention un peu plus est &lt;a href="http://code.google.com/p/appengine-jruby/"&gt;jruby sur google app engine&lt;/a&gt;.&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10596376-5028298529539904965?l=rubyscube.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/RubysCube/~4/yLT_bIS7gKs" height="1" width="1"/&gt;</content><link rel="related" href="http://www.railsenvy.com/2009/5/13/railsconf-video-2" title="Railsconf 2009 (Trop ?)" /><link rel="replies" type="application/atom+xml" href="http://rubyscube.blogspot.com/feeds/5028298529539904965/comments/default" title="Publier les commentaires" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=10596376&amp;postID=5028298529539904965" title="1 commentaires" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/5028298529539904965?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/5028298529539904965?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RubysCube/~3/yLT_bIS7gKs/railsconf-2009-trop.html" title="Railsconf 2009 (Trop ?)" /><author><name>Benjamin Francisoud</name><uri>http://www.blogger.com/profile/14823114858391962141</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="13057970757532367135" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total><feedburner:origLink>http://rubyscube.blogspot.com/2009/05/railsconf-2009-trop.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkMNRXc4fCp7ImA9WxVbFEQ.&quot;"><id>tag:blogger.com,1999:blog-10596376.post-2072690958007225134</id><published>2009-03-31T00:12:00.002-10:00</published><updated>2009-03-31T00:14:54.934-10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-03-31T00:14:54.934-10:00</app:edited><title>PragDave@github</title><content type="html">&lt;div&gt;&lt;/div&gt;Je viens juste de découvrir qu'un de mes "guru" favori a un compte sur github ;)
Hop "&lt;a href="http://github.com/pragdavespc"&gt;Follow&lt;/a&gt;" !

Je sens qu'il va s'y passer des choses intéressantes: "&lt;a href="http://pragdave.blogs.pragprog.com/pragdave/2009/03/using-comments-as-rake-task-descriptions.html"&gt;comments as rake desc&lt;/a&gt;" :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10596376-2072690958007225134?l=rubyscube.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/RubysCube/~4/Xc2K4Bloq8U" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://rubyscube.blogspot.com/feeds/2072690958007225134/comments/default" title="Publier les commentaires" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=10596376&amp;postID=2072690958007225134" title="0 commentaires" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/2072690958007225134?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/2072690958007225134?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RubysCube/~3/Xc2K4Bloq8U/pragdavegithub.html" title="PragDave@github" /><author><name>Benjamin Francisoud</name><uri>http://www.blogger.com/profile/14823114858391962141</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="13057970757532367135" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://rubyscube.blogspot.com/2009/03/pragdavegithub.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DU4FQnY4cSp7ImA9WxVRGUo.&quot;"><id>tag:blogger.com,1999:blog-10596376.post-269716881837977602</id><published>2009-01-26T01:10:00.005-10:00</published><updated>2009-01-26T03:51:53.839-10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-01-26T03:51:53.839-10:00</app:edited><title>Différences entre exec et system</title><content type="html">&lt;div&gt;Je n'aime pas trop la notation qui utilise les `` pour lancer une commande système parce que:&lt;ul&gt;&lt;li&gt;c'est facile de passer à côté et de les confondre avec un ' normal&lt;/li&gt;&lt;li&gt;parce que pour un novice c'est difficile à comprendre&lt;/li&gt;&lt;li&gt;etc. ...&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;
&lt;div&gt;Jusqu'à présent j'utilisais &lt;a href="http://www.ruby-doc.org/core/classes/Kernel.html#M005979"&gt;exec&lt;/a&gt; mais en voulant l'utiliser dans une boucle je me suis rendu compte que mon programme ruby s'arrêtait juste après l'exécution (sous windows mais je pense que c'est pareil sur d'autres os).&lt;/div&gt;
&lt;code&gt;&lt;pre&gt;
Dir["folder/foo_*.txt"].each do |path|
    cmd = "echo #{path}"
    exec(cmd)
end
&lt;/pre&gt;&lt;/code&gt;
&lt;div&gt;Si on veut que le programme ruby ne soit pas interompu (la plupart du temps) il faut en fait utiliser &lt;a href="http://www.ruby-doc.org/core/classes/Kernel.html#M005982"&gt;system&lt;/a&gt;.&lt;/div&gt;
&lt;code&gt;&lt;pre&gt;
Dir["folder/foo_*.txt"].each do |path|
    cmd = "echo #{path}"
    system(cmd)
end
&lt;/pre&gt;&lt;/code&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10596376-269716881837977602?l=rubyscube.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/RubysCube/~4/oQCtQuMpKx0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://rubyscube.blogspot.com/feeds/269716881837977602/comments/default" title="Publier les commentaires" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=10596376&amp;postID=269716881837977602" title="0 commentaires" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/269716881837977602?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/269716881837977602?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RubysCube/~3/oQCtQuMpKx0/diffrences-entre-exec-et-system.html" title="Différences entre exec et system" /><author><name>Benjamin Francisoud</name><uri>http://www.blogger.com/profile/14823114858391962141</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="13057970757532367135" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://rubyscube.blogspot.com/2009/01/diffrences-entre-exec-et-system.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CE8BR3Y4cSp7ImA9WxRUF0w.&quot;"><id>tag:blogger.com,1999:blog-10596376.post-2319247124362555434</id><published>2008-11-26T05:17:00.003-10:00</published><updated>2008-11-26T05:20:56.839-10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-11-26T05:20:56.839-10:00</app:edited><title>Changer l'extension d'un fichier</title><content type="html">&lt;div&gt;Un petit bout de script qui m'a fait économiser pas mal de temps ;)&lt;br/&gt;
Change l'extension de tous les fichiers d'un répertoire et ses sous-répertoires (ici de .kml en .xml).&lt;br/&gt;
Ne fonctionne pas si vos noms de fichiers contiennent des '.'
&lt;pre&gt;&lt;code&gt;
require 'fileutils.rb'

Dir['**/*.kml'].each do |file|
    puts file
    filename = file.split('.')[0]
    # FileUtils.cp("#{filename}.kml", "#{filename}.xml")
    # FileUtils.mv("#{filename}.kml", "#{filename}.xml")
end
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10596376-2319247124362555434?l=rubyscube.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/RubysCube/~4/LMiV296-Qjo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://rubyscube.blogspot.com/feeds/2319247124362555434/comments/default" title="Publier les commentaires" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=10596376&amp;postID=2319247124362555434" title="3 commentaires" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/2319247124362555434?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/2319247124362555434?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RubysCube/~3/LMiV296-Qjo/changer-lextension-dun-fichier.html" title="Changer l'extension d'un fichier" /><author><name>Benjamin Francisoud</name><uri>http://www.blogger.com/profile/14823114858391962141</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="13057970757532367135" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">3</thr:total><feedburner:origLink>http://rubyscube.blogspot.com/2008/11/changer-lextension-dun-fichier.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0MASXw6eip7ImA9WxdWF0s.&quot;"><id>tag:blogger.com,1999:blog-10596376.post-4107707639294703259</id><published>2008-07-10T22:34:00.002-10:00</published><updated>2008-07-10T22:37:28.212-10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-07-10T22:37:28.212-10:00</app:edited><title>Rubik’s Cube a 25 ans</title><content type="html">&lt;div&gt;Vu le nom que j'ai choisi pour mon blog, je me devais de fêter les 25 ans du Rubik's Cube, le vrai!&lt;/div&gt;
&lt;div&gt;Une campagne de pub pour l'occasion: Article &lt;a href="http://viacomit.free.fr/index.php/2008/07/11/rubik%E2%80%99s-cube-a-25-ans/"&gt;ViaComIT&lt;/a&gt;.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10596376-4107707639294703259?l=rubyscube.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/RubysCube/~4/Z-pqIqBOPhE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://rubyscube.blogspot.com/feeds/4107707639294703259/comments/default" title="Publier les commentaires" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=10596376&amp;postID=4107707639294703259" title="1 commentaires" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/4107707639294703259?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/4107707639294703259?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RubysCube/~3/Z-pqIqBOPhE/rubiks-cube-25-ans.html" title="Rubik’s Cube a 25 ans" /><author><name>Benjamin Francisoud</name><uri>http://www.blogger.com/profile/14823114858391962141</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="13057970757532367135" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total><feedburner:origLink>http://rubyscube.blogspot.com/2008/07/rubiks-cube-25-ans.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUEGSHo7eSp7ImA9WxdXFE0.&quot;"><id>tag:blogger.com,1999:blog-10596376.post-2854735200006605189</id><published>2008-06-25T05:19:00.004-10:00</published><updated>2008-06-25T05:27:09.401-10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-06-25T05:27:09.401-10:00</app:edited><title>LinkedIn la plus grosse application rails au monde ?</title><content type="html">&lt;div&gt;Plus précisément "BumperSticker" de LinkedIn.&lt;/div&gt;
&lt;div&gt;C'est en tout cas ce que les gens de &lt;a href="http://www.linkedin.com"&gt;LinkedIn&lt;/a&gt; proclament sur leur &lt;a href="http://blog.linkedin.com/blog/2008/06/web-scalability.html"&gt;blog&lt;/a&gt; (relayé par &lt;a href="http://raibledesigns.com/rd/entry/linkedin_has_the_biggest_rails"&gt;Matt Raible&lt;/a&gt; connu pour ses comparaisons de framework web java).&lt;/div&gt;
&lt;div&gt;En tout cas si la &lt;a href="http://joyent.vo.llnwd.net/o25/videos/LinkedIn-Bumpersticker-LED-Scaling-Rails.m4v"&gt;video&lt;/a&gt; dit vrai: &lt;span style="font-weight:bold;"&gt;"Scaling Rails to 1 Billion Pages a Month"&lt;/span&gt;... c'est impressionnant!&lt;br/&gt; Et surtout ça prouve que rails est capable de supporter la charge... (après tout dépend du talent des developpeurs qui font l'application).&lt;/div&gt;
&lt;div&gt;&lt;i&gt;Technorati tags: &lt;a href="http://technorati.com/tag/rails" rel="tag"&gt;rails&lt;/a&gt;  &lt;a href="http://technorati.com/tag/ror" rel="tag"&gt;ror&lt;/a&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10596376-2854735200006605189?l=rubyscube.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/RubysCube/~4/mY112kSxzpA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://rubyscube.blogspot.com/feeds/2854735200006605189/comments/default" title="Publier les commentaires" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=10596376&amp;postID=2854735200006605189" title="0 commentaires" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/2854735200006605189?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/2854735200006605189?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RubysCube/~3/mY112kSxzpA/linkedin-la-plus-grosse-application.html" title="LinkedIn la plus grosse application rails au monde ?" /><author><name>Benjamin Francisoud</name><uri>http://www.blogger.com/profile/14823114858391962141</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="13057970757532367135" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://rubyscube.blogspot.com/2008/06/linkedin-la-plus-grosse-application.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEQBQnYyeSp7ImA9WxdRFUU.&quot;"><id>tag:blogger.com,1999:blog-10596376.post-2109644536849687158</id><published>2008-06-04T03:24:00.002-10:00</published><updated>2008-06-04T03:32:33.891-10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-06-04T03:32:33.891-10:00</app:edited><title>Ruby Riddle: "Trouver le nom de la nouvelle société où je travaille"</title><content type="html">&lt;div&gt;J'ai posé ma démission de &lt;a href="http://www.anyware-tech.com"&gt;Anyware Technologies&lt;/a&gt; depuis quelques temps maintenant mais j'ai gardé le nom de la nouvelle ssii secrète pour l'instant :p&lt;/div&gt;
&lt;div&gt;Pour favoriser les personnes que je connais qui ont &lt;a href="http://www.ruby-lang.org/fr/downloads/"&gt;installé Ruby&lt;/a&gt; sur leur machine et pour pousser ceux qui sont curieux à le faire :D &lt;br/&gt;
Voici un petit programme ruby en forme de devinette.&lt;/div&gt;
&lt;pre&gt;&lt;code&gt;old_job = "anyware"
puts "old job: #{old_job}"
magic = 345756
new_job = old_job[0, 1]
magic.times {|j| new_job = new_job.next}
puts "new job: #{new_job.upcase}"&lt;/code&gt;&lt;/pre&gt;
&lt;div&gt;Il suffit de l'exécuter pour avoir la réponse ;)&lt;/div&gt;
&lt;div&gt;Je posterai l'annonce officielle sur &lt;a href="http://francisoud.blogspot.com"&gt;mon autre blog&lt;/a&gt; demain ;)&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10596376-2109644536849687158?l=rubyscube.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/RubysCube/~4/DeACcB1Rc_0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://rubyscube.blogspot.com/feeds/2109644536849687158/comments/default" title="Publier les commentaires" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=10596376&amp;postID=2109644536849687158" title="2 commentaires" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/2109644536849687158?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/2109644536849687158?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RubysCube/~3/DeACcB1Rc_0/ruby-riddle-trouver-le-nom-de-la.html" title="Ruby Riddle: &quot;Trouver le nom de la nouvelle société où je travaille&quot;" /><author><name>Benjamin Francisoud</name><uri>http://www.blogger.com/profile/14823114858391962141</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="13057970757532367135" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total><feedburner:origLink>http://rubyscube.blogspot.com/2008/06/ruby-riddle-trouver-le-nom-de-la.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUQDSXg9fSp7ImA9WxZaE0o.&quot;"><id>tag:blogger.com,1999:blog-10596376.post-5776790669696573141</id><published>2008-04-28T00:01:00.002-10:00</published><updated>2008-04-28T00:09:38.665-10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-04-28T00:09:38.665-10:00</app:edited><title>Ruby à l'Université</title><content type="html">&lt;div&gt;Comme rien n'échappe à Google et à ses "Google Alerts", je viens de découvrir un cours à l'Université de Toulouse II - Le Mirail qui utilise Ruby comme langage de programmation pour les débutants:
&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.univ-tlse2.fr/MI0003Y/0/fiche___ueup/&amp;RH=02Formation"&gt;Informatique S1&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.univ-tlse2.fr/MI0006Y/0/fiche___ueup/&amp;RH=02Formation"&gt;Informatique S2&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;
&lt;div&gt;Une bien bonne nouvelle et une excellente initiative :)&lt;/div&gt;
&lt;div&gt;Si vous doutez de l'adéquation entre Ruby et Débutants, je vous conseille de jeter un coup d'oeil au livre: &lt;a href="http://pip.pragprog.com/titles/fr_ltp/learn-to-program"&gt;"Learn to Program"&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;i&gt;Technorati tags: &lt;a href="http://technorati.com/tag/toulouse" rel="tag"&gt;toulouse&lt;/a&gt; &lt;a href="http://technorati.com/tag/ruby" rel="tag"&gt;ruby&lt;/a&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10596376-5776790669696573141?l=rubyscube.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/RubysCube/~4/IpQVBEboFeU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://rubyscube.blogspot.com/feeds/5776790669696573141/comments/default" title="Publier les commentaires" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=10596376&amp;postID=5776790669696573141" title="2 commentaires" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/5776790669696573141?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/5776790669696573141?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RubysCube/~3/IpQVBEboFeU/ruby-luniversit.html" title="Ruby à l'Université" /><author><name>Benjamin Francisoud</name><uri>http://www.blogger.com/profile/14823114858391962141</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="13057970757532367135" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total><feedburner:origLink>http://rubyscube.blogspot.com/2008/04/ruby-luniversit.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0MBQn4-eCp7ImA9WxZVGUU.&quot;"><id>tag:blogger.com,1999:blog-10596376.post-2314552003596659295</id><published>2008-03-31T08:13:00.008-10:00</published><updated>2008-03-31T08:50:53.050-10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-03-31T08:50:53.050-10:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="ruby" /><title>Experimentations avec les Mixins / Modules et les méthodes statiques (self)</title><content type="html">&lt;div&gt;On m'a posé une question aujourd'hui: &lt;span style="font-weight:bold;"&gt;"Comment définir une méthode statique dans un module et l'inclure dans une classe ?"&lt;/span&gt;. &lt;span style="font-style:italic;"&gt;Simple non ?!&lt;/span&gt;&lt;br/&gt; Justement j'avais eu le même problème quand j'avais fait mon projet &lt;a href="http://naturalsort.rubyforge.org/"&gt;"natural_sort"&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;Spontanément j'ai essayé:
&lt;pre&gt;&lt;code&gt;
module Carnivore
  def self.manger(oiseau)
    puts "slurp! #{oiseau}"
  end
end

class GrosMinet
  include Carnivore
end

Carnivore.manger "titi" # ok ca foncionnne
GrosMinet.manger "titi" # undefined method `manger' for GrosMinet:Class (NoMethodError) WTF ?!
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;div&gt;Malheureusement &lt;span style="font-weight:bold;"&gt;ça ne fonctionne pas :(&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;
Dans &lt;a href="http://naturalsort.rubyforge.org/"&gt;NaturalSort&lt;/a&gt;, j'ai contourné le problème:

&lt;pre&gt;&lt;code&gt;
module NaturalSort
  def self.naturalsort(object)
    ...
  end
  def natural_sort
    NaturalSort::naturalsort(to_a)
  end
end
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;div&gt;Je suis tombé sur cet article: &lt;a href="http://www.juixe.com/techknow/index.php/2006/06/15/mixins-in-ruby/"&gt;"Ruby Mixin Tutorial"&lt;/a&gt; et j'ai essayé différentes combinaisons, &lt;span style="font-weight:bold;"&gt;il n'y en pas une qui soit satifaisante dans tous les cas...&lt;/span&gt;&lt;br/&gt;
Ici vous pourrez voir les &lt;span style="font-weight:bold;"&gt;principales étapes jusqu'à la version finale&lt;/span&gt;, celle qui me satisfait le plus.&lt;/div&gt;

&lt;div&gt;&lt;span style="font-weight:bold;"&gt;Etape n°1:&lt;/span&gt; classe statique dans le module uniquement
&lt;pre&gt;&lt;code&gt;
module Carnivore
  def self.manger(oiseau)
    puts "slurp! #{oiseau}"
  end
end

Carnivore.manger "titi"
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;div&gt;&lt;span style="font-weight:bold;"&gt;Etape n°2:&lt;/span&gt; méthode d'instance de classe (l'utilisation classique du module par excellence):
&lt;pre&gt;&lt;code&gt;
module Carnivore
  def manger(oiseau)
    puts "slurp! #{oiseau}"
  end
end

class GrosMinet
  include Carnivore
end

gros_minet = GrosMinet.new 
gros_minet.manger "titi"
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;


&lt;div&gt;&lt;span style="font-weight:bold;"&gt;Version finale.&lt;/span&gt; 2 grosses subtilités:&lt;ul&gt;&lt;li&gt;il n'y a pas de 'self' dans la définition de la méthode 'manger'&lt;/li&gt;&lt;li&gt;On utilise 'extends' au lieu de 'include'&lt;/li&gt;&lt;/ul&gt;
&lt;pre&gt;&lt;code&gt;
module Carnivore
  def manger(oiseau)
    puts "slurp! #{oiseau}"
  end
end

module Chat
  def miauler
    puts "miaou..."
  end
end

class GrosMinet
  include Chat
  # include Carnivore # necessaire à gros_minet.manger("titi")
  extend Carnivore
end

GrosMinet.manger "titi"

gros_minet = GrosMinet.new 
gros_minet.miauler
# gros_minet.manger "titi" # necessite le include Carnivore pour fonctionner
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;br/&gt;
&lt;p&gt;&lt;span style="font-weight:bold;"&gt;Conclusion:&lt;/span&gt; Ca fonctionne et le code est court mais je trouve la syntax un peut étrange, je ne comprend pas trop pourquoi le 'include' n'inclus pas les méthodes 'self' ? il y a quelquechose qui m'échappe pour l'instant...
&lt;br/&gt;&lt;br/&gt;
Du coup je pense que c'est &lt;span style="font-weight:bold;"&gt;une bonne pratique de ne pas utiliser de méthodes préfixé par 'self' dans le modules&lt;/span&gt; et que faire &lt;span style="font-weight:bold;"&gt;MonModule.ma_methode&lt;/span&gt; n'est peut-être pas très orienté objet... après tout &lt;span style="font-weight:bold;"&gt;les modules&lt;/span&gt; ne sont pas vraiment des objets et &lt;span style="font-weight:bold;"&gt;ne devraient pas être utilisés seuls&lt;/span&gt; ? Qu'est ce que vous en pensez ?&lt;/p&gt;
&lt;br/&gt;
&lt;div&gt;&lt;i&gt;Technorati tags: &lt;a href="http://technorati.com/tag/mixin" rel="tag"&gt;mixin&lt;/a&gt; &lt;a href="http://technorati.com/tag/ruby" rel="tag"&gt;ruby&lt;/a&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10596376-2314552003596659295?l=rubyscube.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/RubysCube/~4/nsaFO4jTbx4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://rubyscube.blogspot.com/feeds/2314552003596659295/comments/default" title="Publier les commentaires" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=10596376&amp;postID=2314552003596659295" title="1 commentaires" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/2314552003596659295?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/2314552003596659295?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RubysCube/~3/nsaFO4jTbx4/experimentations-avec-les-mixins.html" title="Experimentations avec les Mixins / Modules et les méthodes statiques (self)" /><author><name>Benjamin Francisoud</name><uri>http://www.blogger.com/profile/14823114858391962141</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="13057970757532367135" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total><feedburner:origLink>http://rubyscube.blogspot.com/2008/03/experimentations-avec-les-mixins.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C04FQ30-fSp7ImA9WxZWGUk.&quot;"><id>tag:blogger.com,1999:blog-10596376.post-6758968643924807233</id><published>2008-03-19T05:45:00.004-10:00</published><updated>2008-03-19T05:51:52.355-10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-03-19T05:51:52.355-10:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="rails" /><title>Rails 2 - Renommer des .rjs en .js.rjs</title><content type="html">&lt;div&gt;Suite à ma &lt;a href="http://rubyscube.blogspot.com/2008/03/migration-pas-pas-dune-application-ruby_18.html"&gt;migration en rails 2.0&lt;/a&gt;, j'avais renommé mes &lt;span style="font-weight:bold;"&gt;.rjs en .js.rjs&lt;/span&gt; mais les pages ne fonctionnaient plus :(&lt;/div&gt;
&lt;div&gt;C'est parce qu'il faut ajouté le block &lt;span style="font-weight:bold;"&gt;respond_to&lt;/span&gt; dans la méthode qui appelle l'ajax dans  le controller:
&lt;pre&gt;
  # Ajax response for validation
  def validate_new_holiday
    @holiday = self.init_holiday
    respond_to do |format|
      format.js      # validate_new_holiday.js.rjs
    end
  end 
&lt;/pre&gt;&lt;/div&gt;
&lt;div&gt;&lt;i&gt;Technorati tags: &lt;a href="http://technorati.com/tag/rails" rel="tag"&gt;rails&lt;/a&gt; &lt;a href="http://technorati.com/tag/ror" rel="tag"&gt;ror&lt;/a&gt; &lt;a href="http://technorati.com/tag/ruby" rel="tag"&gt;ruby&lt;/a&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10596376-6758968643924807233?l=rubyscube.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/RubysCube/~4/jWG8rnnsQB8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://rubyscube.blogspot.com/feeds/6758968643924807233/comments/default" title="Publier les commentaires" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=10596376&amp;postID=6758968643924807233" title="0 commentaires" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/6758968643924807233?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/6758968643924807233?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RubysCube/~3/jWG8rnnsQB8/rails-2-renommer-des-rjs-en-jsrjs.html" title="Rails 2 - Renommer des .rjs en .js.rjs" /><author><name>Benjamin Francisoud</name><uri>http://www.blogger.com/profile/14823114858391962141</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="13057970757532367135" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://rubyscube.blogspot.com/2008/03/rails-2-renommer-des-rjs-en-jsrjs.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkMCQn45fyp7ImA9WxZWGE4.&quot;"><id>tag:blogger.com,1999:blog-10596376.post-431243802255034835</id><published>2008-03-18T00:40:00.010-10:00</published><updated>2008-03-18T01:07:43.027-10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-03-18T01:07:43.027-10:00</app:edited><title>Migration "Pas à pas" d'une application ruby on rails de 1.2.6 vers 2.0.2 (part 2)</title><content type="html">&lt;p&gt;&lt;div&gt;Dans le post précédent nous avons vu comment &lt;a href="http://rubyscube.blogspot.com/2008/03/migration-pas-pas-dune-application-ruby.html"&gt;migrer de 1.2.2 vers 1.2.6&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;Maintenant nous allons passer &lt;span style="font-weight:bold;"&gt;de 1.2.6 à 2.0.2&lt;/span&gt;&lt;/div&gt;&lt;/p&gt;
&lt;br/&gt;
&lt;p&gt;Je ne l'ai pas dit dans mon post précédent tellement ça me paraissait évident, mais &lt;span style="font-weight:bold;"&gt;utiliser systématiquement subversion&lt;/span&gt; (ou un autre système: cvs, git...) pour pouvoir revenir en arrière. &lt;span style="font-weight:bold;"&gt;C'est indispensable !!&lt;/span&gt;&lt;/p&gt;
&lt;br/&gt;
&lt;pre&gt;
&amp;gt; rake rails:unfreeze

&amp;gt; svn delete vendor/rails

&amp;gt; gem list rails

*** LOCAL GEMS ***

rails (1.2.6)

&amp;gt; gem update rails
Successfully installed rails-2.0.2
1 gem installed
Gems updated: rails

&amp;gt; gem list rails

*** LOCAL GEMS ***

rails (2.0.2, 1.2.6)

&amp;gt; edit config/environment.rb
&lt;/pre&gt;
&lt;p&gt;Changer&lt;br/&gt;
&lt;code&gt;RAILS_GEM_VERSION = '1.2.6' unless defined? RAILS_GEM_VERSION&lt;/code&gt;
&lt;br/&gt;En:&lt;br/&gt;
&lt;code&gt;RAILS_GEM_VERSION = '2.0.2' unless defined? RAILS_GEM_VERSION&lt;/code&gt;&lt;/p&gt;

&lt;pre&gt;
&amp;gt;ruby script\about

      *******************************************************************
      * config.breakpoint_server has been deprecated and has no effect. *
      *******************************************************************

About your application's environment
Ruby version              1.8.6 (i386-mswin32)
RubyGems version          1.0.1
Rails version             2.0.2
Active Record version     2.0.2
Action Pack version       2.0.2
Active Resource version   2.0.2
Action Mailer version     2.0.2
Active Support version    2.0.2
Application root          C:/developement/ruby/appli
Environment               development
Database adapter          mysql
Database schema version   8
&lt;/pre&gt;
&lt;p&gt;Si vous avez le même warning que moi, éditer le fichier development.rb et enlevé les lignes suivantes:
&lt;pre&gt;
# Enable the breakpoint server that script/breakpointer connects to
config.breakpoint_server = true
&lt;/pre&gt;
puis installer ruby-debug comme expliqué ici: &lt;a href="http://snippets.aktagon.com/snippets/80-Fixing-config-breakpoint-server-has-been-deprecated-and-has-no-effect-when-using-Rails-Edge"&gt;Fixing-config-breakpoint-server&lt;/a&gt;&lt;/p&gt;
&lt;pre&gt;
&amp;gt; rake rails:update

modifie 
  config/boot.rb

  public/javascripts/control.js
  public/javascripts/dragdrop.js
  public/javascripts/effects.js
  public/javascripts/prototype.js

&amp;gt; rake log:clear tmp:clear db:test:purge
&lt;/pre&gt;
&lt;p&gt;Editer database.yml
J'aime bien ajouter l'encoding pour MySql:
&lt;/p&gt;
&lt;pre&gt;
development:
  adapter: mysql
  *encoding: utf8* (sans les étoiles autour ;) )
  database: appli_development
  username: appli
  password: appli
  host: localhost

&amp;gt; rake db:reset
(optionnel ?)

&amp;gt; rake db:migrate:reset
...

m à j de db/schema.rb

&amp;gt; rake test
...
36 tests, 95 assertions, 0 failures, 0 errors
...
33 tests, 63 assertions, 0 failures, 0 errors

&amp;gt; ruby script/server
=&amp;gt; Booting Mongrel (use 'script/server webrick' to force WEBrick)
=&amp;gt; Rails application starting on http://0.0.0.0:3000
=&amp;gt; Call with -d to detach
=&amp;gt; Ctrl-C to shutdown server
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
** Rails loaded.
** Loading any Rails specific GemPlugins
** Signals ready.  INT =&amp;gt; stop (no restart).
** Mongrel 1.1.4 available at 0.0.0.0:3000
** Use CTRL-C to stop.
/!\ FAILSAFE /!\  Tue Mar 18 10:16:56 +0100 2008
  Status: 500 Internal Server Error
  A secret is required to generate an integrity hash for cookie session data. Use config.action_controller.session = { :session_key =&amp;gt; 

"_mya
pp_session", :secret =&amp;gt; "some secret phrase of at least 30 characters" } in config/environment.rb
    c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/session/cookie_store.rb:91:in `ensure_secret_secure'
    c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/session/cookie_store.rb:60:in `initialize'
...
&lt;/pre&gt;
&lt;p&gt;http://localhost:3000/ retourne une erreur 500&lt;br/&gt;
Le plus simple que j'ai trouvé c'est de créer une nouvelle appli rails à côté:&lt;br/&gt;
&lt;code&gt;&amp;gt; rails dummy&lt;/code&gt;
&lt;br/&gt;&lt;br/&gt;
Remplacer le contenu de appli/config/environment.rb par celui de dummy (en garder une copie qq part)&lt;br/&gt;
&lt;br/&gt;
&lt;code&gt;&amp;gt; rake secret&lt;/code&gt;
&lt;br/&gt;
Remplacer la ligne suivante:
&lt;pre&gt;
  config.action_controller.session = {
    :session_key =&amp;gt; '_dummy_session',
    :secret      =&amp;gt; '1234abcde'
  }
&lt;/pre&gt;
&lt;br/&gt;par
&lt;pre&gt;
  config.action_controller.session = {
    :session_key =&amp;gt; '_appli_session',
    :secret      =&amp;gt; 'secret generé par la commande rake secret'
  }
&lt;/pre&gt;
&lt;br/&gt;
Ajouter toutes les conf specifiques à votre appli.&lt;br/&gt;
Par exemple dans mon cas j'avais ActionMailer, donc j'ai ajouté à la fin:
&lt;pre&gt;
ActionMailer::Base.smtp_settings = {
  :address  =&amp;gt; 'smtp.truc.com',
  :port  =&amp;gt; '25',
  :domain =&amp;gt; 'www.truc.com'
}
&lt;/pre&gt;
&lt;br/&gt;Continuons la migration...&lt;br/&gt;
&lt;pre&gt;
&amp;gt; rake test
...
&amp;gt; svn commit -m "updating to rails 2.0.2"

&amp;gt; rake rails:freeze:gems
...

&amp;gt; svn add vendor/rails

&amp;gt; rake deprecated
...

&amp;gt; ruby script/plugin remove deprecated
...
inutile maintenant

&amp;gt; svn commit -m "freezing rails 2.0.2"

&amp;gt; gem uninstall rails --version 1.2.6
&lt;/pre&gt;

&lt;p&gt;&lt;span style="font-weight:bold;"&gt;A partir de là vous avez fait l'essentiel!! &lt;br/&gt;Vous pouvez rentrer chez vous après une dure journée de labeur... ou bien fignoler le travail&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;Créer un fichier migrate_views.rb à la racine de l'appli:
Ajouter:
&lt;pre&gt;
Dir.glob('app/views/**/*.rhtml').each do |file|
  puts `svn mv #{file} #{file.gsub(/\.rhtml$/, '.html.erb')}`
end
&lt;/pre&gt;
&lt;/p&gt;

&lt;pre&gt;
&amp;gt; ruby migrate_views.rb
A         app\views\layouts\application.html.erb
D         app\views\layouts\application.rhtml
...

&amp;gt; rake test
...

&amp;gt; ruby script/server
...
Tester l'appli
&lt;/pre&gt;
&lt;p&gt;
Ajouter à production.rb
&lt;pre&gt;config.action_view.cache_template_loading            = true&lt;/pre&gt;
&lt;br/&gt;
Ajouter à test.rb
&lt;pre&gt;
# Disable request forgery protection in test environment
config.action_controller.allow_forgery_protection    = false
&lt;/pre&gt;

Concernant routes.rb, je n'ai pas de solution miracle :(&lt;br/&gt;
Créer un une appli rails dummy à coté et utiliser un outil de conmparaison de fichier pour voir les différences et mettre votre routes.rb à jour.&lt;br/&gt;
&lt;br/&gt;
Par exemple si vous n'utiliser pas le wsdl comme moi vous pouvez supprimer la ligne:
&lt;pre&gt;map.connect ':controller/service.wsdl', :action =&amp;gt; 'wsdl'&lt;/pre&gt;
&lt;br/&gt;
On peut aussi copier/coller le README à la racine de l'appli dummy vers son appli rails&lt;/p&gt;

&lt;p&gt;
Dans test_helper.rb, on peut ajouter:
&lt;pre&gt;
  # The only drawback to using transactional fixtures is when you actually 
  # need to test transactions.  Since your test is bracketed by a transaction,
  # any transactions started in your code will be automatically rolled back.
&lt;/pre&gt;
juste avant&lt;br/&gt;
&lt;code&gt;self.use_transactional_fixtures = true&lt;/code&gt;
&lt;br/&gt;et
&lt;pre&gt;
  # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
  #
  # Note: You'll currently still have to declare fixtures explicitly in integration tests
  # -- they do not yet inherit this setting
  fixtures :all
&lt;/pre&gt;
&lt;/p&gt;
&lt;p&gt;
Si vous avez un script/breakpointer je pense que vous pouvez le supprimer...&lt;br/&gt;&lt;br/&gt;

Vous pouvez aussi changer tous vos fichiers dans db/migrate pour utiliser la nouvelle syntaxe des migrations (optionnel)&lt;br/&gt;&lt;br/&gt;

Il y a plein d'autre améliorations possibles dans les controller, dans les fixtures etc... cf: &lt;a href="http://weblog.rubyonrails.org/2007/12/7/rails-2-0-it-s-done"&gt;rails-2-0-it-s-done&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;&lt;span style="font-weight:bold;"&gt;Et Voilà ! Votre appli est migrée en Rails 2.0.2! Félicitations ;)&lt;/span&gt;&lt;/p&gt;

&lt;div&gt;&lt;i&gt;Technorati tags: &lt;a href="http://technorati.com/tag/rails" rel="tag"&gt;rails&lt;/a&gt; &lt;a href="http://technorati.com/tag/ror" rel="tag"&gt;ror&lt;/a&gt; &lt;a href="http://technorati.com/tag/ruby" rel="tag"&gt;ruby&lt;/a&gt; &lt;a href="http://technorati.com/tag/migration" rel="tag"&gt;migration&lt;/a&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10596376-431243802255034835?l=rubyscube.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/RubysCube/~4/XToZGWHKycs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://rubyscube.blogspot.com/feeds/431243802255034835/comments/default" title="Publier les commentaires" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=10596376&amp;postID=431243802255034835" title="3 commentaires" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/431243802255034835?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/431243802255034835?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RubysCube/~3/XToZGWHKycs/migration-pas-pas-dune-application-ruby_18.html" title="Migration &quot;Pas à pas&quot; d'une application ruby on rails de 1.2.6 vers 2.0.2 (part 2)" /><author><name>Benjamin Francisoud</name><uri>http://www.blogger.com/profile/14823114858391962141</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="13057970757532367135" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">3</thr:total><feedburner:origLink>http://rubyscube.blogspot.com/2008/03/migration-pas-pas-dune-application-ruby_18.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUcDSH88fyp7ImA9WxZWF0o.&quot;"><id>tag:blogger.com,1999:blog-10596376.post-1705183082579385933</id><published>2008-03-17T07:52:00.005-10:00</published><updated>2008-03-17T08:04:39.177-10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-03-17T08:04:39.177-10:00</app:edited><title>Migration "Pas à pas" d'une application ruby on rails de 1.2.2 vers 1.2.6</title><content type="html">&lt;p&gt;Comment &lt;span style="font-weight:bold;"&gt;migrer&lt;/span&gt; "Pas à pas" une application ruby on rails de &lt;span style="font-weight:bold;"&gt;1.2.2 vers 1.2.6&lt;/span&gt; (Nous verrons de 1.2.6 à 2.0.2 dans un autre post).&lt;/p&gt;

Extrait du blog &lt;a href="http://weblog.rubyonrails.org/2007/12/7/rails-2-0-it-s-done"&gt;officiel de Ruby on Rails&lt;/a&gt;:
&lt;blockquote&gt;So how do I upgrade?

If you want to move your application to Rails 2.0, you should first move it to Rails 1.2.6. That’ll include deprecation warnings for most everything we yanked out in 2.0. So if your application runs fine on 1.2.6 with no deprecation warnings, there’s a good chance that it’ll run straight up on 2.0. Of course, if you’re using, say, pagination, you’ll need to install the classic_pagination plugin. If you’re using Oracle, you’ll need to install the activerecord-oracle-adapter gem. And so on and so forth for all the extractions.&lt;/blockquote&gt;
&lt;br/&gt;
&lt;pre&gt;&amp;gt; ruby script\about

About your application's environment
Ruby version                 1.8.6 (i386-mswin32)
RubyGems version             1.0.1
Rails version                1.2.2
Active Record version        1.15.2
Action Pack version          1.13.2
Action Web Service version   1.2.2
Action Mailer version        1.3.2
Active Support version       1.4.1
Edge Rails revision          64
Application root             C:/developement/ruby/prophet/trunk/prophet
Environment                  development
Database adapter             mysql
Database schema version      8



&amp;gt; rake rails:unfreeze

&amp;gt; gem install rails --version 1.2.6

&amp;gt; gem list rails

*** LOCAL GEMS ***

rails (2.0.2, 1.2.6)

&amp;gt; edit appli/config/environment.rb
Changer:
RAILS_GEM_VERSION = '1.2.2' unless defined? RAILS_GEM_VERSION
En:
RAILS_GEM_VERSION = '1.2.6' unless defined? RAILS_GEM_VERSION

&amp;gt; rake rails:update:configs

modifie config/boot.rb

&amp;gt; rake rails:update:javascripts

modifie rien ?

&amp;gt; rake rails:update:scripts

modifie rien ?

&amp;gt; rake log:clear tmp:clear db:test:purge

&amp;gt; ruby script\about

About your application's environment
Ruby version                 1.8.6 (i386-mswin32)
RubyGems version             1.0.1
Rails version                1.2.6
Active Record version        1.15.6
Action Pack version          1.13.6
Action Web Service version   1.2.6
Action Mailer version        1.3.6
Active Support version       1.4.4
Application root             C:/developement/ruby/prophet/trunk/prophet
Environment                  development
Database adapter             mysql
Database schema version      8


&amp;gt; rake test
...
36 tests, 95 assertions, 0 failures, 0 errors
...
33 tests, 63 assertions, 0 failures, 0 errors

&amp;gt; ruby script\server
=&amp;gt; Booting Mongrel (use 'script/server webrick' to force WEBrick)
=&amp;gt; Rails application starting on http://0.0.0.0:3000
=&amp;gt; Call with -d to detach
=&amp;gt; Ctrl-C to shutdown server
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
** Rails loaded.
** Loading any Rails specific GemPlugins
** Signals ready.  INT =&amp;gt; stop (no restart).
** Mongrel 1.1.4 available at 0.0.0.0:3000
** Use CTRL-C to stop.
March 17, 2008 17:39 --

...

&lt;/pre&gt;
Regarder dans les logs s'il y a des "DEPRECATION WARNING"&lt;br/&gt;
Jeter un coup d'oeil à http://www.rubyonrails.org/deprecation&lt;br/&gt;
Installer le plugin deprecated: http://nubyonrails.com/articles/deprecated-plugin-find-old-rails-code&lt;br/&gt;
&lt;pre&gt;
&amp;gt; ruby script/plugin install http://topfunky.net/svn/plugins/deprecated
+ ./deprecated/CHANGELOG
+ ./deprecated/MIT-LICENSE
+ ./deprecated/README
+ ./deprecated/about.yml
+ ./deprecated/tasks/deprecated.rake


&amp;gt; rake deprecated
(in C:/.../app)
--&amp;gt; component
 Clean! Cheers for you!

--&amp;gt; @session
 Clean! Cheers for you!

--&amp;gt; paginate
 Clean! Cheers for you!
...
&lt;/pre&gt;
S'il n'y a que des "Clean" c'est que tout va bien :)&lt;br/&gt;
&lt;pre&gt;
&amp;gt; svn cleanup .
(optionnel ?)

&amp;gt; svn commit -m "upgrading to 1.2.6"

&amp;gt; rake rails:freeze:gems
(in C:/developement/ruby/prophet/trunk/prophet)
Freezing to the gems for Rails 1.2.6
rake aborted!
uninitialized constant Gem::GemRunner

(See full trace by running task with --trace)


&amp;gt;gem update --system
...
&lt;/pre&gt;
&lt;br/&gt;
ATTENTION HACK&lt;br/&gt;
Supprimer le rep 'rails' dans 'vendor' à la main pour revenir à zéro...&lt;br/&gt;
Il y a un probleme de compatibilité entre les dernières version de rubygems et rails 1.2.6&lt;br/&gt;
Il faut ajouter 'require 'rubygems/gem_runner' dans C:\ruby\lib\ruby\gems\1.8\gems\rails-1.2.6\lib\tasks\framework.rake&lt;br/&gt;
cf: &lt;a href="http://bpdp.wordpress.com/2007/11/28/rubygems-095-and-rails-126-uninitialized-constant-gemgemrunner/"&gt;rubygems-095-and-rails-126-uninitialized-constant-gemgemrunner&lt;/a&gt;
&lt;br/&gt;
&lt;pre&gt;
&amp;gt; gem list rails

*** LOCAL GEMS ***

rails (2.0.2, 1.2.6)
&lt;/pre&gt;
&lt;br/&gt;
ATTENTION&lt;br/&gt;
Bien préciser la version sinon ça va freezer la plus récente (ici on veut 1.2.6 pas la 2.0.2)
&lt;br/&gt;
&lt;pre&gt;
&amp;gt; rake rails:freeze:gems VERSION=1.2.6

Maintenant ça devrait marcher...

&amp;gt; svn add vendor/rails

&amp;gt; svn commit -m "freezing to 1.2.6"
&lt;/pre&gt;
&lt;br/&gt;
&lt;div&gt;&lt;span style="font-weight:bold;"&gt;Et voilà !&lt;/span&gt; &lt;br/&gt;Plus vous avez de tests moins il y aura de régressions ;)&lt;br/&gt;
Passez un peu partout dans l'appli pour plus de sureté aussi, on est jamais trop prudent ;)&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10596376-1705183082579385933?l=rubyscube.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/RubysCube/~4/QKDabSjae3g" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://rubyscube.blogspot.com/feeds/1705183082579385933/comments/default" title="Publier les commentaires" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=10596376&amp;postID=1705183082579385933" title="0 commentaires" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/1705183082579385933?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/1705183082579385933?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RubysCube/~3/QKDabSjae3g/migration-pas-pas-dune-application-ruby.html" title="Migration &quot;Pas à pas&quot; d'une application ruby on rails de 1.2.2 vers 1.2.6" /><author><name>Benjamin Francisoud</name><uri>http://www.blogger.com/profile/14823114858391962141</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="13057970757532367135" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://rubyscube.blogspot.com/2008/03/migration-pas-pas-dune-application-ruby.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0EEQnw5fCp7ImA9WxZWEUs.&quot;"><id>tag:blogger.com,1999:blog-10596376.post-1944223061383634492</id><published>2008-03-10T06:10:00.008-10:00</published><updated>2008-03-10T07:20:03.224-10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-03-10T07:20:03.224-10:00</app:edited><title>Déployer une application ruby on rails dans Tomcat</title><content type="html">&lt;div&gt;Je viens de déployer ma première application rails dans un &lt;a href="http://tomcat.apache.org/"&gt;Tomcat&lt;/a&gt; avec &lt;a href="http://jruby.codehaus.org/"&gt;JRuby&lt;/a&gt;.&lt;/div&gt;
&lt;div&gt;Contrairement à ce que la longueur de ce post pourrait laisser penser &lt;span style="font-weight:bold;"&gt;c'est très simple et très rapide&lt;/span&gt; (&lt;span style="font-weight:bold;"&gt;env 2H30&lt;/span&gt; pour quelqu'un d'expérimenté en tomcat, mysql et rails et &lt;span style="font-weight:bold;"&gt;30 min&lt;/span&gt; si tout est pré-installé).&lt;/div&gt;
&lt;div&gt;Le lien &lt;span style="font-weight: bold;"&gt;indispensable&lt;/span&gt; pour déployer une application rail 1.1 ou 2.0 se trouve sur le wiki de JRuby: &lt;a href="http://wiki.jruby.org/wiki/Jruby_on_Rails_on_Tomcat"&gt;Jruby on Rails on Tomcat&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-weight:bold;"&gt;Je vous conseille la page du wiki qui est beaucoup plus succinte en premier!&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;Sinon voilà une autre version &lt;span style="font-weight:bold;"&gt;si vous partez vraiment de zéro avec beaucoup plus de détails et/ou de "bonnes pratiques"&lt;/span&gt; ;)&lt;/div&gt;
&lt;div&gt;En gros il y a &lt;span style="font-weight:bold;"&gt;2 cas&lt;/span&gt;:
&lt;ol&gt;&lt;li&gt;Vous préparez le ".war" (généralement un développeur ruby/java en charge de la livraison) Nous l'appellerons Mr R.&lt;/li&gt;&lt;li&gt;Vous déployez sur la machine de production (généralement l'admin système ou un gars des opérations). Nous l'appellerons Mr A.&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;

&lt;div&gt;&lt;span style="font-weight:bold;"&gt;Versions et environnent testé: &lt;/span&gt;Windows XP + Tomcat(6.0.16) + JRuby(1.0.3) + MySql(5) + Java(jre1.6.0_03)&lt;/div&gt;

&lt;div&gt;&lt;span style="font-weight:bold;"&gt;Cas numéro 1: Création du "War"&lt;/span&gt;&lt;br/&gt;
&lt;ol&gt;&lt;li&gt;JRuby&lt;ul&gt;&lt;li&gt;Télécharger &lt;a href="http://jruby.codehaus.org/"&gt;JRuby&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Dezipper JRuby (ex: c:\jruby)&lt;/li&gt;&lt;li&gt;Ajouter JRUBY_HOME=c:\jruby&lt;/li&gt;&lt;li&gt;Ajouter %JRUBY_HOME%\bin à la variable d'environnement 'Path'&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Tomcat&lt;ul&gt;&lt;li&gt;Télécharger l'installer: apache-tomcat-6.0.16.exe&lt;/li&gt;&lt;li&gt;Installler (suivre le wizard)&lt;/li&gt;&lt;li&gt;Générallement Tomcat est installé ici: C:\Program Files\Apache Software Foundation\Tomcat 6.0&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;MySQL&lt;ul&gt;&lt;li&gt;Installer MySql (encoding utf-8 de préférence)&lt;/li&gt;&lt;li&gt;Se Connecter en 'root'&lt;/li&gt;&lt;li&gt;Créer un schema appli_[env]&lt;/li&gt;&lt;li&gt;Créer un user spécial: &lt;pre&gt;GRANT ALL ON appli_production.* TO 'appli'@'localhost' IDENTIFIED BY 'appli';&lt;/pre&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;Warbler:&lt;pre&gt;
    c:\...\appli&gt; jruby -S gem install -y rails warbler
    c:\...\appli&gt; jruby -S rake db:migrate RAILS_ENV=production
    c:\...\appli&gt; jruby -S rake db:structure:dump RAILS_ENV=production
    c:\...\appli&gt; jruby -S warble war 
    c:\...\appli&gt; jruby -S warble config
&lt;/pre&gt;
Avec la commande "db:structure:dump", on a généré un fichier: production_structure.sql (utilisé par Mr. A)
&lt;/li&gt;&lt;li&gt;Aller dans le "appli&gt;tmp/war/WEB-INF/web.xml" et ajouter les lignes suivantes si vous êtes dans le cas décrit dans le &lt;a href="http://wiki.jruby.org/wiki/Jruby_on_Rails_on_Tomcat"&gt;wiki de JRuby&lt;/a&gt;:&lt;pre&gt;
&amp;lt;context-param&amp;gt;
    &amp;lt;param-name&amp;gt;jruby.session_store&amp;lt;/param-name&amp;gt;
    &amp;lt;param-value&amp;gt;db&amp;lt;/param-value&amp;gt;
&amp;lt;/context-param&amp;gt;&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;Copier/Coller le web.xml modifié dans le répertoire config pour ne pas avoir a refaire cette manip à chaque fois que vous généré le war.&lt;/li&gt;&lt;li&gt;Vérifiez les paramètres de connexion à la production dans database.yml&lt;/li&gt;&lt;li&gt;Figer toutes les versions de rails et warbler:
&lt;pre&gt;
    c:\...\appli&gt; jruby -S rake rails:freeze
    c:\...\appli&gt; jruby -S warble pluginize
&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;Regénérer le war avec le web.xml modifié:
&lt;pre&gt;
    c:\...\appli&gt; jruby -S warble war:clean
    c:\...\appli&gt; jruby -S warble war
&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;Le copier dans le répertoire  webapp de Tomcat&lt;/li&gt;&lt;li&gt;Démarrer Tomcat&lt;/li&gt;&lt;li&gt;Tester l'application: &lt;a href="http://localhost:8080"&gt;http://localhost:8080&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;
&lt;/div&gt;

&lt;div&gt;&lt;span style="font-weight:bold;"&gt;Cas numéro 2: Production&lt;/span&gt;&lt;br/&gt;
&lt;ol&gt;&lt;li&gt;Installer Tomcat&lt;/li&gt;&lt;li&gt;Installer MySql&lt;/li&gt;&lt;li&gt;Créer &lt;a href="http://dev.mysql.com/doc/refman/5.0/en/create-database.html"&gt;le schéma de production&lt;/a&gt;&lt;pre&gt;CREATE SCHEMA appli_production;&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;Charger les tables dans le schéma (j'utilise &lt;a href="http://www.mysql.com/products/tools/query-browser/"&gt;MySql Query Browser&lt;/a&gt; pour ça; je ne connait pas la commande exacte), On utilisera le fichier généré par Mr. R (cf Cas numéro 1: production_structure.sql)&lt;/li&gt;&lt;li&gt;Se mettre d'accord sur les paramètres de connexion à la base avec Mr. R (schema name/username/password)&lt;/li&gt;&lt;li&gt;Créer un user spécial: &lt;pre&gt;GRANT ALL ON appli_production.* TO 'appli'@'localhost' IDENTIFIED BY 'appli';&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;Récupérer le war de Mr. R&lt;/li&gt;&lt;li&gt;Le copier dans le répertoire  webapp de Tomcat&lt;/li&gt;&lt;li&gt;Démarrer Tomcat&lt;/li&gt;&lt;li&gt;Tester l'application: &lt;a href="http://localhost:8080"&gt;http://localhost:8080&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;
&lt;/div&gt;

&lt;div&gt;&lt;span style="font-weight:bold;"&gt;Conclusion:&lt;/span&gt; Voilà j'ai peut-être oublié des choses ou fait des erreurs de frappe mais l'essentiel est là ;)&lt;/div&gt;
&lt;div&gt;&lt;span style="font-weight:bold;"&gt;Rem:&lt;/span&gt; Il y a autant de manières de créer une application que de personnes, certaines pratiques sont une affaire de goût :) &lt;br/&gt;N'hésitez pas à ajouter vos commentaires...&lt;/div&gt;
&lt;div&gt;&lt;i&gt;Technorati tags: &lt;a href="http://technorati.com/tag/rails" rel="tag"&gt;rails&lt;/a&gt; &lt;a href="http://technorati.com/tag/tomcat" rel="tag"&gt;tomcat&lt;/a&gt; &lt;a href="http://technorati.com/tag/ror" rel="tag"&gt;ror&lt;/a&gt; &lt;a href="http://technorati.com/tag/ruby" rel="tag"&gt;ruby&lt;/a&gt; &lt;a href="http://technorati.com/tag/java" rel="tag"&gt;java&lt;/a&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10596376-1944223061383634492?l=rubyscube.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/RubysCube/~4/M-v5AM9xDSY" height="1" width="1"/&gt;</content><link rel="related" href="http://wiki.jruby.org/wiki/Jruby_on_Rails_on_Tomcat" title="Déployer une application ruby on rails dans Tomcat" /><link rel="replies" type="application/atom+xml" href="http://rubyscube.blogspot.com/feeds/1944223061383634492/comments/default" title="Publier les commentaires" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=10596376&amp;postID=1944223061383634492" title="2 commentaires" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/1944223061383634492?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/1944223061383634492?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RubysCube/~3/M-v5AM9xDSY/dployer-une-application-ruby-on-rails.html" title="Déployer une application ruby on rails dans Tomcat" /><author><name>Benjamin Francisoud</name><uri>http://www.blogger.com/profile/14823114858391962141</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="13057970757532367135" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total><feedburner:origLink>http://rubyscube.blogspot.com/2008/03/dployer-une-application-ruby-on-rails.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0cDSX07eip7ImA9WxZXGEw.&quot;"><id>tag:blogger.com,1999:blog-10596376.post-2218041341483476608</id><published>2008-03-06T04:38:00.002-10:00</published><updated>2008-03-06T04:51:18.302-10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-03-06T04:51:18.302-10:00</app:edited><title>Améliorer la lisibilité avec Array.collect</title><content type="html">&lt;div&gt;Je n'ai pas l'habitude (venant du monde java) d'utiliser les méthodes &lt;a href="http://www.ruby-doc.org/core/classes/Array.html#M002210"&gt;collect&lt;/a&gt;, &lt;a href="http://www.ruby-doc.org/core/classes/Array.html#M002219"&gt;reject&lt;/a&gt;, &lt;a href="http://www.ruby-doc.org/core/classes/Array.html#M002214"&gt;select&lt;/a&gt; de Array.&lt;/div&gt;
&lt;div&gt;Voilà un cas d'utilisation où j'ai nettement vu l'amélioration de lisibilité du code.&lt;br/&gt;
Imaginez qu'on veut afficher la liste des noms de users séparés par un espace.
&lt;/div&gt;
&lt;div&gt;Avant:
&lt;pre&gt;&lt;code&gt;
names = ""
for user in users
    names &lt;&lt; "#{user.user_username} "
end
return names.chomp
&lt;/code&gt;&lt;/pre&gt;
&lt;br/&gt;
Après:
&lt;pre&gt;&lt;code&gt;
names = users.collect { |user| user.user_username}
return names.join(' ')
&lt;/code&gt;&lt;/pre&gt;
&lt;br/&gt;
C'est tout simple mais quand on pas l'habitude; on y pense pas forcément ;) &lt;br/&gt;
Je découvre avec un peu de retard l'utilité de "collect()" mais mieux vaut tard que jamais :D
&lt;/div&gt;
&lt;div&gt;&lt;i&gt;Technorati tags: &lt;a href="http://technorati.com/tag/ruby" rel="tag"&gt;ruby&lt;/a&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10596376-2218041341483476608?l=rubyscube.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/RubysCube/~4/0pxmpQHoSNI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://rubyscube.blogspot.com/feeds/2218041341483476608/comments/default" title="Publier les commentaires" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=10596376&amp;postID=2218041341483476608" title="2 commentaires" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/2218041341483476608?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/2218041341483476608?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RubysCube/~3/0pxmpQHoSNI/amliorer-la-lisibilit-avec-arraycollect.html" title="Améliorer la lisibilité avec Array.collect" /><author><name>Benjamin Francisoud</name><uri>http://www.blogger.com/profile/14823114858391962141</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="13057970757532367135" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total><feedburner:origLink>http://rubyscube.blogspot.com/2008/03/amliorer-la-lisibilit-avec-arraycollect.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEMFQn08fip7ImA9WxZXF08.&quot;"><id>tag:blogger.com,1999:blog-10596376.post-903319644259572768</id><published>2008-03-05T04:04:00.002-10:00</published><updated>2008-03-05T04:13:33.376-10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-03-05T04:13:33.376-10:00</app:edited><title>Assertion en ruby</title><content type="html">&lt;div&gt;Je me demandais si le mot clef "assert" existe en ruby... je ne l'ai pas trouvé mais par contre c'est très simple de le réinventer:
&lt;pre&gt;&lt;code&gt;
def assert(*msg)
  raise "Assertion failed ! #{msg}" unless yield if $DEBUG
end
&lt;/code&gt;&lt;/pre&gt;

Un exemple d'utilisation:
&lt;pre&gt;&lt;code&gt;
$DEBUG = true
i = 0
assert("mon msg") {i == 1}
&lt;/code&gt;&lt;/pre&gt;

Résultat:
&lt;pre&gt;
Exception `RuntimeError' at assert.rb:2 - Assertion failed ! mon msg
assert.rb:2:in `assert': Assertion failed ! mon msg (RuntimeError)
        from assert.rb:7
&lt;/pre&gt;
source: &lt;a href="http://snippets.dzone.com/posts/show/925"&gt;dzone.com&lt;/a&gt;&lt;/div&gt;
&lt;br/&gt;
&lt;div&gt;&lt;i&gt;Technorati tags: &lt;a href="http://technorati.com/tag/ruby" rel="tag"&gt;ruby&lt;/a&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10596376-903319644259572768?l=rubyscube.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/RubysCube/~4/w4j6J2zSUoA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://rubyscube.blogspot.com/feeds/903319644259572768/comments/default" title="Publier les commentaires" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=10596376&amp;postID=903319644259572768" title="1 commentaires" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/903319644259572768?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/903319644259572768?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RubysCube/~3/w4j6J2zSUoA/assertion-en-ruby.html" title="Assertion en ruby" /><author><name>Benjamin Francisoud</name><uri>http://www.blogger.com/profile/14823114858391962141</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="13057970757532367135" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total><feedburner:origLink>http://rubyscube.blogspot.com/2008/03/assertion-en-ruby.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkMEQns4cSp7ImA9WxZXFks.&quot;"><id>tag:blogger.com,1999:blog-10596376.post-3612922868820108479</id><published>2008-03-04T06:49:00.003-10:00</published><updated>2008-03-04T11:00:03.539-10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-03-04T11:00:03.539-10:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="rails" /><title>Problème avec Webrick et authenticate_or_request_with_http_basic</title><content type="html">&lt;div&gt;Je ne sais pas pourquoi mais il semblerait que le &lt;a href="http://railscasts.com/episodes/82"&gt;authenticate_or_request_with_http_basic&lt;/a&gt; de rails 2 ne fonctionne pas sous webrick (sous windows ?).&lt;/div&gt;
&lt;br/&gt;
&lt;div&gt;Je n'arrive pas à le faire marcher (je passe l'authentification comme si elle n'existait pas) en mode development ou production.&lt;br/&gt; Par contre avec Mongrel ça fonctionne ?!&lt;/div&gt;
&lt;br/&gt;
&lt;div&gt;J'ai trouvé un &lt;a href="http://www.railsforum.com/viewtopic.php?pid=54691"&gt;thread&lt;/a&gt; où d'autres personnes ont l'air d'avoir le même genre de problème...&lt;/div&gt;
&lt;pre&gt;
C:\...&gt;ruby --version
ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]
C:\...&gt;rails --version
Rails 2.0.2
&lt;/pre&gt;
&lt;br/&gt;&lt;br/&gt;
&lt;div&gt;&lt;i&gt;Technorati tags: &lt;a href="http://technorati.com/tag/rails" rel="tag"&gt;rails&lt;/a&gt; &lt;a href="http://technorati.com/tag/webrick" rel="tag"&gt;webrick&lt;/a&gt; &lt;a href="http://technorati.com/tag/ror" rel="tag"&gt;ror&lt;/a&gt; &lt;a href="http://technorati.com/tag/ruby" rel="tag"&gt;ruby&lt;/a&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10596376-3612922868820108479?l=rubyscube.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/RubysCube/~4/NTM8bGv5dUI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://rubyscube.blogspot.com/feeds/3612922868820108479/comments/default" title="Publier les commentaires" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=10596376&amp;postID=3612922868820108479" title="0 commentaires" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/3612922868820108479?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/3612922868820108479?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RubysCube/~3/NTM8bGv5dUI/problme-avec-webrick-et.html" title="Problème avec Webrick et authenticate_or_request_with_http_basic" /><author><name>Benjamin Francisoud</name><uri>http://www.blogger.com/profile/14823114858391962141</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="13057970757532367135" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://rubyscube.blogspot.com/2008/03/problme-avec-webrick-et.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEQNQHs5eyp7ImA9WxZXFUs.&quot;"><id>tag:blogger.com,1999:blog-10596376.post-5347458043329130917</id><published>2008-03-03T06:27:00.003-10:00</published><updated>2008-03-03T06:39:51.523-10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-03-03T06:39:51.523-10:00</app:edited><title>MD5 en Ruby</title><content type="html">&lt;div&gt;Pour mon autentification d'un utilisateur avec rails en utilisant la méthode "authenticate_or_request_with_http_basic" de &lt;a href="http://railscasts.com/episodes/82"&gt;Basic HTTP authentication&lt;/a&gt;, j'avais besoin de vérifer le mot de passe.&lt;/div&gt;
&lt;br/&gt;
&lt;div&gt;Pour celà, j'avais besoin de transformer le mot de passe saisi par l'utilisateur en &lt;a href="http://en.wikipedia.org/wiki/Md5"&gt;md5&lt;/a&gt; pour le comparer avec le md5 stocké en base (pour éviter de stocker des mots de passe en clair dans la base de données).&lt;/div&gt;
&lt;div&gt;Et bien c'est très simple, il suffit de 2 lignes de code:
&lt;pre&gt;&lt;code&gt;
require 'digest/md5'
hash = Digest::MD5.hexdigest(password)
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;Dans le cas de mon application rails pour voir le code complet, ça donne:
&lt;pre&gt;&lt;code&gt;
class ApplicationController &lt; ActionController::Base
  before_filter :authenticate
  
  protected
  
  def authenticate
    authenticate_or_request_with_http_basic do |username, password|
      auth = User.auth?(username, password)
      if(auth)
        session[:auth], session[:username] = true, username
        return true
      end
      return false
    end
  end
end
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;
require 'digest/md5'

class User &lt; ActiveRecord::Base
  # return true if (username and hashed_password) are correct
  def self.auth?(username, password)
    hashed_password = Digest::MD5.hexdigest(password)
    user = User.find(:first, 
        :conditions =&gt; "username='#{username}' and password='#{hashed_password}'" )
    logger.info "#{username}/#{hashed_password} &gt; auth? : #{!user.nil?}"
    return !user.nil?
  end
end
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;&lt;i&gt;Technorati tags: &lt;a href="http://technorati.com/tag/rails" rel="tag"&gt;rails&lt;/a&gt; &lt;a href="http://technorati.com/tag/md5" rel="tag"&gt;md5&lt;/a&gt; &lt;a href="http://technorati.com/tag/ruby" rel="tag"&gt;ruby&lt;/a&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10596376-5347458043329130917?l=rubyscube.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/RubysCube/~4/0cyCPsQk8z4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://rubyscube.blogspot.com/feeds/5347458043329130917/comments/default" title="Publier les commentaires" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=10596376&amp;postID=5347458043329130917" title="0 commentaires" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/5347458043329130917?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/5347458043329130917?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RubysCube/~3/0cyCPsQk8z4/md5-en-ruby.html" title="MD5 en Ruby" /><author><name>Benjamin Francisoud</name><uri>http://www.blogger.com/profile/14823114858391962141</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="13057970757532367135" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://rubyscube.blogspot.com/2008/03/md5-en-ruby.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C04DRH0ycCp7ImA9WxZQFk0.&quot;"><id>tag:blogger.com,1999:blog-10596376.post-6853914736850524479</id><published>2008-02-21T03:45:00.004-10:00</published><updated>2008-02-21T03:52:55.398-10:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-02-21T03:52:55.398-10:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="ruby" /><title>Enlever les lignes en double dans un fichier</title><content type="html">&lt;div&gt;Une petie astuce que j'ai posté sur le blog de &lt;a href="http://vafer.org/blog/20080221010557"&gt;torsten&lt;/a&gt; en réponse à sa question:&lt;br/&gt;
Comment afficher les lignes d'un fichier en enlevant les doublons (faire une sorte de 'unique' ou 'distinct' sur les lignes du fichier)&lt;/div&gt;
&lt;br/&gt;
&lt;div&gt;Je me suis dit que ça pourrait servir à d'autres donc je le repost ici:
&lt;pre&gt;&lt;code&gt;puts IO.readlines('data.txt').uniq&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;br/&gt;
&lt;div&gt;Par contre sur un gros fichier ça doit consommer beaucoup de mémoire...&lt;/div&gt;
&lt;br/&gt;
&lt;div&gt;&lt;i&gt;Technorati tags: &lt;a href="http://technorati.com/tag/fichier" rel="tag"&gt;fichier&lt;/a&gt; &lt;a href="http://technorati.com/tag/ruby" rel="tag"&gt;ruby&lt;/a&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/10596376-6853914736850524479?l=rubyscube.blogspot.com'/&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/RubysCube/~4/Xv0JbNip6o0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://rubyscube.blogspot.com/feeds/6853914736850524479/comments/default" title="Publier les commentaires" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=10596376&amp;postID=6853914736850524479" title="0 commentaires" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/6853914736850524479?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/10596376/posts/default/6853914736850524479?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/RubysCube/~3/Xv0JbNip6o0/enlever-les-lignes-en-double-dans-un.html" title="Enlever les lignes en double dans un fichier" /><author><name>Benjamin Francisoud</name><uri>http://www.blogger.com/profile/14823114858391962141</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="13057970757532367135" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total><feedburner:origLink>http://rubyscube.blogspot.com/2008/02/enlever-les-lignes-en-double-dans-un.html</feedburner:origLink></entry></feed>
