<?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>Scboffspring</title>
	<atom:link href="http://blog.scboffspring.eu/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.scboffspring.eu</link>
	<description>A developer and his geekness</description>
	<lastBuildDate>Mon, 28 Feb 2011 00:10:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>“Le libre doit être gratuit!” Mais oui, pis tu veux 100 balles et un Mars avec?!?</title>
		<link>http://blog.scboffspring.eu/2010/05/28/le-libre-doit-etre-gratuit-mais-oui-pis-tu-veux-un-mars-avec/</link>
		<comments>http://blog.scboffspring.eu/2010/05/28/le-libre-doit-etre-gratuit-mais-oui-pis-tu-veux-un-mars-avec/#comments</comments>
		<pubDate>Fri, 28 May 2010 21:20:28 +0000</pubDate>
		<dc:creator>Scboffspring</dc:creator>
				<category><![CDATA[Geekness]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[gratuit]]></category>
		<category><![CDATA[hérésie]]></category>
		<category><![CDATA[Libre]]></category>
		<category><![CDATA[licenses]]></category>
		<category><![CDATA[monde actuel]]></category>

		<guid isPermaLink="false">http://blog.scboffspring.eu/?p=162</guid>
		<description><![CDATA[L&#8217;autre jour, en lisant mon Twitter, je suis tombé sur un article (&#8220;Vendre des logiciels libres, une hérésie ?&#8221;) qui m&#8217;a donné envie d&#8217;écrire aussi mes pensées sur ce sujet, celui de Philippe Scoffoni. Combien de fois, en se baladant sur &#8230;<p class="read-more"><a href="http://blog.scboffspring.eu/2010/05/28/le-libre-doit-etre-gratuit-mais-oui-pis-tu-veux-un-mars-avec/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>L&#8217;autre jour, en lisant mon Twitter, je suis tombé sur un article (&#8220;Vendre des logiciels libres, une hérésie ?&#8221;) qui m&#8217;a donné envie d&#8217;écrire aussi mes pensées sur ce sujet, celui de <a href="http://philippe.scoffoni.net/vendre-des-logiciels-libres-une-heresie/">Philippe Scoffoni</a>.</p>
<p>Combien de fois, en se baladant sur internet, sur différents forums, par exemple celui <a href="http://forum.ubuntu-fr.org/">ubuntu-fr.org</a>, des utilisateurs qui disaient &#8220;Le libre doit être gratuit&#8221;?!? Beaucoup trop souvent en tout cas. Que doit-on en penser? Ont-il raison? Tort? Sont-ils aussi idiots qu&#8217;il le montrent? Je vais exposer mon point de vue sur ce sujet sensible au troll&#8230;</p>
<h1>Libre? Kézako?</h1>
<p>Tout d&#8217;abord, situons un peu plus. Je vais principalement parler des logiciels, étant plutôt développeur, mais cela peut concerner tout aussi bien la musique, que les photos.  Ce qui est considéré comme libre, c&#8217;est quelque chose que nous pouvons reproduire à souhaits, donner à son ami qui est pauvre, l&#8217;utiliser comme bon nous semble, etc. Bien sûr, il peut y avoir certaines restrictions, par exemple de citer l&#8217;auteur, ou de ne pas le modifier. Pour un programme, on considèrera comme &#8220;libre/open source&#8221; plus ou moins quand les sources sont publiques, même si ça n&#8217;est pas réellement le cas.</p>
<p>Les grands avantages de ceci, c&#8217;est la possibilité de voir facilement les failles possibles, et surtout pouvoir modifier le programme, ou le script, pour qu&#8217;il corresponde à nos envie. C&#8217;est chouette non? Pouvoir modifier ce truc, et en faire un truc personnalisé, avec les failles du développeur du dimanche en moins.</p>
<p>Maintenant&#8230; Si vous voulez modifier un peu l&#8217;interface d&#8217;un programme, 2 choix sont là.</p>
<p>Premier choix, le logiciel payant: C&#8217;est &#8220;possible&#8221;, mais va falloir s&#8217;amuser un moment, et ce sera du bricolage. C&#8217;est un peu nul quand même.</p>
<p>Deuxième possibilité, le logiciel libre : on récupère les sources, modifie ce qui nous plaît pas (il faut les compétences quand même^^), on compile, et on a réalisé quelque chose de beaucoup plus propre!</p>
<p>Donc le libre, c&#8217;est bien, c&#8217;est beau, et en plus c&#8217;est gratuit!</p>
<p>Le problème avec ceci, c&#8217;est que beaucoup de personne confonde libre avec gratuit. Ben oui, ça paraît logique, on peut avoir les sources etc, pourquoi devrait-on encore payer? Et c&#8217;est là un gros problème de la société, on veut pas payer, surtout si c&#8217;est pour une utilisation &#8220;unique&#8221; (j&#8217;suis du genre aussi, je comprends donc tout à fait <img src='http://blog.scboffspring.eu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  )</p>
<h1>Bon, je paierai pas ton logiciel libre alors!</h1>
<p>Excellent choix Monsieur! Télécharge moi tous ces beaux logiciels que quelqu&#8217;un a développé gracieusement, afin de nous aider!</p>
<p>Il est vrai qu&#8217;en général, beaucoup de logiciel libre sont gratuits pour tous. Par exemple, la plupart des distributions Linux (Ubuntu/Debian/Gentoo/ArchLinux/&#8230;), c&#8217;est un très bon remplaçant de Windows, et ça  nous évite de le pirater, nous ne serons donc pas hors-la-loi.</p>
<p>Il est aussi vrai que de premier abord, la plupart des logiciels libre paraissent moins performants que leur concurrent propriétaire, et je dois dire qu&#8217;en général, c&#8217;est vrai. Je vais prendre par exemple Photoshop, comparé à son concurrent libre, Gimp. Y&#8217;a pas photo, Photoshop est bien plus user-friendly, et plus complet que Gimp, avec ses 20 fenêtres ouvertes pour gérer ses calques, couleurs, et compagnie. Donc pourquoi payer pour un logiciel libre, si il est moins bon que le concurrent payant, que je trouve sur n&#8217;importe quel réseau de téléchargement (Torrent/DDL/P2P).</p>
<p>Le problème, c&#8217;est que le développement c&#8217;est du temps et de l&#8217;argent. Prenons par exemple une personnes développant un système de &#8220;chat&#8221;, pour concurrencer msn, il lui faudra :</p>
<ul>
<li>Un ordinateur pour développer</li>
<li>Un serveur pour gérer les connexions des utilisateurs</li>
<li>Un serveur Web pour présenter le projet, le mettre à disposition, etc..</li>
<li>Des livres pour apprendre (facultatif)</li>
</ul>
<p>Et tout ça, ce n&#8217;est malheureusement pas gratuit.</p>
<p>Pour ça, il y certaines grosses sociétés/fondations qui sont derrière ces logiciels libres. Par exemple &#8220;Canonical&#8221; avec Ubuntu, la fondation &#8220;Mozilla&#8221; derrière Firefox, ou la fondation &#8220;Eclipse&#8221;, qui est derrière Eclipse. Ces entreprises arrivent à lever de l&#8217;argent, grâce aux actionnaires, aux dons des utilisateurs, ou tout autre moyen.</p>
<p>Mais ce n&#8217;est pas le cas du petit développeur, tel que moi, ou un étudiant ayant une bonne idée, qui lui doit sortir cet argent de sa poche. Comment font-ils? Il est certain que ça ne dérange pas tous les développeurs, que certains ont juste envie d&#8217;aider les utilisateurs, et de leur offrir la meilleure expérience possible, et gratuitement, sur le temps libre. Et d&#8217;autre, aimerait pouvoir gagner un peu d&#8217;argent, pour arrondir les fins de mois, ou même, si possible, y vivre!</p>
<p>A ce moment là, 3 choix sont possibles pour cette personnes.</p>
<ul>
<li>Faire du propriétaire, et faire payer le logiciel</li>
<li>Faire du libre, et &#8220;demander&#8221; des dons</li>
<li>Faire du libre, et faire payer le support</li>
<li>Faire du libre, et le faire payer</li>
</ul>
<p>C&#8217;est un choix qui peut s&#8217;avérer difficile.</p>
<ul>
<li>Le premier choix, je suis certain d&#8217;avoir du pognon, c&#8217;est le top. Mais pour l&#8217;acheteur, impossible de le modifier pour l&#8217;intégrer comme il l&#8217;aimerait, ou rajouter une fonction. C&#8217;est dommage</li>
<li>Le 2ème choix, j&#8217;espère en avoir, mais la communauté sera normalement très contente. Ils peuvent en faire ce qu&#8217;ils en veulent</li>
<li>Le 3ème choix, c&#8217;est un des choix le plus souvent utilisé. C&#8217;est vrai que c&#8217;est pratique, le logiciel est gratuit, mais si on veut de l&#8217;aide, ou n&#8217;importe quoi, on paye. Pourquoi pas? Mais c&#8217;est pas certain que les utilisateurs vont vraiment prendre ce support.</li>
<li>Et le 4ème choix, je suis certain d&#8217;avoir du pognon, et la communauté pourrait être contente, car elle a en plus le droit d&#8217;améliorer le programme afin de l&#8217;intégrer au mieux dans l&#8217;entreprise. Mais je risque d&#8217;avoir moins d&#8217;utilisateurs qu&#8217;avec le 2ème choix.</li>
</ul>
<p>Personnellement, le choix qui m&#8217;intéresserait le plus, ce serait le 4ème. J&#8217;ai moyen de faire plaisir, et j&#8217;ai un revenu &#8220;fixe&#8221;.  C&#8217;est le top. (Et vous? N&#8217;hésitez pas à répondre en commentaire, vos avis m&#8217;intéressent)</p>
<h1>Le problème de la licence</h1>
<p>Maintenant, un problème se pose tout de même. Admettons qu&#8217;on vende un de ces logiciels. Avec la majorité des licences libres existantes (GPL/MIT/Apache/CC/&#8230;), n&#8217;importe quel acheteur peut le redistribuer gratuitement sur un site connexe. Au final, si cela se produit,  l&#8217;utilisateur ira voir l&#8217;autre, avec le même software, mais gratuit. Pour &#8220;contrer&#8221; cela, une seule possibilité, demander aux acheteurs de ne pas redistribuer gratuitement, et/ou de modifier et redistribuer sans l&#8217;accord du propriétaire (donc vous). <strong>ILS NE SERONT PAS OBLIGE DE LE FAIRE</strong>, mais essayons de faire confiance à notre utilisateur <img src='http://blog.scboffspring.eu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Dans un prochain article, je vais essayer de vous montrer les différentes licences existantes, leurs défauts et leurs qualités.</p>
<h2><strong>Liens intéressants :</strong></h2>
<p><a href="http://www.april.org/Livre-Blanc-des-Mod%C3%A8les-%C3%89conomiques-du-Logiciel-Libre">Whitepaper sur les modèles économiques du libre</a></p>
<p><a href="http://forum.framasoft.org/viewforum.php?f=97">Framagora &#8211; Forum &#8220;Mise sous licence libre : questions pratiques et juridiques&#8221;</a></p>
<p><a href="http://philippe.scoffoni.net/vendre-des-logiciels-libres-une-heresie/">L&#8217;article de Philippe Scoffoni</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.scboffspring.eu/2010/05/28/le-libre-doit-etre-gratuit-mais-oui-pis-tu-veux-un-mars-avec/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>[Blackberry]RemotePowerpoint, control your presentation remotely [BETA]</title>
		<link>http://blog.scboffspring.eu/2010/05/02/beta-remotepowerpoint/</link>
		<comments>http://blog.scboffspring.eu/2010/05/02/beta-remotepowerpoint/#comments</comments>
		<pubDate>Sun, 02 May 2010 00:36:40 +0000</pubDate>
		<dc:creator>Scboffspring</dc:creator>
				<category><![CDATA[BlackBerry]]></category>
		<category><![CDATA[Download]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[Control]]></category>
		<category><![CDATA[Powerpoint]]></category>
		<category><![CDATA[Remote]]></category>

		<guid isPermaLink="false">http://blog.scboffspring.eu/?p=138</guid>
		<description><![CDATA[This is my first BlackBerry project, and I give you the opportunity to try and use it!

My project is an app to control a Powerpoint remotely, for the moment only via Bluetooth, and maybe later via Wi-FI too.

RemotePowerpoint is really easy to use. Launch the app, choose the computer in the device list shown after 10 seconds, and you're connected.

When you're connected, and after Powerpoint is launched, you can press "S", and your powerpoint will start in fullscreen. Then press "N" or "Space" to move to next slide, and "P" to go previous.<p class="read-more"><a href="http://blog.scboffspring.eu/2010/05/02/beta-remotepowerpoint/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>Hello everybody!</p>
<p>This is my first BlackBerry project, and I give you the opportunity to try and use it!</p>
<p>My project is an app to control a Powerpoint remotely, for the moment only via Bluetooth, and maybe later via Wi-FI too.</p>
<p>It will work only with Blackberry having a Full-Keyboard (like 8900, 9000, 9700, etc..), and Bluetooth. I haven&#8217;t tried it on 4.x firmware, but I think it should work (need confirmation)</p>
<p>RemotePowerpoint is really easy to use. Launch the app on your Blackberry, and on your computer, choose the computer which is running RemotePowerpoint in the device list shown after 10 seconds</p>
<p style="text-align: center;"><a href="http://blog.scboffspring.eu/wp-content/uploads/2010/05/bluetooth.png"><img class="aligncenter size-full wp-image-148" title="Screen from RemotePowerpoint, bluetooth connexion" src="http://blog.scboffspring.eu/wp-content/uploads/2010/05/bluetooth.png" alt="" width="288" height="216" /></a></p>
<p>and you&#8217;re connected.</p>
<p><a href="http://blog.scboffspring.eu/wp-content/uploads/2010/05/desktop.png"><img class="aligncenter size-full wp-image-147" title="Desktop screenshot of RemotePowerpoint" src="http://blog.scboffspring.eu/wp-content/uploads/2010/05/desktop.png" alt="" width="259" height="99" /></a></p>
<p>If you have any problem to find your computer, you&#8217;ve to re-launch the app for the moment. I haven&#8217;t implemented a way to &#8220;refresh&#8221; the list again (in my to-do list)</p>
<p>When you&#8217;re connected, and after MS Powerpoint is launched, you can press &#8220;S&#8221;, and your powerpoint will start in fullscreen. Then press &#8220;N&#8221; or &#8220;Space&#8221; to move to next slide, and &#8220;P&#8221; to go previous.</p>
<p style="text-align: center;"><a href="http://blog.scboffspring.eu/wp-content/uploads/2010/05/screen.png"><img class="aligncenter size-full wp-image-149" title="Screen from RemotePowerpoint, the main screen" src="http://blog.scboffspring.eu/wp-content/uploads/2010/05/screen.png" alt="" width="288" height="216" /></a></p>
<p>There is a timer on the screen. You can start/stop when pressing &#8220;T&#8221;. To reset it, press &#8220;R&#8221;.</p>
<p>It is better to start the bluetooth from the Blackberry, in &#8220;Manage connections&#8221;, than to start it while RemovePowerpoint is starting.</p>
<p>If you want to download this app from your BB, go to <a href="http://blackberry.rocks-it.com">http://blackberry.rocks-it.com</a>, and you&#8217;ll find a link named &#8220;RemoteBlackberry&#8221;.</p>
<p>The desktop application can be download from <a title="RemotePowerpoint Desktop" href="http://blackberry.rocks-it.com/RP/RemotePowerpointDesktop.jar">here</a></p>
<p>If you try it, give me some feedbacks (good or bad), and I&#8217;ll take all what you say into consideration. And if you have ideas to improve this app, say it, and I&#8217;ll do all what I can to implement it for the next version.</p>
<p>If you find this app cool and/or useful, or just because you want to motivate me&#8230; Buy me some beers!</p>
<p><center><br />
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_donations">
<input type="hidden" name="business" value="TKJXTDBGZDR5U">
<input type="hidden" name="lc" value="CH">
<input type="hidden" name="item_name" value="Scboffspring">
<input type="hidden" name="item_number" value="RemotePowerpoint">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="bn" value="PP-DonationsBF:btn_donate_LG.gif:NonHosted">
<input type="image" src="https://www.paypal.com/fr_FR/CH/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - la solution de paiement en ligne la plus simple et la plus sécurisée !">
<img alt="" border="0" src="https://www.paypal.com/fr_FR/i/scr/pixel.gif" width="1" height="1"><br />
</form>
<p></center></p>
<h2>Summary</h2>
<p>You need Java on your computer</p>
<p>The application needed on your computer can be found <a href="http://blackberry.rocks-it.com/RP/RemotePowerpointDesktop.jar">here</a></p>
<p>Go to http://blackberry.rocks-it.com with your Blackberry to download this app<strong>. !!! UPDATE Link is invalid for now. If you really need this app, please email : admin*AT*scboffspring.eu (replace *AT* by &#8220;@&#8221;)!!!<br />
</strong><br />
Be careful! This is Beta 0.1, bugs probably exists..</p>
<p>PS: Sorry for my english, it isn&#8217;t my mother tongue&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.scboffspring.eu/2010/05/02/beta-remotepowerpoint/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>[PlayFramework] Premier jour de jeu!</title>
		<link>http://blog.scboffspring.eu/2010/04/11/playframework-premier-jour-de-jeu/</link>
		<comments>http://blog.scboffspring.eu/2010/04/11/playframework-premier-jour-de-jeu/#comments</comments>
		<pubDate>Sun, 11 Apr 2010 01:07:52 +0000</pubDate>
		<dc:creator>Scboffspring</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[PlayFramework]]></category>
		<category><![CDATA[Programmation]]></category>

		<guid isPermaLink="false">http://blog.scboffspring.eu/?p=124</guid>
		<description><![CDATA[Aujourd&#8217;hui, comme annoncé dans mon dernier article de la nuit passée, j&#8217;ai donné une chance à ce récent framework Java, permettant le développement web, j&#8217;ai nommé Play! Ce que j&#8217;ai fait Tout d&#8217;abord, j&#8217;ai commencé par télécharger ce framework, voir &#8230;<p class="read-more"><a href="http://blog.scboffspring.eu/2010/04/11/playframework-premier-jour-de-jeu/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>Aujourd&#8217;hui, comme annoncé dans mon dernier article de la nuit passée, j&#8217;ai donné une chance à ce récent framework Java, permettant le développement web, j&#8217;ai nommé <a title="PLayFramework" href="http://playframework.org" target="_blank">Play!</a></p>
<h2>Ce que j&#8217;ai fait</h2>
<p>Tout d&#8217;abord, j&#8217;ai commencé par télécharger ce framework, voir comment il était structuré, ce qui était possible, ce qu&#8217;il y avait fourni avec, etc&#8230;</p>
<p>Alors, fourni en téléchargement, il y a :</p>
<ul>
<li>Documentation du framework, dans son dossier</li>
<li>Le framework en lui-même, avec les sources!</li>
<li>Python, pour l&#8217;utilisation sous windows de l&#8217;invite de commande permettant de créer un projet, lancer le serveur, etc&#8230;</li>
<li>Le plugin pour eclipse</li>
<li>Et bien sûr, l&#8217;invite de commande de Play</li>
</ul>
<p>J&#8217;ai donc installé le plugin, et configurer mon eclipse afin de pouvoir travailler convenablement^^. Pour installer le plugin, rien de plus simple, il suffit d&#8217;ajouter le .jar se trouvant dans support/eclipse dans le dossier d&#8217;eclipse, et le tour est joué.</p>
<p>Ensuite, je me suis dirigé vers le <a title="THE Guide" href="http://www.playframework.org/documentation/1.0.2/guide1" target="_blank">guide </a>se trouvant sur le site du framework, et je l&#8217;ai suivi pour réalisé ce blog.</p>
<p>Et pour finir, j&#8217;écris ce billet pour vous dire ce que j&#8217;ai apprécié, et ce que j&#8217;ai moins aimé en développant avec <strong>Play!</strong></p>
<h2>Ce que j&#8217;ai apprécié</h2>
<p>Premièrement, la simplicité de développement. Mes souvenirs de JSF, un immense paquet de fichiers XML où il faut configurer 452 choses pour pouvoir déjà rien que lancer l&#8217;application, et après, un espèce de patchwork à mettre en place, qui une 1 sur 2 ne marchais pas. Ici, avec Play!, je n&#8217;ai pas eu ce genre de soucis. <strong>J&#8217;ai créer mon projet, j&#8217;ai appelé la commande pour réalisé les fichiers eclipse, j&#8217;ai importé le projet, j&#8217;ai configurer la base de donnée, et j&#8217;ai lancé le serveur pour voir si tout marchait </strong>! Ensuite, c&#8217;est du Java, que je connais plutôt bien, et du HTML/CSS/JS pour l&#8217;affichage. Seul truc qui peut dérouter un peu au début, c&#8217;est la syntaxe pour les templates, mais on retrouve le droit chemin rapidement!</p>
<p>Deuxièmement, le serveur. Ça paraît con, mais<strong> ne pas avoir besoin de relancer le serveur</strong>, et de &#8220;rebuild&#8221; l&#8217;application à chaque modification, c&#8217;est vraiment plaisant ! Avec JSF, j&#8217;étais toujours en train de build, et perdais un temps monstrueux, maintenant, je modifie mon fichier, j&#8217;enregistre, je vais sur mon navigateur, et c&#8217;est déjà là. Même la base de donnée! On modifie le model, et c&#8217;est pris en compte directement.</p>
<p>Troisièmement, le MVC. Toujours été fan d&#8217;une bonne organisation, et là, c&#8217;est le cas, donc tant mieux. Il est vrai qu&#8217;avec Java, on a souvent le droit à du <strong>MVC</strong>, ce qui me fait du bien en pensant à PHP^^</p>
<p>Pour finir, je dirais la logique de développement. Le but est de faire le code une fois, et après, on ne fait pas de copier/coller comme je réalisais parfois avec PHP. Là, c&#8217;est organisé tellement bien, que c&#8217;est presque impossible de ne pas faire du code <strong>DRY </strong>(Don&#8217;t Repeat Yourself).</p>
<h2>Ce que j&#8217;apprécie moins</h2>
<p>Personnellement, je n&#8217;ai pas vu grand chose que je n&#8217;apprécie pas. Peut-être une ou deux choses mineurs.</p>
<p>Tout d&#8217;abord, au niveau de la façon de récupérer les objets dans la base de données.</p>
<p>Avec <strong>Play</strong>, pour récupérer par exemple les &#8220;Posts&#8221; d&#8217;un blog, le code est le suivant :</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">List<span style="color: #339933;">&lt;</span>Post<span style="color: #339933;">&gt;</span> olderPosts <span style="color: #339933;">=</span> Post.<span style="color: #006633;">find</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;order by postedAt desc&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">from</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">fetch</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Je pense, personnellement, que la façon de rechercher avec Ruby on Rails, et plus pratique, et plus clair. Par exemple, pour ici, ce serait :</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">HashMap<span style="color: #339933;">&lt;</span>String,String<span style="color: #339933;">&gt;</span> params <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> HashMap<span style="color: #339933;">&lt;</span>String,String<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
params.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;order&quot;</span>,<span style="color: #0000ff;">&quot;order by postedAt desc&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
List<span style="color: #339933;">&lt;</span>Post<span style="color: #339933;">&gt;</span> olderPosts <span style="color: #339933;">=</span> Post.<span style="color: #006633;">find</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;params&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">from</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">fetch</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>C&#8217;est un choix du développeur, mais je vois qu&#8217;il est aussi possible de remplacer &#8220;order by postedAt desc&#8221; par la requête complète. Je ne connais pas encore assez le &#8220;JPA&#8221; utilisé dans le framework pour vraiment m&#8217;avancer, je trouve dommage.</p>
<p>Autre chose, qui est peut-être dommage, le nom-support de base du module de &#8220;<strong>CRUD&#8221; </strong>et de &#8220;<strong>Security&#8221;</strong>. Même si c&#8217;est trèèès facile à ajouter, je pense qu&#8217;ils sont/seront tellement utilisés, qu&#8217;il est dommage de devoir les activer manuellement.</p>
<h2>Conclusion</h2>
<p>Je suis VRAIMENT satisfait de ce Framework, et je vais développer mon prochain site grâce à lui. Dans la logique, il est proche de Ruby on Rails, et c&#8217;est quelque chose qui me plaît beaucoup.</p>
<h3>Avantages</h3>
<ul>
<li>Logique de développement <strong>DRY</strong></li>
<li>Support de toutes les librairies de Java</li>
<li>Facilité de prise en main</li>
<li>Guide <strong>complet </strong>(même si 1 ou 2 erreurs sont présentes)</li>
<li><strong>La &#8220;compilation&#8221; à la volée</strong></li>
<li>Possibilité d&#8217;exporter sous format &#8220;<strong>war</strong>&#8221; compatible Glassfish/Tomcat/etc&#8230;</li>
<li>Module &#8220;Security&#8221; et &#8220;CRUD&#8221; vraiment pratique</li>
</ul>
<h3>Inconvénients</h3>
<ul>
<li>Communauté encore réduite</li>
<li>Gestion des objets relationnels pas encore terminé à mon goût</li>
</ul>
<p>Je dirais donc&#8230; Foncez ! Essayer, c&#8217;est l&#8217;adopter !</p>
<p>Et dans quelques jours, je ferai un prochain article sur la gestion du Multilingue, de l&#8217;implémentation d&#8217;AJAX, et d&#8217;autres choses intéressantes que je trouverai d&#8217;ici là!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.scboffspring.eu/2010/04/11/playframework-premier-jour-de-jeu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[PlayFramework] Play, le framework de développement Java du future?</title>
		<link>http://blog.scboffspring.eu/2010/04/10/play-le-framework-de-developpement-java-du-future/</link>
		<comments>http://blog.scboffspring.eu/2010/04/10/play-le-framework-de-developpement-java-du-future/#comments</comments>
		<pubDate>Sat, 10 Apr 2010 01:16:59 +0000</pubDate>
		<dc:creator>Scboffspring</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[PlayFramework]]></category>
		<category><![CDATA[Programmation]]></category>

		<guid isPermaLink="false">http://blog.scboffspring.eu/?p=111</guid>
		<description><![CDATA[Play? Kézako?

Aujourd'hui, en réalisant quelque recherche sur les différents framework permettant de le développement de sites webs, je suis tombé sur un (apparemment nouveau) framework qui me paraît bien prometteur. J'ai nomé "Play".

Ce framework est développé en Java, et pour développé... Ben c'est aussi en Java! Chose qui m'intéresse grandement, vu que c'est le langage que je connais le mieux (avec PHP)... Il a été développé en premier lieu par Guillaume Bort, un Français, et aidé, à l'heure actuelle, de 9 autres développeurs. Le framework est, comme dit précédemment, jeune, et se trouve en version 1.02. La version 1.1 se profile à l'horizon.

Déjà, pour vous donner un aperçu de la vitesse à laquelle il est possible de développer, voici la vidéo se trouvant en page d'accueil de leur site :<p class="read-more"><a href="http://blog.scboffspring.eu/2010/04/10/play-le-framework-de-developpement-java-du-future/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<h2>Play? Kézako?</h2>
<p>Aujourd&#8217;hui, en réalisant quelque recherche sur les différents framework permettant de le développement de sites webs, je suis tombé sur un (apparemment nouveau) framework qui me paraît bien prometteur. J&#8217;ai nomé &#8220;<a title="Play" href="http://www.playframework.org/" target="_blank">Play</a>&#8220;.</p>
<p>Ce framework est développé en Java, et pour développé&#8230; Ben c&#8217;est aussi en Java! Chose qui m&#8217;intéresse grandement, vu que c&#8217;est le langage que je connais le mieux (avec PHP)&#8230; Il a été développé en premier lieu par <a title="Guillaume Bort" href="http://guillaume.bort.fr/" target="_blank">Guillaume Bort</a>, un Français, et aidé, à l&#8217;heure actuelle, de 9 autres développeurs. Le framework est, comme dit précédemment, jeune, et se trouve en version 1.02. La version 1.1 se profile à l&#8217;horizon.</p>
<p>Déjà, pour vous donner un aperçu de la vitesse à laquelle il est possible de développer, voici la vidéo se trouvant en page d&#8217;accueil de leur site :</p>
<p style="text-align: center;"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="225" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=7087610&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=BCE569&amp;fullscreen=1" /><embed type="application/x-shockwave-flash" width="400" height="225" src="http://vimeo.com/moogaloop.swf?clip_id=7087610&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=BCE569&amp;fullscreen=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>Au niveau des possibilités offertes par Play, tout ce qui se trouve dans Java SE, avec un ÉNORME avantage. Lorsqu&#8217;un bug se produit, par exemple un &#8220;;&#8221; manquant, il suffit de modifier le fichier, le sauvegarder, et recharger la page! Pas besoin de relancer le serveur ou autre.  Une fonctionnalité déjà très intéressante.</p>
<p>Ensuite, comme RoR, les URI sont du type /Control/Action, un concept que j&#8217;apprécie <img src='http://blog.scboffspring.eu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Pour finir, je dirais qu&#8217;un autre avantage de ce framework est la façon d&#8217;écrire ses templates. Alors qu&#8217;avec, par exemple, JSP, il faut écrire un paragraphe énorme comme celui-ci :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;%</span>@ taglib uri<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://java.sun.com/jsp/jstl/core&quot;</span> prefix<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;c&quot;</span> <span style="color: #339933;">%&gt;</span>
<span style="color: #339933;">&lt;%</span>@ taglib uri<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://java.sun.com/jsp/jstl/functions&quot;</span> prefix<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;fn&quot;</span> <span style="color: #339933;">%&gt;</span>
  <span style="color: #339933;">&lt;</span>c<span style="color: #339933;">:</span>choose<span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;</span>c<span style="color: #339933;">:</span>when test<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;${emails.unread != null &amp;&amp; fn:size(emails.unread)}&quot;</span><span style="color: #339933;">&gt;</span>
    You have $<span style="color: #009900;">&#123;</span>fn<span style="color: #339933;">:</span>size<span style="color: #009900;">&#40;</span>emails.<span style="color: #006633;">unread</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span> unread email<span style="color: #009900;">&#40;</span>s<span style="color: #009900;">&#41;</span><span style="color: #339933;">!</span>
  <span style="color: #339933;">&lt;/</span>c<span style="color: #339933;">:</span>when<span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;</span>c<span style="color: #339933;">:</span>otherwise<span style="color: #339933;">&gt;</span>
    You have no unread emails<span style="color: #339933;">!</span>
  <span style="color: #339933;">&lt;/</span>c<span style="color: #339933;">:</span>otherwise<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>c<span style="color: #339933;">:</span>choose<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>Qui est pas très&#8230; Propre dirons-nous, avec Play, il suffit de :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;">You have ${emails.unread ?: 'no'} ${emails.unread?.pluralize('email')} !</pre></td></tr></table></div>

<h2>Prochaine étape?</h2>
<p>Pour moi, la prochaine étape est de testé ce framework à l&#8217;occasion, et je vous ferai un petit retour sur ce que j&#8217;ai trouvé bien/moins bien <img src='http://blog.scboffspring.eu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>En attendant, pour vous donnez un peu envie d&#8217;en savoir plus, allez <a title="Example" href="http://www.playframework.org/documentation/1.0.2/samples" target="_blank">ici</a> pour voir quelques exemples <img src='http://blog.scboffspring.eu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Et pour télécharger, ainsi que le guide du débutant, ça se trouve par <a title="Installation" href="http://www.playframework.org/documentation/1.0.2/install" target="_blank">là</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.scboffspring.eu/2010/04/10/play-le-framework-de-developpement-java-du-future/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP 5.3 et PHP 5.2 en parallèle sur un serveur</title>
		<link>http://blog.scboffspring.eu/2010/02/21/php-5-3-et-php-5-2-en-parallele-sur-un-serveur/</link>
		<comments>http://blog.scboffspring.eu/2010/02/21/php-5-3-et-php-5-2-en-parallele-sur-un-serveur/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 22:48:58 +0000</pubDate>
		<dc:creator>Scboffspring</dc:creator>
				<category><![CDATA[Serveur]]></category>
		<category><![CDATA[Tutoriel]]></category>

		<guid isPermaLink="false">http://blog.scboffspring.eu/?p=91</guid>
		<description><![CDATA[Peut-être certains administrateurs serveur se sont déjà posés cette question... Comment avoir plusieurs version de PHP sur un même serveur, par exemple PHP4 et PHP5 ? Ou PHP 5.3.1 et PHP 5.2.6 comme moi aujourd'hui. Ceux qui ont peut-être déjà essayé se sont probablement tirés les cheveux, comme moi :)

Pour tous ceux qui aimeraient pouvoir le faire sur leur serveur, voici une solution :)

Pré-requis

Tout d'abord, il vous faut un serveur, soit en 32, soit en 64 bits c'est égal (la solution marche sur les 2). Personnellement j'avais une Debian Lenny en 64 bits, donc ce tuto sera plutôt expliqué pour Debian/Ubuntu que pour CentOS ou autres distributions linux existantes.
Du temps devant soi<p class="read-more"><a href="http://blog.scboffspring.eu/2010/02/21/php-5-3-et-php-5-2-en-parallele-sur-un-serveur/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>Peut-être certains administrateurs serveur se sont déjà posés cette question&#8230; Comment avoir plusieurs version de PHP sur un même serveur, par exemple PHP4 et PHP5 ? Ou PHP 5.3.1 et PHP 5.2.6 comme moi aujourd&#8217;hui. Ceux qui ont peut-être déjà essayé se sont probablement tirés les cheveux, comme moi <img src='http://blog.scboffspring.eu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Pour tous ceux qui aimeraient pouvoir le faire sur leur serveur, voici une solution <img src='http://blog.scboffspring.eu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h2>Pré-requis</h2>
<ul>
<li>Tout d&#8217;abord, il vous faut un serveur, soit en 32, soit en 64 bits c&#8217;est égal (la solution marche sur les 2). Personnellement j&#8217;avais une Debian Lenny en 64 bits, donc ce tuto sera plutôt expliqué pour Debian/Ubuntu que pour CentOS ou autres distributions linux existantes.</li>
<li>Du temps devant soi</li>
</ul>
<h2>Installation de la solution LAMP normale (PHP 5.2)</h2>
<p>Tout d&#8217;abord, il vous faudra avoir une installation LAMP (Linux Apache MySQL PHP) qui fonctionne.<br />
Sous Debian, nous allons utiliser la façon la plus rapide. En étant <strong>root</strong>, ou avec <strong>sudo</strong> devant :</p>
<p><code></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> apache2 php5 php5-mysql mysql-server phpmyadmin</pre></div></div>

<p></code><br />
Lorsque ceci est fait, vous pouvez normalement afficher une page (&#8220;It works!&#8221;) en allant à l&#8217;adresse suivante (si en local) ou avec l&#8217;adresse ip du serveur :<br />
<code>http://localhost</code><br />
(Pour la suite du tutorial, nous prendrons comme adresse : 192.168.1.40)</p>
<p>Maintenant, je vous propose de voir votre configuration PHP actuelle, grâce à un fichier &#8220;phpinfo.php&#8221;, que vous mettrez dans <strong>/var/www/</strong> (si pas configuré plus en détail votre Apache).</p>
<p>Donc vous allez créer et remplir ce fichier avec la commande suivante :</p>
<p><code></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;&lt;?php phpinfo(); ?&gt;&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> phpinfo.php</pre></div></div>

<p></code><br />
Lorsque vous allez à l&#8217;adresse http://192.168.1.40/phpinfo.php vous verrez une page dans ce genre là (dépendra de votre version PHP et de votre système) :</p>
<p><img style="display: block; margin-left: auto; margin-right: auto; border: 0px initial initial;" title="screen_php_1" src="http://blog.scboffspring.eu/wp-content/uploads/2010/02/screen_php_1.png" alt="screen_php_1" width="617" height="563" /></p>
<p>Nous voyons donc que chez moi, la version PHP installée est la version 5.2.6.</p>
<p>Le problème, c&#8217;est que moi, maintenant, j&#8217;aimerais faire de l&#8217;objet, et utiliser les <a href="http://php.net/manual/fr/language.oop5.late-static-bindings.php">Late Static Binding</a> qui ne sont disponibles que depuis la version 5.3.</p>
<h2>Compilation de PHP 5.3.1</h2>
<p>Maintenant, il nous faut compiler une nouvelle version de PHP, par exemple pour la version 5.3.1 (cela peut être n&#8217;importe quelle autre version de PHP, par exemple la PHP 4)</p>
<p>Tout d&#8217;abord, alors récupérer PHP depuis le site php.net, par exemple pour moi, le fichier se trouve à l&#8217;adresse suivante : http://ch2.php.net/get/php-5.3.1.tar.bz2/from/this/mirror</p>
<p>Je vais donc le télécharger sur le serveur, et l&#8217;extraire, grâce à la commande suivante :</p>
<p><code></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> ~ <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>ch2.php.net<span style="color: #000000; font-weight: bold;">/</span>get<span style="color: #000000; font-weight: bold;">/</span>php-5.3.1.tar.gz<span style="color: #000000; font-weight: bold;">/</span>from<span style="color: #000000; font-weight: bold;">/</span>this<span style="color: #000000; font-weight: bold;">/</span>mirror <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">tar</span> xvzf php-5.3.1.tar.gz <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">cd</span> php-5.3.1</pre></div></div>

<p></code><br />
Lorsque ceci est fait, il va falloir installer une liste de paquet (dépendra de vous, et ce que vous voulez inclure avec php). Par exemple, moi, je voulais avoir le support MySQL et Curl, plus 2-3 petites choses. La liste des paquets dépendra de la commande suivante.</p>
<p><code></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> build-essential mysql-client libmysql++-dev libxml2-dev  libcurl4-openssl-dev libpng-dev libicu-dev libmcrypt-dev libxslt-dev</pre></div></div>

<p></code><br />
Ensuite, dans le répertoire de php-5.3.1 (nous y sommes déjà normalement), lancez la commande suivante (vous pouvez personnaliser cette commande selon vos besoins. <strong>Il est pas contre important de ne pas mettre le chemin par défaut pour le &#8220;&#8211;prefix&#8221; ainsi que pour le &#8220;&#8211;with-config-file-path&#8221; </strong>:</p>
<p><code></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>php53 <span style="color: #660033;">--with-config-file-path</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>php53<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>php<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">--disable-ipv6</span> <span style="color: #660033;">--with-curl</span> <span style="color: #660033;">--enable-ftp</span> <span style="color: #660033;">--with-gd</span> <span style="color: #660033;">--enable-intl</span> <span style="color: #660033;">--enable-mbstring</span> <span style="color: #660033;">--with-mcrypt</span> <span style="color: #660033;">--with-pdo-mysql</span>=mysqlnd <span style="color: #660033;">--enable-soap</span> <span style="color: #660033;">--with-xsl</span> <span style="color: #660033;">--with-zlib</span> <span style="color: #660033;">--with-openssl</span> <span style="color: #660033;">--with-pear</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>php53<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>php <span style="color: #660033;">--with-mysql</span></pre></div></div>

<p></code><br />
Si tout se passe bien, vous devriez arriver avec un message du genre :<br />
<code>+--------------------------------------------------------------------+<br />
| License:                                                           |<br />
| This software is subject to the PHP License, available in this     |<br />
| distribution in the file LICENSE.  By continuing this installation |<br />
| process, you are bound by the terms of this license agreement.     |<br />
| If you do not agree with the terms of this license, you must abort |<br />
| the installation process at this point.                            |<br />
+--------------------------------------------------------------------+<br />
Thank you for using PHP.</code><br />
Dans le cas contraire, il vous manque des paquets que vous devez installer afin de pouvoir compiler PHP.</p>
<p>Lorsque tout est bon, on lance la compilation, et nous allons vite boire le café en attendant <img src='http://blog.scboffspring.eu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
<code> </code></p>
<p><code></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p></code><br />
Maintenant, php 5.3.1 est installé, mais ne peut pas encore être utilisé, pour cela, nous allons feinter, et utilisé un module d&#8217;apache s&#8217;appelant &#8220;SUPHP&#8221;</p>
<h2>SUPHP, et comment gérer ses versions!</h2>
<p>Afin de gérer nos différentes version PHP, nous allons utilisé le module <strong>SUPHP</strong>, d&#8217;apache.</p>
<p>Pour cela, installer le paquet suivant :</p>
<p><code></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> libapache2-mod-suphp</pre></div></div>

<p></code><br />
Il nous faut ensuite <strong>désactiver </strong>le module <strong>php</strong> d&#8217;apache2, pour cela :<br />
<code>a2dismod php5</code><br />
Ensuite, il faut configurer <strong>suphp</strong> pour gérer nos version. Nous allons pour cela lui ajouter un <strong>Handler </strong>dans le fichier de configuration <strong>/etc/suphp/suphp.conf .</strong>Après la ligne <strong>application/x-httpd-php=php:/usr/bin/php-cgi</strong>, ajoutez la ligne suivante :</p>
<p><code></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">x-httpd-php-<span style="color: #000000;">5</span>-<span style="color: #000000;">3</span>=<span style="color: #ff0000;">&quot;php:/usr/local/php53/bin/php-cgi&quot;</span></pre></div></div>

<p></code><br />
Bien sûr, le chemin spécifié (/usr/local/php53/bin/php-cgi) est à modifier selon la ligne que vous avez utilisée pour la configuration de PHP au-dessus.</p>
<p>Ensuite, il faut modifier le fichier <strong>/etc/apache2/mods-enable/suphp.conf</strong> et rajouter les lignes suivantes après le premier <strong>suPHP_AddHandler application&#8230;</strong> :</p>
<p><span style="font-family: monospace;"> </span></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">AddType x-httpd-php-<span style="color: #000000;">5</span>-<span style="color: #000000;">3</span> .php53
 suPHP_AddHandler x-httpd-php-<span style="color: #000000;">5</span>-<span style="color: #000000;">3</span></pre></div></div>

<p>Il faut aussi modifier le fichier de configuration du VirtualHost par défaut, afin d&#8217;autoriser les .htaccess<br />
Par défaut, c&#8217;est le fichier <strong>/etc/apache2/sites-enabled/000-default/</strong>. Il faut modifier le <strong>AllowOverride None</strong> en <strong>AllowOverride All</strong> (dans le &#8220;&lt;Directory /&gt;&#8221;), ainsi que celui dans le &lt;Directory /var/www&gt;</p>
<p>Il faut aussi ajouter la ligne suivante à <strong>/etc/apache2/apache2.conf</strong> :</p>
<p><code></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">AddType x-httpd-php-<span style="color: #000000;">5</span>-<span style="color: #000000;">3</span> .php53</pre></div></div>

<p></code><br />
Et pour finir, on redémarre apache!</p>
<p><code></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>apache2 restart</pre></div></div>

<p></code></p>
<h2>On teste!</h2>
<p>Maintenant, il reste plus qu&#8217;à tester si cela fonctionne correctement.</p>
<p>Pour cela, il nous faut créer un <strong>htaccess</strong> dans /var/www avec le contenu suivant :</p>
<p><code></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">AddHandler x-httpd-php-<span style="color: #000000;">5</span>-<span style="color: #000000;">3</span> .php</pre></div></div>

<p></code><br />
Cela va indiquer à SuPHP/Apache que lorsque la page est appelée, il doit utilisé le Handler php 5.3, et pas celui par défaut.</p>
<p>Ensuite nous pouvons retourner sur le &#8220;phpinfo&#8221;, et nous verrons la nouvelle version de PHP <img src='http://blog.scboffspring.eu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><img class="aligncenter size-full wp-image-92" title="screen_php_2" src="http://blog.scboffspring.eu/wp-content/uploads/2010/02/screen_php_2.png" alt="screen_php_2" width="621" height="306" /></p>
<h2>Problème de &#8220;Internal Server error&#8221; ?</h2>
<p>Dans le cas où une erreur interne apparaît, il est probable que cela soit pour une seule raison :</p>
<p><strong>Le fichier PHP (</strong>ici phpinfo.php<strong>) NE doit PAS appartenir à root pour être exécuté</strong>.</p>
<p>Pour corriger ce problème, 2 solutions :</p>
<p>Changer dans la configuration de SuPHP les valeurs pour le <strong>min_uid</strong> et <strong>min_guid.</strong></p>
<p>Changer le propriétaire du fichier, pour mettre un utilisateur normal. Je vous conseille ce choix, pour des raisons de sécurité.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.scboffspring.eu/2010/02/21/php-5-3-et-php-5-2-en-parallele-sur-un-serveur/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Retour de vague (Google wave)</title>
		<link>http://blog.scboffspring.eu/2009/10/11/retour-de-vague/</link>
		<comments>http://blog.scboffspring.eu/2009/10/11/retour-de-vague/#comments</comments>
		<pubDate>Sun, 11 Oct 2009 18:22:19 +0000</pubDate>
		<dc:creator>Scboffspring</dc:creator>
				<category><![CDATA[Geekness]]></category>

		<guid isPermaLink="false">http://blog.scboffspring.eu/?p=66</guid>
		<description><![CDATA[Aujourd'hui, je vais faire un petit retour sur ma courte utilisation de Google Wave, le truc à la mode du moment ...
J'ai reçu vendredi matin à 3h48) la précieuse invitation pour Google Wave , de la part d'un inconu (Bobby Johnson que je remercie au passage^^)<p class="read-more"><a href="http://blog.scboffspring.eu/2009/10/11/retour-de-vague/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>Aujourd&#8217;hui, je vais faire un petit retour sur ma courte utilisation de Google Wave, le truc à la mode du moment &#8230;<br />
J&#8217;ai reçu vendredi matin à 3h48) la précieuse invitation pour Google Wave , de la part d&#8217;un inconu (Bobby Johnson que je remercie au passage^^)</p>
<p style="text-align: center;">
<div id="attachment_69" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.scboffspring.eu/wp-content/uploads/2009/10/GWave11.jpg"><img class="size-medium wp-image-69" title="Google Wave Home screen" src="http://blog.scboffspring.eu/wp-content/uploads/2009/10/GWave1-300x198.jpg" alt="Google Wave Home screen" width="300" height="198" /></a><p class="wp-caption-text">Google Wave Home screen</p></div>
<h1>Google Wave, Kézako?!?</h1>
<p>Google Wave est une plateforme développée par Google, qui se trouve entre une messagerie instantanée, et une boite mail. Cette technologie est encore en mode &#8220;Preview&#8221;, sur invitation, mais est déjà bien avancée, et permet de voir à quoi cela pourrait servir.</p>
<div id="attachment_73" class="wp-caption aligncenter" style="width: 392px"><a href="http://blog.scboffspring.eu/wp-content/uploads/2009/10/federation_diagram11.png"><img class="size-full wp-image-73 " title="Diagram Wave Protocole" src="http://blog.scboffspring.eu/wp-content/uploads/2009/10/federation_diagram11.png" alt="Diagram Wave Protocole" width="382" height="267" /></a><p class="wp-caption-text">Diagram Wave Protocole</p></div>
<p>Cette technologie utilise un nouveau protocole, développé pour l&#8217;occasion par Google, afin que n&#8217;importe qui puissent développer son propre système de vague, compatible avec Google Wave, ce qui permettra à une entreprise d&#8217;avoir son propre système, et communiqué avec une autre par exemple. Pour plus d&#8217;info concernant ce protocole, et si vous voulez développer votre Wave Software, vous pouvez retrouver la documentation et les spécifications techniques sur <a title="Google Wave Federation Architecture" href="http://www.waveprotocol.org/" target="_blank">Google Wave Federation Architecture</a>.</p>
<p>Dans Google Wave, il y a une notion de &#8220;Wave &#8221; (Vague en français), qui pourrait plus ou moins correspondre à un suivi de mail, avec une ou plusieurs personnes qui interagissent. Chaque Wave est composée de &#8220;Wavelet&#8221; (Vaguelette en français),  ou un sujet de conversation (et qui peuvent être privée entre 2 personnes, mais au milieu de la même Wave, car ayant un rapport). Et dans chaque Wavelet, il y a des &#8220;Blips&#8221;, qui sont des réponses à une Wavelet. Lorsqu&#8217;un utilisateur écrit quelque chose, l&#8217;autre voit en direct l&#8217;autre utilisateur écrire.</p>
<div id="attachment_76" class="wp-caption aligncenter" style="width: 466px"><a href="http://blog.scboffspring.eu/wp-content/uploads/2009/10/waveEntities11.png"><img class="size-full wp-image-76" title="Wave Entities" src="http://blog.scboffspring.eu/wp-content/uploads/2009/10/waveEntities11.png" alt="Wave Entities" width="456" height="289" /></a><p class="wp-caption-text">Wave Entities</p></div>
<p>Il est possible, dans chaque wave, de rajouter des plugins, permettant par exemple d&#8217;afficher une carte, et rajouter des points dessus, ou des robots permettant par exemple de mettre à jour notre status Twitter.</p>
<p>Petit exemple de carte :</p>
<div id="attachment_78" class="wp-caption aligncenter" style="width: 547px"><a href="http://blog.scboffspring.eu/wp-content/uploads/2009/10/GWave21.jpg"><img class="size-full wp-image-78" title="Google Wave Map Example" src="http://blog.scboffspring.eu/wp-content/uploads/2009/10/GWave21.jpg" alt="Google Wave Interaction Map" width="537" height="671" /></a><p class="wp-caption-text">Google Wave Interaction Map</p></div>
<p>Sur cette carte, toutes les personnes inscrites sur la wave, peuvent placé un point où ils habitent. Cela pourrait permettre par exemple de prévoir un itinéraire avec une autre personne grâce à Google Wave.</p>
<p>Beaucoup d&#8217;autres extensions existent, et sont en cours de développement. Vous pouvez aussi créer vos propres plugins pour Google Wave ! Pour plus d&#8217;information, rendez vous sur le site de l&#8217;<a title="Google Wave API" href="http://code.google.com/intl/fr/apis/wave/guide.html" target="_blank">API Google Wave</a></p>
<p>Une autre chose intéressante est de pouvoir mettre une Wave dans une page web. Cela peut donc permettre de faire un site, grâce à Google Wave, en incluant la wave comme contenu de page.</p>
<p>Voici un petit example :</p>
<div id="attachment_79" class="wp-caption aligncenter" style="width: 310px"><a href="http://blog.scboffspring.eu/wp-content/uploads/2009/10/embedsample11.png"><img class="size-medium wp-image-79" title="Google Wave Embed Sample" src="http://blog.scboffspring.eu/wp-content/uploads/2009/10/embedsample1-300x159.png" alt="Google Wave Embed Sample" width="300" height="159" /></a><p class="wp-caption-text">Google Wave Embed Sample</p></div>
<h1>Mon impression</h1>
<h2>Positive</h2>
<p>Personnellement, je trouve le concept vraiment très intéressant, et pouvant servir pour beaucoup de chose, tel que :</p>
<p>- Discuter d&#8217;un projet en pouvant interagir directement</p>
<p>- Discuter avec des amis</p>
<p>- Prévoir une sortie/un voyage</p>
<p>Et tout ce que votre imagination peut avoir comme idée..</p>
<p>L&#8217;interface est plutôt sympathique, surtout pour une version Preview, mais pour le moment, elle n&#8217;est pas vraiment accessible à tout le monde. J&#8217;espère qu&#8217;elle sera plus &#8220;User-Friendly&#8221; pour la version finale.</p>
<p>Le sytème d&#8217;extension a l&#8217;air pas mal ficelé, et va permettre de rajouter énormément de choses intéressante à la version de &#8220;base&#8221;..</p>
<h2>Négative</h2>
<p>L&#8217;interface est par moment un peu lourde, et lague un peu. J&#8217;espère qu&#8217;un client lourd sortira, et qu&#8217;il n&#8217;y aura pas que la version de Google Wave sur un site Web (Apparemment, c&#8217;est bien parti, et une première version Mac existe).</p>
<p>Comme dit précédemment, l&#8217;interface est pas assez User-Friendly pour l&#8217;utilisateur lambda.</p>
<p>Il est aussi difficile de retrouver les endroits modifier dans la Wave, vu qu&#8217;il est possible de modifier n&#8217;importe où. Il faut donc chercher manuellement. J&#8217;espère qu&#8217;il y aura un moyen de voir que les réponses, où au moins nous renvoyer aux endroits nouveaux, sans devoir le faire à la main.</p>
<p>Pour le moment aucune limite à l&#8217;exécution de Javascript dans une Wave, ce qui pourrait permettre à certains utilisateurs de mettre des bouts de codes Javascript malicieux&#8230;</p>
<h1>Conclusion</h1>
<p>Dans l&#8217;ensemble, je pense que ça peut être quelque chose de vraiment intéressant, que ce soit pour un particulier, ou pour une entreprise.. J&#8217;attends la suite avec impatience, et surtout que certains potes aient reçu leurs invitations, afin de pouvoir réellement testé <img src='http://blog.scboffspring.eu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.scboffspring.eu/2009/10/11/retour-de-vague/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Donnée d&#8217;une table -&gt; objet en PHP</title>
		<link>http://blog.scboffspring.eu/2009/06/24/table_to_objet/</link>
		<comments>http://blog.scboffspring.eu/2009/06/24/table_to_objet/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 22:18:40 +0000</pubDate>
		<dc:creator>Scboffspring</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[Tutoriel]]></category>

		<guid isPermaLink="false">http://blog.scboffspring.eu/?p=44</guid>
		<description><![CDATA[Bonjour :)

Aujourd'hui une petite manipulation qui peut-être très pratique... Chargez les données depuis une base de données, directement dans un objet.

Prenons par exemple la gestion des utilisateurs. Lorsque l'utilisateur se connecte, plutôt que de s'amuser à stocker les informations dans une session normale du genre :

$_SESSION['username'] = $data['user'] ;
 
on va utilisé une méthode bien plus rapide et pratique.

Tout d'abord, on va créer une classe, la classe user . Voici un début de classe :<p class="read-more"><a href="http://blog.scboffspring.eu/2009/06/24/table_to_objet/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>Bonjour <img src='http://blog.scboffspring.eu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Aujourd&#8217;hui une petite manipulation qui peut-être très pratique&#8230; Chargez les données depuis une base de données, directement dans un objet.</p>
<p>Prenons par exemple la gestion des utilisateurs. Lorsque l&#8217;utilisateur se connecte, plutôt que de s&#8217;amuser à stocker les informations dans une session normale du genre :</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'username'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'user'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">;</span></pre></div></div>

<p>on va utilisé une méthode bien plus rapide et pratique.</p>
<p>Tout d&#8217;abord, on va créer une classe, la classe user . Voici un début de classe :</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">     <span style="color: #339933;">*</span> <span style="color: #339933;">@</span>version     <span style="color:#800080;">0.1</span> <span style="color: #009900;">&#91;</span>29<span style="color: #339933;">.</span>05<span style="color: #339933;">.</span>2009<span style="color: #009900;">&#93;</span>
     <span style="color: #339933;">*/</span>
    <span style="color: #000000; font-weight: bold;">class</span> User <span style="color: #009900;">&#123;</span>
		<span style="color: #009933; font-style: italic;">/**
		* Attribut
		*/</span>
        <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$id_user</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$login</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$password</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$name</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$first_name</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$title</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$address</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$NPA</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$city</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$pays</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$tel</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$fax</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$email</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$societe</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$connected</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$active</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$active_code</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$sql</span><span style="color: #339933;">;</span>
		<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$password_uncrypted</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #009933; font-style: italic;">/**
		* Construct the class
		*/</span>
        <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #000088;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$this</span> <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span> sql <span style="color: #339933;">=</span> <span style="color: #000088;">$sql</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #009933; font-style: italic;">/**
		* Function toString
		*
		*  - Return : the login
		*/</span>
        <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __toString<span style="color: #009900;">&#40;</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;">-&amp;</span>gt<span style="color: #339933;">;</span> login<span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
		<span style="color: #009933; font-style: italic;">/**
		* Function used to insert the user in database
		*
		*   - Return : the query to execute
		*/</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getInsertString<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'INSERT INTO t_user (login, password, name, first_name,  address, NPA, city, pays, tel, fax, email, societe,active_code) VALUES '</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$query</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'(&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span> <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span> login<span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;,'</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$query</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span> <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span> password<span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;,'</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$query</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span> <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span> name<span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;,'</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$query</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span> <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span> first_name<span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;,'</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$query</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span> <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span> address<span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;,'</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$query</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span> <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span> NPA<span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;,'</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$query</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span> <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span> city<span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;,'</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$query</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span> <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span> pays<span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;,'</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$query</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span> <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span> tel<span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;,'</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$query</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span> <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span> fax<span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;,'</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$query</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span> <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span> email<span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;,'</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$query</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span> <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span> societe<span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;,'</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$query</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span> <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span> active_code<span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;)'</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #000088;">$query</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #009933; font-style: italic;">/**
		* Function used to connect an user
		*
		*   - Return : the query to execute
		*/</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> connect<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'SELECT * FROM t_user WHERE login = &quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span> <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span> login<span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; AND password = &quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span> <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span> password<span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;'</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_assoc</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span> <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span> sql <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span> Query<span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$keys</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_keys</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span> <span style="color: #009900;">&#123;</span><span style="color: #000088;">$keys</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#125;</span> <span style="color: #339933;">=</span>  <span style="color: #000088;">$query</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$keys</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #009900;">&#125;</span>
&nbsp;
			<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'active'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$this</span> <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span> connected <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$this</span> <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span> connected <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #009933; font-style: italic;">/**
		* Fonction used to know if a user already exist in DB
		*/</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> existInDb<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$bResult</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'SELECT COUNT(login) as Nbr FROM t_user WHERE login = &quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span> <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span> login<span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;'</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_assoc</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span> <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span> sql <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span> Query<span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Nbr'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$bResult</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #000088;">$bResult</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #009933; font-style: italic;">/**
		*	Function used to generate an activation code
		*/</span>
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> generateActivationCode<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$len</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$base</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'ABCDEFGHKLMNOPQRSTWXYZabcdefghjkmnpqrstwxyz123456789'</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$max</span><span style="color: #339933;">=</span><span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$base</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$activatecode</span><span style="color: #339933;">=</span><span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
			<span style="color: #990000;">mt_srand</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>double<span style="color: #009900;">&#41;</span><span style="color: #990000;">microtime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span><span style="color: #cc66cc;">1000000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$activatecode</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span><span style="color: #000088;">$len</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>
			  <span style="color: #000088;">$activatecode</span><span style="color: #339933;">.=</span><span style="color: #000088;">$base</span><span style="color: #009900;">&#123;</span><span style="color: #990000;">mt_rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #000088;">$max</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #000088;">$this</span> <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span> active_code <span style="color: #339933;">=</span> <span style="color: #000088;">$activatecode</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #009933; font-style: italic;">/**
		*	Function used to send the confirmation mail
		*/</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> sendConfirmationMail<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
     		        <span style="color: #000088;">$headers</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'From: &quot;example&quot;'</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
     		        <span style="color: #000088;">$headers</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'Reply-To:example@example.ch'</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
     		        <span style="color: #000088;">$headers</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'Content-Type: text/html; charset=&quot;iso-8859-1&quot;'</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
     		        <span style="color: #000088;">$headers</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'Content-Transfer-Encoding: 8bit'</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #000088;">$message</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$message</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'
&lt;h1&gt;Activation de votre compte&lt;/h1&gt;
'</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$message</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'VOTRE MAIL'</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #000088;">$message</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'
&lt;h1&gt;Vos informations&lt;/h1&gt;
'</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$message</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'Nom d\'utilisateur : '</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span> <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span> login <span style="color: #339933;">;</span>
			<span style="color: #000088;">$message</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'Mot de passe : '</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span> <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span> password_uncrypted <span style="color: #339933;">;</span>
			<span style="color: #000088;">$message</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'
&nbsp;
 Garder ce mail précieusement...'</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$message</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
			<span style="color: #990000;">mail</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span> <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span> email<span style="color: #339933;">,</span> <span style="color: #0000ff;">'Création du compte'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$message</span><span style="color: #339933;">,</span> <span style="color: #000088;">$headers</span><span style="color: #009900;">&#41;</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> activeUser<span style="color: #009900;">&#40;</span><span style="color: #000088;">$user</span><span style="color: #339933;">,</span><span style="color: #000088;">$code</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'UPDATE t_user SET active = &quot;1&quot; WHERE login = &quot;'</span><span style="color: #339933;">.</span><span style="color: #990000;">mysql_real_escape_string</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$user</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; AND active_code = &quot;'</span><span style="color: #339933;">.</span><span style="color: #990000;">mysql_real_escape_string</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$code</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;'</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span> <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span> sql <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span> Query<span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #009933; font-style: italic;">/**
		* Magic Function set
		*/</span>
        <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;">$key</span><span style="color: #339933;">,</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span><span style="color: #000088;">$key</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$value</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #009933; font-style: italic;">/**
		* Magic Function get
		*/</span>
        <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;">$key</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;">-&amp;</span>gt<span style="color: #339933;">;</span><span style="color: #000088;">$key</span><span style="color: #339933;">;</span>
       <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
?<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span></pre></div></div>

<p>Il faut que la classe aie les mêmes champs que la base de données. C&#8217;est à dire que si la base de données à un champ &#8220;login&#8221;, un champ &#8220;password&#8221;, et un champ &#8220;first_name&#8221;, il faut absolument que la classe PHP aie les champs &#8220;login&#8221;, &#8220;password&#8221;, et &#8220;first_name&#8221; . Elle peut avoir d&#8217;autre champ si vous vous voulez.</p>
<p>Alors au niveau des fonctions interessante, il y a tout d&#8217;abord celles là :</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><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;">$key</span><span style="color: #339933;">,</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span><span style="color: #000088;">$key</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$value</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #009933; font-style: italic;">/**
		* Magic Function get
		*/</span>
        <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;">$key</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;">-&amp;</span>gt<span style="color: #339933;">;</span><span style="color: #000088;">$key</span><span style="color: #339933;">;</span>
       <span style="color: #009900;">&#125;</span></pre></div></div>

<p>Cette fonction magique permet de générer les getter/setter pour la classe. Ensuite lorsque vous avez instancié la classe dans votre code, vous pourrez faire :</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$class</span> <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span> attribut <span style="color: #339933;">=</span> <span style="color: #0000ff;">'value'</span><span style="color: #339933;">;</span></pre></div></div>

<p>pour mettre vos valeurs.</p>
<p>L&#8217;autre fonction intéressante est celle-ci :</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">             <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> connect<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'SELECT * FROM t_user WHERE login = &quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span> <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span> login<span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; AND password = &quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span> <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span> password<span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;'</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_assoc</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span> <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span> sql <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span> Query<span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$keys</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_keys</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span> <span style="color: #009900;">&#123;</span><span style="color: #000088;">$keys</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#125;</span> <span style="color: #339933;">=</span>  <span style="color: #000088;">$query</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$keys</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #009900;">&#125;</span>
&nbsp;
			<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'active'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$this</span> <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span> connected <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
			<span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$this</span> <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span> connected <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Elle vous permettra lors de l&#8217;appel à cette fonction, de sauvegarder le résultat de la requête dans la classe. C&#8217;est à dire que l&#8217;utilisateur se connecte, et toutes ses informations seront stocké dans l&#8217;objet $user (pour moi). Après il suffit de stocker cette classe dans la session, et vous pourrez l&#8217;utiliser sur toutes vos pages <img src='http://blog.scboffspring.eu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Cette fonction va donc récupéré l&#8217;array de données de la base de données, ensuite récupéré les clés, et grâce à la syntaxe</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$this</span> <span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #009900;">&#123;</span><span style="color: #000088;">$var</span><span style="color: #009900;">&#125;</span> <span style="color: #339933;">=...</span></pre></td></tr></table></div>

<p>on va pouvoir stocké la valeur, dans l&#8217;attribut ayant cette clé. C&#8217;est pour cela que je demandais d&#8217;avoir les mêmes noms entre la base de données et votre classe php.</p>
<p>Voilà pour ce petit tutoriel&#8230;</p>
<p>Bonne nuit <img src='http://blog.scboffspring.eu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.scboffspring.eu/2009/06/24/table_to_objet/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>L&#8217;API Ovh, ça rock&#8217;s</title>
		<link>http://blog.scboffspring.eu/2009/06/14/lapi-ovh-ca-rocks/</link>
		<comments>http://blog.scboffspring.eu/2009/06/14/lapi-ovh-ca-rocks/#comments</comments>
		<pubDate>Sun, 14 Jun 2009 17:06:38 +0000</pubDate>
		<dc:creator>Scboffspring</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programmation]]></category>
		<category><![CDATA[Tutoriel]]></category>

		<guid isPermaLink="false">http://blog.scboffspring.eu/?p=34</guid>
		<description><![CDATA[Bonjour,

Aujourd'hui, on va faire un petit cours sur comment on utilise l'API d'ovh, nommée SOAPI.

Nous allons prendre comme exemple, comment savoir si un nom de domaine est libre, ou pas :)

Voici une fonction toute faite qui permet de savoir cela :
<p class="read-more"><a href="http://blog.scboffspring.eu/2009/06/14/lapi-ovh-ca-rocks/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>Bonjour,</p>
<p>Aujourd&#8217;hui, on va faire un petit cours sur comment on utilise l&#8217;API d&#8217;ovh, nommée SOAPI.</p>
<p>Nous allons prendre comme exemple, comment savoir si un nom de domaine est libre, ou pas <img src='http://blog.scboffspring.eu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Voici une fonction toute faite qui permet de savoir cela :</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> isAvailable<span style="color: #009900;">&#40;</span><span style="color: #000088;">$domain</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">//Load OVH's Webservice</span>
	<span style="color: #000088;">$soap</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> SoapClient<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'https://www.ovh.com/soapi/soapi-re-1.3.wsdl'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">//login</span>
	try <span style="color: #009900;">&#123;</span>
	        <span style="color: #000088;">$login</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;USER OVH&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$password</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;PASSWORD&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$session</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$soap</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>login<span style="color: #009900;">&#40;</span><span style="color: #000088;">$login</span><span style="color: #339933;">,</span><span style="color: #000088;">$password</span><span style="color: #339933;">,</span><span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> catch<span style="color: #009900;">&#40;</span>SoapFault <span style="color: #000088;">$fault</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">echo</span>  <span style="color: #0000ff;">&quot;Error : &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$fault</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">//domainCheck, and set value to available if it is.</span>
	try <span style="color: #009900;">&#123;</span>
	   	<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$soap</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>domainCheck<span style="color: #009900;">&#40;</span><span style="color: #000088;">$domain</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//$domain est au format domain.tld</span>
	   	<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	  	        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>predicate <span style="color: #339933;">==</span> <span style="color: #0000ff;">'is_available'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			        <span style="color: #000088;">$available</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$value</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>value<span style="color: #339933;">;</span>
	  	        <span style="color: #009900;">&#125;</span>
	        <span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span> catch<span style="color: #009900;">&#40;</span>SoapFault <span style="color: #000088;">$fault</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">echo</span>  <span style="color: #0000ff;">&quot;Error : &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$fault</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #666666; font-style: italic;">//logout</span>
	try <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$soap</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>logout<span style="color: #009900;">&#40;</span><span style="color: #000088;">$session</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> catch<span style="color: #009900;">&#40;</span>SoapFault <span style="color: #000088;">$fault</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Error : &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$fault</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #666666; font-style: italic;">//Return answer</span>
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$available</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Pour pouvoir exécuté tout cela, il vous faudra tout d&#8217;abord activer les extensions openssl, ainsi que l&#8217;extension &#8220;soap&#8221;.</p>
<p>Au début, nous nous connectons au webservice d&#8217;ovh, grâce à notre utilisateur et mot de passe :</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">	<span style="color: #666666; font-style: italic;">//Load OVH's Webservice</span>
	<span style="color: #000088;">$soap</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> SoapClient<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'https://www.ovh.com/soapi/soapi-re-1.3.wsdl'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">//login</span>
       try <span style="color: #009900;">&#123;</span>
	        <span style="color: #000088;">$login</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;USER OVH&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$password</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;PASSWORD&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$session</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$soap</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>login<span style="color: #009900;">&#40;</span><span style="color: #000088;">$login</span><span style="color: #339933;">,</span><span style="color: #000088;">$password</span><span style="color: #339933;">,</span><span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> catch<span style="color: #009900;">&#40;</span>SoapFault <span style="color: #000088;">$fault</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">echo</span>  <span style="color: #0000ff;">&quot;Error : &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$fault</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Bien sûr, l&#8217;user et le mot de passe sont les votre.</p>
<p>Ensuite  on utilise la fonction domainCheck de l&#8217;API, afin de vérifier la disponibilité du domaine, et on le stock dans une variable &#8220;available&#8221;. L&#8217;api nous retourne un array, qu&#8217;il faut donc &#8220;parser&#8221; grâce au foreach, afin de récupéré uniquement si la valeur du is_available, car l&#8217;api nous retourne aussi si il est transférable et si il est renouvelable.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">	 <span style="color: #666666; font-style: italic;">//domainCheck, and set value to available if it is.</span>
	try <span style="color: #009900;">&#123;</span>
	   	<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$soap</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>domainCheck<span style="color: #009900;">&#40;</span><span style="color: #000088;">$domain</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//$domain est au format domain.tld</span>
	   	<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	  	        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>predicate <span style="color: #339933;">==</span> <span style="color: #0000ff;">'is_available'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			        <span style="color: #000088;">$available</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$value</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>value<span style="color: #339933;">;</span>
	  	        <span style="color: #009900;">&#125;</span>
	        <span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span> catch<span style="color: #009900;">&#40;</span>SoapFault <span style="color: #000088;">$fault</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">echo</span>  <span style="color: #0000ff;">&quot;Error : &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$fault</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Et pour finir nous nous déconnectons du webservice, et on retourne le résultat.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">	<span style="color: #666666; font-style: italic;">//logout</span>
	try <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$soap</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>logout<span style="color: #009900;">&#40;</span><span style="color: #000088;">$session</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> catch<span style="color: #009900;">&#40;</span>SoapFault <span style="color: #000088;">$fault</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;Error : &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$fault</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #666666; font-style: italic;">//Return answer</span>
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$available</span><span style="color: #339933;">;</span></pre></div></div>

<p>Voilà.</p>
<p>Pour avoir plus d&#8217;info concernant cette API, dirigez-vous <a href="http://ovh.com/soapi">ICI</a> où se trouve toute la documentation de l&#8217;API, ainsi qu&#8217;un générateur de code&#8230;</p>
<p>Bonne journée <img src='http://blog.scboffspring.eu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.scboffspring.eu/2009/06/14/lapi-ovh-ca-rocks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Réinstallation du blog</title>
		<link>http://blog.scboffspring.eu/2009/05/10/3/</link>
		<comments>http://blog.scboffspring.eu/2009/05/10/3/#comments</comments>
		<pubDate>Sun, 10 May 2009 01:07:08 +0000</pubDate>
		<dc:creator>Scboffspring</dc:creator>
				<category><![CDATA[Divers]]></category>

		<guid isPermaLink="false">http://blog.scboffspring.eu/?p=3</guid>
		<description><![CDATA[Bonjour,

Aujourd'hui, j'ai réinstallé le blog que j'avais avant, qui n'était jamais mis à jour, et qui ne me plaisait plus.

J'en ai profité pour rajouter des fonctionnalités intéressantes, telles que :

Système.out.println("Et en java");<p class="read-more"><a href="http://blog.scboffspring.eu/2009/05/10/3/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>Bonjour,</p>
<p>Aujourd&#8217;hui, j&#8217;ai réinstallé le blog que j&#8217;avais avant, qui n&#8217;était jamais mis à jour, et qui ne me plaisait plus.</p>
<p>J&#8217;en ai profité pour rajouter des fonctionnalités intéressantes, telles que :</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&nbsp;</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">Système.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Et en java&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.scboffspring.eu/2009/05/10/3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

