<?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>Webd &#187; Pro</title>
	<atom:link href="http://webd.fr/category/pro/feed" rel="self" type="application/rss+xml" />
	<link>http://webd.fr</link>
	<description>Le blog de Julien Quéré</description>
	<lastBuildDate>Tue, 22 Mar 2011 15:49:19 +0000</lastBuildDate>
	<language>fr</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>CocoaHeads Rennais: la naissance d&#8217;un groupe de développeurs Cocoa à Rennes</title>
		<link>http://webd.fr/2794-cocoaheads-rennais-la-naissance-dun-groupe-de-developpeurs-cocoa-a-rennes</link>
		<comments>http://webd.fr/2794-cocoaheads-rennais-la-naissance-dun-groupe-de-developpeurs-cocoa-a-rennes#comments</comments>
		<pubDate>Wed, 09 Mar 2011 10:52:12 +0000</pubDate>
		<dc:creator>Julien Quéré</dc:creator>
				<category><![CDATA[Pro]]></category>

		<guid isPermaLink="false">http://webd.fr/?p=2794</guid>
		<description><![CDATA[Sur le bassin rennais, il y a beaucoup d’émulation autours des technologies de l’information. L’arrivée récente de la Cantine Numérique Rennais n’a fait qu’amplifier ce phénomène &#8230; Il y a quelques temps, je me suis rendu compte que nous n’avions &#8230; <a href="http://webd.fr/2794-cocoaheads-rennais-la-naissance-dun-groupe-de-developpeurs-cocoa-a-rennes">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://webd.fr/wp-content/uploads/2011/03/Logo_CocoaHeads.png" rel="lightbox[2794]" title="Logo_CocoaHeads"><img src="http://webd.fr/wp-content/uploads/2011/03/Logo_CocoaHeads-263x300.png" alt="" title="Logo_CocoaHeads" width="263" height="300" class="alignleft size-medium wp-image-2798" /></a>Sur le bassin rennais, il y a beaucoup d’émulation autours des technologies de l’information. L’arrivée récente de la <a href="http://www.lacantine-rennes.net/">Cantine Numérique Rennais</a> n’a fait qu’amplifier ce phénomène &#8230; </p>
<p>Il y a quelques temps, je me suis rendu compte que nous n’avions pas de CocoaHeads à Rennes &#8230; Si CocoaHeads ne vous dis rien: il s’agit simplement d’un groupe de développeurs passionnées (ou simplement enthousiastes) par les technologies Apple (Mac OS X et iOS). Ce groupe se réuni tous les mois afin d’échanger sur des sujets technologiques autour de ces technologies. </p>
<p>Le concept semble très bien marcher à <a href="http://cocoaheads.fr/paris">Paris</a> et à <a href="http://cocoaheads.fr/bordeaux/">Bordeaux</a> (sans compter les <a href="http://cocoaheads.org/">multiples entités à l&#8217;international</a>) &#8230; Alors pourquoi pas à Rennes ? </p>
<p>Nous avons ici un potentiel assez grands de développeurs Objective-C / Cocoa / Cocoa Touch. Alors pourquoi pas nous rassembler, partager, échanger ? Ce serait l’occasion de monter en compétences &#8230; Mais pas seulement. CocoaHeads se veut aussi social ! L’occasion, après les présentations, de boire un verre, manger un morceau. </p>
<p>C’est donc certain: il faut lancer les CocoaHeads Rennais ! Mais pour se faire, il faut du monde, du soutien, des participants. Alors si: </p>
<ul>
<li>Vous souhaitez aider en fournissant des locaux (j’ai déjà une piste à ce sujet) ?</li>
<li>Vous souhaitez intervenir en tant que présentateur ?</li>
<li>Vous souhaitez aider (de n’importe quelle façon que ce soit) ?</li>
<li>Vous souhaitez simplement manifester votre enthousiasme ?</li>
</ul>
<p>Contactez moi: jjy.quere _ arobase _ gmail.com !</p>
<p>Je ne sais pas encore ou et quand la première session aura lieu. Mais plusieurs choses sont certaines: </p>
<ul>
<li>Ce sera gratuit (c’est un principe de base).</li>
<li>Ce sera ouvert à tous (du débutants à l’expert).</li>
<li>Ce sera convivial.</li>
<li>Ce sera intéressant.</li>
<li>Ce sera l’occasion de faire naitre une communauté Cocoa Rennaise (voir bretonne).</li>
</ul>
<p>Alors à très bientôt aux CocoaHeads Rennais ! </p>
<p>PS: un espace plus adapté que ce blog verra bientôt le jour pour parler des CocoaHeads Rennais <img src='http://webd.fr/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> <!-- PHP 5.x --></p>
]]></content:encoded>
			<wfw:commentRss>http://webd.fr/2794-cocoaheads-rennais-la-naissance-dun-groupe-de-developpeurs-cocoa-a-rennes/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Pourquoi je n&#8217;utiliserais pas Google DNS</title>
		<link>http://webd.fr/1461-pourquoi-je-nutiliserais-pas-google-dns</link>
		<comments>http://webd.fr/1461-pourquoi-je-nutiliserais-pas-google-dns#comments</comments>
		<pubDate>Fri, 11 Dec 2009 08:07:41 +0000</pubDate>
		<dc:creator>Julien Quéré</dc:creator>
				<category><![CDATA[Pro]]></category>
		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://webd.fr/?p=1461</guid>
		<description><![CDATA[La semaine dernière, Google annonçait officiellement l&#8217;ouverture au public de son nouveau service: Google Public DNS. Il s&#8217;agit de proposer à tout internaute un service DNS qui se veut offrir une bien meilleure expérience du net à tout les utilisateurs&#8230; &#8230; <a href="http://webd.fr/1461-pourquoi-je-nutiliserais-pas-google-dns">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>La semaine dernière, <a href="http://googleblog.blogspot.com/2009/12/introducing-google-public-dns.html">Google annonçait officiellement</a> l&#8217;ouverture au public de son nouveau service: <em>Google Public DNS</em>. Il s&#8217;agit de proposer à tout internaute un service DNS qui se veut offrir une bien meilleure expérience du net à tout les utilisateurs&#8230;</p>
<h2>DNS, c&#8217;est quoi ?</h2>
<p>DNS (pour <em>Domain Name System</em>). Il s&#8217;agit du système qui traduit les noms de domaines (<em>webd.fr</em> par exemple) en adresses IP (<em>94.23.202.54</em> pour webd). En effet, les machines ne communiquent que par des adresses IP.</p>
<p>A moins d&#8217;être autiste, il est beaucoup plus simple de retenir des adresses textuelles. En fait, il faut voir DNS comme un annuaire du net. Il met en correspondance des noms de site avec des adresses IP. Là où un annuaire téléphonique met en relation des noms de personnes avec des numéros de téléphone.</p>
<p>Ce service DNS est totalement transparent pour les internautes car cela fait partie des services de base lors de la connexion à tout réseau (que ce soit le réseau de son FAI ou un réseau d&#8217;entreprise). Et voilà maintenant que Google lance son propre DNS publique et voudrait faire passer tout le Web par ce service.</p>
<p><span id="more-1461"></span></p>
<h2>Pas plus rapide qu’un autre</h2>
<p>L&#8217;argument de la firme de Mountain View est convaincant de prime abord: le but est d&#8217;offrir un service DNS beaucoup plus rapide. Google prétend que, grâce à son infrastructure réseau présente sur toute la planète, ils arrivent à répondre beaucoup plus rapidement aux requêtes DNS que les serveurs traditionnels. Ainsi, la traduction de nom de domaine en adresse IP se fait beaucoup plus vite. Donc, l&#8217;utilisateur a une expérience beaucoup plus agréable de son surf (puisque ses pages s&#8217;affichent plus vite).</p>
<p>L&#8217;argument n°1 de Google concerne la rapidité … Mais dans les faits, ce n&#8217;est pas ça du tout ! Enfin bon, nuançons quand même: ce n&#8217;est pas ralentissant non plus. C&#8217;est juste que je ne vois pas d&#8217;apport réel. J&#8217;ai fait quelques tests sur différents DNS: <em>Google Public DNS</em>, Free, Neuf et le serveur DNS local du SI sur lequel je me trouve.</p>
<p><img src="http://webd.fr/wp-content/uploads/2009/12/Google-Public-DNS-faster.gif" alt="Google-Public-DNS-faster" title="Google-Public-DNS-faster" width="131" height="60" class="aligncenter size-full wp-image-1493" /></p>
<p>Le résultat est sans appel: le DNS local l&#8217;emporte haut la main. Ça s&#8217;explique simplement par le fait que je n&#8217;ai pas besoin de passer par le réseau Internet pour le contacter. Il est en local avec moi. Et même si on retire cette mesure, <em>Google Public DNS</em> n&#8217;arrive premier que dans 2 cas sur 5 (et de peu).</p>
<p style="text-align: center;"><!-- 		@page { margin: 2cm } 		TD P { margin-bottom: 0cm } 		P { margin-bottom: 0.21cm } --></p>
<table style="text-align: center; height: 192px;" border="1" cellspacing="0" cellpadding="4" width="508" bordercolor="#000000">
<col width="57"></col>
<col width="45"></col>
<col width="51"></col>
<col width="51"></col>
<col width="51"></col>
<tbody>
<tr valign="top">
<td width="22%"></td>
<td width="18%">
<p style="margin-bottom: 0cm;">212.27.32.176<br />
Free</td>
<td width="20%">
<p style="margin-bottom: 0cm;">8.8.8.8<br />
Google</td>
<td width="20%">
<p style="margin-bottom: 0cm;">10.20.40.1<br />
DNS Local</td>
<td width="20%">
<p style="margin-bottom: 0cm;">80.118.192.100<br />
Neuf</td>
</tr>
<tr valign="top">
<td width="22%">Amazon.fr</td>
<td width="18%">29</td>
<td width="20%">23</td>
<td width="20%">13</td>
<td width="20%">12</td>
</tr>
<tr valign="top">
<td width="22%">Google.fr</td>
<td width="18%">29</td>
<td width="20%">49</td>
<td width="20%">18</td>
<td width="20%">12</td>
</tr>
<tr valign="top">
<td width="22%">Webd.fr</td>
<td width="18%">29</td>
<td width="20%"><span style="background: #ffff00 none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">24</span></td>
<td width="20%">11</td>
<td width="20%">27</td>
</tr>
<tr valign="top">
<td width="22%">gandi.net</td>
<td width="18%">28</td>
<td width="20%"><span style="background: #ffff00 none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;">24</span></td>
<td width="20%">9</td>
<td width="20%">26</td>
</tr>
<tr valign="top">
<td width="22%">sxc.hu</td>
<td width="18%">28</td>
<td width="20%">23</td>
<td width="20%">9</td>
<td width="20%">23</td>
</tr>
<tr valign="top">
<td width="22%">developer.apple.com</td>
<td width="18%">30</td>
<td width="20%">23</td>
<td width="20%">11</td>
<td width="20%">12</td>
</tr>
</tbody>
</table>
<p style="margin-bottom: 0cm; text-align: center;">
<p>Donc, pour résumer: utiliser les <em>Google Public DNS</em> quand on a un serveur DNS en local est un suicide. De même, quand un FAI offre des DNS à ses clients, il les place aux plus près de ces derniers: dans son cœur de réseau. A titre d&#8217;information: quand on fait une requête DNS avec <em>Google Public DNS</em>, la requête passe aussi par le cœur de réseau du FAI, mais plutôt que de s&#8217;arrêter là, elle part sur Internet et arrive sur le réseau de Google. Pourquoi aller si loin?</p>
<p>Bref, dans toutes les mesures que j&#8217;ai pu faire (réseau d&#8217;entreprise branchée sur Oléane, réseau de l&#8217;école, Freebox dégroupée à la maison), <em>Google Public DNS</em> n&#8217;est pas plus rapide.</p>
<p>A titre d&#8217;information, voici le script bash que j&#8217;ai utilisé pour faire ces mesures (largement copié de <a href="http://www.manu-j.com/blog/opendns-alternative-google-dns-rocks/403/">ce billet</a>)</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1461code2'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p14612"><td class="code" id="p1461code2"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
<span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #ff0000;">&quot;webd.fr&quot;</span> <span style="color: #ff0000;">&quot;google.fr&quot;</span> <span style="color: #ff0000;">&quot;amazon.fr&quot;</span>  <span style="color: #ff0000;">&quot;gandi.net&quot;</span> <span style="color: #ff0000;">&quot;sxc.hu&quot;</span> <span style="color: #ff0000;">&quot;developer.app$
do
  for j in &quot;</span>80.118.192.100<span style="color: #ff0000;">&quot; &quot;</span>10.20.40.1<span style="color: #ff0000;">&quot; &quot;</span>8.8.8.8<span style="color: #ff0000;">&quot; &quot;</span>212.27.32.176<span style="color: #ff0000;">&quot;
  do
    echo <span style="color: #007800;">$j</span> <span style="color: #007800;">$i</span> <span style="color: #780078;">`dig @$j $i | grep Query | awk -F &quot;:&quot; '{print $2}'`</span>
  done
done</span></pre></td></tr></table></div>

<h2>Pourquoi compliquer la vie de l&#8217;utilisateur ?</h2>
<p>Je ne sais pas vous, mais moi je suis un adapte du <em>Plug&#8217;n'play</em>. J&#8217;arrive sur un réseau, je branche mon cable et le DHCP s&#8217;occupe de tout … Je n&#8217;ai aucune configuration à faire. Pourquoi aller me compliquer la vie à rajouter des entrées DNS à la main alors que mon FAI (ou le DSI de mon entreprise) s&#8217;est décarcassé à faire un SI sans configuration requise ?</p>
<h2>Quid de l&#8217;impact sur les SI d&#8217;entreprise ?</h2>
<p>Aujourd&#8217;hui, Google annonce <em>Google Public DNS</em>. Demain, les utilisateurs quelque peu technophiles vont généraliser l&#8217;utilisation de ces DNS sur leurs machines: <cite>Ouais, moi j&#8217;utilise Google Public DNS, c&#8217;est la classe hein ? J&#8217;ai pas trop compris ce que ça fait, mais j&#8217;ai suivi un tutorial et depuis, il paraît que ça va plus vite</cite> …</p>
<p>A la limite, à la maison, on s&#8217;en fout. Mais en entreprise, c&#8217;est un coup à faire exploser les <em>helpdesk</em> des DSI. Quelques exemples concrets: aujourd&#8217;hui la plupart des entreprises ont des intranets, serveurs de partage, de facturations, … Bref: des serveurs internes. Pour y accéder, c&#8217;est souvent des noms bizzares qui sont utilisés. Par exemple: « poseidon.interne », « rennes.factu », « data.ora » …</p>
<p>Ces noms de domaines ne sont pas connus pas les serveurs DNS publics (à fortiori, par <em>Google Public DNS</em>). Donc, si vous n&#8217;utilisez pas les serveurs DNS internes à votre entreprise: vous ne pourrez plus accéder à ces services … J&#8217;entends déjà les coups de fils: <cite>Le serveur de facturation est innaccessible, vous foutez quoi ??? [...] Quoi, c’est même pas compatible avec Google ? Vous êtes des nazes !</cite>.</p>
<p>Bon, ça c&#8217;est pour le boulot … Vous en voulez pour la maison ? Si vous êtes chez Free, essayez donc d&#8217;accéder au disque de votre Freebox HD avec les <em>Google Public DNS</em> … Je sens que la hotline Free va être ravie …</p>
<p><a href="http://webd.fr/wp-content/uploads/2009/12/Google-Public-DNS-DSI.jpg" rel="lightbox[1461]" title="Google-Public-DNS-DSI"><img src="http://webd.fr/wp-content/uploads/2009/12/Google-Public-DNS-DSI-248x300.jpg" alt="Google-Public-DNS-DSI" title="Google-Public-DNS-DSI" width="248" height="300" class="aligncenter size-medium wp-image-1496" /></a></p>
<h2>Encore un pouvoir de plus pour Google ?</h2>
<p>Aujourd’hui, Google est omniprésent dans notre accès internet au quotidien. Demain, si l’utilisation de <em>Google Public DNS</em> se généralise, Google aura un pouvoir fou sur notre navigation: même plus besoin de passer par une de leur page pour qu’ils sachent sur quel domaine on navigue. Plus loin encore: le service peut ne pas répondre de façon <em>honnête</em>. <a href="http://www.freenews.fr/spip.php?article7037">Voir le principe des DNS menteurs (chez Freenews)</a>. </p>
<p>Bon, je ne suis pas adepte de la théorie du complot <em>Google-CIA-Francs Maçons-Big Brother</em> &#8230; Mais quand même, la je ne vois pas du tout d&#8217;intérêt à donner un tel pouvoir à une société &#8230;</p>
<div id="attachment_1497" class="wp-caption aligncenter" style="width: 310px"><a href="http://webd.fr/wp-content/uploads/2009/12/Google-Public-DNS-Dont-be-evil.jpg" rel="lightbox[1461]" title="Google-Public-DNS-Dont-be-evil"><img src="http://webd.fr/wp-content/uploads/2009/12/Google-Public-DNS-Dont-be-evil-300x174.jpg" alt="Don&#039;t be evil: la devise de Google" title="Google-Public-DNS-Dont-be-evil" width="300" height="174" class="size-medium wp-image-1497" /></a><p class="wp-caption-text">Don't be evil: la devise de Google</p></div>
<h2>Conclusion</h2>
<p>Pour conclure, je dirais simplement que je n’utiliserais pas <em>Google Public DNS</em>: ça ne m’apporte aucun gain de performance, ça risque d’impacter grandement mon <em>expérience utilisateurs</em> au sein des différents SI d’entreprise que j’utilise et ce serait donner trop de pouvoirs à Google.</p>
<p>Par contre, ce service à deux avantages: maintenant je connais une IP simple à pinguer: <em>8.8.8.8</em> pour les tests simples de connectivité. Le second avantage, c’est quand je mets en place une infrastructure réseau et que le DNS n’est pas encore fait, je connais une IP de DNS simple: <em>8.8.8.8</em>. Sinon, je continuerais à faire appel aux services de mon DSI ou FAI.<!-- PHP 5.x --></p>
]]></content:encoded>
			<wfw:commentRss>http://webd.fr/1461-pourquoi-je-nutiliserais-pas-google-dns/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Oui, Windows est obligatoire à SUPINFO</title>
		<link>http://webd.fr/897-oui-windows-est-obligatoire-a-supinfo</link>
		<comments>http://webd.fr/897-oui-windows-est-obligatoire-a-supinfo#comments</comments>
		<pubDate>Thu, 20 Aug 2009 20:44:10 +0000</pubDate>
		<dc:creator>Julien Quéré</dc:creator>
				<category><![CDATA[Pro]]></category>

		<guid isPermaLink="false">http://webd.fr/?p=897</guid>
		<description><![CDATA[Il est rare (en fait c’est la première fois) que je parle de SUPINFO (école où je m&#8217;apprête a faire ma seconde année de Master) sur ces pages. Pourquoi commencer aujourd’hui ? Tout simplement parce qu’une rumeur enfle en ce &#8230; <a href="http://webd.fr/897-oui-windows-est-obligatoire-a-supinfo">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Il est rare (en fait c’est la première fois) que je parle de SUPINFO (école où je m&#8217;apprête a faire ma seconde année de Master) sur ces pages. Pourquoi commencer aujourd’hui ? Tout simplement parce qu’une rumeur enfle en ce moment au sujet de l’école. Le principal canal de diffusion: Twitter. </p>
<p>L’idée de la rumeur est assez simple (simpliste ?): SUPINFO serait «macqué» avec Microsoft et obligerait tout ses étudiants à utiliser Windows sur leurs ordinateurs personnels. De là, on imagine rapidement le processus d’embrigadement visant à éloigner les étudiants du monde du logiciel libre (les élèves ingénieur d’aujourd’hui sont les décideurs de demain).<br />
<span id="more-897"></span><br />
Je ne suis pas connu pour être quelqu’un qui défend aveuglement SUPINFO (ça se vérifie &#8230;), mais cette rumeur m&#8217;énerve particulièrement pour la simple et bonne raison qu’elle est à mille lieux des faits. Tout d&#8217;abord, il faut comprendre quelques points propres à SUPINFO:</p>
<ul>
<li>Chaque étudiant vient en cours avec son propre ordinateur portable. Ceci pour les TP ou pour les cours magistraux</li>
<li>A SUPINFO, les évaluations se font de manière numérique sous forme de QCM. Ces évaluation (basées sur SGES: <i>SUPINFO Global Evaluation System</i>) sont passées par les étudiants sur leurs propres ordinateurs.</li>
</ul>
<p>Deux points qui ne sont pas secrets, qui sont même largement évoqués dans les brochures de l’école. Partant de là, on arrive à un problème simple: il faut que SGES (solution développée en interne par SUPINFO) permette à tout les étudiants de passer les évaluations de façon sécurisée et sans possibilité de triche &#8230; </p>
<p><a href="http://www.labo-linux.org/"><img src="http://webd.fr/wp-content/uploads/2009/08/laboLinux-300x38.jpg" alt="laboLinux" title="laboLinux" width="300" height="38" class="aligncenter size-medium wp-image-899" /></a></p>
<p>Pour des raisons de choix techniques (que je ne connais pas complètement mais qui me semblent logiques à priori), c’est le plateforme .Net qui a été choisie pour développer le client SGES. .Net, jusqu&#8217;à preuve du contraire, c’est pour Windows (oublions Mono). A cela, rajoutez que seul Windows est aussi contrôlable par le développeur. On a donc un client SGES .Net qui permet de passer les évaluations sans tricher (sans, par exemple, naviguer entre les fenêtres à coup de alt+tab pour lire son cours dans Word).</p>
<p>On ne peut pas exécuter le client SGES dans un environnement virtualisé car le propre de SGES est de bloquer l’écran de l’utilisateur. Il faut donc être certains que l&#8217;environnement sur lequel SGES client tourne n’est pas virtualisé, sinon ses protections anti-triche ne servent à rien: au lieu de faire un alt+tab sur l’OS qui héberger SGES, on le fait sur l’OS qui héberge VMWare (ou autre). Dernière question: pourquoi ne pas faire une autre version sur les autres plateformes (Linux, Mac OS X) ? Parce que ça prendrait un temps fou.</p>
<p>Donc, oui Windows (XP, Vista, Seven) est obligatoire à SUPINFO&#8230; Pour les évaluations SGES seulement ! Tout ce qui est demandé, c’est d’avoir une partition avec un Windows installé sur le disque dur de la machine. A coté de cela, mettez ce que vous voulez ! L’année dernière, sur mon portable SUPINFO, il y avait Windows XP, Ubuntu et Mac OS X (vive le multi boot)&#8230; Windows n’a été lancé que pour les évaluations. </p>
<p>Et puis en plus, les licences Windows sont offertes (via ELMS/MSDNAA) ! Alors de quoi se plaint-on ? Et bien en fait, nous les étudiants de SUPINFO, on ne se plaint pas du tout (de ça &#8230;). C’est ceux qui n’ont pas toutes ces informations qui voient un complot franc-maçonnique anti-Linux et anti-Mac &#8230; </p>
<p>Et puis, n’est-ce pas le propre d’un ingénieur: s’adapter à l&#8217;environnement qui entoure sa mission ? Si !<!-- PHP 5.x --></p>
]]></content:encoded>
			<wfw:commentRss>http://webd.fr/897-oui-windows-est-obligatoire-a-supinfo/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Nib2objc: Ou comment convertir un nib en code Objectif-C</title>
		<link>http://webd.fr/735-nib2objc-ou-comment-convertir-un-nib-en-code-objectif-c</link>
		<comments>http://webd.fr/735-nib2objc-ou-comment-convertir-un-nib-en-code-objectif-c#comments</comments>
		<pubDate>Wed, 10 Jun 2009 14:49:40 +0000</pubDate>
		<dc:creator>Julien Quéré</dc:creator>
				<category><![CDATA[Pro]]></category>
		<category><![CDATA[Cocoa Touch]]></category>
		<category><![CDATA[Developpement]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://webd.fr/?p=735</guid>
		<description><![CDATA[L&#8217;utilisation d&#8217;Interface Builder s&#8217;avère très pratique pour les développeurs Cocoa Touch. C&#8217;est vrais que c&#8217;est génial de pouvoir créer ses interfaces en mode WYSIWYG. Oui mais voilà, cela peut poser quelques problèmes. Outre les cas où l&#8217;utilisation du code est &#8230; <a href="http://webd.fr/735-nib2objc-ou-comment-convertir-un-nib-en-code-objectif-c">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>L&#8217;utilisation d&#8217;Interface Builder s&#8217;avère très pratique pour les développeurs Cocoa Touch. C&#8217;est vrais que c&#8217;est génial de pouvoir créer ses interfaces en mode WYSIWYG. Oui mais voilà, cela peut poser quelques problèmes. Outre les cas où l&#8217;utilisation du code est nécessaire (pour atteindre la granularité voulue), on peut vouloir renoncer à l&#8217;utilisation des nibs pour des raisons de performance. </p>
<p>En effet, dans certains cas l&#8217;utilisation des nibs pose de sérieux problèmes de performance. On se retrouve ainsi avec un dur choix: soit on choisit la simplicité (et on utilise Interface Builder), soit on écrit ses interfaces directement dans le code et on gagne en performance. Dans certains cas, l&#8217;impact de l&#8217;utilisation des nibs sur la performance est quasi nul. La question ne se pose donc pas. Mais parfois, ce n&#8217;est pas le cas.<br />
<span id="more-735"></span><br />
Dans ce dernier cas de figure, il existe maintenant une solution: nib2objc. Ce projet Open-Source  est tout simplement un convertisseur de fichiers nib (.xib) vers du code Objectif-C. Il gère toutes les propriétés publiques de chacun des éléments graphiques, le constructeur et la hiérarchie des vues. Pour le moment, il n&#8217;y a que les composants d&#8217;UIKit qui sont supportés. L&#8217;utilisation est on-ne-peut-plus simple:</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p735code5'); return false;">View Code</a> TEXT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p7355"><td class="code" id="p735code5"><pre class="text" style="font-family:monospace;">imac-de-julien-2:Debug julien$ ./nib2objc demo.xib &gt; demo.m</pre></td></tr></table></div>

<p><a href="http://webd.fr/wp-content/uploads/2009/06/image-6.png" rel="lightbox[735]" title="image-6"><img src="http://webd.fr/wp-content/uploads/2009/06/image-6-300x224.png" alt="image-6" title="image-6" width="300" height="224" class="aligncenter size-medium wp-image-738" /></a></p>
<p>Et voilà le résultat pour ce nib:</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p735code6'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p7356"><td class="code" id="p735code6"><pre class="objc" style="font-family:monospace;">UILabel <span style="color: #002200;">*</span>view6 <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UILabel alloc<span style="color: #002200;">&#93;</span> initWithFrame<span style="color: #002200;">:</span>CGRectMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">20.0</span>, <span style="color: #2400d9;">20.0</span>, <span style="color: #2400d9;">260.0</span>, <span style="color: #2400d9;">21.0</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;
view6.frame <span style="color: #002200;">=</span> CGRectMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">20.0</span>, <span style="color: #2400d9;">20.0</span>, <span style="color: #2400d9;">260.0</span>, <span style="color: #2400d9;">21.0</span><span style="color: #002200;">&#41;</span>;
view6.adjustsFontSizeToFitWidth <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
view6.alpha <span style="color: #002200;">=</span> <span style="color: #2400d9;">1.000</span>;
view6.autoresizingMask <span style="color: #002200;">=</span> UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin;
view6.baselineAdjustment <span style="color: #002200;">=</span> UIBaselineAdjustmentAlignCenters;
view6.clearsContextBeforeDrawing <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
view6.clipsToBounds <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
view6.contentMode <span style="color: #002200;">=</span> UIViewContentModeScaleToFill;
view6.enabled <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
view6.font <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIFont fontWithName<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Helvetica&quot;</span> size<span style="color: #002200;">:</span><span style="color: #2400d9;">17.000</span><span style="color: #002200;">&#93;</span>;
view6.hidden <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view6.lineBreakMode <span style="color: #002200;">=</span> UILineBreakModeTailTruncation;
view6.minimumFontSize <span style="color: #002200;">=</span> <span style="color: #2400d9;">10.000</span>;
view6.multipleTouchEnabled <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view6.numberOfLines <span style="color: #002200;">=</span> <span style="color: #2400d9;">1</span>;
view6.opaque <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view6.shadowOffset <span style="color: #002200;">=</span> CGSizeMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">0.0</span>, <span style="color: #002200;">-</span><span style="color: #2400d9;">1.0</span><span style="color: #002200;">&#41;</span>;
view6.tag <span style="color: #002200;">=</span> <span style="color: #2400d9;">0</span>;
view6.text <span style="color: #002200;">=</span> <span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Ma célule personalisée&quot;</span>;
view6.textAlignment <span style="color: #002200;">=</span> UITextAlignmentCenter;
view6.textColor <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIColor colorWithRed<span style="color: #002200;">:</span><span style="color: #2400d9;">0.000</span> green<span style="color: #002200;">:</span><span style="color: #2400d9;">0.000</span> blue<span style="color: #002200;">:</span><span style="color: #2400d9;">0.000</span> alpha<span style="color: #002200;">:</span><span style="color: #2400d9;">1.000</span><span style="color: #002200;">&#93;</span>;
view6.userInteractionEnabled <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
&nbsp;
UITableViewCell <span style="color: #002200;">*</span>view4 <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UITableViewCell alloc<span style="color: #002200;">&#93;</span> initWithFrame<span style="color: #002200;">:</span>CGRectMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">0.0</span>, <span style="color: #2400d9;">0.0</span>, <span style="color: #2400d9;">300.0</span>, <span style="color: #2400d9;">182.0</span><span style="color: #002200;">&#41;</span> reuseIdentifier<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>null<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;
view4.frame <span style="color: #002200;">=</span> CGRectMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">0.0</span>, <span style="color: #2400d9;">0.0</span>, <span style="color: #2400d9;">300.0</span>, <span style="color: #2400d9;">182.0</span><span style="color: #002200;">&#41;</span>;
view4.accessoryType <span style="color: #002200;">=</span> UITableViewCellAccessoryNone;
view4.alpha <span style="color: #002200;">=</span> <span style="color: #2400d9;">1.000</span>;
view4.autoresizingMask <span style="color: #002200;">=</span> UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin;
view4.backgroundColor <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIColor colorWithRed<span style="color: #002200;">:</span><span style="color: #2400d9;">1.000</span> green<span style="color: #002200;">:</span><span style="color: #2400d9;">1.000</span> blue<span style="color: #002200;">:</span><span style="color: #2400d9;">1.000</span> alpha<span style="color: #002200;">:</span><span style="color: #2400d9;">1.000</span><span style="color: #002200;">&#93;</span>;
view4.clearsContextBeforeDrawing <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view4.clipsToBounds <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view4.contentMode <span style="color: #002200;">=</span> UIViewContentModeScaleToFill;
view4.font <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIFont fontWithName<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Helvetica&quot;</span> size<span style="color: #002200;">:</span><span style="color: #2400d9;">17.000</span><span style="color: #002200;">&#93;</span>;
view4.hidden <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view4.hidesAccessoryWhenEditing <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
view4.indentationLevel <span style="color: #002200;">=</span> <span style="color: #2400d9;">0</span>;
view4.indentationWidth <span style="color: #002200;">=</span> <span style="color: #2400d9;">10.000</span>;
view4.lineBreakMode <span style="color: #002200;">=</span> UILineBreakModeTailTruncation;
view4.multipleTouchEnabled <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view4.opaque <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
view4.selectedTextColor <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIColor colorWithWhite<span style="color: #002200;">:</span><span style="color: #2400d9;">1.000</span> alpha<span style="color: #002200;">:</span><span style="color: #2400d9;">1.000</span><span style="color: #002200;">&#93;</span>;
view4.selectionStyle <span style="color: #002200;">=</span> UITableViewCellSelectionStyleBlue;
view4.showsReorderControl <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view4.tag <span style="color: #002200;">=</span> <span style="color: #2400d9;">0</span>;
view4.textAlignment <span style="color: #002200;">=</span> UITextAlignmentLeft;
view4.textColor <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIColor colorWithWhite<span style="color: #002200;">:</span><span style="color: #2400d9;">0.000</span> alpha<span style="color: #002200;">:</span><span style="color: #2400d9;">1.000</span><span style="color: #002200;">&#93;</span>;
view4.userInteractionEnabled <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
&nbsp;
UIButton <span style="color: #002200;">*</span>view7 <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIButton buttonWithType<span style="color: #002200;">:</span>UIButtonTypeRoundedRect<span style="color: #002200;">&#93;</span>;
view7.frame <span style="color: #002200;">=</span> CGRectMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">101.0</span>, <span style="color: #2400d9;">49.0</span>, <span style="color: #2400d9;">99.0</span>, <span style="color: #2400d9;">37.0</span><span style="color: #002200;">&#41;</span>;
view7.adjustsImageWhenDisabled <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
view7.adjustsImageWhenHighlighted <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
view7.alpha <span style="color: #002200;">=</span> <span style="color: #2400d9;">1.000</span>;
view7.autoresizingMask <span style="color: #002200;">=</span> UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin;
view7.clearsContextBeforeDrawing <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view7.clipsToBounds <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view7.contentHorizontalAlignment <span style="color: #002200;">=</span> UIControlContentHorizontalAlignmentCenter;
view7.contentMode <span style="color: #002200;">=</span> UIViewContentModeScaleToFill;
view7.contentVerticalAlignment <span style="color: #002200;">=</span> UIControlContentVerticalAlignmentCenter;
view7.enabled <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
view7.font <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIFont fontWithName<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Helvetica-Bold&quot;</span> size<span style="color: #002200;">:</span><span style="color: #2400d9;">15.000</span><span style="color: #002200;">&#93;</span>;
view7.hidden <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view7.highlighted <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view7.multipleTouchEnabled <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view7.opaque <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view7.reversesTitleShadowWhenHighlighted <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view7.selected <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view7.showsTouchWhenHighlighted <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view7.tag <span style="color: #002200;">=</span> <span style="color: #2400d9;">0</span>;
view7.titleShadowOffset <span style="color: #002200;">=</span> CGSizeMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">1.0</span>, <span style="color: #2400d9;">1.0</span><span style="color: #002200;">&#41;</span>;
view7.userInteractionEnabled <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
<span style="color: #002200;">&#91;</span>view7 setTitle<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Un bouton&quot;</span> forState<span style="color: #002200;">:</span>UIControlStateNormal<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>view7 setTitleColor<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span>UIColor colorWithWhite<span style="color: #002200;">:</span><span style="color: #2400d9;">1.000</span> alpha<span style="color: #002200;">:</span><span style="color: #2400d9;">1.000</span><span style="color: #002200;">&#93;</span> forState<span style="color: #002200;">:</span>UIControlStateHighlighted<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>view7 setTitleColor<span style="color: #002200;">:</span>NSPatternColorSpace <a href="http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSImage_Class/"><span style="color: #400080;">NSImage</span></a> 0x2c3e5a0 Size<span style="color: #002200;">=</span><span style="color: #002200;">&#123;</span><span style="color: #2400d9;">320</span>, <span style="color: #2400d9;">460</span><span style="color: #002200;">&#125;</span> Reps<span style="color: #002200;">=</span><span style="color: #002200;">&#40;</span>
    <a href="http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSBitmapImageRep_Class/"><span style="color: #400080;">NSBitmapImageRep</span></a> 0x2c49460 Size<span style="color: #002200;">=</span><span style="color: #002200;">&#123;</span><span style="color: #2400d9;">320</span>, <span style="color: #2400d9;">460</span><span style="color: #002200;">&#125;</span> ColorSpace<span style="color: #002200;">=</span>NSDeviceRGBColorSpace BPS<span style="color: #002200;">=</span><span style="color: #2400d9;">8</span> BPP<span style="color: #002200;">=</span><span style="color: #2400d9;">32</span> Pixels<span style="color: #002200;">=</span>320x460 Alpha<span style="color: #002200;">=</span><span style="color: #a61390;">YES</span> Planar<span style="color: #002200;">=</span><span style="color: #a61390;">NO</span> Format<span style="color: #002200;">=</span><span style="color: #2400d9;">1</span>
<span style="color: #002200;">&#41;</span> forState<span style="color: #002200;">:</span>UIControlStateNormal<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>view7 setTitleShadowColor<span style="color: #002200;">:</span>NSNamedColorSpace System controlColor forState<span style="color: #002200;">:</span>UIControlStateNormal<span style="color: #002200;">&#93;</span>;
&nbsp;
UISwitch <span style="color: #002200;">*</span>view8 <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UISwitch alloc<span style="color: #002200;">&#93;</span> initWithFrame<span style="color: #002200;">:</span>CGRectMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">103.0</span>, <span style="color: #2400d9;">103.0</span>, <span style="color: #2400d9;">94.0</span>, <span style="color: #2400d9;">27.0</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;
view8.frame <span style="color: #002200;">=</span> CGRectMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">103.0</span>, <span style="color: #2400d9;">103.0</span>, <span style="color: #2400d9;">94.0</span>, <span style="color: #2400d9;">27.0</span><span style="color: #002200;">&#41;</span>;
view8.alpha <span style="color: #002200;">=</span> <span style="color: #2400d9;">1.000</span>;
view8.autoresizingMask <span style="color: #002200;">=</span> UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin;
view8.clearsContextBeforeDrawing <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
view8.clipsToBounds <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
view8.contentHorizontalAlignment <span style="color: #002200;">=</span> UIControlContentHorizontalAlignmentCenter;
view8.contentMode <span style="color: #002200;">=</span> UIViewContentModeScaleToFill;
view8.contentVerticalAlignment <span style="color: #002200;">=</span> UIControlContentVerticalAlignmentCenter;
view8.enabled <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
view8.hidden <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view8.highlighted <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
view8.multipleTouchEnabled <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
view8.on <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
view8.opaque <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view8.selected <span style="color: #002200;">=</span> <span style="color: #a61390;">NO</span>;
view8.tag <span style="color: #002200;">=</span> <span style="color: #2400d9;">0</span>;
view8.userInteractionEnabled <span style="color: #002200;">=</span> <span style="color: #a61390;">YES</span>;
&nbsp;
<span style="color: #002200;">&#91;</span>view4 addSubview<span style="color: #002200;">:</span>view6<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>view4 addSubview<span style="color: #002200;">:</span>view7<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>view4 addSubview<span style="color: #002200;">:</span>view8<span style="color: #002200;">&#93;</span>;</pre></td></tr></table></div>

<p>Comme vous pouvez le voir, c&#8217;est très verbeux. C&#8217;est parce que l&#8217;outil ne détecte pas les valeurs qui sont là par défaut. Donc dans le doute, il génère toutes les propriétés. A noter aussi que les valeurs des propriétés <code>UIImage</code>, <code>NSLocale</code> et <code>NSTimeZone</code> ne sont pas sorties dans le code. En effet, ibtool (sur lequel nib2objc se base) ne les supporte pas. </p>
<p><a href="http://kosmaczewski.net/projects/nib2objc/">Plus d&#8217;informations sur la page du projet nib2objc du site d&#8217;Adrian Kosmaczewski</a>. <!-- PHP 5.x --></p>
]]></content:encoded>
			<wfw:commentRss>http://webd.fr/735-nib2objc-ou-comment-convertir-un-nib-en-code-objectif-c/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Comparer deux NSDate</title>
		<link>http://webd.fr/637-comparer-deux-nsdate</link>
		<comments>http://webd.fr/637-comparer-deux-nsdate#comments</comments>
		<pubDate>Fri, 05 Jun 2009 08:49:47 +0000</pubDate>
		<dc:creator>Julien Quéré</dc:creator>
				<category><![CDATA[Pro]]></category>
		<category><![CDATA[Cocoa Touch]]></category>
		<category><![CDATA[Developpement]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://webd.fr/?p=637</guid>
		<description><![CDATA[Il est souvent utile de comparer deux NSDate dans le temps. Il s&#8217;agit de savoir si une date est antérieure ou postérieure à une autre. Le mécanisme offert par Apple pour les comparaisons de NSDate n&#8217;est pas des plus pratiques. &#8230; <a href="http://webd.fr/637-comparer-deux-nsdate">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Il est souvent utile de comparer deux <code>NSDate</code> dans le temps. Il s&#8217;agit de savoir si une date est antérieure ou postérieure à une autre. Le mécanisme offert par Apple pour les comparaisons de <code>NSDate</code> n&#8217;est pas des plus pratiques. Il faut utiliser la méthode <code>compare:(NSDate*)date</code> qui retourne un objet de type <code>NSComparisonResult</code>. </p>
<p>Cette méthode est une méthode standard de Foundation. Elle permet, grâce à des résultats de comparaison standardisés d&#8217;effectuer un tri sur des objets de façon générique. Oui, mais Apple ne prévoit pas de méthodes un peu plus <i>haut niveau</i> pour les simples comparaisons de dates. Voilà pourquoi j&#8217;ai écrit rapidement une addition de la classe <code>NSDate</code> permettant de comparer deux dates intuitivement. Les voici:<br />
<span id="more-637"></span></p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p637code9'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p6379"><td class="code" id="p637code9"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">//</span>
<span style="color: #11740a; font-style: italic;">//  NSDateAdditions.h</span>
<span style="color: #11740a; font-style: italic;">//</span>
<span style="color: #11740a; font-style: italic;">//  Created by Julien on 28/05/09.</span>
<span style="color: #11740a; font-style: italic;">//  Copyright 2009 Julien Quéré - Webd.fr. All rights reserved.</span>
<span style="color: #11740a; font-style: italic;">//</span>
&nbsp;
<span style="color: #6e371a;">#import &lt;Foundation/Foundation.h&gt;</span>
&nbsp;
<span style="color: #a61390;">@interface</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDate_Class/"><span style="color: #400080;">NSDate</span></a> <span style="color: #002200;">&#40;</span>NSDateAdditions<span style="color: #002200;">&#41;</span> 
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span> isLaterThanOrEqualTo<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDate_Class/"><span style="color: #400080;">NSDate</span></a><span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>date;
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span> isEarlierThanOrEqualTo<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDate_Class/"><span style="color: #400080;">NSDate</span></a><span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>date;
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span> isLaterThan<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDate_Class/"><span style="color: #400080;">NSDate</span></a><span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>date;
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span> isEarlierThan<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDate_Class/"><span style="color: #400080;">NSDate</span></a><span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>date;
<span style="color: #a61390;">@end</span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #11740a; font-style: italic;">//  NSDateAdditions.m</span>
<span style="color: #11740a; font-style: italic;">//</span>
<span style="color: #11740a; font-style: italic;">//  Created by Julien on 28/05/09.</span>
<span style="color: #11740a; font-style: italic;">//  Copyright 2009 Julien Quéré - Webd.fr. All rights reserved.</span>
<span style="color: #11740a; font-style: italic;">//</span>
&nbsp;
<span style="color: #6e371a;">#import &quot;NSDateAdditions.h&quot;</span>
&nbsp;
&nbsp;
<span style="color: #a61390;">@implementation</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDate_Class/"><span style="color: #400080;">NSDate</span></a> <span style="color: #002200;">&#40;</span>NSDateAdditions<span style="color: #002200;">&#41;</span>
&nbsp;
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span> isLaterThanOrEqualTo<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDate_Class/"><span style="color: #400080;">NSDate</span></a><span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>date <span style="color: #002200;">&#123;</span>
	<span style="color: #a61390;">return</span> <span style="color: #002200;">!</span><span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>self compare<span style="color: #002200;">:</span>date<span style="color: #002200;">&#93;</span> <span style="color: #002200;">==</span> NSOrderedAscending<span style="color: #002200;">&#41;</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span> isEarlierThanOrEqualTo<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDate_Class/"><span style="color: #400080;">NSDate</span></a><span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>date <span style="color: #002200;">&#123;</span>
	<span style="color: #a61390;">return</span> <span style="color: #002200;">!</span><span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>self compare<span style="color: #002200;">:</span>date<span style="color: #002200;">&#93;</span> <span style="color: #002200;">==</span> NSOrderedDescending<span style="color: #002200;">&#41;</span>;
<span style="color: #002200;">&#125;</span>
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span> isLaterThan<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDate_Class/"><span style="color: #400080;">NSDate</span></a><span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>date <span style="color: #002200;">&#123;</span>
	<span style="color: #a61390;">return</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>self compare<span style="color: #002200;">:</span>date<span style="color: #002200;">&#93;</span> <span style="color: #002200;">==</span> NSOrderedDescending<span style="color: #002200;">&#41;</span>;
&nbsp;
<span style="color: #002200;">&#125;</span>
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span> isEarlierThan<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDate_Class/"><span style="color: #400080;">NSDate</span></a><span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>date <span style="color: #002200;">&#123;</span>
	<span style="color: #a61390;">return</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>self compare<span style="color: #002200;">:</span>date<span style="color: #002200;">&#93;</span> <span style="color: #002200;">==</span> NSOrderedAscending<span style="color: #002200;">&#41;</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #a61390;">@end</span></pre></td></tr></table></div>

<p>L&#8217;utilisation, quant à elle est on-ne-peut plus simple:</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p637code10'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p63710"><td class="code" id="p637code10"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">// Compare a NSDate (maDate) and the actual date</span>
<span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>maDate isEarlierThanOrEqualTo<span style="color: #002200;">:</span><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDate_Class/"><span style="color: #400080;">NSDate</span></a> date<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>
<span style="color: #002200;">&#123;</span>
	NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;It's earlier or equal&quot;</span><span style="color: #002200;">&#41;</span>;
<span style="color: #002200;">&#125;</span>
<span style="color: #a61390;">else</span>
<span style="color: #002200;">&#123;</span>
	NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;It's later&quot;</span><span style="color: #002200;">&#41;</span>;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p><!-- PHP 5.x --></p>
]]></content:encoded>
			<wfw:commentRss>http://webd.fr/637-comparer-deux-nsdate/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Astuces développement iPhone 8: Modifier le __MyCompanyName__</title>
		<link>http://webd.fr/707-developpement-iphone-modifier-le-__mycompanyname__</link>
		<comments>http://webd.fr/707-developpement-iphone-modifier-le-__mycompanyname__#comments</comments>
		<pubDate>Tue, 02 Jun 2009 08:12:37 +0000</pubDate>
		<dc:creator>Julien Quéré</dc:creator>
				<category><![CDATA[Astuce]]></category>
		<category><![CDATA[Developpement]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://webd.fr/?p=707</guid>
		<description><![CDATA[Je vois assez souvent, dans les fichiers de code qui passent entre mes mains, des en-têtes comme ceci: ?View Code OBJC// Created by Julien on 17/01/09. // Copyright 2009 __MyCompanyName__. All rights reserved. Le problème porte sur __MyCompanyName__. Il serait &#8230; <a href="http://webd.fr/707-developpement-iphone-modifier-le-__mycompanyname__">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Je vois assez souvent, dans les fichiers de code qui passent entre mes mains, des en-têtes comme ceci:</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p707code13'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p70713"><td class="code" id="p707code13"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">//  Created by Julien on 17/01/09.</span>
<span style="color: #11740a; font-style: italic;">//  Copyright 2009 __MyCompanyName__. All rights reserved.</span></pre></td></tr></table></div>

<p>Le problème porte sur <code>__MyCompanyName__</code>. Il serait bien plus propre de le remplacer par une valeur personnalisée (et automatique de préférence). Pour ceci, Apple a tout prévu &#8230;<br />
<span id="more-707"></span><br />
Il suffit tout simplement de modifier <code>ORGANIZATIONNAME</code> de <code>PBXCustomTemplateMacroDefinitions</code> dans la configuration de Xcode. En ligne de commande, ça donne (dans mon cas):</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p707code14'); return false;">View Code</a> TEXT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p70714"><td class="code" id="p707code14"><pre class="text" style="font-family:monospace;">defaults write com.apple.Xcode PBXCustomTemplateMacroDefinitions {&quot;ORGANIZATIONNAME&quot;=&quot;Julien Quéré - http://webd.fr&quot;;}'</pre></td></tr></table></div>

<p><!-- PHP 5.x --></p>
]]></content:encoded>
			<wfw:commentRss>http://webd.fr/707-developpement-iphone-modifier-le-__mycompanyname__/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Redimensionner une UIImage en étant Threadsafe</title>
		<link>http://webd.fr/631-redimensionner-une-uiimage-en-etant-threadsafe</link>
		<comments>http://webd.fr/631-redimensionner-une-uiimage-en-etant-threadsafe#comments</comments>
		<pubDate>Sat, 30 May 2009 07:47:26 +0000</pubDate>
		<dc:creator>Julien Quéré</dc:creator>
				<category><![CDATA[Pro]]></category>
		<category><![CDATA[Developpement]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://webd.fr/?p=631</guid>
		<description><![CDATA[Il y a peu, je vous présentais ici même comment redimensionner une UIImage. Je vous replace dans le contexte: Dans certains cas, il peut être utile de redimensionner une UIImage. En effet, même si UIImageView gère très bien le redimensionnement, &#8230; <a href="http://webd.fr/631-redimensionner-une-uiimage-en-etant-threadsafe">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Il y a peu, je vous présentais ici même comment <a href="http://webd.fr/320-redimensionner-une-uiimage">redimensionner une <code>UIImage</code></a>. Je vous replace dans le contexte: <cite>Dans certains cas, il peut être utile de redimensionner une <code>UIImage</code>. En effet, même si <code>UIImageView</code> gère très bien le redimensionnement, on peut vouloir exporter une image dans une certaine taille. De même, il n’est pas forcement utile de stocker (en mémoire ou bien en dur) une image de grande taille si c’est pour l’afficher réduite par la suite</cite>.</p>
<p>Le code qui était présenté est fonctionnel … Oui, mais un collègue m&#8217;a fait remarquer que ce n&#8217;était pas le cas en multi-threads. Pourquoi ? Tout simplement parce que quand on fait <code>UIGraphicsBeginImageContext()</code>, on travaille dans un contexte unique. Ainsi, quand on voudra redimensionner deux images en même temps, elles partageront le même contexte. Clairement, ça ne peut pas marcher. D&#8217;ailleurs: ça ne marche pas !</p>
<p><span id="more-631"></span></p>
<p>Partant de là il y a deux options: soit on gère un système de sémaphore, soit on trouve un moyen de créer un contexte spécifique. L&#8217;idée du sémaphore est à exclure d&#8217;emblée. Ceci pour la simple et bonne raison qu&#8217;elle nous enlève l&#8217;avantage principal d&#8217;utiliser des threads: pouvoir exécuter des opérations en simultané. </p>
<p>Il faut donc créer un contexte bitmap spécifique à notre thread. Ensuite, on dessine notre image à redimensionner dans ce contexte que l&#8217;on vient de créer. Pour finir, on n&#8217;oubliera pas de libérer les différents refs créées. Dans le code, voilà ce que cela donne:</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p631code17'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p63117"><td class="code" id="p631code17"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">//  UIImageAdditions.m</span>
<span style="color: #11740a; font-style: italic;">//  Untitled</span>
<span style="color: #11740a; font-style: italic;">//</span>
<span style="color: #11740a; font-style: italic;">//  Created by Julien on 28/05/09.</span>
<span style="color: #11740a; font-style: italic;">//  Copyright 2009 Julien Quéré - Webd.fr. All rights reserved.</span>
<span style="color: #11740a; font-style: italic;">//</span>
&nbsp;
<span style="color: #6e371a;">#import &quot;UIImageAdditions.h&quot;</span>
&nbsp;
<span style="color: #a61390;">@implementation</span> UIImage<span style="color: #002200;">&#40;</span>UIImageAdditions<span style="color: #002200;">&#41;</span>
&nbsp;
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>UIImage <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>resizeWithSize<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>CGSize<span style="color: #002200;">&#41;</span>size <span style="color: #002200;">&#123;</span>
	CGColorSpaceRef colorSpace <span style="color: #002200;">=</span> CGColorSpaceCreateDeviceRGB<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span>;
	CGContextRef context <span style="color: #002200;">=</span> CGBitmapContextCreate<span style="color: #002200;">&#40;</span><span style="color: #a61390;">NULL</span>, size.width, size.height, <span style="color: #2400d9;">5</span>, size.width<span style="color: #002200;">*</span><span style="color: #2400d9;">2</span>, colorSpace, kCGImageAlphaNoneSkipFirst<span style="color: #002200;">&#41;</span>; <span style="color: #11740a; font-style: italic;">//5bpc </span>
	<span style="color: #11740a; font-style: italic;">// size.width*2 = 2bbp</span>
	CGRect rect <span style="color: #002200;">=</span> CGRectMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">0</span>, <span style="color: #2400d9;">0</span>, size.width, size.height<span style="color: #002200;">&#41;</span>;
&nbsp;
	CGContextDrawImage<span style="color: #002200;">&#40;</span>context, rect, self.CGImage<span style="color: #002200;">&#41;</span>;
	CGImageRef refNewImage <span style="color: #002200;">=</span> CGBitmapContextCreateImage<span style="color: #002200;">&#40;</span>context<span style="color: #002200;">&#41;</span>;
	UIImage <span style="color: #002200;">*</span>newImage <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIImage imageWithCGImage<span style="color: #002200;">:</span>refNewImage<span style="color: #002200;">&#93;</span>;
&nbsp;
	CGImageRelease<span style="color: #002200;">&#40;</span>refNewImage<span style="color: #002200;">&#41;</span>;
	CGColorSpaceRelease<span style="color: #002200;">&#40;</span>colorSpace<span style="color: #002200;">&#41;</span>;
	CGContextRelease<span style="color: #002200;">&#40;</span>context<span style="color: #002200;">&#41;</span>;
&nbsp;
	<span style="color: #a61390;">return</span> newImage;	
<span style="color: #002200;">&#125;</span>
<span style="color: #a61390;">@end</span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #11740a; font-style: italic;">//  UIImageAdditions.h</span>
<span style="color: #11740a; font-style: italic;">//  Untitled</span>
<span style="color: #11740a; font-style: italic;">//</span>
<span style="color: #11740a; font-style: italic;">//  Created by Julien on 28/05/09.</span>
<span style="color: #11740a; font-style: italic;">//  Copyright 2009 Julien Quéré - Webd.fr. All rights reserved.</span>
<span style="color: #11740a; font-style: italic;">//</span>
&nbsp;
<span style="color: #6e371a;">#import &lt;Foundation/Foundation.h&gt;</span>
&nbsp;
&nbsp;
<span style="color: #a61390;">@interface</span> UIImage<span style="color: #002200;">&#40;</span>UIImageAdditions<span style="color: #002200;">&#41;</span>
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span>UIImage <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>resizeWithSize<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span>CGSize<span style="color: #002200;">&#41;</span>size;
<span style="color: #a61390;">@end</span></pre></td></tr></table></div>

<p>Pour l&#8217;utilisation de <code>CGBitmapContextCreate</code>, référez vous à <a href="http://developer.apple.com/iphone/library/documentation/GraphicsImaging/Reference/CGBitmapContext/Reference/reference.html#//apple_ref/doc/uid/TP30000947-CH1g-F16989">la littérature Apple sur le sujet</a>. La seule chose qui aurait besoin d&#8217;être explicité c&#8217;est le premier paramètre: le <code>NULL</code>. Le premier paramètre correspond à un pointeur où les données du contexte doivent être stockées. Quand on passe <code>NULL</code>, on indique en fait que l&#8217;on se fiche d&#8217;où les données seront stockées (ce qui est notre cas).</p>
<p>Une fois l&#8217;addition de <code>UIImage</code> mise en place, l&#8217;utilisation du code est assez simple:</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p631code18'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p63118"><td class="code" id="p631code18"><pre class="objc" style="font-family:monospace;">	UIImage <span style="color: #002200;">*</span>myPic <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>UIImage imageNamed<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;poney.jpg&quot;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>myPic resizeWithSize<span style="color: #002200;">:</span>CGSizeMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">50</span>, <span style="color: #2400d9;">50</span><span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>im setImage<span style="color: #002200;">:</span>myPic<span style="color: #002200;">&#93;</span>; <span style="color: #11740a; font-style: italic;">//im is an UIImageView</span></pre></td></tr></table></div>

<p>Merci à Loïc Dardant pour le code et le coup de main.<br />
<!-- PHP 5.x --></p>
]]></content:encoded>
			<wfw:commentRss>http://webd.fr/631-redimensionner-une-uiimage-en-etant-threadsafe/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Calculer un hash MD5</title>
		<link>http://webd.fr/636-calculer-un-hash-md5</link>
		<comments>http://webd.fr/636-calculer-un-hash-md5#comments</comments>
		<pubDate>Tue, 19 May 2009 07:14:56 +0000</pubDate>
		<dc:creator>Julien Quéré</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[Developpement]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Objective-C]]></category>

		<guid isPermaLink="false">http://webd.fr/?p=636</guid>
		<description><![CDATA[Pour ceux qui ne la connaissent pas, MD5 est une méthode permettant d&#8217;obtenir une empreinte numérique unique d&#8217;un message (au sens large du terme: chaine de caractère ou fichier). Cet algorithme a longtemps été utilisé à des fins de sécurité. &#8230; <a href="http://webd.fr/636-calculer-un-hash-md5">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Pour ceux qui ne la connaissent pas, MD5 est une méthode permettant d&#8217;obtenir une empreinte numérique unique d&#8217;un message (au sens large du terme: chaine de caractère ou fichier). Cet algorithme a longtemps été utilisé à des fins de sécurité. Au risque de me répéter: <strong>n&#8217;utilisez pas MD5 à des fins de sécurité</strong> ! Cet algorithme est maintenant faible. Plus d&#8217;informations sur <a href="http://en.wikipedia.org/wiki/MD5#Vulnerability">Wikipedia EN</a>.</p>
<p>MD5 peut être utilisé pour générer une clef &laquo;&nbsp;<i>unique</i>&nbsp;&raquo; à partir d&#8217;une chaine de caractères. Exemple concret: j&#8217;ai des objets représentant des rendez-vous qui naviguent un peu partout (SQLite local, serveur de calendrier distant, &#8230;). Il me faut à tout moment pouvoir identifier uniquement un rendez-vous. La solution que j&#8217;ai choisi est de générer une somme MD5 à partir du titre du rendez-vous, de la date de création et l&#8217;UDID (voir <a href="http://webd.fr/526-astuces-developpement-iphone-6-recuperer-ludid"><em>Comment récupérer l’UDID</em></a>). Voici l&#8217;implémentation que j&#8217;utilise pour générer mes MD5 (dans le cas présent, c&#8217;est une addition de <code>NSString</code>):<br />
<span id="more-636"></span></p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p636code22'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p63622"><td class="code" id="p636code22"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">//</span>
<span style="color: #11740a; font-style: italic;">//  NSStringAdditions.h</span>
<span style="color: #11740a; font-style: italic;">//  iMeeting</span>
<span style="color: #11740a; font-style: italic;">//</span>
<span style="color: #11740a; font-style: italic;">//  Created by Julien on 12/05/09.</span>
<span style="color: #11740a; font-style: italic;">//</span>
&nbsp;
<span style="color: #6e371a;">#import &lt;Foundation/Foundation.h&gt;</span>
<span style="color: #6e371a;">#import &lt;CommonCrypto/CommonDigest.h&gt;</span>
&nbsp;
&nbsp;
<span style="color: #a61390;">@interface</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">&#40;</span>NSStringAdditions<span style="color: #002200;">&#41;</span>  
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>md5Hash;
&nbsp;
<span style="color: #a61390;">@end</span></pre></td></tr></table></div>


<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p636code23'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p63623"><td class="code" id="p636code23"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">//</span>
<span style="color: #11740a; font-style: italic;">//  NSStringAdditions.m</span>
<span style="color: #11740a; font-style: italic;">//  iMeeting</span>
<span style="color: #11740a; font-style: italic;">//</span>
<span style="color: #11740a; font-style: italic;">//  Created by Julien on 12/05/09.</span>
<span style="color: #11740a; font-style: italic;">//</span>
&nbsp;
<span style="color: #6e371a;">#import &quot;NSStringAdditions.h&quot;</span>
&nbsp;
&nbsp;
<span style="color: #a61390;">@implementation</span>  <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">&#40;</span>NSStringAdditions<span style="color: #002200;">&#41;</span>  
<span style="color: #002200;">-</span> <span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>md5Hash
<span style="color: #002200;">&#123;</span>
	<span style="color: #a61390;">const</span> <span style="color: #a61390;">char</span> <span style="color: #002200;">*</span>cStr <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>self UTF8String<span style="color: #002200;">&#93;</span>;
	<span style="color: #a61390;">unsigned</span> <span style="color: #a61390;">char</span> result<span style="color: #002200;">&#91;</span>CC_MD5_DIGEST_LENGTH<span style="color: #002200;">&#93;</span>;
	CC_MD5<span style="color: #002200;">&#40;</span> cStr, <a href="http://www.opengroup.org/onlinepubs/009695399/functions/strlen.html"><span style="color: #a61390;">strlen</span></a><span style="color: #002200;">&#40;</span>cStr<span style="color: #002200;">&#41;</span>, result <span style="color: #002200;">&#41;</span>;
	<span style="color: #a61390;">return</span> <span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> stringWithFormat<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X&quot;</span>,
			result<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">0</span><span style="color: #002200;">&#93;</span>, result<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">1</span><span style="color: #002200;">&#93;</span>, result<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">2</span><span style="color: #002200;">&#93;</span>, result<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">3</span><span style="color: #002200;">&#93;</span>, result<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">4</span><span style="color: #002200;">&#93;</span>, result<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">5</span><span style="color: #002200;">&#93;</span>, result<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">6</span><span style="color: #002200;">&#93;</span>, result<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">7</span><span style="color: #002200;">&#93;</span>,
			result<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">8</span><span style="color: #002200;">&#93;</span>, result<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">9</span><span style="color: #002200;">&#93;</span>, result<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">10</span><span style="color: #002200;">&#93;</span>, result<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">11</span><span style="color: #002200;">&#93;</span>, result<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">12</span><span style="color: #002200;">&#93;</span>, result<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">13</span><span style="color: #002200;">&#93;</span>, result<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">14</span><span style="color: #002200;">&#93;</span>, result<span style="color: #002200;">&#91;</span><span style="color: #2400d9;">15</span><span style="color: #002200;">&#93;</span>
			<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#125;</span>
<span style="color: #a61390;">@end</span></pre></td></tr></table></div>

<p>Et un exemple simple d&#8217;utilisation:</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p636code24'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p63624"><td class="code" id="p636code24"><pre class="objc" style="font-family:monospace;"><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>maChaine <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> stringWithString<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;MaChaineAMoi&quot;</span><span style="color: #002200;">&#93;</span><span style="color: #002200;">:</span>
<a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>monMd5 <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>maChaine md5Hash<span style="color: #002200;">&#93;</span>;</pre></td></tr></table></div>

<p><!-- PHP 5.x --></p>
]]></content:encoded>
			<wfw:commentRss>http://webd.fr/636-calculer-un-hash-md5/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Astuces développement iPhone 7: Deux NSDate sont-elles du même jour ?</title>
		<link>http://webd.fr/586-astuces-developpement-iphone-nsdate-comparaison-jour</link>
		<comments>http://webd.fr/586-astuces-developpement-iphone-nsdate-comparaison-jour#comments</comments>
		<pubDate>Fri, 15 May 2009 07:06:42 +0000</pubDate>
		<dc:creator>Julien Quéré</dc:creator>
				<category><![CDATA[Astuce]]></category>
		<category><![CDATA[Developpement]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://webd.fr/?p=586</guid>
		<description><![CDATA[Voilà un problème simple qui s&#8217;est posé lors d&#8217;un de mes développement: comme vérifier si deux dates sont bien le même jour ? Ceci, en gardant les notions de fuseau horaires et compagnie. Bien que le problème soit simple, la &#8230; <a href="http://webd.fr/586-astuces-developpement-iphone-nsdate-comparaison-jour">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Voilà un problème simple qui s&#8217;est posé lors d&#8217;un de mes développement: comme vérifier si deux dates sont bien le même jour ? Ceci, en gardant les notions de fuseau horaires et compagnie. Bien que le problème soit simple, la solution n&#8217;est pas si anodine que cela.<br />
<span id="more-586"></span><br />
Il s&#8217;agit, dans un premier temps, de préciser dans quel calendrier on se situe. Ici, on est tout simple dans le calendrier <code>NSGregorianCalendar</code>. Ensuite, on extrait le composant de la date qui nous intéresse (ici: le jour). Puis, il ne reste plus qu&#8217;a comparer les deux composants extraits pour déterminer si les deux <code>NSDate</code> sont bien le même jour. </p>
<p>Voici la méthode qui fait cela (en étendant <code>NSDate</code> au passage) et l&#8217;utilisation: </p>
<p>Ajoute dans la classe NSDate en dérivant</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p586code28'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p58628"><td class="code" id="p586code28"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">// Le .h</span>
<span style="color: #6e371a;">#import &lt;Foundation/Foundation.h&gt;</span>
&nbsp;
&nbsp;
<span style="color: #a61390;">@interface</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDate_Class/"><span style="color: #400080;">NSDate</span></a> <span style="color: #002200;">&#40;</span>NSDateAdditions<span style="color: #002200;">&#41;</span> 
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span> isTheSameDayAsThisDate<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDate_Class/"><span style="color: #400080;">NSDate</span></a><span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>date;
<span style="color: #a61390;">@end</span></pre></td></tr></table></div>


<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p586code29'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p58629"><td class="code" id="p586code29"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">// Le .m</span>
<span style="color: #a61390;">@implementation</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDate_Class/"><span style="color: #400080;">NSDate</span></a> <span style="color: #002200;">&#40;</span>NSDateAdditions<span style="color: #002200;">&#41;</span>
&nbsp;
<span style="color: #002200;">-</span><span style="color: #002200;">&#40;</span><span style="color: #a61390;">BOOL</span><span style="color: #002200;">&#41;</span> isTheSameDayAsThisDate<span style="color: #002200;">:</span><span style="color: #002200;">&#40;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDate_Class/"><span style="color: #400080;">NSDate</span></a><span style="color: #002200;">*</span><span style="color: #002200;">&#41;</span>date <span style="color: #002200;">&#123;</span>
	<a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSCalendar_Class/"><span style="color: #400080;">NSCalendar</span></a> <span style="color: #002200;">*</span>gregorian <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSCalendar_Class/"><span style="color: #400080;">NSCalendar</span></a> alloc<span style="color: #002200;">&#93;</span>	initWithCalendarIdentifier<span style="color: #002200;">:</span>NSGregorianCalendar<span style="color: #002200;">&#93;</span>;
	<a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDateComponents_Class/"><span style="color: #400080;">NSDateComponents</span></a> <span style="color: #002200;">*</span>comps1 <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>gregorian components<span style="color: #002200;">:</span>NSDayCalendarUnit fromDate<span style="color: #002200;">:</span>date<span style="color: #002200;">&#93;</span>;
	<a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDateComponents_Class/"><span style="color: #400080;">NSDateComponents</span></a> <span style="color: #002200;">*</span>comps2 <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span>gregorian components<span style="color: #002200;">:</span>NSDayCalendarUnit fromDate<span style="color: #002200;">:</span>self<span style="color: #002200;">&#93;</span>;
	<span style="color: #002200;">&#91;</span>gregorian release<span style="color: #002200;">&#93;</span>;
	<span style="color: #a61390;">return</span> <span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>comps1 isEqual<span style="color: #002200;">:</span>comps2<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>;
<span style="color: #002200;">&#125;</span>
&nbsp;
<span style="color: #a61390;">@end</span></pre></td></tr></table></div>


<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p586code30'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p58630"><td class="code" id="p586code30"><pre class="objc" style="font-family:monospace;"><span style="color: #11740a; font-style: italic;">// startDate et endDate étant deux NSDate</span>
<span style="color: #a61390;">if</span><span style="color: #002200;">&#40;</span><span style="color: #002200;">&#91;</span>startDate isTheSameDayAsThisDate<span style="color: #002200;">:</span>endDate<span style="color: #002200;">&#93;</span><span style="color: #002200;">&#41;</span>
<span style="color: #002200;">&#123;</span>
	NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;startDate et endDate sont le même jour&quot;</span><span style="color: #002200;">&#41;</span>;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p><!-- PHP 5.x --></p>
]]></content:encoded>
			<wfw:commentRss>http://webd.fr/586-astuces-developpement-iphone-nsdate-comparaison-jour/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Astuces développement iPhone 6: Récupérer l&#8217;UDID</title>
		<link>http://webd.fr/526-astuces-developpement-iphone-6-recuperer-ludid</link>
		<comments>http://webd.fr/526-astuces-developpement-iphone-6-recuperer-ludid#comments</comments>
		<pubDate>Mon, 11 May 2009 09:14:54 +0000</pubDate>
		<dc:creator>Julien Quéré</dc:creator>
				<category><![CDATA[Astuce]]></category>
		<category><![CDATA[Developpement]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://webd.fr/?p=526</guid>
		<description><![CDATA[Il peut être utile, dans une application, de connaître l'UDID de façon logicielle. Ainsi, on identifie de façon unique et certaine l'équipement sur lequel notre application s'exécute. Pour récupérer l'UDID, rien de plus simple ... <a href="http://webd.fr/526-astuces-developpement-iphone-6-recuperer-ludid">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>L&#8217;UDID (<i>Universal Device Identifier</i>) d&#8217;un iPhone est, comme son nom l&#8217;indique, un identifiant unique pour chaque iPhone / iPod. Si vous avez déjà eu à générer des fichiers de provisioning, vous connaissez bien cet identifiant. En effet, c&#8217;est ce dernier que l&#8217;on doit transmettre à Apple quand on veut rajouter un iPhone / iPod dans la liste des appareils autorisés pour un développement ou une distribution. </p>
<p>Il peut être utile, dans une application, de connaître ce fameux UDID de façon logicielle. Ainsi, on identifie de façon unique et certaine l&#8217;équipement sur lequel notre application s&#8217;exécute. Pour récupérer l&#8217;UDID, rien de plus simple:</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p526code31'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p52631"><td class="code" id="p526code31"><pre class="objc" style="font-family:monospace;"><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>udid <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span>UIDevice currentDevice<span style="color: #002200;">&#93;</span> uniqueIdentifier<span style="color: #002200;">&#93;</span>;</pre></td></tr></table></div>

<p><!-- PHP 5.x --></p>
]]></content:encoded>
			<wfw:commentRss>http://webd.fr/526-astuces-developpement-iphone-6-recuperer-ludid/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Astuces développement iPhone 5: whatis et ptype</title>
		<link>http://webd.fr/388-astuces-developpement-iphone-5-whatis-et-ptype</link>
		<comments>http://webd.fr/388-astuces-developpement-iphone-5-whatis-et-ptype#comments</comments>
		<pubDate>Wed, 06 May 2009 09:02:38 +0000</pubDate>
		<dc:creator>Julien Quéré</dc:creator>
				<category><![CDATA[Astuce]]></category>
		<category><![CDATA[Developpement]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://webd.fr/?p=388</guid>
		<description><![CDATA[Dans la même veine que le Print Object en console, voici une nouvelle astuce en console de debug. L&#8217;idée n&#8217;est plus de récupérer la description d&#8217;un objet, mais son type. Ainsi, il y a deux commandes: whatis et ptype. La &#8230; <a href="http://webd.fr/388-astuces-developpement-iphone-5-whatis-et-ptype">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Dans la même veine que le <a href="http://webd.fr/385-astuces-developpement-iphone-2-print-object-en-console">Print Object en console</a>, voici une nouvelle astuce en console de debug. L&#8217;idée n&#8217;est plus de récupérer la description d&#8217;un objet, mais son type. Ainsi, il y a deux commandes: <code>whatis</code> et <code>ptype</code>. La première permets d&#8217;avoir simplement le type d&#8217;un objet. Ainsi, si on a un objet <code>monDico</code> de type <code>NSMutableDictionary</code>, voilà ce que l&#8217;on obtient avec <code>whatis</code>:</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p388code36'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p38836"><td class="code" id="p388code36"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">&#40;</span>gdb<span style="color: #002200;">&#41;</span> whatis monDico
type <span style="color: #002200;">=</span> <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSMutableDictionary_Class/"><span style="color: #400080;">NSMutableDictionary</span></a> <span style="color: #002200;">*</span></pre></td></tr></table></div>

<p><code>ptype</code>, quant à lui est beaucoup plus complet. Si on reprends le même exemple, voilà ce que l&#8217;on obtient:</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p388code37'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p38837"><td class="code" id="p388code37"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">&#40;</span>gdb<span style="color: #002200;">&#41;</span> ptype monDico
type <span style="color: #002200;">=</span> class <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSMutableDictionary_Class/"><span style="color: #400080;">NSMutableDictionary</span></a> <span style="color: #002200;">:</span> public <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/"><span style="color: #400080;">NSDictionary</span></a> <span style="color: #002200;">&#123;</span>
<span style="color: #002200;">&#125;</span> <span style="color: #002200;">*</span></pre></td></tr></table></div>

<p>Là où <code>ptype</code> prends tout son intérêt, c&#8217;est sur les types personnalisés. Voici deux exemple concret avec des objet perso:</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p388code38'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p38838"><td class="code" id="p388code38"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">&#40;</span>gdb<span style="color: #002200;">&#41;</span> ptype currentRdv
type <span style="color: #002200;">=</span> class MiniRdv <span style="color: #002200;">:</span> public <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSObject_Class/"><span style="color: #400080;">NSObject</span></a> <span style="color: #002200;">&#123;</span>
  protected<span style="color: #002200;">:</span>
    <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>startDateFormated;
    <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>startTimeFormated;
    <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>title;
    <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>personName;
    <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>personFirstName;
    <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>personPhoneBookId;
    NSInteger dbId;
<span style="color: #002200;">&#125;</span> <span style="color: #002200;">*</span></pre></td></tr></table></div>


<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p388code39'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p38839"><td class="code" id="p388code39"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">&#40;</span>gdb<span style="color: #002200;">&#41;</span> ptype cell
type <span style="color: #002200;">=</span> class RdvTableCell <span style="color: #002200;">:</span> public UITableViewCell <span style="color: #002200;">&#123;</span>
  protected<span style="color: #002200;">:</span>
    MiniRdv <span style="color: #002200;">*</span>miniRdvObject;
    UILabel <span style="color: #002200;">*</span>topLeftLabel;
    UILabel <span style="color: #002200;">*</span>bottomLeftLabel;
    UILabel <span style="color: #002200;">*</span>bottomRightLabel;
    UILabel <span style="color: #002200;">*</span>topRightLabel;
    UIImageView <span style="color: #002200;">*</span>avatar;
<span style="color: #002200;">&#125;</span> <span style="color: #002200;">*</span></pre></td></tr></table></div>

<p>Bref, <code>ptype</code> est un outil indispensable au debug d&#8217;applications !<!-- PHP 5.x --></p>
]]></content:encoded>
			<wfw:commentRss>http://webd.fr/388-astuces-developpement-iphone-5-whatis-et-ptype/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Astuces développement iPhone 4: Récupérer le nom de l&#8217;iPhone</title>
		<link>http://webd.fr/420-astuces-developpement-iphone-4-recuperer-le-nom-de-liphone</link>
		<comments>http://webd.fr/420-astuces-developpement-iphone-4-recuperer-le-nom-de-liphone#comments</comments>
		<pubDate>Fri, 01 May 2009 07:56:02 +0000</pubDate>
		<dc:creator>Julien Quéré</dc:creator>
				<category><![CDATA[Astuce]]></category>
		<category><![CDATA[Developpement]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://webd.fr/?p=420</guid>
		<description><![CDATA[Il peut être très utile de récupérer le nom de l&#8217;iPhone sur lequel notre application s&#8217;exécute (comme iPhone-de-julien). C&#8217;est le cas notamment dans des applications où on appaire deux iPhone au travers d&#8217;un réseau WiFi (par exemple). L&#8217;idée est très &#8230; <a href="http://webd.fr/420-astuces-developpement-iphone-4-recuperer-le-nom-de-liphone">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Il peut être très utile de récupérer le nom de l&#8217;iPhone sur lequel notre application s&#8217;exécute (comme <cite>iPhone-de-julien</cite>). C&#8217;est le cas notamment dans des applications où on appaire deux iPhone au travers d&#8217;un réseau WiFi (par exemple). L&#8217;idée est très simple: on récupère les informations de l&#8217;hôte courant, puis on prend le premier de ses noms. Ce qui donne au final:</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p420code41'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p42041"><td class="code" id="p420code41"><pre class="objc" style="font-family:monospace;"><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/"><span style="color: #400080;">NSString</span></a> <span style="color: #002200;">*</span>deviceName <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSHost_Class/"><span style="color: #400080;">NSHost</span></a> currentHost<span style="color: #002200;">&#93;</span> names<span style="color: #002200;">&#93;</span> objectAtIndex<span style="color: #002200;">:</span><span style="color: #2400d9;">0</span><span style="color: #002200;">&#93;</span>;</pre></td></tr></table></div>

<p><!-- PHP 5.x --></p>
]]></content:encoded>
			<wfw:commentRss>http://webd.fr/420-astuces-developpement-iphone-4-recuperer-le-nom-de-liphone/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Astuces développement iPhone 3: Executer un code seulement sur le simulateur</title>
		<link>http://webd.fr/415-iphone-executer-code-seulement-le-simulateur</link>
		<comments>http://webd.fr/415-iphone-executer-code-seulement-le-simulateur#comments</comments>
		<pubDate>Mon, 27 Apr 2009 09:14:00 +0000</pubDate>
		<dc:creator>Julien Quéré</dc:creator>
				<category><![CDATA[Astuce]]></category>
		<category><![CDATA[Developpement]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://webd.fr/?p=415</guid>
		<description><![CDATA[Il peut être utile parfois de n&#8217;exécuter certains codes que dans le simulateur (ou à l&#8217;inverse: seulement sur un véritable iPhone). Concrètement, c&#8217;est le cas quand on utilise des fonctionnalités non présentes sur le simulateur (accéléromètre par exemple). Pour ce &#8230; <a href="http://webd.fr/415-iphone-executer-code-seulement-le-simulateur">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Il peut être utile parfois de n&#8217;exécuter certains codes que dans le simulateur (ou à l&#8217;inverse: seulement sur un véritable iPhone). Concrètement, c&#8217;est le cas quand on utilise des fonctionnalités non présentes sur le simulateur (accéléromètre par exemple). Pour ce faire, il suffit d&#8217;inclure le code a exécuter sur simulateur entre des directives de compilateur:</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p415code43'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p41543"><td class="code" id="p415code43"><pre class="objc" style="font-family:monospace;"><span style="color: #6e371a;">#if TARGET_IPHONE_SIMULATOR</span>
  NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Bonjour, je suis sir le simulateur&quot;</span><span style="color: #002200;">&#41;</span>;
<span style="color: #6e371a;">#else</span>
  NSLog<span style="color: #002200;">&#40;</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;Bonjour, je suis sur un véritable iPhone !&quot;</span><span style="color: #002200;">&#41;</span>;
<span style="color: #6e371a;">#endif</span></pre></td></tr></table></div>

<p><!-- PHP 5.x --></p>
]]></content:encoded>
			<wfw:commentRss>http://webd.fr/415-iphone-executer-code-seulement-le-simulateur/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Astuces développement iPhone 2: Print Object en console</title>
		<link>http://webd.fr/385-astuces-developpement-iphone-2-print-object-en-console</link>
		<comments>http://webd.fr/385-astuces-developpement-iphone-2-print-object-en-console#comments</comments>
		<pubDate>Mon, 20 Apr 2009 08:30:24 +0000</pubDate>
		<dc:creator>Julien Quéré</dc:creator>
				<category><![CDATA[Astuce]]></category>
		<category><![CDATA[Developpement]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://webd.fr/?p=385</guid>
		<description><![CDATA[Je me suis très souvent posé la question suivante: Mais pourquoi ça ne marche pas ? Qu&#8217;est ce qu&#8217;il y a dans cet objet ?. Le fait est que ce n&#8217;est pas très facile de répondre à cette question avec &#8230; <a href="http://webd.fr/385-astuces-developpement-iphone-2-print-object-en-console">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Je me suis très souvent posé la question suivante: <cite>Mais pourquoi ça ne marche pas ? Qu&#8217;est ce qu&#8217;il y a dans cet objet ?</cite>. Le fait est que ce n&#8217;est pas très facile de répondre à cette question avec l&#8217;interface de débogage de Xcode. Par contre dans la console de debug, il y a une commande magnifique … </p>
<p>Il s&#8217;agit tout simplement de <code>po</code> (pour <i>Print Object</i>). Pour l&#8217;utiliser, rien de plus simple: mettez un point d&#8217;arrêt là où vous voulez voir ce que contient un objet. Ensuite, faites un simple <code>po monObjet</code>. Par exemple, créons un <code>NSMutableDictionary</code> …</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p385code46'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p38546"><td class="code" id="p385code46"><pre class="objc" style="font-family:monospace;"><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSMutableDictionary_Class/"><span style="color: #400080;">NSMutableDictionary</span></a> <span style="color: #002200;">*</span> monDico <span style="color: #002200;">=</span> <span style="color: #002200;">&#91;</span><span style="color: #002200;">&#91;</span><a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSMutableDictionary_Class/"><span style="color: #400080;">NSMutableDictionary</span></a> alloc<span style="color: #002200;">&#93;</span> init<span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>monDico setObject<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;objet1&quot;</span> forKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;clef1&quot;</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>monDico setObject<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;objet2&quot;</span> forKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;clef2&quot;</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>monDico setObject<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;objet3&quot;</span> forKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;clef3&quot;</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>monDico setObject<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;objet4&quot;</span> forKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;clef4&quot;</span><span style="color: #002200;">&#93;</span>;
<span style="color: #002200;">&#91;</span>monDico setObject<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;objet5&quot;</span> forKey<span style="color: #002200;">:</span><span style="color: #bf1d1a;">@</span><span style="color: #bf1d1a;">&quot;clef5&quot;</span><span style="color: #002200;">&#93;</span>;</pre></td></tr></table></div>

<p>Et voilà ce que nous renvoie la console après un <code>po monDico</code></p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p385code47'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p38547"><td class="code" id="p385code47"><pre class="objc" style="font-family:monospace;"><span style="color: #002200;">&#40;</span>gdb<span style="color: #002200;">&#41;</span> po monDico
<span style="color: #002200;">&#123;</span>
    clef1 <span style="color: #002200;">=</span> objet1;
    clef2 <span style="color: #002200;">=</span> objet2;
    clef3 <span style="color: #002200;">=</span> objet3;
    clef4 <span style="color: #002200;">=</span> objet4;
    clef5 <span style="color: #002200;">=</span> objet5;
<span style="color: #002200;">&#125;</span></pre></td></tr></table></div>

<p>En fait, <code>po</code> fait appel à la méthode <code>description</code> de l&#8217;objet. Toutes les classes Cocoa de base implémentent cette méthode. Pour les classes personnelles, il vous suffit d&#8217;implémenter le protocole suivant: <code>- (NSString *)description;</code>.<!-- PHP 5.x --></p>
]]></content:encoded>
			<wfw:commentRss>http://webd.fr/385-astuces-developpement-iphone-2-print-object-en-console/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Astuces développement iPhone 1: Quelques raccourcis claviers</title>
		<link>http://webd.fr/378-astuces-developpement-iphone-1-quelques-raccourcis-claviers</link>
		<comments>http://webd.fr/378-astuces-developpement-iphone-1-quelques-raccourcis-claviers#comments</comments>
		<pubDate>Mon, 13 Apr 2009 09:06:59 +0000</pubDate>
		<dc:creator>Julien Quéré</dc:creator>
				<category><![CDATA[Astuce]]></category>
		<category><![CDATA[Developpement]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://webd.fr/?p=378</guid>
		<description><![CDATA[Au cours de mes développements iPhone, il y a plein de petites astuces que je découvre. Des petites choses toute bêtes, mais elles peuvent faire gagner pas mal de temps et de confort quand on les utilise les uns à &#8230; <a href="http://webd.fr/378-astuces-developpement-iphone-1-quelques-raccourcis-claviers">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Au cours de mes développements iPhone, il y a plein de petites astuces que je découvre. Des petites choses toute bêtes, mais elles peuvent faire gagner pas mal de temps et de confort quand on les utilise les uns à la suite des autres. Voilà pourquoi je pense lancer une série de billets où je présenterais les astuces découvertes au fil du temps. </p>
<p>Commençons donc par quelques raccourcis claviers découverts récemment qui me font gagner pas mal de temps: </p>
<ul>
<li><b>Option et double clic</b>: affiche la documentation pour ce qui se trouve sous le curseur (si la documentation existe bien évidement). </li>
<li><b>Commande et double clic</b>: envoie vers la définition (dans le .h) de ce qui se trouve sous le curseur.</li>
<li><b>Commande-Option-Haut</b>: permets de switcher entre le fichier d&#8217;en-tête (.h) et de code (.m) et vice-versa.</li>
<li><b>Commande-B</b>: lance la compilation du projet.</li>
<li><b>Commande-Retour</b>: compile le projet et le lance.</li>
</ul>
<p>Sinon, pour ceux qui veulent un grand poster, il y a l&#8217;image faite par <a href="http://cocoasamurai.blogspot.com/2008/02/complete-xcode-keyboard-shortcut-list.html">Colin Wheeler de Cocoa Samurai</a>. Elle est très (trop ?) complète:</p>
<p><a href="http://webd.fr/wp-content/uploads/2009/04/xcode-shortcuts.png" rel="lightbox[378]" title="xcode-shortcuts"><img src="http://webd.fr/wp-content/uploads/2009/04/xcode-shortcuts-290x300.png" alt="xcode-shortcuts" title="xcode-shortcuts" width="290" height="300" class="aligncenter size-medium wp-image-381" /></a></p>
<p>A bientôt (certainement) pour de nouvelles astuces … </p>
<p><!-- PHP 5.x --></p>
]]></content:encoded>
			<wfw:commentRss>http://webd.fr/378-astuces-developpement-iphone-1-quelques-raccourcis-claviers/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Décompresser des archives dans des dossiers multiples sous MacOS</title>
		<link>http://webd.fr/327-decompresser-des-archives-dans-des-dossiers-multiples-sous-mac</link>
		<comments>http://webd.fr/327-decompresser-des-archives-dans-des-dossiers-multiples-sous-mac#comments</comments>
		<pubDate>Wed, 25 Mar 2009 14:46:51 +0000</pubDate>
		<dc:creator>Julien Quéré</dc:creator>
				<category><![CDATA[Pro]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Script]]></category>

		<guid isPermaLink="false">http://webd.fr/?p=327</guid>
		<description><![CDATA[J&#8217;avais fait pas mal de billets sur ce blog concernant un script de décompression d&#8217;archives multiples en rar sous Linux (le dernier ici). L&#8217;idée est de porter la processus sur Mac OS. Premier problème: il n&#8217;y a pas de commande &#8230; <a href="http://webd.fr/327-decompresser-des-archives-dans-des-dossiers-multiples-sous-mac">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>J&#8217;avais fait pas mal de billets sur ce blog concernant un script de décompression d&#8217;archives multiples en <code>rar</code> sous Linux (<a href="http://webd.fr/145-decompresser-des-archives-dans-des-dossiers-multiples-sous-linux-3">le dernier ici</a>). L&#8217;idée est de porter la processus sur Mac OS. Premier problème: il n&#8217;y a pas de commande <code>rar</code> (ni même <code>unrar</code>) par défaut (même avec UnrarX). </p>
<p>Pour corriger cela, il suffit de se rendre sur le site de <a href="http://www.rarlab.com/download.htm">rarlab</a> et de télécharger la version MacOS X de rar. Une fois le téléchargement décompressé, il suffit de déplacer les exécutables qui vont bien dans <code>/usr/bin</code>. Pour ce faire: </p>
<pre>
mac-de-julien:rar julien$ sudo mv unrar /usr/bin
mac-de-julien:rar julien$ sudo mv rar /usr/bin
</pre>
<p>Pour finir, il suffit d&#8217;utiliser le script habituellement utilisé sur Linux et c&#8217;est bon &#8230; Vous le trouverez <a href="http://webd.fr/145-decompresser-des-archives-dans-des-dossiers-multiples-sous-linux-3">par là</a>.</p>
<p><!-- PHP 5.x --></p>
]]></content:encoded>
			<wfw:commentRss>http://webd.fr/327-decompresser-des-archives-dans-des-dossiers-multiples-sous-mac/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Redimensionner une UIImage</title>
		<link>http://webd.fr/320-redimensionner-une-uiimage</link>
		<comments>http://webd.fr/320-redimensionner-une-uiimage#comments</comments>
		<pubDate>Fri, 27 Feb 2009 15:14:04 +0000</pubDate>
		<dc:creator>Julien Quéré</dc:creator>
				<category><![CDATA[Pro]]></category>
		<category><![CDATA[Cocoa Touch]]></category>
		<category><![CDATA[Developpement]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://webd.fr/?p=320</guid>
		<description><![CDATA[Dans certains cas, il peut être utile de redimensionner une UIImage. En effet, même si UIImageView gère très bien le redimensionnement, on peut vouloir exporter une image dans une certaine taille. De même, il n&#8217;est pas forcement utile de stocker &#8230; <a href="http://webd.fr/320-redimensionner-une-uiimage">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Dans certains cas, il peut être utile de redimensionner une <code>UIImage</code>. En effet, même si <code>UIImageView</code> gère très bien le redimensionnement, on peut vouloir exporter une image dans une certaine taille. De même, il n&#8217;est pas forcement utile de stocker (en mémoire ou bien en dur) une image de grande taille si c&#8217;est pour l&#8217;afficher réduite par la suite. </p>
<p>Pour redimensionner une image, c&#8217;est plutôt simple ! L&#8217;idée est de créer un contexte d&#8217;image de la taille souhaitée (ici 40*40 pixels). Dans ce contexte, en dessine l&#8217;image à redimensionner dans la taille souhaitée. Il ne reste alors plus qu&#8217;à récupérer l&#8217;image redimensionnée avec un <code>UIGraphicsGetImageFromCurrentImageContext</code>. Pour finir, on pensera bien à fermer le contexte courant. </p>
<p>Voici le code final:</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p320code49'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p32049"><td class="code" id="p320code49"><pre class="objc" style="font-family:monospace;">CGSize size <span style="color: #002200;">=</span> CGSizeMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">40</span>, <span style="color: #2400d9;">40</span><span style="color: #002200;">&#41;</span>;
UIGraphicsBeginImageContext<span style="color: #002200;">&#40;</span> size <span style="color: #002200;">&#41;</span>;
<span style="color: #002200;">&#91;</span>avatarImage drawInRect<span style="color: #002200;">:</span>CGRectMake<span style="color: #002200;">&#40;</span><span style="color: #2400d9;">0</span>,<span style="color: #2400d9;">0</span>,size.width,size.height<span style="color: #002200;">&#41;</span><span style="color: #002200;">&#93;</span>;
avatarImage <span style="color: #002200;">=</span> UIGraphicsGetImageFromCurrentImageContext<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span>;
UIGraphicsEndImageContext<span style="color: #002200;">&#40;</span><span style="color: #002200;">&#41;</span>;</pre></td></tr></table></div>

<p><!-- PHP 5.x --></p>
]]></content:encoded>
			<wfw:commentRss>http://webd.fr/320-redimensionner-une-uiimage/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Désactiver les NSLog en release</title>
		<link>http://webd.fr/307-desactiver-les-nslog-en-release</link>
		<comments>http://webd.fr/307-desactiver-les-nslog-en-release#comments</comments>
		<pubDate>Fri, 20 Feb 2009 15:28:09 +0000</pubDate>
		<dc:creator>Julien Quéré</dc:creator>
				<category><![CDATA[Pro]]></category>
		<category><![CDATA[Cocoa Touch]]></category>
		<category><![CDATA[Developpement]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://webd.fr/?p=307</guid>
		<description><![CDATA[Le NSLog est l&#8217;outil de base dans le développement et le déboguage d&#8217;application Cocoa (donc Cocoa Touch). Seulement, l&#8217;utilisation de NSLog n&#8217;est pas si anodine qu&#8217;elle peut paraître … Le fait d&#8217;envoyer une chaine de caractère à la sortie console &#8230; <a href="http://webd.fr/307-desactiver-les-nslog-en-release">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Le <code>NSLog</code> est l&#8217;outil de base dans le développement et le déboguage d&#8217;application Cocoa (donc Cocoa Touch). Seulement, l&#8217;utilisation de <code>NSLog</code> n&#8217;est pas si anodine qu&#8217;elle peut paraître … Le fait d&#8217;envoyer une chaine de caractère à la sortie console consomme des ressources. </p>
<p>Certes, c&#8217;est peu de choses, mais quand un <code>NSLog</code> est inclus dans une boucle, se déclenche à chaque <code>touchesMoved:</code> (par exemple), il commence à ralentir très sérieusement le fonctionnement de l&#8217;application. Sans compter qu&#8217;une fois l&#8217;application distribuée, il est possible pour l&#8217;utilisateur final de lire ce qui se trouve dans les logs … Ce qui n&#8217;est pas forcement voulu pour le développeur. </p>
<p>L&#8217;idée serait donc, quand on est en configuration de compilation « release », de désactiver (automatiquement les <code>NSLog</code>). <span id="more-307"></span>Pour ce faire, on va simplement ajouter le code suivant dans <code>leNomDeLApplication_Prefix.pch</code> (il s&#8217;agit simplement d&#8217;un fichier qui est inclus dans tous les fichiers d&#8217;un projet):</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p307code51'); return false;">View Code</a> OBJC</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p30751"><td class="code" id="p307code51"><pre class="objc" style="font-family:monospace;"><span style="color: #6e371a;">#ifndef DEBUG</span>
<span style="color: #6e371a;">#define NSLog //</span>
<span style="color: #6e371a;">#endif</span></pre></td></tr></table></div>

<p>Le code veut simplement dire: <cite>Si <code>DEBUG</code> n&#8217;est pas activé, on remplace les <code>NSLog</code> par des commentaires</cite>. On pensera donc à ajouter un flag <code>DEBUG</code> dans <code>GCC_PREPROCESSOR_DEFINITIONS</code> de la configuration de compilation dans le mode <code>Debug</code>. Notez que, par défaut, <code>GCC_PREPROCESSOR_DEFINITIONS</code> n&#8217;existe pas, il faudra donc le créer à la main. </p>
<p><a href="http://webd.fr/wp-content/uploads/2009/02/disablenslogscreen.png" rel="lightbox[307]" title="disablenslogscreen"><img src="http://webd.fr/wp-content/uploads/2009/02/disablenslogscreen-281x300.png" alt="disablenslogscreen" title="disablenslogscreen" width="281" height="300" class="aligncenter size-medium wp-image-308" /></a></p>
<p>Voilà, c&#8217;est fini <img src='http://webd.fr/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . Notez tout de même que cette façon de faire a une limitation: il faut que les <code>NSLog</code> soient définis sur une seule ligne. Mais bon, ça l&#8217;est dans 99% des cas ! <!-- PHP 5.x --></p>
]]></content:encoded>
			<wfw:commentRss>http://webd.fr/307-desactiver-les-nslog-en-release/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Le retour du canard sous Mac OS X</title>
		<link>http://webd.fr/298-le-retour-du-canard-sous-mac-os-x</link>
		<comments>http://webd.fr/298-le-retour-du-canard-sous-mac-os-x#comments</comments>
		<pubDate>Fri, 06 Feb 2009 08:21:49 +0000</pubDate>
		<dc:creator>Julien Quéré</dc:creator>
				<category><![CDATA[Pro]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Perte de temps]]></category>

		<guid isPermaLink="false">http://webd.fr/?p=298</guid>
		<description><![CDATA[Il y a quelques temps maintenant, j&#8217;ai fais l&#8217;acquisition d&#8217;un Mac (même si j&#8217;ai un Mac professionnel depuis pas mal de temps). Et bizarrement l&#8217;une des choses inutiles mais indispensables que j&#8217;attendais, c&#8217;était le fameux son de canard en guise &#8230; <a href="http://webd.fr/298-le-retour-du-canard-sous-mac-os-x">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Il y a quelques temps maintenant, j&#8217;ai fais l&#8217;acquisition d&#8217;un Mac (même si j&#8217;ai un Mac professionnel depuis pas mal de temps). Et bizarrement l&#8217;une des choses inutiles mais indispensables que j&#8217;attendais, c&#8217;était le fameux son de canard en guise d&#8217;alerte. Concrètement, on a le droit à un « coin » à chaque alerte de l&#8217;OS. </p>
<p>Après avoir cherché quelque peu, je m&#8217;aperçois avec effroi que ce son n&#8217;est tout simplement pas présent sous Léopard. En poussant un peu mes recherches, je me rends compte que c&#8217;est le cas depuis Mac OS X 10.0 (comme quoi ma précédente expérience Mac OS non-pro remontait à loin !). </p>
<p>Après quelques recherches (non, je n&#8217;abandonne pas, même pour de telles futilités), j&#8217;ai trouvé comment combler ce manque. Il suffit de télécharger <a href='http://webd.fr/wp-content/uploads/2009/02/macosxoldschoolsoundsdmg.tgz'>l&#8217;archive ci-jointe</a> (qui contient les sons système depuis System 6 jusqu&#8217;à Mac OS 9). Ensuite, il faut mettre les fichiers <code>.aiff</code> dans <code>/Bibliothèque/Sounds/</code>. Si le dossier <code>Sounds</code> n&#8217;existe pas, créez le. </p>
<p><a href="http://webd.fr/wp-content/uploads/2009/02/image-5.png" rel="lightbox[298]" title="image-5"><img src="http://webd.fr/wp-content/uploads/2009/02/image-5-300x111.png" alt="image-5" title="image-5" width="300" height="111" class="aligncenter size-medium wp-image-300" /></a></p>
<p>Après avoir redémarré votre machine, rendez vous dans les <cite>Préférences systèmes</cite> puis <cite>Sons</cite> puis <cite>Effets sonores</cite>. Vous pourrez maintenant choisir le son qui vous plait. Ici, c&#8217;est bien évidement le canard !</p>
<p><a href="http://webd.fr/wp-content/uploads/2009/02/image-6.png" rel="lightbox[298]" title="image-6"><img src="http://webd.fr/wp-content/uploads/2009/02/image-6-300x227.png" alt="image-6" title="image-6" width="300" height="227" class="aligncenter size-medium wp-image-301" /></a><br />
<!-- PHP 5.x --></p>
]]></content:encoded>
			<wfw:commentRss>http://webd.fr/298-le-retour-du-canard-sous-mac-os-x/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Iphonelite3: Une nouvelle librairie SQLite pour iPhone</title>
		<link>http://webd.fr/288-iphonelite3-une-nouvelle-librairie-sqlite-pour-iphone</link>
		<comments>http://webd.fr/288-iphonelite3-une-nouvelle-librairie-sqlite-pour-iphone#comments</comments>
		<pubDate>Thu, 29 Jan 2009 20:32:18 +0000</pubDate>
		<dc:creator>Julien Quéré</dc:creator>
				<category><![CDATA[Pro]]></category>
		<category><![CDATA[Cocoa Touch]]></category>
		<category><![CDATA[Developpement]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[SQLite]]></category>

		<guid isPermaLink="false">http://webd.fr/?p=288</guid>
		<description><![CDATA[Je viens de découvrir aujourd&#8217;hui une nouvelle librairie permettant de simplifier l&#8217;utilisation de SQLite3 sur iPhone: Iphonelite3. L&#8217;idée global du projet est de ne pas avoir à coder une seule ligne de SQL dans son application. Il s&#8217;agit tout bêtement &#8230; <a href="http://webd.fr/288-iphonelite3-une-nouvelle-librairie-sqlite-pour-iphone">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Je viens de découvrir aujourd&#8217;hui une nouvelle librairie permettant de simplifier l&#8217;utilisation de SQLite3 sur iPhone: Iphonelite3. L&#8217;idée global du projet est de ne pas avoir à coder une seule ligne de SQL dans son application. Il s&#8217;agit tout bêtement de faire de la persistance d&#8217;objet. Là où le concept est intéressant, c&#8217;est qu&#8217;il ne se base pas sur des objets héritant d&#8217;une quelconque implémentation de serialisation. </p>
<p>Non, l&#8217;idée est plus axée « hibernate » (que l&#8217;on trouve avec Java). Vous passez votre objet au gestionnaire de base de données et il s&#8217;occupe de tout le reste. Je ne vais pas continuer à faire l&#8217;article de Iphonelite3, son auteur le fait très bien <a href="http://iphonelite3.wordpress.com/">sur son blog dédié</a>. Notez que le projet est, pour le moment, en phase <cite>alpha</cite> et ne doit donc pas être utilisé en phase de production. Mais c&#8217;est à regarder avec attention. </p>
<p>Au passage, je rappellerais ce qui se fait sur ce segment en ce moment. Il y a les projets <a href="http://code.google.com/p/flycode/source/browse/trunk/fmdb">FMDB</a> (que j&#8217;utilise dans deux de mes projets), <a href="http://code.google.com/p/sqlitepersistentobjects/">SQLitePersistentObjects</a> (que je n&#8217;ai pas pu utiliser dans mon dernier projet car il gère mal les <code>NSMutableDictionary</code>) et <a href="http://code.google.com/p/entropydb/">EntropyDB</a>.<!-- PHP 5.x --></p>
]]></content:encoded>
			<wfw:commentRss>http://webd.fr/288-iphonelite3-une-nouvelle-librairie-sqlite-pour-iphone/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

