<?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>Sébastien Barbieri's blog &#187; Projects</title>
	<atom:link href="http://blog.sbw.be/category/projects/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sbw.be</link>
	<description>My life, my work, my projects</description>
	<lastBuildDate>Mon, 28 Jun 2010 05:28:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Bru-GTUG #1 Date Poll</title>
		<link>http://blog.sbw.be/2009/11/24/bru-gtug-1-date-poll/</link>
		<comments>http://blog.sbw.be/2009/11/24/bru-gtug-1-date-poll/#comments</comments>
		<pubDate>Tue, 24 Nov 2009 07:37:44 +0000</pubDate>
		<dc:creator>Sébastien Barbieri</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[freelance]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[bru-gtug]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[hackaton]]></category>

		<guid isPermaLink="false">http://blog.sbw.be/?p=334</guid>
		<description><![CDATA[Feel free to participate in the Bru-GTUG #1
 
]]></description>
			<content:encoded><![CDATA[<p>Feel free to participate in the Bru-GTUG #1</p>
<p><iframe width="300" height="250" frameborder="0" src="http://www.doodle.com/summary.html?pollId=6939wknuzkwkwweq"> </iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sbw.be/2009/11/24/bru-gtug-1-date-poll/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Firefox Ubiquity php search handy command</title>
		<link>http://blog.sbw.be/2009/08/26/firefox-ubiquity-php-search-handy-command/</link>
		<comments>http://blog.sbw.be/2009/08/26/firefox-ubiquity-php-search-handy-command/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 14:22:35 +0000</pubDate>
		<dc:creator>Sébastien Barbieri</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[freelance]]></category>
		<category><![CDATA[truc de g33k]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[ubiquity]]></category>

		<guid isPermaLink="false">http://blog.sbw.be/?p=301</guid>
		<description><![CDATA[Just created a Firfow Ubiquity php search command based on 2 other work: http://download.sbw.be/projects/ubiquity/php-search.html
]]></description>
			<content:encoded><![CDATA[<p>Just created a Firfow Ubiquity php search command based on 2 other work: <a href="http://download.sbw.be/projects/ubiquity/php-search.html">http://download.sbw.be/projects/ubiquity/php-search.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sbw.be/2009/08/26/firefox-ubiquity-php-search-handy-command/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Distance between cities</title>
		<link>http://blog.sbw.be/2009/06/12/distance-between-cities/</link>
		<comments>http://blog.sbw.be/2009/06/12/distance-between-cities/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 07:06:45 +0000</pubDate>
		<dc:creator>Sébastien Barbieri</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[truc de g33k]]></category>
		<category><![CDATA[belgium]]></category>
		<category><![CDATA[cities]]></category>
		<category><![CDATA[latitude]]></category>
		<category><![CDATA[longitude]]></category>
		<category><![CDATA[zip]]></category>

		<guid isPermaLink="false">http://blog.sbw.be/?p=256</guid>
		<description><![CDATA[First of all I need to cite my sources: 


		Calculate distance, bearing and more between two Latitude/Longitude points
	

		Geocoding Belgium Postal Codes
	

The goal of my project was to find out which cities are nearby (within a user specified distance).
Of course users don&#8217;t know their city coordinate, so you will have to find out by yourself. To [...]]]></description>
			<content:encoded><![CDATA[<p>First of all I need to cite my sources: </p>
<ul>
<li>
		<a href="http://www.movable-type.co.uk/scripts/latlong.html">Calculate distance, bearing and more between two Latitude/Longitude points</a>
	</li>
<li>
		<a href="http://www.jedi.be/blog/2009/04/29/geocoding-belgium-postal-codes/">Geocoding Belgium Postal Codes</a>
	</li>
</ul>
<p>The goal of my project was to find out which cities are nearby (within a user specified distance).<br />
Of course users don&#8217;t know their city coordinate, so you will have to find out by yourself. To do so, I used the JEDI trick (<a href="http://www.jedi.be/blog/2009/04/29/geocoding-belgium-postal-codes/">Geocoding Belgium Postal Codes</a>) which is:</p>
<ul>
<ol>Downloading the csv of cities and zip code (available on the <a href="http://www.post.be/site/fr/residential/customerservice/search/postal_codes.html">national mail </a>site for Belgium, I don&#8217;t know for other countries)</ol>
<ol>Writing a small piece of code to parse the csv and retrieve the right latitude and longitude via google geo service</ol>
</ul>
<p>I could have downloaded <a href="http://www.jedi.be/blog/wp-content/uploads/2009/04/geocodes.csv">the file from the JEDI site</a> but I really needed to do it by myself.</p>
<p>So the next thing to do is: finding the cities within an arbitrary distance.</p>
<p>This was based on the documentation I found on the movable-type math site.</p>
<p>All I did is translating the Javascript function to PHP functions:</p>
<pre class="brush: php;">
    private function sphericalDistance($lat1,$lon1,$lat2,$lon2){
        $R = 6371.0; // km
        $d = acos(
                sin(deg2rad($lat1))*sin(deg2rad($lat2))
                + cos(deg2rad($lat1))*cos(deg2rad($lat2))
                * cos(deg2rad($lon2-$lon1))
             )
             * $R;
        return $d;
    }

    private function haversineDistance($lat1,$lon1,$lat2,$lon2){
        $R = 6371.0; // km
        $dLat = deg2rad($lat2-$lat1);
        $dLon = deg2rad($lon2-$lon1);
        $a = sin($dLat/2) * sin($dLat/2)
            + cos(deg2rad($lat1)) * cos(deg2rad($lat2))
            * sin($dLon/2) * sin($dLon/2);
        $c = 2.0 * atan2(sqrt($a), sqrt(1-$a));
        $d = $R * $c;
        return $d;
    }

    private function vincentyDistance($lat1,$lon1,$lat2,$lon2){
        $a = 6378137.0; $b = 6356752.3142;  $f = 1/298.257223563;  // WGS-84 ellipsiod
        $L = deg2rad($lon2-$lon1);
        $U1 = atan((1-$f) * tan(deg2rad($lat1)));
        $U2 = atan((1-$f) * tan(deg2rad($lat2)));
        $sinU1 = sin($U1);
        $cosU1 = cos($U1);
        $sinU2 = sin($U2);
        $cosU2 = cos($U2);
        $lambda = $L;
        $lambdaP = $L;
        $iterLimit = 100;
        do{
            $sinLambda = sin($lambda);
            $cosLambda = cos($lambda);
            $sinSigma = sqrt(($cosU2*$sinLambda) * ($cosU2*$sinLambda) +
                        ($cosU1*$sinU2-$sinU1*$cosU2*$cosLambda) * ($cosU1*$sinU2-$sinU1*$cosU2*$cosLambda));
            if($sinSigma==0) return 0;
            $cosSigma = $sinU1 * $sinU2 + $cosU1*$cosU2*$cosLambda;
            $sigma = atan2($sinSigma, $cosSigma);
            $sinAlpha = $cosU1 * $cosU2 * $sinLambda / $sinSigma;
            $cosSqAlpha = 1 - $sinAlpha*$sinAlpha;
            if($cosSqAlpha!=0){
                $cos2SigmaM = $cosSigma - 2*$sinU1*$sinU2/$cosSqAlpha;
            }else{
                $cos2SigmaM =0;
            }
            $C = $f/16*$cosSqAlpha*(4+$f*(4-3*$cosSqAlpha));
            $lambdaP = $lambda;
            $lambda = $L + (1-$C) * $f * $sinAlpha *
                    ($sigma + $C*$sinSigma*($cos2SigmaM+$C*$cosSigma*(-1+2*$cos2SigmaM*$cos2SigmaM)));
        }while(abs($lambda-$lambdaP) &gt; 1e-12 &amp;&amp; --$iterLimit&gt;0);
        if($iterLimit == 0) return false; // formula failed to converge
        $uSq = $cosSqAlpha * ($a*$a - $b*$b) / ($b*$b);
        $A = 1 + $uSq/16384.0*(4096+$uSq*(-768+$uSq*(320-175*$uSq)));
        $B = $uSq/1024.0 * (256+$uSq*(-128+$uSq*(74-47*$uSq)));
        $deltaSigma = $B*$sinSigma*($cos2SigmaM+$B/4*($cosSigma*(-1+2*$cos2SigmaM*$cos2SigmaM)
                    - $B/6*$cos2SigmaM*(-3+4*$sinSigma*$sinSigma)*(-3+4*$cos2SigmaM*$cos2SigmaM)));
        $s = $b*$A*($sigma-$deltaSigma);
        return $s/1000.0;
    }
</pre>
<p>And that&#8217;s it&#8230;</p>
<p>So if you want the<a href="http://code.sbw.be/php/belgianCitiesCoord.data"> php serialized cities of Belgium with Zip, cityname, uppercase cityname, longitude,latitude</a>.</p>
<p>I didn&#8217;t do a lot at all, just put every source together.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sbw.be/2009/06/12/distance-between-cities/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quechup is selling (let steal) e-mail adresses: honey pot #1 triggered</title>
		<link>http://blog.sbw.be/2009/04/03/quechup-is-selling-let-steal-e-mail-adresses-honey-pot-1-triggered/</link>
		<comments>http://blog.sbw.be/2009/04/03/quechup-is-selling-let-steal-e-mail-adresses-honey-pot-1-triggered/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 07:41:24 +0000</pubDate>
		<dc:creator>Sébastien Barbieri</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[freelance]]></category>
		<category><![CDATA[truc de g33k]]></category>
		<category><![CDATA[email marketing]]></category>

		<guid isPermaLink="false">http://blog.sbw.be/2009/04/03/quechup-is-selling-let-steal-e-mail-adresses-honey-pot-1-triggered/</guid>
		<description><![CDATA[My subscription to quechup was used for spam mail such has:
Cindy Foster &#8211; CindyFoster1533@live.com
 to quechupxxx@xxx.sbw.be
H! I find your post interesting. I am pretty chick. I am moving to your area from russia
I am looking for a good man to show me around and may be more ;)
Could you please kindly reply to me at [...]]]></description>
			<content:encoded><![CDATA[<p>My subscription to <a href="http://www.quechup.com/">quechup</a> was used for spam mail such has:</p>
<blockquote><p>Cindy Foster &#8211; CindyFoster1533@live.com<br />
 to quechupxxx@xxx.sbw.be</p>
<p>H! I find your post interesting. I am pretty chick. I am moving to your area from russia<br />
I am looking for a good man to show me around and may be more ;)<br />
Could you please kindly reply to me at jclapptakomapark@gmail.com<br />
I will send you some of my pictures back in reply.<br />
Could you reply to my email account I am supplying in the body of this email as I am writing from my work email which i don&#8217;t use for personal correspondence</p>
<p>Windows Live™: Keep your life in sync. Check it out.
</p></blockquote>
<p>&#8211;> Don&#8217;t use quechup</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sbw.be/2009/04/03/quechup-is-selling-let-steal-e-mail-adresses-honey-pot-1-triggered/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Deezer embed test</title>
		<link>http://blog.sbw.be/2008/12/23/deezer-embed-test/</link>
		<comments>http://blog.sbw.be/2008/12/23/deezer-embed-test/#comments</comments>
		<pubDate>Tue, 23 Dec 2008 09:54:52 +0000</pubDate>
		<dc:creator>Sébastien Barbieri</dc:creator>
				<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://blog.sbw.be/2008/12/23/deezer-embed-test/</guid>
		<description><![CDATA[Discover K&#8217;s Choice!
]]></description>
			<content:encoded><![CDATA[<div style="width:220px;height:35px;overflow:hidden;border-right: 1px solid black;border-bottom: 1px solid black;"><object width="220" height="55"><param name="movie" value="http://www.deezer.com/embedded/small-widget-v2.swf?idSong=561298&#038;colorBackground=0xFFFFFF&#038;textColor1=0x000000&#038;colorVolume=0xCCCCCC&#038;autoplay=0"></param><embed src="http://www.deezer.com/embedded/small-widget-v2.swf?idSong=561298&#038;colorBackground=0xFFFFFF&#038;textColor1=0x000000&#038;colorVolume=0xCCCCCC&#038;autoplay=0" type="application/x-shockwave-flash" width="220" height="55"></embed></object><br /><font size='1' color ='#000000' face='Arial'>Discover <a href='http://www.deezer.com/en/k-s-choice.html'>K&#8217;s Choice</a>!</font></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.sbw.be/2008/12/23/deezer-embed-test/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Not aligned&#8230;</title>
		<link>http://blog.sbw.be/2008/09/01/not-aligned/</link>
		<comments>http://blog.sbw.be/2008/09/01/not-aligned/#comments</comments>
		<pubDate>Mon, 01 Sep 2008 10:15:24 +0000</pubDate>
		<dc:creator>Sébastien Barbieri</dc:creator>
				<category><![CDATA[Mon blog]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://blog.sbw.be/2008/09/01/not-aligned/</guid>
		<description><![CDATA[&#8230; with my managment&#8230;
I prefere to do research and to develop than to maintain out-sourced code&#8230;
Why do they outsource the great applications and concepts&#8230; and leave us with the day to day operationnal work&#8230;
That&#8217;s not nice&#8230;
So I decided to resign&#8230; Bye bye Skynet&#8230; I hope that you will see the light sooner or later&#8230; and [...]]]></description>
			<content:encoded><![CDATA[<p>&#8230; with my managment&#8230;</p>
<p>I prefere to do research and to develop than to maintain out-sourced code&#8230;</p>
<p>Why do they outsource the great applications and concepts&#8230; and leave us with the day to day operationnal work&#8230;</p>
<p>That&#8217;s not nice&#8230;</p>
<p>So I decided to resign&#8230; Bye bye Skynet&#8230; I hope that you will see the light sooner or later&#8230; and stop your self-destruction&#8230;</p>
<p>S.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sbw.be/2008/09/01/not-aligned/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>create a patch with subversion</title>
		<link>http://blog.sbw.be/2008/02/06/create-a-patch-with-subversion/</link>
		<comments>http://blog.sbw.be/2008/02/06/create-a-patch-with-subversion/#comments</comments>
		<pubDate>Wed, 06 Feb 2008 01:06:12 +0000</pubDate>
		<dc:creator>Sébastien Barbieri</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[truc de g33k]]></category>

		<guid isPermaLink="false">http://blog.sbw.be/2008/02/06/create-a-patch-with-subversion/</guid>
		<description><![CDATA[Before the commit:
svn diff > mypatch_xx.diff
After the commit:
svn diff -r  > mypatch_xx.diff
copy the mypatch_xx.diff file at the same relative place on the other computer/directory/&#8230;
and do:
patch --dry-run -p0 -i ~/mypatch_xx.diff
to see what will be done and then
patch -p0 -i ~/mypatch_xx.diff
to do it really
to install patch: apt-get install patch
to install subversion: apt-get install subversion
]]></description>
			<content:encoded><![CDATA[<p>Before the commit:</p>
<p><code>svn diff > mypatch_xx.diff</code></p>
<p>After the commit:</p>
<p><code>svn diff -r <PREVIOUS REVISION NUMBER> > mypatch_xx.diff</code></p>
<p>copy the mypatch_xx.diff file at the same relative place on the other computer/directory/&#8230;</p>
<p>and do:</p>
<p><code>patch --dry-run -p0 -i ~/mypatch_xx.diff</code></p>
<p>to see what will be done and then</p>
<p><code>patch -p0 -i ~/mypatch_xx.diff</code></p>
<p>to do it really</p>
<p>to install patch: <code>apt-get install patch</code><br />
to install subversion: <code>apt-get install subversion</code></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sbw.be/2008/02/06/create-a-patch-with-subversion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to install php 5 mode cgi on apache 1.3 with mod php 4 / Debian stable</title>
		<link>http://blog.sbw.be/2007/08/01/how-to-install-php-5-mode-cgi-on-apache-13-with-mod-php-4-debian-stable/</link>
		<comments>http://blog.sbw.be/2007/08/01/how-to-install-php-5-mode-cgi-on-apache-13-with-mod-php-4-debian-stable/#comments</comments>
		<pubDate>Wed, 01 Aug 2007 21:55:38 +0000</pubDate>
		<dc:creator>Sébastien Barbieri</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[freelance]]></category>
		<category><![CDATA[truc de g33k]]></category>

		<guid isPermaLink="false">http://blog.sbw.be/2007/08/01/how-to-install-php-5-mode-cgi-on-apache-13-with-mod-php-4-debian-stable/</guid>
		<description><![CDATA[php4 and php5 on same server is not that complex
You must be root (or able to sudo)!
1. check that cgi-bin mod_alias is activated
in /etc/apache/httpd.conf search for:
&#60;IfModule mod_alias.c&#62;
  #ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
...

the line should be uncommented
2. Install php5-cgi
update:

apt-get update

simulate install:

apt-get -s install php5-cgi
Reading package lists... Done
Building dependency tree... Done
The following NEW packages will be installed
  [...]]]></description>
			<content:encoded><![CDATA[<p>php4 and php5 on same server is not that complex</p>
<p>You must be root (or able to sudo)!</p>
<p>1. check that cgi-bin mod_alias is activated</p>
<p>in /etc/apache/httpd.conf search for:</p>
<p><code>&lt;IfModule mod_alias.c&gt;<br />
  #ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/<br />
...<br />
</code></p>
<p>the line should be uncommented</p>
<p>2. Install php5-cgi</p>
<p>update:</p>
<p><code><br />
apt-get update<br />
</code></p>
<p>simulate install:</p>
<p><code><br />
apt-get -s install php5-cgi<br />
Reading package lists... Done<br />
Building dependency tree... Done<br />
The following NEW packages will be installed<br />
  php5-cgi<br />
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.<br />
...<br />
</code></p>
<p>if you have something similar, let&#8217;s do it for real</p>
<p><code>apt-get install php5-cgi<br />
</code></p>
<p>3. add an handler in the directory where php5 files are</p>
<p>in the directory where you want to have php5 running (ex: /var/www/myphp5site/)<br />
create an .htaccess file containing:</p>
<p><code>AddHandler x-httpd-php5 .php<br />
Action x-httpd-php5 /cgi-bin/php5<br />
</code></p>
<p>4. gracefuly restart apache</p>
<p><code>apachectl graceful<br />
</code></p>
<p>It&#8217;s done, enjoy.</p>
<p>sources:</p>
<p><a href="http://www.generation-linux.net/article.php3?id_article=26">http://www.generation-linux.net/article.php3?id_article=26</a></p>
<p><a href="http://www.siteduzero.com/tuto-3-19975-1-php4-et-php5-en-meme-temps-sur-un-serveur-linux.html">http://www.siteduzero.com/&#8230;serveur-linux.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sbw.be/2007/08/01/how-to-install-php-5-mode-cgi-on-apache-13-with-mod-php-4-debian-stable/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Company site</title>
		<link>http://blog.sbw.be/2007/04/27/company-site/</link>
		<comments>http://blog.sbw.be/2007/04/27/company-site/#comments</comments>
		<pubDate>Fri, 27 Apr 2007 06:00:26 +0000</pubDate>
		<dc:creator>Sébastien Barbieri</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[freelance]]></category>

		<guid isPermaLink="false">http://blog.sbw.be/2007/04/27/company-site/</guid>
		<description><![CDATA[My company site is under construction: http://www.sbw.be/ feel free to comment suggestions.
]]></description>
			<content:encoded><![CDATA[<p>My company site is under construction: <a href="http://www.sbw.be/ ">http://www.sbw.be/</a> feel free to comment suggestions.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sbw.be/2007/04/27/company-site/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>open source web icons</title>
		<link>http://blog.sbw.be/2007/01/24/open-source-web-icons/</link>
		<comments>http://blog.sbw.be/2007/01/24/open-source-web-icons/#comments</comments>
		<pubDate>Tue, 23 Jan 2007 22:51:19 +0000</pubDate>
		<dc:creator>Sébastien Barbieri</dc:creator>
				<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://blog.sbw.be/2007/01/24/open-source-web-icons/</guid>
		<description><![CDATA[after few search I finally found: http://www.maxpower.ca/free-icons/2006/03/05/ which is a really great source of open source icons.
And some good Ajax Please Wait Icons
]]></description>
			<content:encoded><![CDATA[<p>after few search I finally found: <a href="http://www.maxpower.ca/free-icons/2006/03/05/">http://www.maxpower.ca/free-icons/2006/03/05/</a> which is a really great source of open source icons.<br />
And some good <a href="http://www.napyfab.com/ajax-indicators/">Ajax Please Wait Icons</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sbw.be/2007/01/24/open-source-web-icons/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
