<?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>Bugz Blog, Développements web (HTML, CSS, Framework, PHP, Ruby on Rails)</title>
	<atom:link href="http://www.bugz.fr/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bugz.fr</link>
	<description>Parce que chaque jour on en apprend un peu plus, et que parfois ca vaut le coup de le partager...</description>
	<lastBuildDate>Tue, 15 May 2012 07:14:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Tapestry5/Ajax : Problème id dynamique dans une Loop</title>
		<link>http://www.bugz.fr/2012/05/tapestry5ajax-probleme-id-dynamique-dans-une-loop/</link>
		<comments>http://www.bugz.fr/2012/05/tapestry5ajax-probleme-id-dynamique-dans-une-loop/#comments</comments>
		<pubDate>Tue, 15 May 2012 07:14:52 +0000</pubDate>
		<dc:creator>bugz</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Prog]]></category>
		<category><![CDATA[actionlink]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[tapestry]]></category>
		<category><![CDATA[zone]]></category>

		<guid isPermaLink="false">http://www.bugz.fr/?p=2223</guid>
		<description><![CDATA[Tapestry est un puissant framework MVC en java qui utilise une approche par composant. Les contrôleurs sont des classes java. Chacune est associée à une vue, qui prend la forme d&#8217;un template xml propre à tapestry. Les modèles sont des pojo java qui sont comme dans tous les framework MVC trimbalés entre le controlleur et [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.bugz.fr/wp-content/uploads/2012/05/tapestry_logo.png"><img src="http://www.bugz.fr/wp-content/uploads/2012/05/tapestry_logo.png" alt="" title="tapestry_logo" width="215" height="230" class="alignleft size-full wp-image-2311" /></a>Tapestry est un puissant <strong>framework MVC en java</strong> qui utilise une <strong>approche par composant</strong>. Les contrôleurs sont des <em>classes java</em>. Chacune est associée à une vue, qui prend la forme d&#8217;un <em>template xml</em> propre à tapestry. Les modèles sont des pojo java qui sont comme dans tous les framework MVC trimbalés entre le controlleur et la vue. </p>
<p>Contrairement aux jsp, qui permettent l&#8217;inclusion de code java et qui sont par conséquent extrêmement permissives, les templates Tapestry de par leurs structures xml ne contient que très peu de logique. Ils permettent d&#8217;isoler un maximum les traitements et de revenir à la fonction principale de la vue qui est d&#8217;afficher la donnée. Cette philosophie est intéressante car elle oblige le développeur à factoriser son travail. La vue se retrouve ainsi considérablement allégée et sa lecture devient facilitée. </p>
<p>Par contre l&#8217;utilisation quasi magique des composants du framework peut parfois faire tourner la tête et rendre certaines problématiques plus complexe qu&#8217;initialement.<br />
<span id="more-2223"></span></p>
<h3>Mise en place du problème</h3>
<p>Nous allons créer un composant dont le rôle sera d&#8217;afficher une liste d’éléments avec pour chacun d&#8217;entre eux, un lien avec la possibilité de charger de manière asynchrone un élément de cette liste.<br />
Pour cela nous alons donc commencer par créer le model :</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Foo <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> name <span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> about <span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">public</span> Foo<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> name, <span style="color: #003399;">String</span> about<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">name</span> <span style="color: #339933;">=</span> name <span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">about</span> <span style="color: #339933;">=</span> about <span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getName<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">return</span> name <span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> <span style="color: #003399;">String</span> setName<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> <span style="color: #003399;">Name</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">name</span> <span style="color: #339933;">=</span> name <span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getAbout<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">return</span> about <span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> <span style="color: #003399;">String</span> setAbout<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> about<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">about</span> <span style="color: #339933;">=</span> about <span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Nous allons mainenant créer note controlleur qui contiendra la liste de Foo que nous allons créer arbitrairement pour l&#8217;exemple.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> FooList <span style="color: #009900;">&#123;</span>
    @Property
    <span style="color: #000000; font-weight: bold;">private</span> List<span style="color: #339933;">&lt;</span>Foo<span style="color: #339933;">&gt;</span> fooList<span style="color: #339933;">;</span>
    @Property
    <span style="color: #000000; font-weight: bold;">private</span> Foo foo<span style="color: #339933;">;</span>   
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> FooList<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        fooList <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ArrayList<span style="color: #339933;">&lt;</span>Foo<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        fooList.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Foo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;one&quot;</span>, <span style="color: #0000ff;">&quot;blablablabla&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        fooList.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Foo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;two&quot;</span>, <span style="color: #0000ff;">&quot;blibliblibli&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        fooList.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Foo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;tree&quot;</span>, <span style="color: #0000ff;">&quot;bloblobloblo&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        fooList.<span style="color: #006633;">add</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Foo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;four&quot;</span>, <span style="color: #0000ff;">&quot;blublublublu&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    @Inject
    <span style="color: #000000; font-weight: bold;">private</span> Block blockFoo<span style="color: #339933;">;</span>
&nbsp;
    @Inject
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">Request</span> request<span style="color: #339933;">;</span>
&nbsp;
    @OnEvent<span style="color: #009900;">&#40;</span>value <span style="color: #339933;">=</span> EventConstants.<span style="color: #006633;">ACTION</span>, component <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;editZone&quot;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">Object</span> editZone<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> fooName<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>Foo fooTmp <span style="color: #339933;">:</span> fooList<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>fooTmp.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span>fooName<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                foo <span style="color: #339933;">=</span> fooTmp<span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000000; font-weight: bold;">return</span> request.<span style="color: #006633;">isXHR</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">?</span> blockFoo <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">this</span> <span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Dans la vue :</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;t:loop</span> <span style="color: #000066;">source</span>=<span style="color: #ff0000;">&quot;fooList&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;foo&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;t:actionlink</span> <span style="color: #000066;">t:id</span>=<span style="color: #ff0000;">&quot;editZone&quot;</span> <span style="color: #000066;">t:zone</span>=<span style="color: #ff0000;">&quot;zoneFoo&quot;</span> <span style="color: #000066;">t:context</span>=<span style="color: #ff0000;">&quot;foo.name&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      View Foo
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/t:actionlink<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;t:zone</span> <span style="color: #000066;">t:id</span>=<span style="color: #ff0000;">&quot;zoneFoo&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;t:block</span> <span style="color: #000066;">t:id</span>=<span style="color: #ff0000;">&quot;blockFoo&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span> ${foo.about} <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/t:block<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/t:zone<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/t:loop<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Voilà nous pouvons maintenant tester. Notre liste de lien s&#8217;affiche bien mais il est impossible de mettre à jour les différentes zones. Quoi que l&#8217;on fasse c&#8217;est toujours la première qui est affectée.</p>
<p><a href="http://www.bugz.fr/wp-content/uploads/2012/05/tapestryajaxerror.png"><img src="http://www.bugz.fr/wp-content/uploads/2012/05/tapestryajaxerror.png" alt="" title="tapestryajaxerror" width="258" height="143" class="aligncenter size-full wp-image-2320" /></a></p>
<h3>Solution</h3>
<p>Pour expliquer celà, il faut commencer par identifier l&#8217;erreur. Regardons du côté de <code>t:zone</code>. Le composant est utilisé à l&#8217;intérieur d&#8217;une boucle et nous lui mettons toujours le même <code>t:id</code>. Cette notation est accepté par Tapestry mais évidement un id dans le DOM se doit d&#8217;être unique. </p>
<p>En HTML/Javascript classique, une démarche classique aurait été de générer un <code>id</code> spécifique pour chaque itération et de générer l&#8217;appel asynchrone directement en js. Rien de bien sorcier si on connait javacscript, mais on se prive de la logique et la magie de Tapestry pour la gestion des Zone et des Event. C&#8217;est pas le top. </p>
<p>On va plutôt essayer de prendre le problème dans le sens inverse. C&#8217;est à dire plutôt que de générer un id comme on sait le faire, on pourrait déterminer l&#8217;id que tapestry génère et voir si on peut dynamiquement pointer vers lui.</p>
<p>En regardant de plus près, du coté client, Tapestry génère un <code>id</code> différent pour chaque zone ayant le même <code>t:id</code> suivant la règle suivante :</p>
<p>1ère itération : <em>zoneFoo</em><br />
2nd itération : <em>zoneFoo_0</em><br />
3nd itération : <em>zoneFoo_1</em><br />
4ème itération : <em>zoneFoo_2</em><br />
&#8230;</p>
<p>Et dans l&#8217;actionLink <code>t:zone="zoneFoo"</code> fait référence au <code>id</code> HTML et non au <code>t:id</code>. Ce qui nous permet de déterminer le nom généré par Tapestry pour une certaine itération. Pour ce faire nous allons créer une méthode <code>getZoneName</code>.</p>
<p>Dans le controller :</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">    @Property
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">Integer</span> index<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getZoneName<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>index.<span style="color: #006633;">intValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
            <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;zoneFoo&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #0000ff;">&quot;zoneFoo_&quot;</span> <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span>index.<span style="color: #006633;">intValue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

<p>Dans la vue :</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;t:loop</span> <span style="color: #000066;">source</span>=<span style="color: #ff0000;">&quot;fooList&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;foo&quot;</span> <span style="color: #000066;">t:index</span>=<span style="color: #ff0000;">&quot;index&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;t:actionlink</span> <span style="color: #000066;">t:id</span>=<span style="color: #ff0000;">&quot;editZone&quot;</span> <span style="color: #000066;">t:zone</span>=<span style="color: #ff0000;">&quot;zoneFoo&quot;</span> <span style="color: #000066;">t:context</span>=<span style="color: #ff0000;">&quot;foo.name&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      View Foo
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/t:actionlink<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;t:zone</span> <span style="color: #000066;">t:id</span>=<span style="color: #ff0000;">&quot;zoneFoo&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;t:block</span> <span style="color: #000066;">t:id</span>=<span style="color: #ff0000;">&quot;blockFoo&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span> ${foo.about} <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/t:block<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/t:zone<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/t:loop<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Avec cette petite astuce, on peut utiliser les zones de Tapestry dans une boucle sans problème. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.bugz.fr/2012/05/tapestry5ajax-probleme-id-dynamique-dans-une-loop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Comment supprimer la publicité sur Echofon 2.4 pour Firefox</title>
		<link>http://www.bugz.fr/2012/03/comment-supprimer-la-publicite-sur-echofon-2-4-pour-firefox/</link>
		<comments>http://www.bugz.fr/2012/03/comment-supprimer-la-publicite-sur-echofon-2-4-pour-firefox/#comments</comments>
		<pubDate>Fri, 30 Mar 2012 09:22:16 +0000</pubDate>
		<dc:creator>bugz</dc:creator>
				<category><![CDATA[Actualité geek]]></category>
		<category><![CDATA[Navigateur Web]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[echofon]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[publicité]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.bugz.fr/?p=2163</guid>
		<description><![CDATA[Echofon est un client twitter qui permet de consulter twitter sans passer par le site web. Il est disponible sous plusieurs plate-formes tels que Windows, Mac, iOS. Il existe aussi un plugin Firefox très connu chez tous les twittos que nous sommes. Il permet de synchroniser ses tweets directement dans son navigateur Internet préféré. Ce [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.bugz.fr/wp-content/uploads/2012/03/echofon-icon-ads.png"><img src="http://www.bugz.fr/wp-content/uploads/2012/03/echofon-icon-ads-150x150.png" alt="" title="echofon-icon-ads" width="150" height="150" class="alignright size-thumbnail wp-image-2183" /></a><br />
<strong>Echofon est un client twitter</strong> qui permet de consulter twitter sans passer par le site web. Il est disponible sous plusieurs plate-formes tels que Windows, Mac, iOS. </p>
<p>Il existe aussi un <strong>plugin Firefox</strong> très connu chez tous les twittos que nous sommes. Il permet de synchroniser ses tweets directement dans son navigateur Internet préféré. Ce qui est très pratique car au final la consultation de twitter est très souvent associé à celle d&#8217;une page web.<br />
<span id="more-2163"></span></p>
<p>Vous avez peut-être pu vous rendre compte que la dernière <em>mise à jour du plugin</em> a fait apparaître une nauséabonde bannière de publicité avant le premier résultat. Il semblerait que le service était une version beta et que désormais le produit devient commercial. </p>
<p>Heureusement pour nous ce n&#8217;est pas une fatalité. Firefox est une plate-forme libre et donc facilement customisable. On peut par exemple changer l&#8217;apparence certaines boites et c&#8217;est exactement ce qui nous intéresse avec cette bannière.</p>
<p>Pour ce faire il suffit de se rendre dans le profile de firefox.</p>
<style>code{font-size:1.1em;text-align:left;}</style>
<p>pour linux/mac :<br />
<code>/home/[user]/.mozilla/firefox/[key].default</code></p>
<p>pour windows XP:<br />
<code>C:\Document and Setting\Application Data\[user]\Mozilla\Firefox\[key].default</code></p>
<p>pour windows Vista/7/8:<br />
<code>C:\Users\[USER]\AppData\Roaming\[user]\Mozilla\Firefox\[key].default</code></p>
<p>Dans le répertoire chrome créer le fichier userChrome.css et rajouter ces quelques lignes css.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#echofon-ad-unit</span> <span style="color: #00AA00;">&#123;</span>
   <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span> !important<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Vous pouvez redémarrer votre Firefox, la publicité s&#8217;en est allée.</p>
<p>Sinon vous pouvez toujours acheter la version payante ($9.99) du plugin.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bugz.fr/2012/03/comment-supprimer-la-publicite-sur-echofon-2-4-pour-firefox/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Utiliser le cache de Chrome/Firefox pour restaurer un fichier</title>
		<link>http://www.bugz.fr/2011/12/utiliser-le-cache-de-chromefirefox-pour-restaurer-un-fichier/</link>
		<comments>http://www.bugz.fr/2011/12/utiliser-le-cache-de-chromefirefox-pour-restaurer-un-fichier/#comments</comments>
		<pubDate>Thu, 15 Dec 2011 17:28:44 +0000</pubDate>
		<dc:creator>bugz</dc:creator>
				<category><![CDATA[Navigateur Web]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[gzip]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.bugz.fr/?p=2113</guid>
		<description><![CDATA[J&#8217;ai récemment eu le malheur de perdre un fichier sur lequel je travaillais. Je n&#8217;avais conservé aucune copie récente de celui-ci et bien évidement je ne l&#8217;avais pas versionné. Vu que c&#8217;était un fichier javascript, j&#8217;ai eu l&#8217;idée de le récupérer via le cache de mon navigateur internet. Je vais vous expliquer la marche à [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.bugz.fr/wp-content/uploads/2011/12/minigeek.png"><img src="http://www.bugz.fr/wp-content/uploads/2011/12/minigeek-150x150.png" alt="" title="minigeek" width="150" height="150" class="alignleft size-thumbnail wp-image-2151" /></a>J&#8217;ai récemment eu le malheur de <strong>perdre un fichier</strong> sur lequel je travaillais. Je n&#8217;avais conservé aucune copie récente de celui-ci et bien évidement je ne l&#8217;avais pas versionné. Vu que c&#8217;était un fichier javascript, j&#8217;ai eu l&#8217;idée de le <strong>récupérer via le cache de mon navigateur internet</strong>. Je vais vous expliquer la marche à suivre.<br />
<span id="more-2113"></span></p>
<p>Dans un premier temps, ouvrez <em>Google Chrome</em> ou <em>Mozilla Firefox</em> et saisissez dans la barre d&#8217;adresse <code>about:cache</code>. Cette page liste tous les fichiers que le navigateur possède dans son cache. Croisez les droits en espérant ne pas l&#8217;avoir effacé ou rafraîchi manuellement. La boite de recherche devrait vous permettre de retrouver le fichier rapidement. </p>
<p>Quand on clique dessus, on peut se rendre compte que Chrome ne l&#8217;affiche pas. A la place il nous montre les données brut de la trame HTTP. Si vous avez déjà travaillé avec <em>Wireshark</em> vous ne serez pas perdu. </p>
<p><a href="http://www.bugz.fr/wp-content/uploads/2011/12/chrome_cache.png"><img src="http://www.bugz.fr/wp-content/uploads/2011/12/chrome_cache-300x236.png" alt="" title="chrome_cache" width="300" height="236" class="aligncenter size-medium wp-image-2133" /></a></p>
<p>La partie &laquo;&nbsp;contenu&nbsp;&raquo; de la trame est sous une forme binaire. Elle n&#8217;est donc pas exploitable telle quelle.<br />
Dans le cas où <strong>la transaction avec le serveur web est compressée</strong>, il faudra également la <strong>dézipper</strong>. </p>
<p>Le script que j&#8217;ai trouvé sur <a href="http://www.frozax.com/blog/2011/05/recover-file-google-chrome-cache-gzipped" target="_blank">le blog de Frozax</a> résout très bien la problématique.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">// cache.log is a copy of chrome cache page with only the file content section</span>
<span style="color: #000088;">$cacheString</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;cache.log&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$matches</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">preg_match_all</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/\s[0-9a-f]{2}\s/'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$cacheString</span><span style="color: #339933;">,</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$f</span> <span style="color: #339933;">=</span> <span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;t.bin&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;wb&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$match</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #990000;">fwrite</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$f</span><span style="color: #339933;">,</span><span style="color: #990000;">chr</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">hexdec</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$match</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$f</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #990000;">ob_start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">readgzfile</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;t.bin&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$decoded_data</span><span style="color: #339933;">=</span><span style="color: #990000;">ob_get_clean</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$decoded_data</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Pour l&#8217;utiliser, il suffit de copier la partie &laquo;&nbsp;File content&nbsp;&raquo; de la trame dans un fichier nommé <code>cache.log</code>, d&#8217;éxecuter le script php et <strong>votre fichier sera restauré</strong>.</p>
<p><br/></p>
<p>sources: <a href="http://www.frozax.com/blog/2011/05/recover-file-google-chrome-cache-gzipped/">http://www.frozax.com/blog/2011/05/recover-file-google-chrome-cache-gzipped/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bugz.fr/2011/12/utiliser-le-cache-de-chromefirefox-pour-restaurer-un-fichier/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Les meilleurs annuaires de fonts gratuites</title>
		<link>http://www.bugz.fr/2011/12/les-meilleurs-annuaires-de-fonts-gratuites/</link>
		<comments>http://www.bugz.fr/2011/12/les-meilleurs-annuaires-de-fonts-gratuites/#comments</comments>
		<pubDate>Tue, 06 Dec 2011 18:03:51 +0000</pubDate>
		<dc:creator>bugz</dc:creator>
				<category><![CDATA[On the Web]]></category>
		<category><![CDATA[font]]></category>

		<guid isPermaLink="false">http://www.bugz.fr/?p=1943</guid>
		<description><![CDATA[Le choix d&#8217;une fonts pour un design web est toujours une chose délicate. Si on se borne aux fonts disponibles par défauts sur les systèmes d&#8217;exploitation, le design pourrait ne pas avoir toute la singularité recherchée. On pourrait, celà dit, dans une quête d&#8217;unicité, oublier son amour propre, et utiliser le &#171;&#160;Comic Sans MS&#160;&#187;. Choisir [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.bugz.fr/wp-content/uploads/2011/12/fonts-2.png"><img src="http://www.bugz.fr/wp-content/uploads/2011/12/fonts-2-150x150.png" alt="" title="fonts-2" width="150" height="150" class="alignright size-thumbnail wp-image-2085" /></a><br />
Le choix d&#8217;une fonts pour <strong>un design web</strong> est toujours une chose délicate. Si on se borne aux fonts disponibles par défauts sur les <em>systèmes d&#8217;exploitation</em>, le design pourrait ne pas avoir toute la <strong>singularité recherchée</strong>. On pourrait, celà dit, dans une quête d&#8217;unicité, oublier son amour propre, et<em> utiliser le &laquo;&nbsp;Comic Sans MS&nbsp;&raquo;</em>.<br />
<span id="more-1943"></span><br />
Choisir une police que tout le monde possède sur son ordinateur permet néanmoins <strong>un gain de performance pour votre site web</strong> et permet une compatibilité sur le vieux P133 de votre grand-mère.</p>
<p>Mais comment se priver, aujourd&#8217;hui, <strong>des webfonts</strong> alors que tous les navigateurs internet récents permettent d&#8217;intégrer cette singularité.<br />
De plus, c&#8217;est véritablement un jeu d&#8217;enfant, vous pouvez consulter ce billet, <a href="http://www.bugz.fr/2011/05/comment-imbriquer-une-fonte-dans-une-page-web/" target="_blank">qui explique comment intégrer une fonte custom dans une page web</a>.</p>
<p>La vrai difficulté réside dans le choix de cette fonte, effectivement, le net pullule de site permettant d&#8217;en télécharger. Mais c&#8217;est toujours frustrant qu&#8217;une fois trouvée celle adaptée à son projet, on se rend compte qu&#8217;elle est <em>sous licence protégée</em> et qu&#8217;il va falloir sortir le porte-feuille pour l&#8217;utiliser. </p>
<p>C&#8217;est pour cette raison qu&#8217;aujourd&#8217;hui, je vous propose <strong>5 annuaires complètement gratuits</strong> qui vous aideront à choisir vos polices d&#8217;écriture pour vos projets.</p>
<h3>FontSpace</h3>
<p style="height: 100px;">
<a href="http://www.dafont.com/" target="_blank"><img width="80px" src="http://www.bugz.fr/wp-content/uploads/2011/12/dafont.png" alt="" title="dafont" class="alignleft size-full wp-image-1983" /></a><a href="http://www.dafont.com/" target="_blank">FontSpace &#8211; www.dafont.com</a><br />
Un annuaire de fonts de qualité, qui est connu et qu&#8217;on ne présente plus qui possède un large choix de polices d&#8217;écriture dans toutes les catégories.
</p>
<h3>API Google Fonts</h3>
<p style="height: 100px;">
<a href="http://www.google.com/webfonts" target="_blank"><img src="http://www.bugz.fr/wp-content/uploads/2011/12/googlefonts.png" alt="" title="googlefonts" width="180" height="120" class="alignleft size-full wp-image-1983" /></a><a href="http://www.google.com/webfonts" target="_blank">API Google Fonts &#8211; www.fontsquirrel.com</a><br />
L&#8217;API Google Font est une l&#8217;excellence dans le domaine, elle permet de charger les fonts via des CDN sur les serveurs de Google. Il est très aisé de choisir et comparer toutes les polices. Domage qu&#8217;il y ait si peu de choix.
</p>
<h3>Font Squirrel</h3>
<p style="height: 100px;">
<a href="http://www.fontsquirrel.com/" target="_blank"><img src="http://www.bugz.fr/wp-content/uploads/2011/06/squirrel.png" alt="" title="squirrel" width="180" height="120" class="alignleft size-full wp-image-1983" /></a><a href="http://www.fontsquirrel.com/" target="_blank">Font Squirrel &#8211; www.fontsquirrel.com</a><br />
Un site concernant les fonts à connaître absolument. Il permet la conversion de tous les formats et possède un annuaire impressionnant.
</p>
<h3>FontSpace</h3>
<p style="height: 100px;">
<a href="http://www.fontspace.com" target="_blank"><img src="http://www.bugz.fr/wp-content/uploads/2011/12/fontspace.png" alt="" title="fontspace" class="alignleft size-full wp-image-1983" /></a><a href="http://www.fontspace.com" target="_blank">FontSpace &#8211; www.fontspace.com</a><br />
Les polices d&#8217;écritures que j&#8217;ai trouvé sur ce site sont plus excentriques que les autres. Mais celà peut très bien correspondre à un besoin.
</p>
<h3>Open Font Library</h3>
<p style="height: 100px;">
<a href="http://openfontlibrary.org" target="_blank"><img src="http://www.bugz.fr/wp-content/uploads/2011/12/openfont.png" alt="" title="fontspace" class="alignleft size-full wp-image-1983" /></a><a href="http://openfontlibrary.org" target="_blank">FontSpace &#8211; openfontlibrary.org</a><br />
Communauté de designer voulant créer une librairie de font libre. La bibliothèque est encore assez pauvre.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bugz.fr/2011/12/les-meilleurs-annuaires-de-fonts-gratuites/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Update WordPress 3.2 &#8211; Memory Exhausted Error</title>
		<link>http://www.bugz.fr/2011/07/update-wordpress-3-2-memory-exhausted-error/</link>
		<comments>http://www.bugz.fr/2011/07/update-wordpress-3-2-memory-exhausted-error/#comments</comments>
		<pubDate>Wed, 06 Jul 2011 08:02:14 +0000</pubDate>
		<dc:creator>bugz</dc:creator>
				<category><![CDATA[Actualité geek]]></category>
		<category><![CDATA[Outils]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[mémoire]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.bugz.fr/?p=2009</guid>
		<description><![CDATA[Depuis la récente mise à jour de WordPress, il est possible de que le CMS dépasse le quota de mémoire allouée. J&#8217;ai effectué le passage aujourd&#8217;hui à WordPress 3.2, et impossible de me connecter à l&#8217;admin. Il semblerait que le problème apparaisse quand un certain nombre d&#8217;extensions soient installées. Le message d&#8217;erreur est le suivant [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.bugz.fr/wp-content/uploads/2011/07/broken-wordpress.png"><img src="http://www.bugz.fr/wp-content/uploads/2011/07/broken-wordpress.png" alt="" title="broken-wordpress" width="120" height="120" class="alignleft size-full wp-image-2028" /></a>Depuis la récente <strong>mise à jour de WordPress</strong>, il est possible de que le <strong>CMS dépasse le quota de mémoire allouée</strong>. J&#8217;ai effectué le passage aujourd&#8217;hui à <em>WordPress 3.2</em>, et impossible de me connecter à l&#8217;admin. Il semblerait que le problème apparaisse quand un certain nombre d&#8217;extensions soient installées.<br />
<span id="more-2009"></span><br />
Le message d&#8217;erreur est le suivant :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">PHP Fatal error: Allowed memory <span style="color: #c20cb9; font-weight: bold;">size</span> of <span style="color: #000000;">33554432</span> bytes exhausted 
<span style="color: #7a0874; font-weight: bold;">&#40;</span>tried to allocate <span style="color: #000000;">491520</span> bytes<span style="color: #7a0874; font-weight: bold;">&#41;</span> in...</pre></div></div>

<p>Pour corriger le problème, il suffit d&#8217;augmenter la taille de la mémoire allouée à wordpress. Pour se faire, il faut éditer le fichier <code>config.php</code> et y redéfinir la valeur par défaut. Pour celà, ajouter la ligne suivante :</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'WP_MEMORY_LIMIT'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'64M'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>La limite de mémoire dédié à WordPress va passer de 32Mb à 64Mb et normalement le bug devrait être corrigé.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bugz.fr/2011/07/update-wordpress-3-2-memory-exhausted-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Comment convertir une font en .TTF .EOT .WOFF .SVG</title>
		<link>http://www.bugz.fr/2011/06/comment-convertir-une-font-en-ttf-eot-woff-svg/</link>
		<comments>http://www.bugz.fr/2011/06/comment-convertir-une-font-en-ttf-eot-woff-svg/#comments</comments>
		<pubDate>Thu, 30 Jun 2011 21:15:22 +0000</pubDate>
		<dc:creator>bugz</dc:creator>
				<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[On the Web]]></category>
		<category><![CDATA[Outils]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[font]]></category>
		<category><![CDATA[font-face]]></category>

		<guid isPermaLink="false">http://www.bugz.fr/?p=1730</guid>
		<description><![CDATA[Il est possible d&#8217;utiliser une police d&#8217;écriture personnalisée sur une page Web. Pour se faire, il existe la propriété CSS @font-face permettant de créer une font-family. Vous pouvez lire : Comment imbriquer une fonte dans une page Web ? qui pose la problématique du format et explique l&#8217;intégration de la police en CSS. Si vous [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.bugz.fr/wp-content/uploads/2011/06/fontfile1.png"><img src="http://www.bugz.fr/wp-content/uploads/2011/06/fontfile1.png" alt="" title="fontfile" width="180" height="120" class="alignright size-full wp-image-2005" /></a>Il est possible d&#8217;utiliser une <strong>police d&#8217;écriture personnalisée</strong> sur une page Web. Pour se faire, il existe <strong>la propriété CSS @font-face</strong> permettant de <em>créer une font-family</em>. Vous pouvez lire : <a href="http://www.bugz.fr/2011/05/comment-imbriquer-une-fonte-dans-une-page-web">Comment imbriquer une fonte dans une page Web ?</a> qui pose <strong>la problématique du format</strong> et explique l&#8217;intégration de la police en CSS.<br />
Si vous choisissez de récupérer une police de caractères sur un annuaire, il y a de grande chance que le format de celle-ci soit du TTF. Pour une intégration cross-browser dans une page Web, il sera nécessaire de générer plusieurs formats de font. Il existe plusieurs plus outils capable d’exécuter cette tâche.<br />
<span id="more-1730"></span></p>
<h3>FontForge</h3>
<p>FontForge est une application open source qui permet via une interface d&#8217;éditer des fichiers de font. Il a l&#8217;avantage d&#8217;être disponible pour mac, linux. Il faudra passer par cygwin pour les utilisateurs Windows. Il est possible de <a target="_blank" href=" http://sourceforge.net/projects/fontforge/files/fontforge-executables/">télécharger librement FontForge sur SourceForge</a>. Avec cette outils, on peut ouvrir un TTF et générer à partir de celui-ci un autre fichier de font sous un autre format tel que OTF ou SVG (et vice versa).<br />
Il permet aussi d&#8217;émuler une fenêtre comme si vous étiez sur Windows (via WEFT). Ainsi, vous pouvez tester sur votre environnement le rendu de votre police dans le monde Microsoft.</p>
<h3>TTF2EOT</h3>
<p>Cette application en ligne de commande permet à partir d&#8217;un fichier TTF de générer un EOT. C&#8217;est un logiciel libre, vous pouvez le <a href="http://code.google.com/p/ttf2eot/">télécharger sur google code</a>.</p>
<h3>Batik TTF2SVG</h3>
<p>Cette application, également en ligne de commande permet de convertir vos TTF en SVG. Elle nécessite java et peut être <a target="_blank" href="http://xmlgraphics.apache.org/batik/tools/font-converter.html">télécharger librement</a>.</p>
<h3>Outils en ligne </h3>
<p>Vous pouvez également utiliser des outils online, il faudra alors uploader votre ttf. La manipulation sera peut-être plus lente et limité en taille, mais ces outils ne nécessitent aucun logiciel installé sur votre machine. </p>
<p style="height: 150px;">
<a href="http://www.fontsquirrel.com/fontface/generator" target="_blank"><img src="http://www.bugz.fr/wp-content/uploads/2011/06/squirrel.png" alt="" title="squirrel" width="180" height="120" class="alignleft size-full wp-image-1983" /></a><a href="http://www.fontsquirrel.com/fontface/generator" target="_blank">Font Squirrel &#8211; font face convertor</a><br />
Très bon outils qui permet la convertion en plusieurs format tel que TTF, EOT, WOFF, SVG et SVGZ. Le site possède aussi un annuaire de fonte qui est bien fourni et bien classé.
</p>
<p style="height: 150px;">
<a href="http://www.kirsle.net/wizards/ttf2eot.cgi" target="_blank"><img src="http://www.bugz.fr/wp-content/uploads/2011/06/kirsle1.png" alt="" title="kirsle" width="180" height="120" class="alignleft size-full wp-image-1982" /></a><a href="http://www.kirsle.net/wizards/ttf2eot.cgi" target="_blank">ttf2eot by Kirsle </a> Convertisseur TTF vers EOT. Le style du site est totalement simpliste. Il y a une limite de taille de 1MB pour le fichier à convertir.</p>
<p style="height: 150px;">
<a href="http://ttf2eot.sebastiankippe.com/" target="_blank"><img src="http://www.bugz.fr/wp-content/uploads/2011/06/sebastiankippe.png" alt="" title="sebastiankippe" width="180" height="120" class="alignleft size-full wp-image-1974" /></a><a href="http://ttf2eot.sebastiankippe.com/" target="_blank">ttf2eot by sebastiankippe</a> Outil qui permet la conversion TTF vers EOT avec une page web avec style épuré à la Google. Il semblerait que son créateur va ajouter un convertisseur vers OTF.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bugz.fr/2011/06/comment-convertir-une-font-en-ttf-eot-woff-svg/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Comment imbriquer une fonte dans une page Web ?</title>
		<link>http://www.bugz.fr/2011/05/comment-imbriquer-une-fonte-dans-une-page-web/</link>
		<comments>http://www.bugz.fr/2011/05/comment-imbriquer-une-fonte-dans-une-page-web/#comments</comments>
		<pubDate>Wed, 25 May 2011 19:58:35 +0000</pubDate>
		<dc:creator>bugz</dc:creator>
				<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[Prog]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[font]]></category>
		<category><![CDATA[font-face]]></category>

		<guid isPermaLink="false">http://www.bugz.fr/?p=1814</guid>
		<description><![CDATA[L&#8217;attribut @font-face est loin d&#8217;être récent. Il existait déjà sur Internet Explorer 4 et sur Netscape 4. Malheursement il n&#8217;ont pas réussi à se mettre d&#8217;accord sur le format de fonte à utiliser. Il faut aussi savoir qu&#8217;à cette époque les connexions ADSL n&#8217;était réservé qu&#8217;aux plus chanceux d&#8217;entre nous. Par conséquent l&#8217;intégration d&#8217;une police [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.bugz.fr/wp-content/uploads/2011/05/font2.png"><img src="http://www.bugz.fr/wp-content/uploads/2011/05/font2.png" alt="" title="font" width="180" height="120" class="alignleft size-full wp-image-1889" /></a><strong>L&#8217;attribut @font-face</strong> est loin d&#8217;être récent. Il existait déjà sur Internet Explorer 4 et sur Netscape 4. Malheursement il n&#8217;ont pas réussi à se mettre d&#8217;accord sur le <strong>format de fonte</strong> à utiliser. </p>
<p>Il faut aussi savoir qu&#8217;à cette époque les connexions ADSL n&#8217;était réservé qu&#8217;aux plus chanceux d&#8217;entre nous. Par conséquent l&#8217;intégration d&#8217;une police de caractère à une page web était particulièrement pesante pour la bande passante. C&#8217;est certainement ces arguments qui ont poussé le <em>W3C</em> a ne pas inclure la propriété <strong>@font-face aux spécifications de CSS2.1</strong>.<span id="more-1814"></span></p>
<p>Mais aujourd&#8217;hui les choses ont bougés et la propriété est désormais <strong>incluse dans CSS3</strong>. Tous les navigateurs supportent maintenant cette propriété. </p>
<p>Malheureusement les problèmes de format ne sont pas pour autant résolus. Il en existe 5 types différent que l&#8217;ont peut imbriquer dans une page web.</p>
<h3>Format .TTF</h3>
<p>TrueType est un format vectoriel développé par Apple à la fin des années 1980. Il est aujourd&#8217;hui le plus utilisé des formats de police de caractères. Il est présent sur tout les systèmes d&#8217;exploitation. Mais il n&#8217;est pas compressé et donc pas optimisé pour une intégration web. Cependant nous pouvons palier à ce problème <a href="http://www.bugz.fr/2010/09/apache-compression-mod_gzip-et-mod_deflate/">en compressant le fichier avec apache avec mod_deflate ou mod_gzip</a>.</p>
<h3>Format .OTF</h3>
<p>OpenType est un format propriétaire, développé conjointement par Microsoft et Adobe. Il est basé sur TrueType et est son successeur sur Windows. </p>
<h3>Format .EOT</h3>
<p>C&#8217;est une version de OpenType compressé, qui est utilisé pour l&#8217;imbrication dans une page web. Il faut utiliser le Web Embedding Fonts Tool de Microsoft pour pouvoir créer une font de ce format. Le W3C a refusé d&#8217;en faire un standard pour CSS3. Actuellement seul Internet Explorer le supporte.</p>
<h3>Format .SVG</h3>
<p>Scalable Vector Graphics est un standard libre basé sur la lecture d&#8217;un fichier XML qui définit une forme graphique de manière vectorielle. </p>
<h3>Format .WOFF</h3>
<p>Ce format, crée en 2009, est considéré comme la WebFont à utiliser car <strong>elle est recommandée par le W3C</strong>. Elle sera certainement utilisée comme futur standard. Elle est constituée d&#8217;un TrueType compressé et de méta données.</p>
<h3>Compatibilité browser/format</h3>
<p>Le tableau suivant permet de se rendre compte que la compatibilité entre navigateur et format de font rend difficile le choix d&#8217;un format sur l&#8217;autre.</p>
<table width="100%">
<thead>
<tr>
<th>Browser</th>
<th width="10%">.eot</th>
<th width="10%">.ttf</th>
<th width="10%">.otf</th>
<th width="10%">.woff</th>
<th width="10%">.svg</th>
</tr>
</thead>
<tbody>
<tr>
<td>IE 4 &#8211; 8</td>
<td>X</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td>IE 9</td>
<td>X</td>
<td>-</td>
<td>-</td>
<td>X</td>
<td>-</td>
</tr>
<tr>
<td>Firefox 3.5 </td>
<td>-</td>
<td>X</td>
<td>X</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td>Firefox 3.6 &#8211; 4 </td>
<td>-</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>-</td>
</tr>
<tr>
<td>Opera 10</td>
<td>-</td>
<td>X</td>
<td>X</td>
<td>-</td>
<td>-</td>
</tr>
<tr>
<td>Opera 11</td>
<td>-</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
</tr>
<tr>
<td>Safari 3</td>
<td>-</td>
<td>X</td>
<td>X</td>
<td>-</td>
<td>X</td>
</tr>
<tr>
<td>Safari 4+</td>
<td>-</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
</tr>
<tr>
<td>Chrome 2 &#8211; 3</td>
<td>-</td>
<td>X</td>
<td>-</td>
<td>-</td>
<td>X</td>
</tr>
<tr>
<td>Chrome 4</td>
<td>-</td>
<td>X</td>
<td>X</td>
<td>-</td>
<td>X</td>
</tr>
<tr>
<td>Chrome 5+</td>
<td>-</td>
<td>X</td>
<td>X</td>
<td>X</td>
<td>X</td>
</tr>
</tbody>
</table>
<h3>Exemple d&#8217;utilisation de @font-face</h3>
<p>Pour utiliser une fonte imbriquée et s&#8217;assurer de la compatibilité entre les navigateurs, je vous conseille de charger plusieurs fichiers de la même fonte en précisant le format. Il est donc nécessaire de la déclarer de la manière suivante.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #a1a100;">@font-face{  </span>
	<span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">&quot;Ma Jolie Font&quot;</span><span style="color: #00AA00;">;</span> 
	<span style="color: #000000; font-weight: bold;">font-style</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">normal</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">normal</span><span style="color: #00AA00;">;</span>
	src<span style="color: #00AA00;">:</span> 	<span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'majoliefont.ttf'</span><span style="color: #00AA00;">&#41;</span>  format<span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'truetype'</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">,</span> 
        	<span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'majoliefont.otf'</span><span style="color: #00AA00;">&#41;</span>  format<span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'opentype'</span><span style="color: #00AA00;">&#41;</span> <span style="color: #00AA00;">,</span>
        	<span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'majoliefont.eot'</span><span style="color: #00AA00;">&#41;</span>  format<span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'opentype'</span><span style="color: #00AA00;">&#41;</span> <span style="color: #00AA00;">,</span>
         	<span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'majoliefont.woff'</span><span style="color: #00AA00;">&#41;</span>  format<span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'woff'</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Pour utiliser la fonte nouvellement imbriquée, il suffit maintenant d&#8217;utiliser l&#8217;attribut <code>font-family</code> avec son nom.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">html <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span><span style="color: #ff0000;">&quot;Ma Jolie Font&quot;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Si vous voulez avec une écriture grasse, il faudra aussi importer un fichier de fonte correspondant à celle-ci. Dans ce cas, dans la déclaration de <code>@font-face</code>, il faudra le préciser grâce à l&#8217;attribut <code>font-weight</code>.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #a1a100;">@font-face{  </span>
	<span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">&quot;Ma Jolie Font&quot;</span><span style="color: #00AA00;">;</span> 
	<span style="color: #000000; font-weight: bold;">font-style</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">normal</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">bold</span><span style="color: #00AA00;">;</span>
	src<span style="color: #00AA00;">:</span> 	<span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'majoliefont-bold.ttf'</span><span style="color: #00AA00;">&#41;</span>  format<span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'truetype'</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">,</span> 
        	<span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'majoliefont-bold.otf'</span><span style="color: #00AA00;">&#41;</span>  format<span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'opentype'</span><span style="color: #00AA00;">&#41;</span> <span style="color: #00AA00;">,</span>
        	<span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'majoliefont-bold.eot'</span><span style="color: #00AA00;">&#41;</span>  format<span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'opentype'</span><span style="color: #00AA00;">&#41;</span> <span style="color: #00AA00;">,</span>
         	<span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'majoliefont-bold.woff'</span><span style="color: #00AA00;">&#41;</span>  format<span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'woff'</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Dans le cas d&#8217;une écriture en italic, il faudra le préciser de la même manière grâce à l&#8217;attribut <code>font-style:italic</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.bugz.fr/2011/05/comment-imbriquer-une-fonte-dans-une-page-web/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Comment faire un texte en 3D avec CSS ?</title>
		<link>http://www.bugz.fr/2011/04/comment-faire-un-texte-en-3d-avec-css3/</link>
		<comments>http://www.bugz.fr/2011/04/comment-faire-un-texte-en-3d-avec-css3/#comments</comments>
		<pubDate>Wed, 27 Apr 2011 06:56:29 +0000</pubDate>
		<dc:creator>bugz</dc:creator>
				<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[Prog]]></category>
		<category><![CDATA[3D]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>

		<guid isPermaLink="false">http://www.bugz.fr/?p=1718</guid>
		<description><![CDATA[L&#8217;arrivée d&#8217;Internet Explorer 9 va enfin nous permettre d&#8217;exploiter à fond le CSS3. Tous les navigateurs modernes supportant désormais cette technologie, l&#8217;utilisation de Photoshop pour les effets de styles sur le texte n&#8217;est plus automatique. La propriété CSS text-3d n&#8217;existe pas en soit. Mais on peut créer l&#8217;effet 3D en superposant plusieurs ombres de texte [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.bugz.fr/wp-content/uploads/2011/04/css3D.png"><img src="http://www.bugz.fr/wp-content/uploads/2011/04/css3D-150x150.png" alt="" title="CSS3 3D" width="150" height="150" class="alignright size-thumbnail wp-image-1806" /></a>L&#8217;arrivée d&#8217;Internet Explorer 9 va enfin nous permettre <strong>d&#8217;exploiter à fond le CSS3</strong>. Tous les navigateurs modernes supportant désormais cette technologie, l&#8217;utilisation de Photoshop pour les effets de styles sur le texte n&#8217;est plus automatique. </p>
<p>La propriété CSS text-3d n&#8217;existe pas en soit. Mais on peut <strong>créer l&#8217;effet 3D</strong> en superposant plusieurs ombres de texte (<strong>text-shadow</strong>).<br />
<span id="more-1718"></span></p>
<p>La propriété text-shadow permet de créer l&#8217;ombre d&#8217;un texte avec un décalage en x et en y.<br />
La couleur de l&#8217;ombre, ainsi que la diffusion de celle-ci peut être choisie.</p>
<p><br/><br />
<strong>text-shadow</strong>: <span style="color:#CC00CC">position_x</span> <span style="color:purple">position_y</span> <span style="color:green">diffusion</span> <span style="color:red">couleur</span>;<br />
<br/><br />
<br/></p>
<div>
<div style="width:30%;float:left;font-size:36px;text-shadow: 5px 10px 1px #CFB565;">
Ombre
</div>
<div style="width:66%">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">.texte_au_soleil<span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">text-shadow</span><span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">3px</span> <span style="color: #933;">5px</span> <span style="color: #cc00cc;">#CFB565</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
</div>
<p>La superposition des ombres est très simple à mettre en place, il suffit d&#8217;ajouter d&#8217;autres ombres à la propriété text-shadow de la manière suivante.</p>
<div>
<div style="width:30%;float:left;font-size:36px;text-shadow:1px 1px 1px #CFB565,1px 2px 1px #CFB565,1px 3px 1px #CFB565,1px 4px 1px #CFB565,1px 5px 1px #CFB565,1px 6px 1px #CFB565,1px 7px 1px #CFB565;">
Text 3D
</div>
<div style="width:66%">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">.texte_3D<span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">text-shadow</span><span style="color: #00AA00;">:</span> 
        <span style="color: #933;">1px</span> <span style="color: #933;">1px</span> <span style="color: #933;">1px</span> <span style="color: #cc00cc;">#CFB565</span><span style="color: #00AA00;">,</span>
        <span style="color: #933;">1px</span> <span style="color: #933;">2px</span> <span style="color: #933;">1px</span> <span style="color: #cc00cc;">#CFB565</span><span style="color: #00AA00;">,</span>
        <span style="color: #933;">1px</span> <span style="color: #933;">3px</span> <span style="color: #933;">1px</span> <span style="color: #cc00cc;">#CFB565</span><span style="color: #00AA00;">,</span>
        <span style="color: #933;">1px</span> <span style="color: #933;">4px</span> <span style="color: #933;">1px</span> <span style="color: #cc00cc;">#CFB565</span><span style="color: #00AA00;">,</span>
        <span style="color: #933;">1px</span> <span style="color: #933;">5px</span> <span style="color: #933;">1px</span> <span style="color: #cc00cc;">#CFB565</span><span style="color: #00AA00;">,</span>
        <span style="color: #933;">1px</span> <span style="color: #933;">6px</span> <span style="color: #933;">1px</span> <span style="color: #cc00cc;">#CFB565</span><span style="color: #00AA00;">,</span>
        <span style="color: #933;">1px</span> <span style="color: #933;">7px</span> <span style="color: #933;">1px</span> <span style="color: #cc00cc;">#CFB565</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
</div>
<p>On peut donner plus de réalisme à l&#8217;effet 3D en ajoutant un jeu de lumière grâce à une ombre plus diffuse.</p>
<div>
<div style="width:30%;float:left;font-size:36px;text-shadow:1px 1px 1px #CFB565,1px 2px 1px #CFB565,1px 3px 1px #CFB565,1px 4px 1px #CFB565,1px 5px 1px #CFB565,1px 6px 1px #CFB565,1px 7px 1px #CFB565,0 1px 1px rgba(68,68,68,.3),0 5px 3px rgba(68,68,68,.2),0 10px 4px rgba(68,68,68,.2),0 15px 8px rgba(68,68,68,.2),0 30px 10px rgba(68,68,68,.1);">
Text 3D
</div>
<div style="width:66%">

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">.texte_3D<span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">text-shadow</span><span style="color: #00AA00;">:</span> 
        <span style="color: #933;">1px</span> <span style="color: #933;">1px</span> <span style="color: #933;">1px</span> <span style="color: #cc00cc;">#CFB565</span><span style="color: #00AA00;">,</span>
        <span style="color: #933;">1px</span> <span style="color: #933;">2px</span> <span style="color: #933;">1px</span> <span style="color: #cc00cc;">#CFB565</span><span style="color: #00AA00;">,</span>
        <span style="color: #933;">1px</span> <span style="color: #933;">3px</span> <span style="color: #933;">1px</span> <span style="color: #cc00cc;">#CFB565</span><span style="color: #00AA00;">,</span>
        <span style="color: #933;">1px</span> <span style="color: #933;">4px</span> <span style="color: #933;">1px</span> <span style="color: #cc00cc;">#CFB565</span><span style="color: #00AA00;">,</span>
        <span style="color: #933;">1px</span> <span style="color: #933;">5px</span> <span style="color: #933;">1px</span> <span style="color: #cc00cc;">#CFB565</span><span style="color: #00AA00;">,</span>
        <span style="color: #933;">1px</span> <span style="color: #933;">6px</span> <span style="color: #933;">1px</span> <span style="color: #cc00cc;">#CFB565</span><span style="color: #00AA00;">,</span>
        <span style="color: #933;">1px</span> <span style="color: #933;">7px</span> <span style="color: #933;">1px</span> <span style="color: #cc00cc;">#CFB565</span><span style="color: #00AA00;">,</span>
        <span style="color: #cc66cc;">0</span> <span style="color: #933;">1px</span> <span style="color: #933;">1px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">68</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">68</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">68</span><span style="color: #00AA00;">,</span>.3<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">,</span>
        <span style="color: #cc66cc;">0</span> <span style="color: #933;">5px</span> <span style="color: #933;">3px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">68</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">68</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">68</span><span style="color: #00AA00;">,</span>.2<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">,</span>
        <span style="color: #cc66cc;">0</span> <span style="color: #933;">10px</span> <span style="color: #933;">4px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">68</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">68</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">68</span><span style="color: #00AA00;">,</span>.2<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">,</span>
        <span style="color: #cc66cc;">0</span> <span style="color: #933;">15px</span> <span style="color: #933;">8px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">68</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">68</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">68</span><span style="color: #00AA00;">,</span>.2<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">,</span>
        <span style="color: #cc66cc;">0</span> <span style="color: #933;">30px</span> <span style="color: #933;">10px</span> rgba<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">68</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">68</span><span style="color: #00AA00;">,</span><span style="color: #cc66cc;">68</span><span style="color: #00AA00;">,</span>.1<span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.bugz.fr/2011/04/comment-faire-un-texte-en-3d-avec-css3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Le PHP Big Bang provoqué par un isset sur l&#8217;attribut d&#8217;un objet</title>
		<link>http://www.bugz.fr/2011/04/le-php-big-bang-provoque-par-un-isset-sur-lattribut-dun-objet/</link>
		<comments>http://www.bugz.fr/2011/04/le-php-big-bang-provoque-par-un-isset-sur-lattribut-dun-objet/#comments</comments>
		<pubDate>Wed, 06 Apr 2011 20:31:01 +0000</pubDate>
		<dc:creator>bugz</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Prog]]></category>
		<category><![CDATA[empty]]></category>
		<category><![CDATA[isset]]></category>
		<category><![CDATA[magic mehod]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.bugz.fr/?p=1584</guid>
		<description><![CDATA[Comment résoudre un bug PHP provoqué par l'appel de la fonction isset ?]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.bugz.fr/wp-content/uploads/2011/04/bigbang-php1.png"><img src="http://www.bugz.fr/wp-content/uploads/2011/04/bigbang-php1.png" alt="" title="bigbang-php" width="230" height="150" class="alignright size-full wp-image-1649" /></a></p>
<p>L&#8217;utilisation de <em>PHP5</em>, enfin l&#8217;utilisation de la programmation objet dans ce langage peut parfois s&#8217;avérer déstabilisant. Un développeur PHP ne doit jamais oublier que la notion objet est en réalité un patch appliqué au langage et qui n&#8217;était donc pas prévu dans les premières versions. </p>
<p>J&#8217;ai été récemment confronté à un problème qui m&#8217;a laissé relativement dubitatif. Il s&#8217;agissait d&#8217;élucider le mystère de l&#8217;aberrant résultat issu de mes lignes de code PHP, qui dans une certaine situation, me retournait <strong>un objet vide</strong> mais ayant <strong>tout de même une valeur</strong>. <span id="more-1584"></span><br />
Dit de cette manière, je sais que ce n&#8217;est pas très clair. Je vais donc, plutôt illustrer mon problème avec une synthèse de ces quelques lignes :</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$objA</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ObjA<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
<span style="color: #000088;">$objA</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">attr</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;42&quot;</span> <span style="color: #339933;">;</span>
<span style="color: #000088;">$var</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$objA</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">attr</span> <span style="color: #339933;">;</span>
<span style="color: #990000;">var_dump</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$objA</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">attr</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>               
<span style="color: #990000;">var_dump</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$objA</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">attr</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span> 
<span style="color: #990000;">var_dump</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$objA</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">attr</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span> 
<span style="color: #990000;">var_dump</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #666666; font-style: italic;">// retourne</span>
<span style="color: #666666; font-style: italic;">// string '42' (length=2)</span>
<span style="color: #666666; font-style: italic;">// boolean false</span>
<span style="color: #666666; font-style: italic;">// boolean false</span>
<span style="color: #666666; font-style: italic;">// boolean true</span></pre></div></div>

<p>Donc, voilà mon problème comment l&#8217;attribut <code>attr</code> de l&#8217;objet <code>objA</code> peut-il <strong>être vide, et en même temps retourner la valeur 42</strong>. </p>
<p>Ca ne parait pas logique, mais bon, après tout, ça ne serait pas la première réalité qui m&#8217;échapperait. Si le temps et l&#8217;espace est à l&#8217;origine une même chose, alors pourquoi le néant et le concret ne seraient-ils pas aussi confondus ?</p>
<p>Au lieu de chercher ma réponse à l&#8217;origne des temps (ou de l&#8217;espace je ne sais plus trop), essayons de remonter à la racine de mon code source.</p>
<p>La classe <code>ObjA</code> est la suivante :</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> ObjA <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$attr</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __get<span style="color: #009900;">&#40;</span><span style="color: #000088;">$att</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #000088;">$att</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __set<span style="color: #009900;">&#40;</span><span style="color: #000088;">$att</span><span style="color: #339933;">,</span><span style="color: #000088;">$val</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #000088;">$att</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$val</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #000088;">$att</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>La seule spécificité de cette classe est qu&#8217;elle possède des <strong>magic getters et setters</strong> qui permettent d&#8217;accéder à ses tous ses attributs comme s&#8217;ils étaient publics de la manière suivante :</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$objA</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ObjA<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$objA</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">attr</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;42&quot;</span> <span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// appel de __set</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$objA</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">attr</span> <span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// appel de __get</span></pre></div></div>

<p>Si on change l&#8217;attribut de la classe <code>ObjA</code> en <strong>public</strong> et que l&#8217;on relance le test, on obtient le surprenant résultat suivant :</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$objA</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ObjA<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
<span style="color: #000088;">$objA</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">attr</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;42&quot;</span> <span style="color: #339933;">;</span>
<span style="color: #000088;">$var</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$objA</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">attr</span> <span style="color: #339933;">;</span>
<span style="color: #990000;">var_dump</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$objA</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">attr</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>               
<span style="color: #990000;">var_dump</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$objA</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">attr</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span> 
<span style="color: #990000;">var_dump</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$objA</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">attr</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span> 
<span style="color: #990000;">var_dump</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span> 
&nbsp;
<span style="color: #666666; font-style: italic;">// retourne</span>
<span style="color: #666666; font-style: italic;">// string '42' (length=2)</span>
<span style="color: #666666; font-style: italic;">// boolean true</span>
<span style="color: #666666; font-style: italic;">// boolean true</span>
<span style="color: #666666; font-style: italic;">// boolean true</span></pre></div></div>

<p>L&#8217;attribut <code>$objA->attr</code> possède toujours la valeur &laquo;42&raquo; et ne semble cette fois ne plus être vide. <strong>Le PHP Big Bang</strong> aurait-il enfin eu lieu ? Le néant et le concret se seraient-ils séparés ?</p>
<p>Rien n&#8217;est encore sur, mais on peut affirmé que le problème survient lorsque l&#8217;on essaie d&#8217;accéder à un attribut à partir d&#8217;une classe dont nous n&#8217;avons pas la visibilité (sur un<em> attribut private ou protected</em>). </p>
<p>Essayons de décortiquer ce qu&#8217;il s&#8217;est passé :</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$objA</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">attr</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span></pre></div></div>

<p><code>$objA->attr</code> est catché par le magic getter de <code>ObjA</code> qui est censé retourner la valeur de l&#8217;attribut <code>$this->attr</code> .</p>
<p>Ce qu&#8217;il fait car <code>echo $objA->attr</code> retourne bien la valeur.</p>
<p>En toute logique la fonction <code>isset</code> devrait analyser ce que nous lui fournissons en paramètre, soit la valeur retourné par le getter, mais il n&#8217;en est rien, pour une raison inconnue elle semble introspecter l&#8217;objet <code>$objA</code>.</p>
<p>Un petit coup d&#8217;œil dans la <strong>documentation</strong> de la <strong>fonction isset de php</strong> permet d&#8217;y voir un peu plus clair.</p>
<blockquote><p>
<em>Note:</p>
<p>When using isset() on inaccessible object properties, the __isset overloading method will be called, if declared.</em> </p></blockquote>
<p><strong>Pour contrer le Big Bang</strong>, il suffirait de surcharger le comportement de la magic method <code>__isset</code> d&#8217;un object lors de l&#8217;appel de la méthode <code>isset</code> sur son attribut.</p>
<p>En simple, la classe ObjA doit ressemblé à ça :</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> ObjA <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$attr</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __get<span style="color: #009900;">&#40;</span><span style="color: #000088;">$att</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #000088;">$att</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __set<span style="color: #009900;">&#40;</span><span style="color: #000088;">$att</span><span style="color: #339933;">,</span><span style="color: #000088;">$val</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #000088;">$att</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$val</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #000088;">$att</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __isset<span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div>

<p>Encore plus incroyable, après avoir tester, le <strong>Big Bang ne se produirait pas sur Windows</strong>. En tout cas pas avec la version 5.2.5 de PHP.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bugz.fr/2011/04/le-php-big-bang-provoque-par-un-isset-sur-lattribut-dun-objet/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Comment configurer WordPress pour avoir l&#8217;admin en HTTPS ?</title>
		<link>http://www.bugz.fr/2011/03/comment-configurer-wordpress-pour-avoir-ladmin-en-https/</link>
		<comments>http://www.bugz.fr/2011/03/comment-configurer-wordpress-pour-avoir-ladmin-en-https/#comments</comments>
		<pubDate>Tue, 15 Mar 2011 19:26:15 +0000</pubDate>
		<dc:creator>bugz</dc:creator>
				<category><![CDATA[Outils]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[HTTPS]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.bugz.fr/?p=1465</guid>
		<description><![CDATA[Tutorial qui explique comment mettre en place une connexion sécuriser via SSL pour la zone d'administration de wordpress.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.bugz.fr/wp-content/uploads/2011/03/wordpresscrypted.png"><img width="150" height="150" alt="" src="http://www.bugz.fr/wp-content/uploads/2011/03/wordpresscrypted.png" title="wordpresscrypted" style="float: left; padding-right: 10px;" class="alignleft size-full wp-image-1381"></a></p>
<p>Il est recommandé de sécuriser au maximum l&#8217;accès à son blog. Surtout lors de <strong>l&#8217;utilisation de CMS</strong> tel que Worpress, qui sont soumis à des attaques génériques.</p>
<p>Parmis les précautions que l&#8217;on peut prendre, il est possible <strong>d&#8217;encrypter via SSL ses communications</strong> avec les pages d&#8217;administations de votre blog. </p>
<p>Pour celà, il suffit de changer le protocol réseau dans le fichier le fichier de configuration de WordPress.<br />
<span id="more-1465"></span><br />
Ouvrez le fichier <code>wp-config.php</code> et insérer la ligne suivante :</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;FORCE_SSL_ADMIN&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Il sera également nécéssaire de <strong>configurer apache</strong> pour activer SSL sur le port <strong>443</strong>.<br />
Pour celà vous pouvez vous inspirez de la conf suivante :</p>

<div class="wp_syntax"><div class="code"><pre class="conf" style="font-family:monospace;">&lt;VirtualHost *:443&gt;
    ServerName www.monblog.com
&nbsp;
    SSLEngine On
    SSLCertificateFile    /chemin/vers/fichier/cert
    SSLCertificateKeyFile /chemin/vers/fichier/pem
    SetEnvIf User-Agent &quot;.*MSIE.*&quot; nokeepalive ssl-unclean-shutdown
&nbsp;
    DocumentRoot /var/www/monblog
&nbsp;
    &lt;IfModule mod_rewrite.c&gt;
        RewriteEngine On
        RewriteRule !^/wp-admin/(.*) - [C]
        RewriteRule ^/(.*) http://www.monblog.com/$1 [QSA,L]
    &lt;/IfModule&gt;
&nbsp;
&lt;/VirtualHost&gt;</pre></div></div>

<p>Vous pouvez également ajouté une règle de réécriture pour forcer l&#8217;utilisation de https lors de la saisie d&#8217;une URL de l&#8217;admin :</p>

<div class="wp_syntax"><div class="code"><pre class="conf" style="font-family:monospace;">&lt;VirtualHost *:80&gt;
    ServerName www.monblog.com
    DocumentRoot /var/www/monblog
&nbsp;
    &lt;Directory /var/www/monblog &gt;
        &lt;IfModule mod_rewrite.c&gt;
            RewriteEngine On
            RewriteBase /
            RewriteCond %{REQUEST_FILENAME} -f [OR]
            RewriteCond %{REQUEST_FILENAME} -d
            RewriteRule ^wp-admin/(.*) https://www.mysite.com/wp-admin/$1 [C]
            RewriteRule ^.*$ - [S=40]
        &lt;/IfModule&gt;
    &lt;/Directory&gt;
&lt;/VirtualHost&gt;</pre></div></div>

<p>Et voila le tour est joué, il suffit désormais d&#8217;accéder à l&#8217;admin via l&#8217;addresse suivante :<br />
<br/></p>
<p style="text-align:center">
<strong>https</strong>://votre-blog.com/wp-admin
</p>
<p>Il est également possible de passer par un plugin <a target="_blank" href="http://wordpress.org/extend/plugins/admin-ssl-secure-admin/">Admin SSL</a>. Mais il n&#8217;est malheureusement compatible qu&#8217;avec les anciennes versions de WordPress. Et puis bon, pour une ligne à ajouter dans la config, je vois pas l&#8217;intérêt d&#8217;installer un plugin qui a de grande chance de ralentir votre wordpress. </p>
<p>source: http://codex.wordpress.org/Administration_Over_SSL</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bugz.fr/2011/03/comment-configurer-wordpress-pour-avoir-ladmin-en-https/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

