<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>William POTTIER - A Dev In The Sky</title>
	
	<link>http://blog.william-pottier.fr</link>
	<description>Blog d'un consultant la tête dans les étoiles...</description>
	<lastBuildDate>Tue, 08 Nov 2011 21:15:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/WilliamPottier" /><feedburner:info uri="williampottier" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><creativeCommons:license>http://creativecommons.org/licenses/by-nc-nd/3.0/</creativeCommons:license><image><link>http://creativecommons.org/licenses/by-nc-nd/3.0/</link><url>http://creativecommons.org/images/public/somerights20.gif</url><title>Some Rights Reserved</title></image><item>
		<title>Twig : insérer un morceau de template uniquement en mode debug</title>
		<link>http://feedproxy.google.com/~r/WilliamPottier/~3/4vhlzRBVNOo/</link>
		<comments>http://blog.william-pottier.fr/2011/11/twig-inserer-un-morceau-de-template-uniquement-en-mode-debug/#comments</comments>
		<pubDate>Tue, 08 Nov 2011 21:15:17 +0000</pubDate>
		<dc:creator>wizad</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[symfony2]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[twig]]></category>

		<guid isPermaLink="false">http://blog.william-pottier.fr/?p=70</guid>
		<description><![CDATA[Dans vos template Twig il peut vous arriver de vouloir insérer certains éléments uniquement en phase de debug (exemple : du code javascript pour remplir un formulaire de paiement avec des données de test). Voici donc comment faire : {% if _self.env.isDebug() %} &#60;!-- ceci ne sera visible qu'en debug --&#62; {% endif %}]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.william-pottier.fr%2F2011%2F11%2Ftwig-inserer-un-morceau-de-template-uniquement-en-mode-debug%2F" onclick="pageTracker._trackPageview('/outgoing/api.tweetmeme.com/share?url=http_3A_2F_2Fblog.william-pottier.fr_2F2011_2F11_2Ftwig-inserer-un-morceau-de-template-uniquement-en-mode-debug_2F&amp;referer=');"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.william-pottier.fr%2F2011%2F11%2Ftwig-inserer-un-morceau-de-template-uniquement-en-mode-debug%2F&amp;source=wizad&amp;style=normal&amp;service=bit.ly&amp;service_api=R_52f9b438fd727621c96803c397da1cbe&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Dans vos template <a title="Twig" href="http://twig.sensiolabs.org" target="_blank" onclick="pageTracker._trackPageview('/outgoing/twig.sensiolabs.org?referer=');">Twig </a> il peut vous arriver de vouloir insérer certains éléments uniquement en phase de debug (exemple : du code javascript pour remplir un formulaire de paiement avec des données de test).</p>
<p>Voici donc comment faire :</p>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">{% if _self.env.isDebug() %}<br />
<span style="color: #808080; font-style: italic;">&lt;!-- ceci ne sera visible qu'en debug --&gt;</span><br />
{% endif %}</div></div>
<img src="http://feeds.feedburner.com/~r/WilliamPottier/~4/4vhlzRBVNOo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.william-pottier.fr/2011/11/twig-inserer-un-morceau-de-template-uniquement-en-mode-debug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.william-pottier.fr/2011/11/twig-inserer-un-morceau-de-template-uniquement-en-mode-debug/</feedburner:origLink></item>
		<item>
		<title>Ajouter tous les fichiers sur svn</title>
		<link>http://feedproxy.google.com/~r/WilliamPottier/~3/nkC1B41NMaI/</link>
		<comments>http://blog.william-pottier.fr/2011/05/ajouter-tous-les-fichiers-sur-svn/#comments</comments>
		<pubDate>Mon, 09 May 2011 14:00:22 +0000</pubDate>
		<dc:creator>wizad</dc:creator>
				<category><![CDATA[Astuces]]></category>
		<category><![CDATA[astuce]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://blog.william-pottier.fr/?p=57</guid>
		<description><![CDATA[Voici la ligne de commande permettant d&#8217;ajouter automatiquement tous les nouveau fichiers de votre repository : svn st &#124; grep ? &#124; cut -c 8- &#124; xargs svn add]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.william-pottier.fr%2F2011%2F05%2Fajouter-tous-les-fichiers-sur-svn%2F" onclick="pageTracker._trackPageview('/outgoing/api.tweetmeme.com/share?url=http_3A_2F_2Fblog.william-pottier.fr_2F2011_2F05_2Fajouter-tous-les-fichiers-sur-svn_2F&amp;referer=');"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.william-pottier.fr%2F2011%2F05%2Fajouter-tous-les-fichiers-sur-svn%2F&amp;source=wizad&amp;style=normal&amp;service=bit.ly&amp;service_api=R_52f9b438fd727621c96803c397da1cbe&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Voici la ligne de commande permettant d&#8217;ajouter automatiquement tous les nouveau fichiers de votre repository :</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">svn st</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> ? <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-c</span> <span style="color: #000000;">8</span>- <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #c20cb9; font-weight: bold;">svn add</span></div></div>
<img src="http://feeds.feedburner.com/~r/WilliamPottier/~4/nkC1B41NMaI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.william-pottier.fr/2011/05/ajouter-tous-les-fichiers-sur-svn/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.william-pottier.fr/2011/05/ajouter-tous-les-fichiers-sur-svn/</feedburner:origLink></item>
		<item>
		<title>Php : aider l’autocompletion des IDE</title>
		<link>http://feedproxy.google.com/~r/WilliamPottier/~3/OaVFZpVBosI/</link>
		<comments>http://blog.william-pottier.fr/2011/03/php-aider-lautocompletion-des-ide/#comments</comments>
		<pubDate>Tue, 01 Mar 2011 16:14:39 +0000</pubDate>
		<dc:creator>wizad</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[ide]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tricks]]></category>

		<guid isPermaLink="false">http://blog.william-pottier.fr/?p=12</guid>
		<description><![CDATA[L&#8217;un des défauts du développement PHP est l&#8217;absence, parfois, d’auto-complétion dans nos IDE notamment lors de manipulation d&#8217;objet. En effet le typage dynamique de PHP empêche nos fidèles IDE de pourvoir déterminer correctement le type de la variable que nous manipulons et donc de déduire les méthodes et autres membres de classe à nous afficher. [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.william-pottier.fr%2F2011%2F03%2Fphp-aider-lautocompletion-des-ide%2F" onclick="pageTracker._trackPageview('/outgoing/api.tweetmeme.com/share?url=http_3A_2F_2Fblog.william-pottier.fr_2F2011_2F03_2Fphp-aider-lautocompletion-des-ide_2F&amp;referer=');"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.william-pottier.fr%2F2011%2F03%2Fphp-aider-lautocompletion-des-ide%2F&amp;source=wizad&amp;style=normal&amp;service=bit.ly&amp;service_api=R_52f9b438fd727621c96803c397da1cbe&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>L&#8217;un des défauts du développement PHP est l&#8217;absence, parfois, d’auto-complétion dans nos IDE notamment lors de manipulation d&#8217;objet. En effet le typage dynamique de PHP empêche nos fidèles IDE de pourvoir déterminer correctement le type de la variable que nous manipulons et donc de déduire les méthodes et autres membres de classe à nous afficher.</p>
<p>Néanmoins une solution existe au moins pour NetBeans (mais il me semble que tous les IDE récent doivent supporter cette fonction). Pour aider l&#8217;IDE il suffit ainsi de lui indiquer via la syntaxe PHPDoc le type de notre variable :</p>
<blockquote><p>/* @var $maVar MaClasse */</p></blockquote>
<p>De cette façon, vous disposerez de l&#8217;auto-complétion sur votre variable $maVar.</p>
<p>Happy Coding !</p>
<img src="http://feeds.feedburner.com/~r/WilliamPottier/~4/OaVFZpVBosI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.william-pottier.fr/2011/03/php-aider-lautocompletion-des-ide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.william-pottier.fr/2011/03/php-aider-lautocompletion-des-ide/</feedburner:origLink></item>
		<item>
		<title>Magento : astuce de chemin des templates dans l’administration</title>
		<link>http://feedproxy.google.com/~r/WilliamPottier/~3/FxQt2_yO5_E/</link>
		<comments>http://blog.william-pottier.fr/2010/11/magento-astuce-de-chemin-des-templates-dans-ladministration/#comments</comments>
		<pubDate>Tue, 02 Nov 2010 11:12:43 +0000</pubDate>
		<dc:creator>wizad</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[magento]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.william-pottier.fr/?p=44</guid>
		<description><![CDATA[Lors de l&#8217;intégration d&#8217;un site Magento on peut être amené à devoir modifier les templates de l&#8217;administration. Pour cela il peut être intéressant d&#8217;afficher les chemins des différentes templates utilisées. Malheureusement, contrairement à la partie &#171;&#160;Front&#160;&#187; cette option ne peut être activée via l&#8217;interface de configuration. Pour ce faire il convient donc d&#8217;aller directement dans [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.william-pottier.fr%2F2010%2F11%2Fmagento-astuce-de-chemin-des-templates-dans-ladministration%2F" onclick="pageTracker._trackPageview('/outgoing/api.tweetmeme.com/share?url=http_3A_2F_2Fblog.william-pottier.fr_2F2010_2F11_2Fmagento-astuce-de-chemin-des-templates-dans-ladministration_2F&amp;referer=');"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.william-pottier.fr%2F2010%2F11%2Fmagento-astuce-de-chemin-des-templates-dans-ladministration%2F&amp;source=wizad&amp;style=normal&amp;service=bit.ly&amp;service_api=R_52f9b438fd727621c96803c397da1cbe&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Lors de l&#8217;intégration d&#8217;un site Magento on peut être amené à devoir modifier les templates de l&#8217;administration. Pour cela il peut être intéressant d&#8217;afficher les chemins des différentes templates utilisées. Malheureusement, contrairement à la partie &laquo;&nbsp;Front&nbsp;&raquo; cette option ne peut être activée via l&#8217;interface de configuration.</p>
<p>Pour ce faire il convient donc d&#8217;aller directement dans la base de donnée (table &laquo;&nbsp;core_config_data&nbsp;&raquo;) et de chercher la ligne ayant pour valeur &laquo;&nbsp;dev/debug/template_hints&nbsp;&raquo; dans la colonne &laquo;&nbsp;path&nbsp;&raquo;. Une fois trouvée, il vous suffit de modifier la colonne &laquo;&nbsp;scope_id&nbsp;&raquo; de cette ligne en 0.</p>
<img src="http://feeds.feedburner.com/~r/WilliamPottier/~4/FxQt2_yO5_E" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.william-pottier.fr/2010/11/magento-astuce-de-chemin-des-templates-dans-ladministration/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://blog.william-pottier.fr/2010/11/magento-astuce-de-chemin-des-templates-dans-ladministration/</feedburner:origLink></item>
		<item>
		<title>C# : de la bonne utilisation des « switch »</title>
		<link>http://feedproxy.google.com/~r/WilliamPottier/~3/2aQ8B45iMtg/</link>
		<comments>http://blog.william-pottier.fr/2010/10/c-de-la-bonne-utilisation-des-switch/#comments</comments>
		<pubDate>Tue, 19 Oct 2010 14:31:34 +0000</pubDate>
		<dc:creator>wizad</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[c#]]></category>

		<guid isPermaLink="false">http://blog.william-pottier.fr/?p=38</guid>
		<description><![CDATA[Pour avoir récemment eu la question voici un petit rappel quand à l&#8217;utilisation de switch en c#. Tout d&#8217;abord il convient de rappeler le principe d&#8217;un switch. Un switch est un structure permettant de spécifier un comportement en fonction d&#8217;une variable donnée. Ainsi les deux codes suivant sont équivalent en comportement : switch&#40;maVariable&#41; &#123; &#160; [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.william-pottier.fr%2F2010%2F10%2Fc-de-la-bonne-utilisation-des-switch%2F" onclick="pageTracker._trackPageview('/outgoing/api.tweetmeme.com/share?url=http_3A_2F_2Fblog.william-pottier.fr_2F2010_2F10_2Fc-de-la-bonne-utilisation-des-switch_2F&amp;referer=');"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.william-pottier.fr%2F2010%2F10%2Fc-de-la-bonne-utilisation-des-switch%2F&amp;source=wizad&amp;style=normal&amp;service=bit.ly&amp;service_api=R_52f9b438fd727621c96803c397da1cbe&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Pour avoir récemment eu la question voici un petit rappel quand à l&#8217;utilisation de switch en c#.</p>
<p>Tout d&#8217;abord il convient de rappeler le principe d&#8217;un switch. Un switch est un structure permettant de spécifier un comportement en fonction d&#8217;une variable donnée. Ainsi les deux codes suivant sont équivalent en comportement :</p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0600FF; font-weight: bold;">switch</span><span style="color: #008000;">&#40;</span>maVariable<span style="color: #008000;">&#41;</span><br />
<span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">case</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Action à réaliser</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">break</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">case</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Autre action à réaliser</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">break</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">default</span><span style="color: #008000;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Action par defaut</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">break</span><span style="color: #008000;">;</span><br />
<span style="color: #008000;">&#125;</span></div></div>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0600FF; font-weight: bold;">if</span><span style="color: #008000;">&#40;</span>maVariable <span style="color: #008000;">==</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span><br />
<span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Action à réaliser</span><br />
<span style="color: #008000;">&#125;</span><br />
<span style="color: #0600FF; font-weight: bold;">else</span> <span style="color: #0600FF; font-weight: bold;">if</span><span style="color: #008000;">&#40;</span>maVariable <span style="color: #008000;">==</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">&#41;</span><br />
<span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Autre action à réaliser</span><br />
<span style="color: #008000;">&#125;</span><br />
<span style="color: #0600FF; font-weight: bold;">else</span><br />
<span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Action par defaut</span><br />
<span style="color: #008000;">&#125;</span></div></div>
<p>Ces 2 exemples ont le même comportement. Néanmoins il est important de noter qu&#8217;une structure en switch (figure 1) est plus performant qu&#8217;une structure en if (figure 2). Ceci s&#8217;explique aisément par le fait que lors d&#8217;un structure en if chacune des condition (les unes à prés les autres bien entendu) doivent être évalué jusqu&#8217;à trouvé une correspondance. Le switch utilisant un label celà permet un accés plus rapide.</p>
<p>Contraintes pour maVariable :</p>
<p>maVariable doit être uniquement d&#8217;un type primitif (ex : string, int); Si vous avez besoin d&#8217;utiliser d&#8217;autre type (ex : float, double,&#8230;) vous devez utiliser une structure en if (comme figure 2).<br />
Les label de case doivent être une expression constante (ex : 42, &laquo;&nbsp;toto&nbsp;&raquo;). Si vous voulez calculer les valeurs ou utiliser des variables vous devez utiliser une structure en if (comme figure 2)<br />
Chaque label de case doit être unique.<br />
Chaque case contenant du code ne doit pas passer au case suivant implicitement (voir plus bas)<br />
Il est à noter qu&#8217;un switch peut utiliser un type nullable dés l&#8217;instant qu&#8217;il respecte les règles ci-dessus.</p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6666cc; font-weight: bold;">int</span><span style="color: #008000;">?</span> maVariable <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">null</span><br />
<span style="color: #0600FF; font-weight: bold;">switch</span><span style="color: #008000;">&#40;</span>maVariable<span style="color: #008000;">&#41;</span><br />
<span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">case</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Aucune valeur&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">break</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">default</span><span style="color: #008000;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span>maVariable<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">break</span><span style="color: #008000;">;</span><br />
<span style="color: #008000;">&#125;</span></div></div>
<p>Maintenant abordons le saut de case en case dans notre structure. Contrairement à d&#8217;autre langage le c# ne supporte pas le passage implicite d&#8217;un case à l&#8217;autre à moins que celui-ci soit vide. Concrètement ce code ne compilera pas :</p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0600FF; font-weight: bold;">switch</span><span style="color: #008000;">&#40;</span>maVariable<span style="color: #008000;">&#41;</span><br />
<span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">case</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span>maVariable<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">case</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;1&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
<span style="color: #008000;">&#125;</span></div></div>
<p>Par contre celui-ci compilera correctement :</p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0600FF; font-weight: bold;">switch</span><span style="color: #008000;">&#40;</span>maVariable<span style="color: #008000;">&#41;</span><br />
<span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">case</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span>maVariable<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">break</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">case</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">:</span><br />
&nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">case</span> <span style="color: #FF0000;">2</span><span style="color: #008000;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;1&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">break</span><span style="color: #008000;">;</span><br />
<span style="color: #008000;">&#125;</span></div></div>
<p>Mais alors comment obtenir le comportement souhaitez à la figure 4?</p>
<p>Tout simplement en spécifiant explicitement qu&#8217;il faut effectuer le saut par l&#8217;intermédiaire de l&#8217;instruction &laquo;&nbsp;goto&nbsp;&raquo;.</p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0600FF; font-weight: bold;">switch</span><span style="color: #008000;">&#40;</span>maVariable<span style="color: #008000;">&#41;</span><br />
<span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">case</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span>maVariable<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">goto</span> <span style="color: #0600FF; font-weight: bold;">case</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">case</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;1&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">goto</span> <span style="color: #0600FF; font-weight: bold;">default</span><span style="color: #008000;">:</span><br />
&nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">default</span><span style="color: #008000;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;default&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">break</span><span style="color: #008000;">;</span><br />
<span style="color: #008000;">&#125;</span></div></div>
<p>Happy Coding!</p>
<img src="http://feeds.feedburner.com/~r/WilliamPottier/~4/2aQ8B45iMtg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.william-pottier.fr/2010/10/c-de-la-bonne-utilisation-des-switch/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://blog.william-pottier.fr/2010/10/c-de-la-bonne-utilisation-des-switch/</feedburner:origLink></item>
		<item>
		<title>Symfony : ouvrir par le code une connexion Doctrine</title>
		<link>http://feedproxy.google.com/~r/WilliamPottier/~3/38xK7WYyXww/</link>
		<comments>http://blog.william-pottier.fr/2010/10/symfony-creation-manuel-et-par-le-code-dune-connexion-doctrine/#comments</comments>
		<pubDate>Mon, 18 Oct 2010 22:28:39 +0000</pubDate>
		<dc:creator>wizad</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[doctrine]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[symfony]]></category>

		<guid isPermaLink="false">http://blog.william-pottier.fr/?p=7</guid>
		<description><![CDATA[Lors d&#8217;un récent projet avec Symfony (1.4), je devais ouvrir une connexion doctrine  à la volée. Rien de bien compliqué jusque là. Par contre afin de pouvoir logger et tracer correctement les actions sur cette connexion, il m&#8217;a fallu un peu chercher comment déclarer celle-ci auprès de Symfony afin de bénéficier des possibilités du framework. [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.william-pottier.fr%2F2010%2F10%2Fsymfony-creation-manuel-et-par-le-code-dune-connexion-doctrine%2F" onclick="pageTracker._trackPageview('/outgoing/api.tweetmeme.com/share?url=http_3A_2F_2Fblog.william-pottier.fr_2F2010_2F10_2Fsymfony-creation-manuel-et-par-le-code-dune-connexion-doctrine_2F&amp;referer=');"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.william-pottier.fr%2F2010%2F10%2Fsymfony-creation-manuel-et-par-le-code-dune-connexion-doctrine%2F&amp;source=wizad&amp;style=normal&amp;service=bit.ly&amp;service_api=R_52f9b438fd727621c96803c397da1cbe&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Lors d&#8217;un récent projet avec Symfony (1.4), je devais ouvrir une connexion doctrine  à la volée. Rien de bien compliqué jusque là.</p>
<p>Par contre afin de pouvoir logger et tracer correctement les actions sur cette connexion, il m&#8217;a fallu un peu chercher comment déclarer celle-ci auprès de Symfony afin de bénéficier des possibilités du framework.</p>
<p>Je vous livre donc tel quel le code permettant d&#8217;ouvrir une connexion par le code et de la déclarer auprès du gestionnaire de bdd intégré au framework.</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<span style="color: #000088;">$connexionString</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'...'</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$parameters</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array" onclick="pageTracker._trackPageview('/outgoing/www.php.net/array?referer=');"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">'name'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'client'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">'dsn'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$connexionString</span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$database</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> sfDoctrineDatabase<span style="color: #009900;">&#40;</span><span style="color: #000088;">$parameters</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
sfContext<span style="color: #339933;">::</span><span style="color: #004000;">getInstance</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getDatabaseManager</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">setDatabase</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'client'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$database</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div></div>
<img src="http://feeds.feedburner.com/~r/WilliamPottier/~4/38xK7WYyXww" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.william-pottier.fr/2010/10/symfony-creation-manuel-et-par-le-code-dune-connexion-doctrine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.william-pottier.fr/2010/10/symfony-creation-manuel-et-par-le-code-dune-connexion-doctrine/</feedburner:origLink></item>
		<item>
		<title>Nouveau Départ</title>
		<link>http://feedproxy.google.com/~r/WilliamPottier/~3/PxNBfJKMpvs/</link>
		<comments>http://blog.william-pottier.fr/2010/06/nouveau-depart/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 12:48:04 +0000</pubDate>
		<dc:creator>wizad</dc:creator>
				<category><![CDATA[Générale]]></category>

		<guid isPermaLink="false">http://blog.william-pottier.fr/?p=4</guid>
		<description><![CDATA[Cher visiteur Il y a quelques temps que je n&#8217;avais pas blogué, j&#8217;ai donc décidé de repartir d&#8217;ici sur un nouveau pied. Plusieurs changements devrais s&#8217;opérer dans les prochains mois/semaines et ce blog servira à la fois à de référentiel technique et de suivi de mes aventures pour ma famille. A Bientôt donc pour de [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.william-pottier.fr%2F2010%2F06%2Fnouveau-depart%2F" onclick="pageTracker._trackPageview('/outgoing/api.tweetmeme.com/share?url=http_3A_2F_2Fblog.william-pottier.fr_2F2010_2F06_2Fnouveau-depart_2F&amp;referer=');"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.william-pottier.fr%2F2010%2F06%2Fnouveau-depart%2F&amp;source=wizad&amp;style=normal&amp;service=bit.ly&amp;service_api=R_52f9b438fd727621c96803c397da1cbe&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Cher visiteur</p>
<p>Il y a quelques temps que je n&#8217;avais pas blogué, j&#8217;ai donc décidé de repartir d&#8217;ici sur un nouveau pied.</p>
<p>Plusieurs changements devrais s&#8217;opérer dans les prochains mois/semaines et ce blog servira à la fois à de référentiel technique et de suivi de mes aventures pour ma famille.</p>
<p>A Bientôt donc pour de nouvelles aventures !</p>
<img src="http://feeds.feedburner.com/~r/WilliamPottier/~4/PxNBfJKMpvs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.william-pottier.fr/2010/06/nouveau-depart/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.william-pottier.fr/2010/06/nouveau-depart/</feedburner:origLink></item>
		<item>
		<title>[WPF] Un dataForm pour vos applications !</title>
		<link>http://feedproxy.google.com/~r/WilliamPottier/~3/uVwXUUsmZ7I/</link>
		<comments>http://blog.william-pottier.fr/2009/09/wpf-un-dataform-pour-vos-applications/#comments</comments>
		<pubDate>Sat, 19 Sep 2009 17:44:42 +0000</pubDate>
		<dc:creator>wizad</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[dataform]]></category>
		<category><![CDATA[wpf]]></category>

		<guid isPermaLink="false">http://blog.william-pottier.fr/?p=36</guid>
		<description><![CDATA[Pour tout ceux qui ont rêvé d&#8217;avoir le contrôle DataForm de silverlight dans leurs applications WPF, je me suis mis en tête cette semaine de le réaliser. C&#8217;est donc avec grand plaisir que je le partage avec vous via codeplex : http://wpfdataform.codeplex.com/ Bien entendu il s&#8217;agit d&#8217;une première version alors n&#8217;hésitez pas à me faire part [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.william-pottier.fr%2F2009%2F09%2Fwpf-un-dataform-pour-vos-applications%2F" onclick="pageTracker._trackPageview('/outgoing/api.tweetmeme.com/share?url=http_3A_2F_2Fblog.william-pottier.fr_2F2009_2F09_2Fwpf-un-dataform-pour-vos-applications_2F&amp;referer=');"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.william-pottier.fr%2F2009%2F09%2Fwpf-un-dataform-pour-vos-applications%2F&amp;source=wizad&amp;style=normal&amp;service=bit.ly&amp;service_api=R_52f9b438fd727621c96803c397da1cbe&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Pour tout ceux qui ont rêvé d&#8217;avoir le contrôle DataForm de silverlight dans leurs applications WPF, je me suis mis en tête cette semaine de le réaliser. C&#8217;est donc avec grand plaisir que je le partage avec vous via codeplex : <a href="http://wpfdataform.codeplex.com/" onclick="pageTracker._trackPageview('/outgoing/wpfdataform.codeplex.com/?referer=');">http://wpfdataform.codeplex.com/</a><br />
Bien entendu il s&#8217;agit d&#8217;une première version alors n&#8217;hésitez pas à me faire part de toute vos remarques et suggestions afin de l&#8217;améliorer.</p>
<p>Happy Coding!</p>
<img src="http://feeds.feedburner.com/~r/WilliamPottier/~4/uVwXUUsmZ7I" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.william-pottier.fr/2009/09/wpf-un-dataform-pour-vos-applications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.william-pottier.fr/2009/09/wpf-un-dataform-pour-vos-applications/</feedburner:origLink></item>
	</channel>
</rss>

