<?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>Blog of a developer</title>
	<atom:link href="http://agherschon.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://agherschon.com</link>
	<description>Ruby on Rails &#38; Android</description>
	<lastBuildDate>Tue, 06 Jul 2010 21:57:21 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>[Android] Got always altitude 0.0 longitude 0.0 altitude 10.0 on DDMS</title>
		<link>http://agherschon.com/2010/07/06/android-got-always-altitude-0-0-longitude-0-0-altitude-10-0-on-ddms/</link>
		<comments>http://agherschon.com/2010/07/06/android-got-always-altitude-0-0-longitude-0-0-altitude-10-0-on-ddms/#comments</comments>
		<pubDate>Tue, 06 Jul 2010 21:57:21 +0000</pubDate>
		<dc:creator>Alexandre Gherschon</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[0]]></category>
		<category><![CDATA[altitude]]></category>
		<category><![CDATA[altitude 10]]></category>
		<category><![CDATA[always]]></category>
		<category><![CDATA[gps]]></category>
		<category><![CDATA[longitude]]></category>

		<guid isPermaLink="false">http://agherschon.com/?p=266</guid>
		<description><![CDATA[I had a really disturbing issue with my first use of the GPS of Android with DDMS.
Always got Latitude 0.0, longitude 0.0, altitude 10.0, when sending coordinates with the Location Controls tool.
To correct this bug (coming from the locals of your machine, simply add this line to your eclipse.ini file :
-Duser.language=en
Enjoy  
]]></description>
			<content:encoded><![CDATA[<p>I had a really disturbing issue with my first use of the GPS of Android with DDMS.</p>
<p>Always got Latitude 0.0, longitude 0.0, altitude 10.0, when sending coordinates with the Location Controls tool.</p>
<p>To correct this bug (coming from the locals of your machine, simply add this line to your eclipse.ini file :</p>
<p>-Duser.language=en</p>
<p>Enjoy <img src='http://agherschon.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://agherschon.com/2010/07/06/android-got-always-altitude-0-0-longitude-0-0-altitude-10-0-on-ddms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Android] Timeout executing service</title>
		<link>http://agherschon.com/2010/05/24/android-timeout-executing-service/</link>
		<comments>http://agherschon.com/2010/05/24/android-timeout-executing-service/#comments</comments>
		<pubDate>Mon, 24 May 2010 14:05:57 +0000</pubDate>
		<dc:creator>Alexandre Gherschon</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Languages]]></category>
		<category><![CDATA[Context]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[executing]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[log]]></category>
		<category><![CDATA[service]]></category>
		<category><![CDATA[serviceRecord]]></category>
		<category><![CDATA[timeout]]></category>

		<guid isPermaLink="false">http://agherschon.com/?p=249</guid>
		<description><![CDATA[Annoying, right ?
When I was binding my Activity to a Service with a ServiceConnection, I did this, and always got this error: 

?View Code JAVAbindService&#40;new Intent&#40;this, PlayerService.class&#41;, this.psc, Context.BIND_AUTO_CREATE&#41;;

To resolve that, I asked for more debug :

?View Code JAVAbindService&#40;new Intent&#40;this, PlayerService.class&#41;, this.psc, Context.BIND_DEBUG_UNBIND&#41;;

Then this error disappeared !

Seriously, what happened ? I have no idea, but <a href="http://agherschon.com/2010/05/24/android-timeout-executing-service/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p><span style="color: #000000;">Annoying, </span><span style="color: #000000;">right ?</span></p>
<p><span style="color: #000000;">When I was binding my Activity to a Service with a ServiceConnection, I did this, and always got <a title="Timeout executing service error pop-up" href="http://agherschon.com/wp-content/uploads/2010/05/timeout-executing-service.png" target="_blank">this error</a>: </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('p249code3'); return false;">View Code</a> JAVA</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2493"><td class="code" id="p249code3"><pre class="java" style="font-family:monospace;">bindService<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Intent<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>, PlayerService.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span>, <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">psc</span>, <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Acontext+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Context</span></a>.<span style="color: #006633;">BIND_AUTO_CREATE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><span style="color: #000000;">To resolve that, I asked for more debug :</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('p249code4'); return false;">View Code</a> JAVA</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2494"><td class="code" id="p249code4"><pre class="java" style="font-family:monospace;">bindService<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Intent<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>, PlayerService.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span>, <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">psc</span>, <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Acontext+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky"><span style="color: #003399;">Context</span></a>.<span style="color: #006633;">BIND_DEBUG_UNBIND</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><span style="color: #000000;">Then this error disappeared !<br />
</span></p>
<p><span style="color: #000000;">Seriously, what happened ? I have <strong>no</strong> idea, but I&#8217;m <strong>happy</strong> my application doesn&#8217;t crash anymore after the user just closed it&#8230;</span></p>
]]></content:encoded>
			<wfw:commentRss>http://agherschon.com/2010/05/24/android-timeout-executing-service/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New website</title>
		<link>http://agherschon.com/2010/04/20/new-website/</link>
		<comments>http://agherschon.com/2010/04/20/new-website/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 21:55:53 +0000</pubDate>
		<dc:creator>Alexandre Gherschon</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://agherschon.com/?p=234</guid>
		<description><![CDATA[What ? A ruby developer using php as a blog ? Are you kidding ?!?
No, I&#8217;m not.
First, I used PHP before falling in love with Ruby. Secondly, I&#8217;m just a simple user. Users don&#8217;t care about technologies, only about solutions, and this one works fine for me !
So I merged my &#8220;portfolio&#8221; and my previous <a href="http://agherschon.com/2010/04/20/new-website/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>What ? A ruby developer using php as a blog ? Are you kidding ?!?</p>
<p>No, I&#8217;m not.</p>
<p>First, I used PHP before falling in love with Ruby. Secondly, I&#8217;m just a simple user. Users don&#8217;t care about technologies, only about solutions, and this one works fine for me !</p>
<p>So I merged my &#8220;portfolio&#8221; and my previous blog, to one central place.</p>
<p>Hurray for the new site ! Hurray !</p>
]]></content:encoded>
			<wfw:commentRss>http://agherschon.com/2010/04/20/new-website/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Ruby on rails] Installation on Mac</title>
		<link>http://agherschon.com/2010/01/03/install-ruby-on-rails-on-mac/</link>
		<comments>http://agherschon.com/2010/01/03/install-ruby-on-rails-on-mac/#comments</comments>
		<pubDate>Sun, 03 Jan 2010 07:32:17 +0000</pubDate>
		<dc:creator>Alexandre Gherschon</dc:creator>
				<category><![CDATA[Mac OS X Snow Leopard]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[installation]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[os x]]></category>

		<guid isPermaLink="false">http://agherschon.devloblog.com/?p=95</guid>
		<description><![CDATA[Hi,
By default, ruby 1.8.7 came with my mac. But I could not update rubygems, I just got this error:

?View Code BASHUpdating installed gems
Updating RedCloth
WARNING:  Installing to ~/.gem since /Library/Ruby/Gems/1.8 and
	  /usr/bin aren't both writable.
WARNING:  You don't have /Users/agherschon/.gem/ruby/1.8/bin in your PATH,
	  gem executables will not run.
Building native extensions.  This could <a href="http://agherschon.com/2010/01/03/install-ruby-on-rails-on-mac/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>Hi,</p>
<p>By default, ruby 1.8.7 came with my mac. But I could not update rubygems, I just got this error:</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('p95code6'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p956"><td class="code" id="p95code6"><pre class="bash" style="font-family:monospace;">Updating installed gems
Updating RedCloth
WARNING:  Installing to ~<span style="color: #000000; font-weight: bold;">/</span>.gem since <span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Ruby<span style="color: #000000; font-weight: bold;">/</span>Gems<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1.8</span> and
	  <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin aren<span style="color: #ff0000;">'t both writable.
WARNING:  You don'</span>t have <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>agherschon<span style="color: #000000; font-weight: bold;">/</span>.gem<span style="color: #000000; font-weight: bold;">/</span>ruby<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1.8</span><span style="color: #000000; font-weight: bold;">/</span>bin <span style="color: #000000; font-weight: bold;">in</span> your PATH,
	  gem executables will not run.
Building native extensions.  This could take a while...
ERROR:  While executing gem ... <span style="color: #7a0874; font-weight: bold;">&#40;</span>Gem::Installer::ExtensionBuildError<span style="color: #7a0874; font-weight: bold;">&#41;</span>
    ERROR: Failed to build gem native extension.
&nbsp;
<span style="color: #000000; font-weight: bold;">/</span>System<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Frameworks<span style="color: #000000; font-weight: bold;">/</span>Ruby.framework<span style="color: #000000; font-weight: bold;">/</span>Versions<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1.8</span><span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ruby extconf.rb update
mkmf.rb can<span style="color: #ff0000;">'t find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h
&nbsp;
Gem files will remain installed in /Users/agherschon/.gem/ruby/1.8/gems/RedCloth-4.2.2 for inspection.
Results logged to /Users/agherschon/.gem/ruby/1.8/gems/RedCloth-4.2.2/ext/redcloth_scan/gem_make.out</span></pre></td></tr></table></div>

<p><span id="more-95"></span>To resolve that, you have to <a href="http://www.google.be/search?q=install+xcode&amp;ie=utf-8&amp;oe=utf-8&amp;aq=t&amp;rls=org.mozilla:fr:official&amp;client=firefox-a">install XCode</a>. Right after this step, things are easier :</p>
<ul>
<li>sudo gem update</li>
<li>sudo gem install rails &#8211;include-dependencies</li>
</ul>
<p>That&#8217;s it !</p>
]]></content:encoded>
			<wfw:commentRss>http://agherschon.com/2010/01/03/install-ruby-on-rails-on-mac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Android] Block application orientation</title>
		<link>http://agherschon.com/2009/12/19/android-block-application-orientation/</link>
		<comments>http://agherschon.com/2009/12/19/android-block-application-orientation/#comments</comments>
		<pubDate>Sat, 19 Dec 2009 14:11:48 +0000</pubDate>
		<dc:creator>Alexandre Gherschon</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[block]]></category>
		<category><![CDATA[manifest]]></category>
		<category><![CDATA[orientation]]></category>
		<category><![CDATA[portrait]]></category>

		<guid isPermaLink="false">http://agherschon.devloblog.com/?p=82</guid>
		<description><![CDATA[In my application, I set an AbsoluteLayout to put buttons on an exact positions.
But when I rotated the emulator (CTRL+F11), the layout was all broken.
So here&#8217;s how to block the application on the &#8220;Portrait&#8221; layout:
Set the attribute &#8220;screenOrientation&#8221; to the value &#8220;portrait&#8221; into your main Activity in AndroidManifest.xml:

?View Code XML&#60;activity android:name=&#34;.activities.OxydroidActivity&#34;
    android:label=&#34;@string/app_name&#34;
 <a href="http://agherschon.com/2009/12/19/android-block-application-orientation/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>In my application, I set an AbsoluteLayout to put buttons on an exact positions.<br />
But when I rotated the emulator (CTRL+F11), the layout was all broken.</p>
<p>So here&#8217;s how to block the application on the &#8220;Portrait&#8221; layout:</p>
<p><span id="more-82"></span>Set the attribute &#8220;screenOrientation&#8221; to the value &#8220;portrait&#8221; into your main Activity in AndroidManifest.xml:</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('p82code8'); return false;">View Code</a> XML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p828"><td class="code" id="p82code8"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;activity</span> <span style="color: #000066;">android:name</span>=<span style="color: #ff0000;">&quot;.activities.OxydroidActivity&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">android:label</span>=<span style="color: #ff0000;">&quot;@string/app_name&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">android:screenOrientation</span>=<span style="color: #ff0000;">&quot;portrait&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/activity<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>Thanks to <a href="http://www.mail-archive.com/android-developers@googlegroups.com/msg11397.html">Evan JIANG</a> !</p>
]]></content:encoded>
			<wfw:commentRss>http://agherschon.com/2009/12/19/android-block-application-orientation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Android] Add a modal dialog</title>
		<link>http://agherschon.com/2009/12/18/android-add-a-modal-dialog/</link>
		<comments>http://agherschon.com/2009/12/18/android-add-a-modal-dialog/#comments</comments>
		<pubDate>Fri, 18 Dec 2009 11:20:16 +0000</pubDate>
		<dc:creator>Alexandre Gherschon</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[modal]]></category>
		<category><![CDATA[pop-up]]></category>
		<category><![CDATA[popup]]></category>

		<guid isPermaLink="false">http://agherschon.devloblog.com/?p=56</guid>
		<description><![CDATA[
Here is the code to add something like in this image : a dialog (pop-up) with buttons in Android.
Normally, the user may come back to your application with the &#8220;back&#8221; button. I wanted it to be a dead-end dialog. My aim was to close the application if there is no Internet connexion at all.
In this <a href="http://agherschon.com/2009/12/18/android-add-a-modal-dialog/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://agherschon.com/wp-content/uploads/2009/12/dialog.png"><img class="alignright size-medium wp-image-57" title="dialog-android" src="http://agherschon.com/wp-content/uploads/2009/12/dialog-200x300.png" alt="" width="200" height="300" /></a></p>
<p>Here is the code to add something like in this image : a dialog (pop-up) with buttons in Android.</p>
<p>Normally, the user may come back to your application with the &#8220;back&#8221; button. I wanted it to be a dead-end dialog. My aim was to close the application if there is no Internet connexion at all.</p>
<p><span id="more-56"></span>In this example, I set a modal <a href="http://developer.android.com/intl/fr/reference/android/app/AlertDialog.Builder.html">AlertDialog</a> with a title, a message, and an &#8220;OK&#8221; button, which will close the application (my current activity and a service).</p>
<p>What makes it modal, which means the user can not go back to the application without pushing the &#8220;OK&#8221; button, is the <a href="http://developer.android.com/intl/fr/reference/android/app/AlertDialog.Builder.html#setCancelable%28boolean%29">setCancelable(boolean)</a> function.</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('p56code10'); return false;">View Code</a> JAVA</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p5610"><td class="code" id="p56code10"><pre class="java" style="font-family:monospace;">AlertDialog alertDialog <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> AlertDialog.<span style="color: #006633;">Builder</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">create</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
alertDialog.<span style="color: #006633;">setTitle</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;No connection&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
alertDialog.<span style="color: #006633;">setMessage</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Oxydroid a besoin d'une connexion à Internet. Veuillez vérifier vos paramètres.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
alertDialog.<span style="color: #006633;">setCancelable</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
alertDialog.<span style="color: #006633;">setButton</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;OK&quot;</span>,<span style="color: #000000; font-weight: bold;">new</span> OnClickListener<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> onClick<span style="color: #009900;">&#40;</span>DialogInterface dialog, <span style="color: #000066; font-weight: bold;">int</span> which<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		stopService<span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Intent<span style="color: #009900;">&#40;</span>Oxydroid.<span style="color: #000000; font-weight: bold;">this</span>, PlayerService.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		Oxydroid.<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">finish</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
alertDialog.<span style="color: #006633;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p> <img src='http://agherschon.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://agherschon.com/2009/12/18/android-add-a-modal-dialog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Compare password with MySQL ENCRYPTed password</title>
		<link>http://agherschon.com/2009/12/16/compare-password-with-mysql-encrypted-password/</link>
		<comments>http://agherschon.com/2009/12/16/compare-password-with-mysql-encrypted-password/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 13:07:36 +0000</pubDate>
		<dc:creator>Alexandre Gherschon</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[compare]]></category>
		<category><![CDATA[encrypt]]></category>

		<guid isPermaLink="false">http://agherschon.devloblog.com/?p=47</guid>
		<description><![CDATA[How to compare two passwords, one encrypted with the MySQL ENCRYPT function, when the other one is clear ? 
Here&#8217;s how to compare:


Get the encrypted_password
Get the not_encrypted_password
Compare the passwords by encoding the not_encrypted_password using the two first characters of the encrypted_password as salt for the crypt method.

In Ruby language, this means coding something like this:

?View <a href="http://agherschon.com/2009/12/16/compare-password-with-mysql-encrypted-password/" class="more-link">More &#62;</a>]]></description>
			<content:encoded><![CDATA[<p>How to <strong><ins>compare</ins></strong> two passwords, one encrypted with the MySQL ENCRYPT function, when the other one is clear ? </p>
<p>Here&#8217;s how to compare:</p>
<p><span id="more-47"></span>
<ul>
<li>Get the <strong>encrypted_password</strong></li>
<li>Get the <strong>not_encrypted_password</strong></li>
<li>Compare the passwords by encoding the <strong>not_encrypted_password</strong> using the two first characters of the <strong>encrypted_password </strong>as <ins><strong><em>salt</em></strong></ins> for the crypt method.</li>
</ul>
<p>In <ins><strong>Ruby language</strong></ins>, this means coding something like this:</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('p47code12'); return false;">View Code</a> RUBY</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p4712"><td class="code" id="p47code12"><pre class="ruby" style="font-family:monospace;">not_encrypted_password.<span style="color:#9900CC;">crypt</span><span style="color:#006600; font-weight:bold;">&#40;</span>encrypted_password<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span>,<span style="color:#006666;">2</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> == encrypted_password</pre></td></tr></table></div>

<p>return <strong>true</strong> if passwords are maching. Youpi !</p>
<p>I did this article to never forget this&#8230; Hoping it would be helpful for someone else !</p>
]]></content:encoded>
			<wfw:commentRss>http://agherschon.com/2009/12/16/compare-password-with-mysql-encrypted-password/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
