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

<channel>
	<title>tomrochette.com</title>
	<atom:link href="http://www.tomrochette.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tomrochette.com</link>
	<description>What&#039;s up with my life</description>
	<lastBuildDate>Sat, 07 Apr 2012 01:17:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>PHPUnit &#8211; PHP Fatal error: require_once(): Failed opening required &#8216;PHPUnit/Util/Filter.php&#8217;</title>
		<link>http://www.tomrochette.com/phpunit-php-fatal-error-require_once-failed-opening-required-phpunitutilfilter-php/</link>
		<comments>http://www.tomrochette.com/phpunit-php-fatal-error-require_once-failed-opening-required-phpunitutilfilter-php/#comments</comments>
		<pubDate>Sat, 26 Nov 2011 00:14:53 +0000</pubDate>
		<dc:creator>tomzx</dc:creator>
				<category><![CDATA[Programmation]]></category>

		<guid isPermaLink="false">http://www.tomrochette.com/?p=656</guid>
		<description><![CDATA[A friend of mine was trying to install PHPUnit on his mac (OS X Lion), but unfortunately, he got stuck during the process. At some point, he was faced with this error being displayed. We both looked at the problem and first made sure that said file existed. It was the case, weird&#8230; A bit [...]]]></description>
			<content:encoded><![CDATA[<p>A friend of mine was trying to install PHPUnit on his mac (OS X Lion), but unfortunately, he got stuck during the process.</p>
<p>At some point, he was faced with this error being displayed. We both looked at the problem and first made sure that said file existed. It was the case, weird&#8230;</p>
<p>A bit of googling will reveal that this is frequently fixed by appending the path to the pear folder to your php include_path (defined in your php.ini). But in his case, that was already done and it still wasn&#8217;t working.</p>
<p>Next up was to check permissions problem. Not having read permissions on the file would of been an easy one to fix, but again, this was not the cause of the problem.</p>
<p>At this point you might be asking yourself, how come the file exists, you have permission to read it, but yet, you can&#8217;t&#8230;</p>
<p>Well, the actual problem was that his OS was set up such that the maxfiles was set to 256 and PHPUnit had already reached that amount of open files.</p>
<p>To check if you have the same problem, try running phpunit using <strong>sudo dtruss -f -t open phpunit</strong> (Linux users will want to use <strong>strace -e open phpunit</strong>). In your output, you should see the files being opened. At some point, you&#8217;ll find <strong>Err#24</strong>, which indicates &#8220;To many file descriptors opened&#8221;. If you have this problem, then the following should help you fix it.</p>
<p>The solution to this problem is quite easy. What you&#8217;ll want to do is increase the maximum number of descriptors that can be used by a process. You can do it temporarily with <strong>ulimit -S -n 1024</strong> (to use 1024 instead of 256). Another way is to edit it and keep those settings (until you change them again) is to use <strong>launchctl limit maxfiles 1024 unlimited</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tomrochette.com/phpunit-php-fatal-error-require_once-failed-opening-required-phpunitutilfilter-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHPUnit not outputting coverage-html</title>
		<link>http://www.tomrochette.com/phpunit-not-outputting-coverage-html/</link>
		<comments>http://www.tomrochette.com/phpunit-not-outputting-coverage-html/#comments</comments>
		<pubDate>Tue, 25 Oct 2011 01:31:45 +0000</pubDate>
		<dc:creator>tomzx</dc:creator>
				<category><![CDATA[Programmation]]></category>

		<guid isPermaLink="false">http://www.tomrochette.com/?p=643</guid>
		<description><![CDATA[I&#8217;ve been using PHPUnit recently to test a Kohana application I&#8217;m developing as my last semester project for my bachelor&#8217;s degree. At some point during the development, code coverage generation decided to stop working on my desktop (my remote CI still had no problem). I started diagnosing the problem, being on Windows, I thought it [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using PHPUnit recently to test a Kohana application I&#8217;m developing as my last semester project for my bachelor&#8217;s degree.</p>
<p>At some point during the development, code coverage generation decided to stop working on my desktop (my remote CI still had no problem).</p>
<p>I started diagnosing the problem, being on Windows, I thought it could be due to the &#8220;poor job&#8221; I had done on installing php, pear and phpunit. I didn&#8217;t want to go through the trouble or reinstalling everything though and just did the minimum: uninstall and reinstall phpunit. No success at that point.</p>
<p>I decided to go back a week or two in my SVN revisions, have it generate code coverage and get to the point were code coverage generation would fail. Took around 2 SVN &#8220;update to&#8221; to get to that point. After that, I tried updating the tests, but the new tests were using new features. So I updated the code first, then started updating the test files one by one. After a couple of files, I hit an interesting message:</p>
<p><strong>ErrorException [ 1 ]: Allowed memory size of 134217728 bytes exhausted (tried to allocate 543278 bytes) ~ C:\php\pear\Text\Template.php [ 134 ]</strong></p>
<p>I never had that message show up before, which is kind of strange. I would have expected PHP to tell me that same message everytime it tried to generate the documentation but couldn&#8217;t&#8230;</p>
<p>So, quick fix was for me to edit my php.ini so that the memory_limit = 256M instead of 128M.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tomrochette.com/phpunit-not-outputting-coverage-html/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Daniel Pink &#8211; Motivation</title>
		<link>http://www.tomrochette.com/daniel-pink-motivation/</link>
		<comments>http://www.tomrochette.com/daniel-pink-motivation/#comments</comments>
		<pubDate>Sat, 11 Jun 2011 00:21:52 +0000</pubDate>
		<dc:creator>tomzx</dc:creator>
				<category><![CDATA[Général]]></category>
		<category><![CDATA[Philosophie]]></category>

		<guid isPermaLink="false">http://www.tomrochette.com/?p=625</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><iframe width="480" height="320" src="http://www.youtube.com/embed/u6XAPnuFjJc" frameborder="0" allowfullscreen></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tomrochette.com/daniel-pink-motivation/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Serializing &#8220;anything&#8221; in C# using extensions</title>
		<link>http://www.tomrochette.com/serializing-anything-in-c-using-extensions/</link>
		<comments>http://www.tomrochette.com/serializing-anything-in-c-using-extensions/#comments</comments>
		<pubDate>Sun, 05 Jun 2011 04:22:07 +0000</pubDate>
		<dc:creator>tomzx</dc:creator>
				<category><![CDATA[Informatique]]></category>
		<category><![CDATA[Programmation]]></category>

		<guid isPermaLink="false">http://www.tomrochette.com/?p=615</guid>
		<description><![CDATA[I was recently interested in getting C# objects to serialize into XML so that I could save and load a configuration out of a file. Sadly, C# support for XML and serialization is far from the best stuff I&#8217;ve seen in programming. But anyway, here&#8217;s what this post is about: using DataContract with a bit [...]]]></description>
			<content:encoded><![CDATA[<p>I was recently interested in getting C# objects to serialize into XML so that I could save and load a configuration out of a file. Sadly, C# support for XML and serialization is far from the best stuff I&#8217;ve seen in programming. But anyway, here&#8217;s what this post is about: using DataContract with a bit of extension magic to get anything to be serializable into XML!</p>
<p>One small problem when you use the Serializable attribute of C# is that you cannot serialize dictionary directly and we all know dictionaries are a VERY useful structure to have serialized. One easy way to have serializable dictionaries is to use the DataContract attribute instead. It implies a bit more code compared to the version where you use the Serializable attribute, but not that much more (mostly the WriteObject and ReadObject lines).</p>
<p>I haven&#8217;t coded any of this, so thanks to user <a href="http://stackoverflow.com/users/285678/loudenvier">Loudenvier</a> from <a href="http://www.stackoverflow.com">Stackoverflow.com</a>! This solution allows you to turn ANY object into an XML string representation. It also allows you to turn that string back into an object representation. Very useful.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">class</span> SerializationExtensions
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">string</span> Serialize<span style="color: #008000;">&lt;</span>T<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span> T obj<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        var serializer <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> DataContractSerializer<span style="color: #008000;">&#40;</span>obj<span style="color: #008000;">.</span><span style="color: #0000FF;">GetType</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008000;">&#40;</span>var writer <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> StringWriter<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
        <span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008000;">&#40;</span>var stm <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> XmlTextWriter<span style="color: #008000;">&#40;</span>writer<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            serializer<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteObject</span><span style="color: #008000;">&#40;</span>stm, obj<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #0600FF; font-weight: bold;">return</span> writer<span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> T Deserialize<span style="color: #008000;">&lt;</span>T<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span> <span style="color: #6666cc; font-weight: bold;">string</span> serialized<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        var serializer <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> DataContractSerializer<span style="color: #008000;">&#40;</span><span style="color: #008000;">typeof</span><span style="color: #008000;">&#40;</span>T<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008000;">&#40;</span>var reader <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> StringReader<span style="color: #008000;">&#40;</span>serialized<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
        <span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008000;">&#40;</span>var stm <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> XmlTextReader<span style="color: #008000;">&#40;</span>reader<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #008000;">&#40;</span>T<span style="color: #008000;">&#41;</span>serializer<span style="color: #008000;">.</span><span style="color: #0000FF;">ReadObject</span><span style="color: #008000;">&#40;</span>stm<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>How to use example</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008080; font-style: italic;">// dictionary to serialize to string</span>
Dictionary<span style="color: #008000;">&lt;</span><span style="color: #6666cc; font-weight: bold;">string</span>, <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&gt;</span> myDict <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Dictionary<span style="color: #008000;">&lt;</span><span style="color: #6666cc; font-weight: bold;">string</span>, <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #008080; font-style: italic;">// add items to the dictionary...</span>
myDict<span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">...</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #008080; font-style: italic;">// serialization is straight-forward</span>
<span style="color: #6666cc; font-weight: bold;">string</span> serialized <span style="color: #008000;">=</span> myDict<span style="color: #008000;">.</span><span style="color: #0000FF;">Serialize</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #008000;">...</span>
<span style="color: #008080; font-style: italic;">// deserialization is just as simple</span>
Dictionary<span style="color: #008000;">&lt;</span><span style="color: #6666cc; font-weight: bold;">string</span>, <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&gt;</span> myDictCopy <span style="color: #008000;">=</span> serialized<span style="color: #008000;">.</span><span style="color: #0000FF;">Deserialize</span><span style="color: #008000;">&lt;</span>Dictionary<span style="color: #008000;">&lt;</span><span style="color: #6666cc; font-weight: bold;">string</span>,<span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&gt;&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></pre></td></tr></table></div>

<p><strong>Source:</strong> <a href="http://www.stackoverflow.com/questions/1124597/why-isnt-there-an-xml-serializable-dictionary-in-net/5941122#5941122">http://www.stackoverflow.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tomrochette.com/serializing-anything-in-c-using-extensions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enginuity series on GameDev.net</title>
		<link>http://www.tomrochette.com/enginuity-series-on-gamedev-net/</link>
		<comments>http://www.tomrochette.com/enginuity-series-on-gamedev-net/#comments</comments>
		<pubDate>Mon, 25 Apr 2011 04:01:00 +0000</pubDate>
		<dc:creator>tomzx</dc:creator>
				<category><![CDATA[Programmation]]></category>
		<category><![CDATA[gamedev]]></category>

		<guid isPermaLink="false">http://www.tomrochette.com/?p=598</guid>
		<description><![CDATA[I&#8217;ve just stumbled upon a series of articles from Richard Fine that were written in 2003 which describes the basics of a game engine he calls Enginuity. It lays the foundations to basic memory management, logging, kernel and tasks management and much more. An extremely interesting read. Sadly, you can read in the articles that [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just stumbled upon a series of articles from Richard Fine that were written in 2003 which describes the basics of a game engine he calls Enginuity. It lays the foundations to basic memory management, logging, kernel and tasks management and much more. An extremely interesting read. Sadly, you can read in the articles that this was projected to be a series of more than 8 articles, but it seems it stopped at the fifth article. If anyone knows where to find the rest (if it exists), I&#8217;d be grateful!</p>
<p><strong>On GameDev.net:</strong> <a href="http://www.gamedev.net/page/resources/_/reference/programming/game-programming/300/enginuity-part-i-r1947">Part 1</a> <a href="http://www.gamedev.net/page/resources/_/reference/programming/game-programming/300/enginuity-part-ii-r1954">Part 2</a> <a href="http://www.gamedev.net/page/resources/_/reference/programming/game-programming/300/enginuity-part-iii-r1959">Part 3</a> <a href="http://www.gamedev.net/page/resources/_/reference/programming/game-programming/300/enginuity-part-iv-r1973">Part 4</a> <a href="http://www.gamedev.net/page/resources/_/reference/programming/game-programming/300/enginuity-part-v-r2011">Part 5</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tomrochette.com/enginuity-series-on-gamedev-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automatic Mechanical Self Replication</title>
		<link>http://www.tomrochette.com/automatic-mechanical-self-replication/</link>
		<comments>http://www.tomrochette.com/automatic-mechanical-self-replication/#comments</comments>
		<pubDate>Mon, 22 Nov 2010 04:52:50 +0000</pubDate>
		<dc:creator>tomzx</dc:creator>
				<category><![CDATA[Général]]></category>

		<guid isPermaLink="false">http://www.tomrochette.com/?p=538</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><iframe src="http://player.vimeo.com/video/10297756" width="400" height="300" frameborder="0"></iframe><br />
<iframe src="http://player.vimeo.com/video/10298933" width="400" height="300" frameborder="0"></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tomrochette.com/automatic-mechanical-self-replication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Éthique de l&#8217;ingénieur et drones militaires</title>
		<link>http://www.tomrochette.com/ethique-de-lingenieur-et-drones-militaires/</link>
		<comments>http://www.tomrochette.com/ethique-de-lingenieur-et-drones-militaires/#comments</comments>
		<pubDate>Sun, 02 May 2010 17:17:41 +0000</pubDate>
		<dc:creator>tomzx</dc:creator>
				<category><![CDATA[Général]]></category>

		<guid isPermaLink="false">http://www.tomrochette.com/?p=512</guid>
		<description><![CDATA[Les départements militaires sont souvent les premiers à placer leur argent dans des technologies révolutionnaires qui pourraient leur permettre d’avoir un avantage stratégique sur leurs ennemis. Un exemple connu est celui de la conception de l’ordinateur. Les ordinateurs avaient comme but premier d’effectuer le calcul d’équations complexes décrivant la trajectoire d’un projectile. Ces équations contenaient [...]]]></description>
			<content:encoded><![CDATA[<p>Les départements militaires sont souvent les premiers à placer leur argent dans des  technologies révolutionnaires qui pourraient leur permettre d’avoir un avantage stratégique sur leurs ennemis. Un exemple connu est celui de la conception de l’ordinateur. Les ordinateurs avaient comme but premier d’effectuer le calcul d’équations complexes décrivant la trajectoire d’un projectile. Ces équations contenaient plusieurs paramètres tels que la vitesse du vent, la distance désirée, la gravité ainsi que la vitesse de déplacement du navire qui tirerait le projectile. Avec les ordinateurs, les scientifiques étaient en mesure d’effectuer ces calculs de manière accélérée. Ils pouvaient de plus assurer que les calculs ne contiendraient pas d’erreurs humaines puisqu’il fallait répéter cette même tâche plusieurs centaines de fois. Une seconde invention développée par un département militaire, DARPA (Defense Advanced Research Projects Agency), est Internet, un des systèmes de communication les plus employés à l’heure actuelle. </p>
<p>Avec les avancées technologiques effectuées au fil des années, les départements militaires ont commencé à chercher des moyens d’accroitre leur capacité d’absorption d’information. Il fallait de plus que cela ne nécessite pas l’augmentation du personnel nécessaire pour ce faire. Une augmentation dans le volume de communication aurait pour impact d’augmenter les chances de transmettre des messages subtilement différents entre individus, ce qui pourrait causer de graves problèmes, surtout en situation d’urgence. Afin d’accroitre leur intelligence sur le terrain en temps de guerre, les départements militaires ont acheté des drones aériens provenant de contractants. Un drone aérien est en quelque sorte un robot, semblable à un avion, mais sans pilote dans le cockpit. Le drone est piloté à distance par un pilote, les deux communiquant par système radio ou satellite. Ces drones ont pour objectif de survoler certains points cibles afin d’obtenir de<br />
l’intelligence et d’attaquer des cibles stratégiques à l’aide de l’information obtenue de diverses sources. </p>
<p>Les recherches actuelles tentent de concevoir des drones qui seraient pilotés automatiquement (sans assistance humaine) et capables de communiquer entre eux afin d’augmenter leur efficacité globale. La conception de systèmes étant capables de tuer se basant sur une intelligence artificielle ou des décisions préétablies amène à poser la question suivante :  </p>
<div style="text-align: center;"><strong>Est-il éthiquement défendable pour un ingénieur de concevoir des drones aériens intelligents employés pour des fins militaires?</strong></div>
<p>Afin d’arriver à une conclusion justifiée sur cette question, une étude de chacune des positions sera présentée. Premièrement, il s’agira de comprendre et analyser les raisons qui appuient la position, c’est-à-dire qu’il est actuellement défendable pour un ingénieur de concevoir de tels systèmes. Deuxièmement, nous aborderons les raisons qui soutiennent qu’il n’est pas défendable de concevoir ces systèmes intelligents. Finalement, une synthèse de cette discussion permettra d’établir la position qui semble la plus appropriée pour l’instant. </p>
<div class="alert">Pour lire l’ensemble du texte: <a href='http://www.tomrochette.com/wp-content/uploads/2010/05/SSH5501-Travail-personnel.pdf'>Télécharger le PDF</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.tomrochette.com/ethique-de-lingenieur-et-drones-militaires/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Marshal un hash avec proc</title>
		<link>http://www.tomrochette.com/marshal-un-hash-avec-proc/</link>
		<comments>http://www.tomrochette.com/marshal-un-hash-avec-proc/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 06:15:15 +0000</pubDate>
		<dc:creator>tomzx</dc:creator>
				<category><![CDATA[Programmation]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.tomrochette.com/?p=503</guid>
		<description><![CDATA[Il arrive souvent que l&#8217;on veut écrire un hash imbriqué, tel que objet[:unevaleur][:unesecondevaleur] accédant à la valeur :unesecondevaleur du hash contenu dans objet[:unevaleur]. Voici une implémentation simpliste de la chose. 1 X = Hash.new &#123;&#124;h, k&#124; h&#91;k&#93; = Hash.new&#40;0&#41;&#125; Avec ce code, à chaque fois qu&#8217;on crée un hash non-existant dans X, on ajoute un [...]]]></description>
			<content:encoded><![CDATA[<p>Il arrive souvent que l&#8217;on veut écrire un hash imbriqué, tel que <strong>objet[:unevaleur][:unesecondevaleur]</strong> accédant à la valeur <strong>:unesecondevaleur</strong> du hash contenu dans <strong>objet[:unevaleur]</strong>. Voici une implémentation simpliste de la chose.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">X = <span style="color:#CC00FF; font-weight:bold;">Hash</span>.<span style="color:#9900CC;">new</span> <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">|</span>h, k<span style="color:#006600; font-weight:bold;">|</span> h<span style="color:#006600; font-weight:bold;">&#91;</span>k<span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#CC00FF; font-weight:bold;">Hash</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#125;</span></pre></td></tr></table></div>

<p>Avec ce code, à chaque fois qu&#8217;on crée un hash non-existant dans X, on ajoute un nouveau hash avec 0 comme valeur par défaut. Si maintenant on veut marshaller X, on obtient l&#8217;erreur suivante:</p>
<blockquote><p>Marshal.dump(X)<br />
TypeError: can&#8217;t dump hash with default proc</p></blockquote>
<p>On obtient cette erreur puisque, lorsqu&#8217;on crée X, on a passé un bloc à new ce qui fait que lorsqu&#8217;on veut le marshaller, Ruby n&#8217;est pas mesure de marshaller le proc associé.<br />
Afin d&#8217;être en mesure de marshaller X, il suffit simplement d&#8217;éliminer le proc en effectuant une copie vers un nouveau hash sans proc.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">Y = <span style="color:#CC00FF; font-weight:bold;">Hash</span>.<span style="color:#9900CC;">new</span>
X.<span style="color:#9900CC;">each</span> <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">|</span>h, k<span style="color:#006600; font-weight:bold;">|</span> Y<span style="color:#006600; font-weight:bold;">&#91;</span>h<span style="color:#006600; font-weight:bold;">&#93;</span> = X<span style="color:#006600; font-weight:bold;">&#91;</span>h<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#125;</span>
<span style="color:#CC00FF; font-weight:bold;">Marshal</span>.<span style="color:#9900CC;">dump</span><span style="color:#006600; font-weight:bold;">&#40;</span>Y<span style="color:#006600; font-weight:bold;">&#41;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.tomrochette.com/marshal-un-hash-avec-proc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Software developer</title>
		<link>http://www.tomrochette.com/software-developer/</link>
		<comments>http://www.tomrochette.com/software-developer/#comments</comments>
		<pubDate>Sun, 26 Apr 2009 22:53:36 +0000</pubDate>
		<dc:creator>tomzx</dc:creator>
				<category><![CDATA[Informatique]]></category>
		<category><![CDATA[Philosophie]]></category>

		<guid isPermaLink="false">http://www.tomrochette.com/software-engineering/</guid>
		<description><![CDATA[A man is flying in a hot air balloon and realizes he is lost. He reduces height and spots a man down below. He lowers the balloon further and shouts: &#8220;Excuse me, can you tell me where I am?&#8221; The man below says: &#8220;Yes you&#8217;re in a hot air balloon, hovering 30 feet above this [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>A man is flying in a hot air balloon and realizes he is lost. He reduces height and spots a man down below. He lowers the balloon further and shouts: &#8220;Excuse me, can you tell me where I am?&#8221;</p>
<p>The man below says: &#8220;Yes you&#8217;re in a hot air balloon, hovering 30 feet above this field.&#8221;</p>
<p>&#8220;You must be a software developer,&#8221; says the balloonist.</p>
<p>&#8220;I am,&#8221; replies the man. &#8220;How did you know?&#8221;</p>
<p>&#8220;Well,&#8221; says the balloonist, &#8220;everything you have told me is technically correct, but it&#8217;s of no use to anyone.&#8221;</p>
<p>The man below says, &#8220;You must work in business as a manager.&#8221; &#8220;I do,&#8221; replies the balloonist, &#8220;but how did you know?&#8221;</p>
<p>&#8220;Well,&#8221; says the man, &#8220;you don&#8217;t know where you are or where you are going, but you expect me to be able to help. You&#8217;re in the same position you were before we met but now it&#8217;s my fault.&#8221; </p></blockquote>
<p><strong>Source:</strong> <a href="http://www.codinghorror.com/blog/archives/000230.html">Coding Horror</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tomrochette.com/software-developer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Développement logiciel sur plateforme Linux et Windows</title>
		<link>http://www.tomrochette.com/developpement-logiciel-sur-plateforme-linux-et-windows/</link>
		<comments>http://www.tomrochette.com/developpement-logiciel-sur-plateforme-linux-et-windows/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 02:13:45 +0000</pubDate>
		<dc:creator>tomzx</dc:creator>
				<category><![CDATA[Informatique]]></category>
		<category><![CDATA[Logiciels]]></category>
		<category><![CDATA[Programmation]]></category>

		<guid isPermaLink="false">http://www.tomrochette.com/?p=265</guid>
		<description><![CDATA[Le domaine informatique a toujours été dominé par trois géants (du côté consommateur) : Linux, Windows et Macintosh. Les trois systèmes étant très différents, cela a toujours causé des complications aux programmeurs qui voulaient rendre leur code accessible à une plus grande population. Ainsi, ils devaient « porter » leurs codes vers une nouvelle plateforme, [...]]]></description>
			<content:encoded><![CDATA[<p>Le domaine informatique a toujours été dominé par trois géants (du côté consommateur) : Linux, Windows et Macintosh. Les trois systèmes étant très différents, cela a toujours causé des complications aux programmeurs qui voulaient rendre leur code accessible à une plus grande population. Ainsi, ils devaient « porter » leurs codes vers une nouvelle plateforme, soit pour passer de Windows à Macintosh ou encore de Linux vers Windows par exemple. Afin de diminuer cette tâche qui se verrait devenir répétitive, ces développeurs ont eut l’idée de regrouper les ensembles de codes similaires afin d’en former des librairies qu’ils pourraient réutiliser pour accélérer le développement d’applications futures.</p>
<p>Avec l’ensemble des librairies qui ont été codés avec le temps (GTK, FTLK, Qt, wxWidgets, OpenGL, SDL, etc.), la majorité des plateformes informatiques ont commencés à devenir de plus en plus uniformes, permettant ainsi de déployer un même code sur plusieurs machines utilisant des systèmes d’opérations différents. On observe de plus la présence d’environnements de développement intégrés (EDI) multi-plateformes tel que Netbeans, Eclipse et Code::Blocks. Toutefois, il reste à déterminer quelle plateforme est la plus apte à permettre un développement qui sera rapide, efficace et de qualité. Afin de débattre de cette question, il est nécessaire d’évaluer certains aspects essentiels à la création d’un logiciel. Un logiciel peut être très facile à programmer mais être de piètre qualité en termes de performance (facilité de développement). Il peut être très long à programmer mais ne rien coûter (coûts reliées au développement). Les outils que les plateformes nous offrent peuvent être flexibles mais nécessiter une grande connaissance de ceux qui les emploient. Pour le développeur qui souhaite vendre son logiciel, il faut aussi connaître les diverses restrictions qui s’appliquent lorsqu’on emploi une librairie. Bref, il s’agit ici d’un ensemble d’aspects que nous aborderons afin de déterminer quelle plateforme entre Windows et Linux convient le mieux à un programmeur.</p>
<div class="alert">Pour lire l&#8217;ensemble du texte: <a href='http://www.tomrochette.com/wp-content/uploads/2009/04/log2410-tom-rochette.pdf'>Télécharger le PDF</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.tomrochette.com/developpement-logiciel-sur-plateforme-linux-et-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

