<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Haveacafe's Weblog</title>
	<atom:link href="http://haveacafe.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://haveacafe.wordpress.com</link>
	<description>Java, unix, web and other intersting tricks !</description>
	<lastBuildDate>Wed, 23 Sep 2009 09:17:39 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>fr</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='haveacafe.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/ec698bdf3bb36e6d0e5d3b1af4c9422d?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Haveacafe's Weblog</title>
		<link>http://haveacafe.wordpress.com</link>
	</image>
			<item>
		<title>Astuce iphone : nombre de chiffres significatifs avec NSLog()</title>
		<link>http://haveacafe.wordpress.com/2009/09/23/astuce-iphone-nombre-de-chiffres-significatifs-avec-nslog/</link>
		<comments>http://haveacafe.wordpress.com/2009/09/23/astuce-iphone-nombre-de-chiffres-significatifs-avec-nslog/#comments</comments>
		<pubDate>Wed, 23 Sep 2009 09:17:39 +0000</pubDate>
		<dc:creator>haveacafe</dc:creator>
				<category><![CDATA[iphone programming]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[iphoneOS]]></category>

		<guid isPermaLink="false">http://haveacafe.wordpress.com/?p=278</guid>
		<description><![CDATA[Si vous voulez spécifier le nombre de chiffres après la virgule lors de la création d&#8217;un NSString, la syntaxe est :
%.nf ou n représente le nombre de chiffres après la virgule.
Cela marche aussi avec le C pur et la comande printf.
Posted in iphone programming       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haveacafe.wordpress.com&blog=2198367&post=278&subd=haveacafe&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Si vous voulez spécifier le nombre de chiffres après la virgule lors de la création d&#8217;un NSString, la syntaxe est :</p>
<p>%<em>.n</em>f ou n représente le nombre de chiffres après la virgule.</p>
<p>Cela marche aussi avec le C pur et la comande printf.</p>
Posted in iphone programming  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/haveacafe.wordpress.com/278/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/haveacafe.wordpress.com/278/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/haveacafe.wordpress.com/278/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/haveacafe.wordpress.com/278/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/haveacafe.wordpress.com/278/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/haveacafe.wordpress.com/278/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/haveacafe.wordpress.com/278/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/haveacafe.wordpress.com/278/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/haveacafe.wordpress.com/278/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/haveacafe.wordpress.com/278/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haveacafe.wordpress.com&blog=2198367&post=278&subd=haveacafe&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://haveacafe.wordpress.com/2009/09/23/astuce-iphone-nombre-de-chiffres-significatifs-avec-nslog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6b8e035a4a7eba7f8f4674a34c21b97b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">haveacafe</media:title>
		</media:content>
	</item>
		<item>
		<title>Mieux que le &#8220;spotlight&#8221; : les outils de bases d&#8217; UNIX</title>
		<link>http://haveacafe.wordpress.com/2009/09/19/mieux-que-le-spotlight-les-outils-de-bases-d-unix/</link>
		<comments>http://haveacafe.wordpress.com/2009/09/19/mieux-que-le-spotlight-les-outils-de-bases-d-unix/#comments</comments>
		<pubDate>Sat, 19 Sep 2009 14:10:49 +0000</pubDate>
		<dc:creator>haveacafe</dc:creator>
				<category><![CDATA[administration]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[iphoneOS]]></category>
		<category><![CDATA[services linux]]></category>

		<guid isPermaLink="false">http://haveacafe.wordpress.com/?p=276</guid>
		<description><![CDATA[Pour ceux qui l&#8217;ignorent encore, Snow Leopard et plus généralement la famille MacOS x, est basé sur le systeme d&#8217;exploitation BSD.
SI vous êtes un jour confrontés à la problématique de retrouver le nom d&#8217;un fichier contenant une certaine chaîne de caractère (dont vous avez oublié le nom), utilisez la puissance des outils de bases d&#8217;unix [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haveacafe.wordpress.com&blog=2198367&post=276&subd=haveacafe&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Pour ceux qui l&#8217;ignorent encore, Snow Leopard et plus généralement la famille MacOS x, est basé sur le systeme d&#8217;exploitation BSD.</p>
<p>SI vous êtes un jour confrontés à la problématique de retrouver le nom d&#8217;un fichier contenant une certaine chaîne de caractère (dont vous avez oublié le nom), utilisez la puissance des outils de bases d&#8217;unix pour effectuer cette tâche et jouissez de la commande grep et du -exec de find! <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Une petite piqure de rappel au cas ou vous n&#8217;êtes pas familiers de la ligne de commande linux :</p>
<p><strong>find / -exec grep -l expression_a_rechercher {} \;</strong></p>
Posted in administration  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/haveacafe.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/haveacafe.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/haveacafe.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/haveacafe.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/haveacafe.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/haveacafe.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/haveacafe.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/haveacafe.wordpress.com/276/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/haveacafe.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/haveacafe.wordpress.com/276/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haveacafe.wordpress.com&blog=2198367&post=276&subd=haveacafe&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://haveacafe.wordpress.com/2009/09/19/mieux-que-le-spotlight-les-outils-de-bases-d-unix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6b8e035a4a7eba7f8f4674a34c21b97b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">haveacafe</media:title>
		</media:content>
	</item>
		<item>
		<title>Astuce iPhone : afficher la taille d&#8217;un CGRect avec NSLog</title>
		<link>http://haveacafe.wordpress.com/2009/08/10/astuce-iphone-afficher-la-taille-dun-cgrect-avec-nslog/</link>
		<comments>http://haveacafe.wordpress.com/2009/08/10/astuce-iphone-afficher-la-taille-dun-cgrect-avec-nslog/#comments</comments>
		<pubDate>Mon, 10 Aug 2009 12:55:49 +0000</pubDate>
		<dc:creator>haveacafe</dc:creator>
				<category><![CDATA[iphone programming]]></category>
		<category><![CDATA[iphone]]></category>

		<guid isPermaLink="false">http://haveacafe.wordpress.com/?p=274</guid>
		<description><![CDATA[Si vous souhaitez afficher une structure C (CGPoint ou CGRect par exemple), vous avez du vous rendre compte que le format %@ n&#8221;était pas efficace&#8230;
Plutot que de passer par une macro, il est possible d&#8217;utiliser une des fonctions en C fournies par le SDK de l&#8217;iPhone:
Par exemple :
- NSStringFromCGRect(self.view.frame)
- NSStringFromCGPoint(self.view.frame.origin)
&#8230;
Posted in iphone programming   [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haveacafe.wordpress.com&blog=2198367&post=274&subd=haveacafe&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Si vous souhaitez afficher une structure C (CGPoint ou CGRect par exemple), vous avez du vous rendre compte que le format %@ n&#8221;était pas efficace&#8230;</p>
<p>Plutot que de passer par une macro, il est possible d&#8217;utiliser une des fonctions en C fournies par le SDK de l&#8217;iPhone:<br />
Par exemple :</p>
<p>- NSStringFromCGRect(self.view.frame)<br />
- NSStringFromCGPoint(self.view.frame.origin)</p>
<p>&#8230;</p>
Posted in iphone programming  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/haveacafe.wordpress.com/274/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/haveacafe.wordpress.com/274/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/haveacafe.wordpress.com/274/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/haveacafe.wordpress.com/274/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/haveacafe.wordpress.com/274/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/haveacafe.wordpress.com/274/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/haveacafe.wordpress.com/274/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/haveacafe.wordpress.com/274/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/haveacafe.wordpress.com/274/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/haveacafe.wordpress.com/274/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haveacafe.wordpress.com&blog=2198367&post=274&subd=haveacafe&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://haveacafe.wordpress.com/2009/08/10/astuce-iphone-afficher-la-taille-dun-cgrect-avec-nslog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6b8e035a4a7eba7f8f4674a34c21b97b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">haveacafe</media:title>
		</media:content>
	</item>
		<item>
		<title>Place dans un classement et rang parmi des enregistrements MySQL</title>
		<link>http://haveacafe.wordpress.com/2009/06/04/place-dans-un-classement-et-rang-parmi-des-enregisterements-mysql/</link>
		<comments>http://haveacafe.wordpress.com/2009/06/04/place-dans-un-classement-et-rang-parmi-des-enregisterements-mysql/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 17:06:28 +0000</pubDate>
		<dc:creator>haveacafe</dc:creator>
				<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://haveacafe.wordpress.com/?p=267</guid>
		<description><![CDATA[Si vous voulez réaliser un Top 1000 pour votre jeu en ligne ou plus généralement connaitre quelle est la place d&#8217;un de vos tuple dans un ensemble trié d&#8217;enregistrements, voici une petite astuce qui vous permettra d&#8217;obtenir le résultat avec un moyen 100 % SQL ( pas besoin de variable compteur coté serveur).
Imaginez une table [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haveacafe.wordpress.com&blog=2198367&post=267&subd=haveacafe&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Si vous voulez réaliser un Top 1000 pour votre jeu en ligne ou plus généralement connaitre quelle est la place d&#8217;un de vos tuple dans un ensemble trié d&#8217;enregistrements, voici une petite astuce qui vous permettra d&#8217;obtenir le résultat avec un moyen 100 % SQL ( pas besoin de variable compteur coté serveur).</p>
<p>Imaginez une table players contenant les colonnes &#8220;pseudo, score et time_played&#8221;. Notre objectif est de connaitre la position d&#8217;un joueur dans le classement total connaissant le champ &#8220;pseudo&#8221;. L&#8217;obtention de son rang va se faire en 3 temps :</p>
<p>1. On va commencer par initialiser une variable MySQL avec la commande SET:<br />
<strong>SET @counter = 0;</strong></p>
<p>2. L&#8217;étape suivante consiste à effectuer une première requête qui va compter et créer une colonne indiquant le rang de chacun des enregistrements au sein de la table.<br />
<strong>SELECT pseudo,score,time_played,@counter:=@counter+1 AS rang FROM players ORDER BY score ASC;</strong></p>
<p>3. Enfin,  nous allons isoler l&#8217;enregistrement qui nous intéresse, à savoir, celui dont la valeur pseudo est celle que nous cherchons.</p>
<p>Il s&#8217;agit d&#8217;une simple requête du type</p>
<p><strong>SELECT place,pseudo FROM (*****) AS subrequest WHERE pseudo = &#8216;John Doe&#8217;;</strong></p>
<p>Si vous avez suivi, vous aurez d&#8217;ores et déja compris qu&#8217;il va falloir remplacer les ***** par notre requête construite à l&#8217;étape 2 (il s&#8217;agit de ce qu&#8217;on appelle une <strong>sous- requete</strong>). Le résultat obtenu devrait être une table contenant le rang et le pseudonyme de notre joueur <em>&#8216;John Doe&#8217;</em>.</p>
<p>N&#8217;hésitez pas à envoyer un commentaire si vous avez besoin d&#8217;aide !</p>
<p>Références :<br />
<a href="http://dev.mysql.com/doc/refman/5.0/fr/unnamed-views.html"> Documentation MySQL </a></p>
Posted in mysql  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/haveacafe.wordpress.com/267/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/haveacafe.wordpress.com/267/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/haveacafe.wordpress.com/267/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/haveacafe.wordpress.com/267/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/haveacafe.wordpress.com/267/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/haveacafe.wordpress.com/267/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/haveacafe.wordpress.com/267/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/haveacafe.wordpress.com/267/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/haveacafe.wordpress.com/267/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/haveacafe.wordpress.com/267/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haveacafe.wordpress.com&blog=2198367&post=267&subd=haveacafe&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://haveacafe.wordpress.com/2009/06/04/place-dans-un-classement-et-rang-parmi-des-enregisterements-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6b8e035a4a7eba7f8f4674a34c21b97b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">haveacafe</media:title>
		</media:content>
	</item>
		<item>
		<title>Iphone simulator&#8217;s mess : get your AVFoundation audio and video working !</title>
		<link>http://haveacafe.wordpress.com/2009/04/07/iphone-simulators-mess-get-your-avfoundation-audio-and-video-working/</link>
		<comments>http://haveacafe.wordpress.com/2009/04/07/iphone-simulators-mess-get-your-avfoundation-audio-and-video-working/#comments</comments>
		<pubDate>Tue, 07 Apr 2009 20:36:58 +0000</pubDate>
		<dc:creator>haveacafe</dc:creator>
				<category><![CDATA[iphone programming]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[iphoneOS]]></category>

		<guid isPermaLink="false">http://haveacafe.wordpress.com/?p=260</guid>
		<description><![CDATA[I got yesterday an error when playing a wav or mp sound within the Iphone simulator. My code and everything was right, but the console displayed an error about a quicktime library.
Error loading /Library/QuickTime/DivX Decoder.component/Contents/MacOS/DivX Decoder:  dlopen(/Library/QuickTime/DivX Decoder.component/Contents/MacOS/DivX Decoder, 262): Symbol not found: _SCDynamicStoreCopyConsoleUser
Referenced from: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/LangAnalysis.framework/Versions/A/LangAnalysis
Expected in: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.2.1.sdk/System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration
My configuration is Macbook under Mac OS [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haveacafe.wordpress.com&blog=2198367&post=260&subd=haveacafe&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I got yesterday an error when playing a wav or mp sound within the Iphone simulator. My code and everything was right, but the console displayed an error about a quicktime library.</p>
<blockquote><p>Error loading /Library/QuickTime/DivX Decoder.component/Contents/MacOS/DivX Decoder:  dlopen(/Library/QuickTime/DivX Decoder.component/Contents/MacOS/DivX Decoder, 262): Symbol not found: _SCDynamicStoreCopyConsoleUser<br />
Referenced from: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/LangAnalysis.framework/Versions/A/LangAnalysis<br />
Expected in: /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.2.1.sdk/System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration</p></blockquote>
<p>My configuration is Macbook under Mac OS 10.5  + iphone SDK 2.2.1.</p>
<p><strong>How to solve this issue ?</strong></p>
<p>If you have the same kind of message, it means (as far as i understand) your iphone simulator is looking for a codec on your shared library, and found one suiting for the playing of your file, but which is not linked to your simulator.</p>
<p>The best way i found was to uninsall with the &#8220;DivX uninstaller&#8221; program.</p>
<p>If you don&#8217;t have any &#8220;DivX uninstaller&#8221;, you can either:</p>
<p><strong>1. Reinstall divx codecs from quicktime thirdparty code download center, and then uninstall the library using this program</strong></p>
<p>or</p>
<p><strong>2. Become root and type some rm -rf on the directory of the evil codec  (something like /Library/QuickTime/DivX)</strong></p>
<p>I&#8217;m now able to play wav files without any problem.Mp3 and m4v should be OK too.</p>
Posted in iphone programming  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/haveacafe.wordpress.com/260/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/haveacafe.wordpress.com/260/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/haveacafe.wordpress.com/260/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/haveacafe.wordpress.com/260/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/haveacafe.wordpress.com/260/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/haveacafe.wordpress.com/260/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/haveacafe.wordpress.com/260/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/haveacafe.wordpress.com/260/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/haveacafe.wordpress.com/260/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/haveacafe.wordpress.com/260/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haveacafe.wordpress.com&blog=2198367&post=260&subd=haveacafe&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://haveacafe.wordpress.com/2009/04/07/iphone-simulators-mess-get-your-avfoundation-audio-and-video-working/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6b8e035a4a7eba7f8f4674a34c21b97b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">haveacafe</media:title>
		</media:content>
	</item>
		<item>
		<title>Animated transition between tabbar&#8217;s view on Iphone</title>
		<link>http://haveacafe.wordpress.com/2009/04/06/animated-transition-between-tabbars-view-on-iphone/</link>
		<comments>http://haveacafe.wordpress.com/2009/04/06/animated-transition-between-tabbars-view-on-iphone/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 12:38:47 +0000</pubDate>
		<dc:creator>haveacafe</dc:creator>
				<category><![CDATA[english publications]]></category>
		<category><![CDATA[iphone programming]]></category>
		<category><![CDATA[iphoneOS]]></category>
		<category><![CDATA[Objective-C]]></category>

		<guid isPermaLink="false">http://haveacafe.wordpress.com/?p=252</guid>
		<description><![CDATA[Since last week, I&#8217;ve been attending a fantastic training course for Iphone developpement delivered by Geppy Parziale from Invasive Code.
I meet great people there, but training is now finished, and I&#8217;m on my own to develop some fresh apps!
I&#8217;ve been playing around with the Iphone SDK for the last few days. If you like &#8220;transitions&#8221; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haveacafe.wordpress.com&blog=2198367&post=252&subd=haveacafe&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Since last week, I&#8217;ve been attending a fantastic training course for Iphone developpement delivered by Geppy Parziale from <a href="http://www.invasivecode.com/iNVASIVE_CODE/Welcome.html">Invasive Code</a>.<br />
I meet great people there, but training is now finished, and I&#8217;m on my own to develop some fresh apps!</p>
<p>I&#8217;ve been playing around with the Iphone SDK for the last few days. If you like &#8220;transitions&#8221; perhaps you tried to add an animation to the tab bar view. Nice transitions provide the tabbar&#8217;s item a fluent navigation. <em>WARNING : Although i found nothing explicitely dismissing tabbar animation, it seems Apple discouraged programmers to animate tabbars view switching. Please leave a comment if you found information from Apple on this subject! </em></p>
<p>Anyway, it&#8217;s a good exercise to implement view transition to a TabBar controller. This article requires you to know how to implement the ViewController paradigm. I will not cover basic  subjects  like creating project, interface building, or any other ViewController related questions. If you don&#8217;t know about this, I would suggest you to attend to training courses or read some Cocoa Touch tutorials, books, and materials to be familiar with project designing.</p>
<p><strong>I. Prepare your view and controller</strong></p>
<p>If you are familiar with Iphone and Cocoa developpement, you probably noticed how Apple is using the delegation pattern. The project we are going to build here will follow this delegation chain:</p>
<p>Main application &#8211;&gt; TabBarAppDelegate &#8211;&gt; ViewSwitcher TabbarDelegate</p>
<p>To implement that, the TabBarDelegate is using the UIApplicationDelegate. The ViewSwitcherTabbarDelegate use the UITabBarController Delegate.</p>
<p>Create 2 or 3 viewController class, design their interface, and link them to the UITabbar&#8217;s items.  Declare your UITabBarController and name it tabBarController in your application delegate <em>.h </em>file. When ready, just open the implementation of your TabBarAppDelegate and modify the  applicationDidFinishLaunching: method as this:</p>
<p><strong>-(void)applicationDidFinishLaunching:(UIApplication *)app {</p>
<p>tabBarController.delegate = [[ViewSwitcherTabbarDelegate alloc]init];</p>
<p>[window addSubview:[tabBarController view]]:</p>
<p>[window makeKeyAndVisible]:</p>
<p>}</strong></p>
<p>Don&#8217;t forget to release the ViewSwitcherTabbarDelegate and the tabBarController in your <em>dealloc</em> method of the application Delegate.<br />
Let&#8217;s talk about what we have done:<br />
The first line of code declares we are using another class to enhance our tabBarController behaviour.<br />
The second line is defining the first view which is appearing when bringing our tabBarController to the screen.<br />
The third line make our window active on the screen.</p>
<p><strong>II. create your animation</strong></p>
<p>Jump to the <em>ViewSwitcherTabbarDelegate</em> implementation file. You need to implements 2 methods to get your delegate working:</p>
<p>These function are<br />
<em>- tabBarController:didEndCustomizingViewControllers:changed:<br />
- tabBarController:didSelectViewController:</em></p>
<p>The method we are looking for is tabBarController:didSelectViewController:, because this method will be fired when the tabBarController is switching between his views.</p>
<p>Here is an example of the implementation of this method to animate the transition :<br />
<strong><br />
-(void)tabBarController:(UITabBarController *)tabBarController<br />
didSelectViewController:(UIViewController)viewController{<br />
</strong>// prepare your transition<strong><br />
CATransition *transition;<br />
transition = [CATransition animation];<br />
transition.type = <em>yourtypeoftransition</em><br />
transition.duration = <em>yourduration </em>&#8230;<br />
</strong><br />
// prepare your view switching <strong><br />
[[[ViewController view]layer]addAnimation:transition forKey:nil];<br />
}</strong></p>
<p>When building and runnig, you should now see the transition between the view, using your animation parameters. Enjoy !</p>
Posted in english publications, iphone programming  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/haveacafe.wordpress.com/252/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/haveacafe.wordpress.com/252/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/haveacafe.wordpress.com/252/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/haveacafe.wordpress.com/252/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/haveacafe.wordpress.com/252/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/haveacafe.wordpress.com/252/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/haveacafe.wordpress.com/252/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/haveacafe.wordpress.com/252/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/haveacafe.wordpress.com/252/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/haveacafe.wordpress.com/252/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haveacafe.wordpress.com&blog=2198367&post=252&subd=haveacafe&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://haveacafe.wordpress.com/2009/04/06/animated-transition-between-tabbars-view-on-iphone/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6b8e035a4a7eba7f8f4674a34c21b97b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">haveacafe</media:title>
		</media:content>
	</item>
		<item>
		<title>Validation xhtml strict : textes rayés et _target&#8230;</title>
		<link>http://haveacafe.wordpress.com/2009/03/24/un-texte-raye-valide-xhtml/</link>
		<comments>http://haveacafe.wordpress.com/2009/03/24/un-texte-raye-valide-xhtml/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 15:48:48 +0000</pubDate>
		<dc:creator>haveacafe</dc:creator>
				<category><![CDATA[webdesign]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[xhtml]]></category>

		<guid isPermaLink="false">http://haveacafe.wordpress.com/?p=246</guid>
		<description><![CDATA[Strike !
J&#8217;avais l&#8217;habitude d&#8217;utiliser les balises  &#60;strike&#62; et &#60;/strike&#62; pour rayer une ligne de texte en HTML, . Seulement ces balises sont dépréciées et feront sauter votre validation xhtml strict!
La solution que je préconise pour barrer du texte en HTML est d&#8217;utiliser l&#8217;équivalent CSS.
Il suffit par exemple de créer une classe &#8220;strike&#8221;, et de [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haveacafe.wordpress.com&blog=2198367&post=246&subd=haveacafe&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><h2>Strike !</h2>
<p>J&#8217;avais l&#8217;habitude d&#8217;utiliser les balises  &lt;strike&gt; et &lt;/strike&gt; pour rayer une ligne de texte en HTML, . Seulement ces balises sont dépréciées et feront sauter votre validation xhtml strict!</p>
<p>La solution que je préconise pour barrer du texte en HTML est d&#8217;utiliser l&#8217;équivalent CSS.</p>
<p>Il suffit par exemple de créer une classe &#8220;strike&#8221;, et de créer un span portant cet attribut de classe pour rayer un texte.<br />
Exemple :</p>
<p>En CSS :<br />
<strong>.strike {<br />
text-decoration: line-through;<br />
} </strong></p>
<p>En xHTML :</p>
<p><strong> </strong></p>
<p><strong>&lt;p&gt;Ceci est un mot &lt;span class=&#8217;strike&#8217;&gt;rayé &lt;/span&gt;&lt;/p&gt;</strong></p>
<h2>Target !</h2>
<p>Autre écueil du passage au xhtml strict: l&#8217;utilisation de l&#8217;attribut &#8220;target=_blank&#8221; pour ouvrir un lien dans un nouvel onglet ou une nouvelle fenetre.</p>
<p>L&#8217;attribut n&#8217;est plus valide xhtml strict, il faut aors utiliser javascript et remplacer l&#8217;attribut par :</p>
<p><strong><span class="attribute-name">onclick</span>=<span class="attribute-value">&#8220;window.open(this.href); return false;&#8221;</span></strong></p>
Posted in webdesign  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/haveacafe.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/haveacafe.wordpress.com/246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/haveacafe.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/haveacafe.wordpress.com/246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/haveacafe.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/haveacafe.wordpress.com/246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/haveacafe.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/haveacafe.wordpress.com/246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/haveacafe.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/haveacafe.wordpress.com/246/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haveacafe.wordpress.com&blog=2198367&post=246&subd=haveacafe&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://haveacafe.wordpress.com/2009/03/24/un-texte-raye-valide-xhtml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6b8e035a4a7eba7f8f4674a34c21b97b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">haveacafe</media:title>
		</media:content>
	</item>
		<item>
		<title>Playing with the shell history on Unix-ish systems</title>
		<link>http://haveacafe.wordpress.com/2009/02/27/playing-with-the-shell-history-on-unix-ish-systems/</link>
		<comments>http://haveacafe.wordpress.com/2009/02/27/playing-with-the-shell-history-on-unix-ish-systems/#comments</comments>
		<pubDate>Fri, 27 Feb 2009 20:01:43 +0000</pubDate>
		<dc:creator>haveacafe</dc:creator>
				<category><![CDATA[administration]]></category>
		<category><![CDATA[english publications]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[serveur dédié]]></category>
		<category><![CDATA[services linux]]></category>

		<guid isPermaLink="false">http://haveacafe.wordpress.com/?p=244</guid>
		<description><![CDATA[When using the shell on a server, you could type command revealing secrets on your root password or on your server organisation. For instance: just imagine your return keypress has not been working while becoming root, and your &#8220;su&#8221; password would be written without security asterisk and save in the history&#8230;)&#8230;
Moreover, it&#8217;s sometimes useful to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haveacafe.wordpress.com&blog=2198367&post=244&subd=haveacafe&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>When using the shell on a server, you could type command revealing secrets on your root password or on your server organisation. For instance: just imagine your return keypress has not been working while becoming root, and your &#8220;su&#8221; password would be written without security asterisk and save in the history&#8230;)&#8230;</p>
<p>Moreover, it&#8217;s sometimes useful to scan your entire history when playing around with your shell.</p>
<p>So you juste have to learn the some shell history tricks command.</p>
<h3><b>How to list the entire shell history ?</b></h3>
<p>Just type &#8220;<strong>history </strong>&#8220;</p>
<h3><b>How to clear the shell history ?</b></h3>
<p>Just type &#8220;<strong>history -c</strong>&#8220;</p>
<h3><b>How to avoid having twice the same command in the shell history ?</b></h3>
<p>Just insert this in&#8221; <strong>~/.bash_profile</strong>:&#8221;<br />
<strong>export HISTCONTROL=ignoredups</strong></p>
<p>Hope these few tricks could have been useful for you !</p>
Posted in administration, english publications  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/haveacafe.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/haveacafe.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/haveacafe.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/haveacafe.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/haveacafe.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/haveacafe.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/haveacafe.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/haveacafe.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/haveacafe.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/haveacafe.wordpress.com/244/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haveacafe.wordpress.com&blog=2198367&post=244&subd=haveacafe&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://haveacafe.wordpress.com/2009/02/27/playing-with-the-shell-history-on-unix-ish-systems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6b8e035a4a7eba7f8f4674a34c21b97b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">haveacafe</media:title>
		</media:content>
	</item>
		<item>
		<title>Sécuriser MySQL : création d&#8217;un utilisateur dédié à une base de donnée</title>
		<link>http://haveacafe.wordpress.com/2009/02/23/securiser-mysql-creation-dun-utilisateur-dedie-a-une-base-de-donnee/</link>
		<comments>http://haveacafe.wordpress.com/2009/02/23/securiser-mysql-creation-dun-utilisateur-dedie-a-une-base-de-donnee/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 12:01:42 +0000</pubDate>
		<dc:creator>haveacafe</dc:creator>
				<category><![CDATA[administration]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[serveur dédié]]></category>

		<guid isPermaLink="false">http://haveacafe.wordpress.com/?p=233</guid>
		<description><![CDATA[Dans l&#8217;ensemble de cet article on supposera l&#8217;utilisateur MySQL root existant avec le mot de passe: rootPass
Etape 1 : Créer l&#8217;utilisateur
Connectez vous en root sur la table appelée &#8220;mysql&#8221;, et tapez la commandes suivantes.
INSERT INTO user(host,user,password) VALUES (&#8216;localhost&#8217;,'nom_user&#8217;,PASSWORD(&#8216;pass_user&#8217;));   
Etape 2 : Créer la base de donnée
En root, il suffit d&#8217;entrer les commandes CREATE [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haveacafe.wordpress.com&blog=2198367&post=233&subd=haveacafe&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><i>Dans l&#8217;ensemble de cet article on supposera l&#8217;utilisateur MySQL root existant avec le mot de passe: rootPass</i></p>
<h3>Etape 1 : Créer l&#8217;utilisateur</h3>
<p>Connectez vous en root sur la table appelée &#8220;mysql&#8221;, et tapez la commandes suivantes.</p>
<p><strong>INSERT INTO user(host,user,password) VALUES (&#8216;localhost&#8217;,'nom_user&#8217;,PASSWORD(&#8216;pass_user&#8217;));   </strong></p>
<h3>Etape 2 : Créer la base de donnée</h3>
<p>En root, il suffit d&#8217;entrer les commandes <strong>CREATE DATABASE nom_database;</strong>.<br />
Pour générer les tables, que vous avez déjà probablement crée lors de la phase de développement, je vous conseille d&#8217;exporter la structure depuis le SGBD de dev, puis de l&#8217;insérer dans le SGBD de production en utilisant:<br />
<strong>mysql -u root -prootPass nom_database &lt;votrefichier.sql</strong></p>
<h3>Etape 3 : Attribuer les droits : insertion, suppression, et lecture sur l&#8217;ensemble de la base</h3>
<p>L&#8217;attribution des droits s&#8217;effectue avec l&#8217;usage de la commane GRANT, comme suit:</p>
<p><strong>GRANT SELECT, INSERT, UPDATE ON  nom_database.* TO nom_user@&#8217;localhost&#8217; ;</strong></p>
<p>Validez l&#8217;attribution de ces droits par:<br />
<strong>flush privileges;</strong></p>
<h3>Références</h3>
<p><a href="http://dev.mysql.com/doc/refman/5.0/fr/adding-users.html">http://dev.mysql.com/doc/refman/5.0/fr/adding-users.html</a></p>
Posted in administration, mysql, tutorial  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/haveacafe.wordpress.com/233/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/haveacafe.wordpress.com/233/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/haveacafe.wordpress.com/233/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/haveacafe.wordpress.com/233/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/haveacafe.wordpress.com/233/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/haveacafe.wordpress.com/233/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/haveacafe.wordpress.com/233/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/haveacafe.wordpress.com/233/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/haveacafe.wordpress.com/233/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/haveacafe.wordpress.com/233/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haveacafe.wordpress.com&blog=2198367&post=233&subd=haveacafe&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://haveacafe.wordpress.com/2009/02/23/securiser-mysql-creation-dun-utilisateur-dedie-a-une-base-de-donnee/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6b8e035a4a7eba7f8f4674a34c21b97b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">haveacafe</media:title>
		</media:content>
	</item>
		<item>
		<title>Vérifier la validité d&#8217;un email avec Java</title>
		<link>http://haveacafe.wordpress.com/2009/02/18/verifier-la-validite-dun-email-avec-java/</link>
		<comments>http://haveacafe.wordpress.com/2009/02/18/verifier-la-validite-dun-email-avec-java/#comments</comments>
		<pubDate>Wed, 18 Feb 2009 23:47:53 +0000</pubDate>
		<dc:creator>haveacafe</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[email validation]]></category>
		<category><![CDATA[email valide]]></category>
		<category><![CDATA[regex]]></category>

		<guid isPermaLink="false">http://haveacafe.wordpress.com/?p=223</guid>
		<description><![CDATA[Un jour ou l&#8217;autre, à travailler dans le WEB, opn finit par devoir vérifier la validité d&#8217;un email. Comme on ne peut pas faire confiance à Javascript ou Flash pour vérifier les données envoyées par le client, il faut impérativement vérifier la validité des adresse mail coté serveur (au pire, vous risquez l&#8217;injection SQL). Voivi [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haveacafe.wordpress.com&blog=2198367&post=223&subd=haveacafe&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Un jour ou l&#8217;autre, à travailler dans le WEB, opn finit par devoir vérifier la validité d&#8217;un email. Comme on ne peut pas faire confiance à Javascript ou Flash pour vérifier les données envoyées par le client, il faut impérativement vérifier la validité des adresse mail coté serveur (au pire, vous risquez l&#8217;injection SQL). Voivi quelques pistes pour vérifier ces emails sur un serveur J2EE, ou sur n&#8217;importe quel conteneur de servlet (Tomcat,Jetty, Glassfish).</p>
<h3>La solution de facilité</h3>
<p>Voici un moyen simple rapide et à priori efficace d&#8217;effectuer cette vérification, à l&#8217;aide de la libraire apache &#8220;commons-validator&#8221;:</p>
<p><b>public static boolean validateEmailAddress(String votreEmail){<br />
EmailValidator emailValidator = EmailValidator.getInstance();<br />
return emailValidator.isValid(votreEmail);<br />
}</b></p>
<p>Le fichier jar est disponible à cet endroit: <a href="http://commons.apache.org/validator/">http://commons.apache.org/validator/</a>. A noter que ls utilitaires de validation Apache permettent de valider également les dates, ou encore les numéros de carte bleue, que ce soit en java, ou en javascript!</p>
<h3>Prendre le taureau par les cornes, et chercher a implémenter la RFC 2822</h3>
<p>C&#8217;est une usine à gaz, mais ca a été fait, en listant l&#8217;ensemble des <em>tld</em>(top level domains: .com, .net .org, etc) existants. C&#8217;est ce qui est réalisé ici:<br />
<a href="http://www.velocityreviews.com/forums/t125158-java-email-validator.html">http://www.velocityreviews.com/forums/t125158-java-email-validator.html</a></p>
<h3>Implémenter sa propre regex simplifiée</h3>
<p>On peut également essayer de construire soi-même sa fonction, en écrivant sa regex et en comparant la chaine de caractère à cette expression régulière. Suivre strictement les recommandations de la RFC 2822 est un vrai casse-tête (comme on a pu le voir un peu plus haut), et n&#8217;est pas forcément utile car l&#8217;email bien que valide n&#8217;est peut être pas réellement attribué a une personne !</p>
<p>Je vous conseille donc d&#8217;utiliser une regex simple, éprouvée, et testée:</p>
<p><b>^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$</b></p>
<p>source: <a href="http://www.regular-expressions.info/email.html">http://www.regular-expressions.info/email.html</a></p>
<p>Et voici l&#8217;implémentation correspondante:</p>
<p><strong>public class Main {</p>
<p>    /**<br />
     * @param args the command line arguments<br />
     */<br />
    public static void main(String[] args) {<br />
         Console console = System.console();<br />
        if (console == null) {<br />
            System.err.println(&#8220;Probleme pour récupérer la console.&#8221;);<br />
            System.exit(1);<br />
        }<br />
        while (true) {<br />
        String a_tester = console.readLine(&#8220;Saisissez une adresse email à tester : &#8220;);<br />
        if(isEmailAdress(a_tester)) {<br />
            console.format(&#8220;OUI&#8221;);<br />
        }else{<br />
            console.format(&#8220;NON&#8221;);<br />
        }</p>
<p>    }<br />
    }</p>
<p>    public static boolean isEmailAdress(String email){<br />
         Pattern p = Pattern.compile(&#8220;^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}$&#8221;);<br />
         Matcher m = p.matcher(email.toUpperCase());<br />
         return m.matches();<br />
     }</p>
<p>}<br />
</strong></p>
<p>Attention au caractère d&#8217;échappement (doublé dans la syntaxe Java) pour la déclaration du &#8220;.&#8221; dans la seconde partie de l&#8217;email!</p>
Posted in java  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/haveacafe.wordpress.com/223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/haveacafe.wordpress.com/223/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/haveacafe.wordpress.com/223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/haveacafe.wordpress.com/223/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/haveacafe.wordpress.com/223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/haveacafe.wordpress.com/223/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/haveacafe.wordpress.com/223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/haveacafe.wordpress.com/223/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/haveacafe.wordpress.com/223/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/haveacafe.wordpress.com/223/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=haveacafe.wordpress.com&blog=2198367&post=223&subd=haveacafe&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://haveacafe.wordpress.com/2009/02/18/verifier-la-validite-dun-email-avec-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6b8e035a4a7eba7f8f4674a34c21b97b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">haveacafe</media:title>
		</media:content>
	</item>
	</channel>
</rss>