<?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>Encounters with the World Wild Web</title>
	<atom:link href="http://www.davidlauzon.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.davidlauzon.net</link>
	<description>David on Laptop</description>
	<lastBuildDate>Tue, 27 Dec 2011 04:50:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Darky ROM with HOME button on T959D (Galaxy S Fascinate)</title>
		<link>http://www.davidlauzon.net/2011/12/darky-rom-with-home-button-t959d/</link>
		<comments>http://www.davidlauzon.net/2011/12/darky-rom-with-home-button-t959d/#comments</comments>
		<pubDate>Tue, 27 Dec 2011 04:44:46 +0000</pubDate>
		<dc:creator>David On Laptop</dc:creator>
				<category><![CDATA[Howtos]]></category>

		<guid isPermaLink="false">http://www.davidlauzon.net/?p=181</guid>
		<description><![CDATA[Hey! If you&#8217;ve installed the Darky Rom 10.2 (or 10.3) on your T959D phone (Samsung Galaxy S Fascinate), and you are missing the HOME and SEARCH key here is how to get them working : Install Darky ROM 10.2 Download the latest Odin 3  (I used Odin3 v1.85) * Start Odin Download DarkyROM_10.2_Resurrection.zip Extract the [...]]]></description>
			<content:encoded><![CDATA[<p>Hey! If you&#8217;ve installed the Darky Rom 10.2 (or 10.3) on your T959D phone (Samsung Galaxy S Fascinate), and you are missing the HOME and SEARCH key here is how to get them working :</p>
<h3>Install Darky ROM 10.2</h3>
<ol>
<li>Download the latest Odin 3  (I used Odin3 v1.85) *</li>
<li>Start Odin</li>
<li>Download <a href="http://sourceforge.net/projects/ficeto.u/files/DarkyROM_10.2_Resurrection.zip/download">DarkyROM_10.2_Resurrection.zip</a></li>
<li>Extract the ZIP</li>
<li>Put the pit file in PIT</li>
<li>Tick repartition</li>
<li>Put PDA.tar it into PDA</li>
<li>Put phone in Download Mode (vol-down+home+pwr)</li>
<li>Connect through USB to your computer (make sure Kies is off)</li>
<li>Hit Start</li>
<li>Sit back and relax while your phone gets resurrected</li>
</ol>
<p>* The provided Odin 1.3 didn&#8217;t detected my phone, so I just used version 1.85</p>
<h3>Install the key layout patch</h3>
<p>But since this ROM is for the I9000 phone which has a hardware HOME button, you need to install a patch to fix the T959D&#8217;s software buttons :</p>
<ol>
<li>Download the <a href="http://forum.xda-developers.com/showthread.php?t=1252908">&#8220;Key Layout Update.zip&#8221; from this page</a></li>
<li>Connect your phone to your computer as a mass storage device</li>
<li>Copy the &#8220;Key Layout Update.zip&#8221; to your phone&#8217;s sd card.</li>
<li>Reboot in recovery mode, by holding the power button and choosing the option &#8220;Recovery&#8221;.</li>
<li>&#8220;Install zip from sdcard&#8221;</li>
<li>&#8220;Choose zip from sdcard&#8221;</li>
<li>Select the zip</li>
<li>Yes, install it</li>
<li>Reboot and voila!</li>
</ol>
<p>By the way, you can also use this patch with Darky ROM 10.3 but this ROM was waaaay too slow!</p>
<h3>Extra : the band frequencies</h3>
<p>If your using Telus Canada, you may need to add the band frequencies (otherwise Canadian bands will be disabled by default) :</p>
<ol>
<li>Open the Dialer app</li>
<li>Type *#*#197328640#*#*</li>
<li>Select [1] Debug Screen</li>
<li>Select [8] Phone control</li>
<li>Select [7] Network control</li>
<li>Select [2] Band Selection</li>
<li>Select [4] Combi Bands []</li>
<li>Select all the bands</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.davidlauzon.net/2011/12/darky-rom-with-home-button-t959d/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Search within pdf files using grep</title>
		<link>http://www.davidlauzon.net/2011/11/greppdf/</link>
		<comments>http://www.davidlauzon.net/2011/11/greppdf/#comments</comments>
		<pubDate>Sat, 26 Nov 2011 00:45:01 +0000</pubDate>
		<dc:creator>David On Laptop</dc:creator>
				<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://www.davidlauzon.net/?p=177</guid>
		<description><![CDATA[Put this code snippet into a script named greppdf into your path : 1234567891011#!/bin/bash for PDF in *.pdf do &#160; &#160; NB_PAGES=`pdfinfo &#34;$PDF&#34; &#124;grep &#34;Pages&#34; &#124;cut -f 2 -d &#34;:&#34;` &#160; &#160; for &#40;&#40; PAGE=1; PAGE&#60;=$NB_PAGES; PAGE++ &#41;&#41; &#160; &#160; do &#160; &#160; &#160; &#160; &#160; pdftotext &#34;$PDF&#34; -f $PAGE -l $PAGE - &#124; grep [...]]]></description>
			<content:encoded><![CDATA[<p>Put this code snippet into a script named greppdf into your path :</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/bin/bash</span><br />
<br />
<span style="color: #000000; font-weight: bold;">for</span> PDF <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">*</span>.pdf<br />
<span style="color: #000000; font-weight: bold;">do</span><br />
&nbsp; &nbsp; <span style="color: #007800;">NB_PAGES</span>=<span style="color: #000000; font-weight: bold;">`</span>pdfinfo <span style="color: #ff0000;">&quot;<span style="color: #007800;">$PDF</span>&quot;</span> <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;Pages&quot;</span> <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-f</span> <span style="color: #000000;">2</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot;:&quot;</span><span style="color: #000000; font-weight: bold;">`</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #007800;">PAGE</span>=<span style="color: #000000;">1</span>; PAGE<span style="color: #000000; font-weight: bold;">&lt;</span>=<span style="color: #007800;">$NB_PAGES</span>; PAGE++ <span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">do</span> &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; pdftotext <span style="color: #ff0000;">&quot;<span style="color: #007800;">$PDF</span>&quot;</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$PAGE</span> <span style="color: #660033;">-l</span> <span style="color: #007800;">$PAGE</span> - <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-i</span> $<span style="color: #000000; font-weight: bold;">@</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #c20cb9; font-weight: bold;">read</span> line; <span style="color: #000000; font-weight: bold;">do</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$PDF</span>:<span style="color: #007800;">$PAGE</span>:<span style="color: #007800;">$line</span>&quot;</span>; <span style="color: #000000; font-weight: bold;">done</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">done</span><br />
<span style="color: #000000; font-weight: bold;">done</span></div></td></tr></tbody></table></div>
<p>Now you can search through a directory of pdf, using this command (you can use as well regular grep parameters) :</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">greppdf <span style="color: #ff0000;">&quot;programming&quot;</span></div></td></tr></tbody></table></div>
<p>This will output the filename and slide number where the &#8220;programming&#8221; string is found.</p>
<p>Requirements: The package poppler-utils needs to be installed on your system.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidlauzon.net/2011/11/greppdf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache virtual host using a symlink to home directory</title>
		<link>http://www.davidlauzon.net/2011/06/apache-virtual-host-using-a-symlink-to-home-directory/</link>
		<comments>http://www.davidlauzon.net/2011/06/apache-virtual-host-using-a-symlink-to-home-directory/#comments</comments>
		<pubDate>Wed, 29 Jun 2011 23:11:36 +0000</pubDate>
		<dc:creator>David On Laptop</dc:creator>
				<category><![CDATA[Howtos]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.davidlauzon.net/?p=160</guid>
		<description><![CDATA[Forbidden : You don&#8217;t have the permission to access / on this server. If you see this error message, then perhaps you&#8217;re trying to use an Apache virtual host that&#8217;s located somewhere in your home directory? Well this could be because Apache doesn&#8217;t have the permissions to traverse the directory, and this post explains how [...]]]></description>
			<content:encoded><![CDATA[<h3>Forbidden : You don&#8217;t have the permission to access / on this server.</h3>
<p>If you see this error message, then perhaps you&#8217;re trying to use an Apache virtual host that&#8217;s located somewhere in your home directory?</p>
<p>Well this could be because Apache doesn&#8217;t have the permissions to traverse the directory, and this post explains how to fix it with complete config files.</p>
<p>In my case, my default apache document root is /var/www and I want to server /var/www/potdigger which is a symlink to /home/david/workspace/php/potdigger_backend .</p>
<h3>Find out what user the Apache process is using</h3>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">david@dragdroid:~$ </span><span style="color: #c20cb9; font-weight: bold;">ps</span> auxf <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">grep</span> apache<br />
david &nbsp; &nbsp;<span style="color: #000000;">23857</span> &nbsp;<span style="color: #000000;">0.0</span> &nbsp;<span style="color: #000000;">0.0</span> &nbsp; <span style="color: #000000;">5304</span> &nbsp; <span style="color: #000000;">856</span> pts<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0</span> &nbsp; &nbsp;S+ &nbsp; <span style="color: #000000;">18</span>:00 &nbsp; <span style="color: #000000;">0</span>:00 &nbsp;<span style="color: #000000; font-weight: bold;">|</span> &nbsp; \_ <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">--color</span>=auto apache<br />
root &nbsp; &nbsp; <span style="color: #000000;">23381</span> &nbsp;<span style="color: #000000;">0.0</span> &nbsp;<span style="color: #000000;">0.0</span> &nbsp; <span style="color: #000000;">5652</span> &nbsp;<span style="color: #000000;">2628</span> ? &nbsp; &nbsp; &nbsp; &nbsp;Ss &nbsp; <span style="color: #000000;">17</span>:<span style="color: #000000;">25</span> &nbsp; <span style="color: #000000;">0</span>:00 <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>apache2 <span style="color: #660033;">-k</span> start<br />
www-data <span style="color: #000000;">23384</span> &nbsp;<span style="color: #000000;">0.0</span> &nbsp;<span style="color: #000000;">0.0</span> &nbsp; <span style="color: #000000;">5424</span> &nbsp;<span style="color: #000000;">1816</span> ? &nbsp; &nbsp; &nbsp; &nbsp;S &nbsp; &nbsp;<span style="color: #000000;">17</span>:<span style="color: #000000;">25</span> &nbsp; <span style="color: #000000;">0</span>:00 &nbsp;\_ <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>apache2 <span style="color: #660033;">-k</span> start<br />
www-data <span style="color: #000000;">23386</span> &nbsp;<span style="color: #000000;">0.0</span> &nbsp;<span style="color: #000000;">0.0</span> <span style="color: #000000;">227328</span> &nbsp;<span style="color: #000000;">2820</span> ? &nbsp; &nbsp; &nbsp; &nbsp;Sl &nbsp; <span style="color: #000000;">17</span>:<span style="color: #000000;">25</span> &nbsp; <span style="color: #000000;">0</span>:00 &nbsp;\_ <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>apache2 <span style="color: #660033;">-k</span> start<br />
www-data <span style="color: #000000;">23387</span> &nbsp;<span style="color: #000000;">0.0</span> &nbsp;<span style="color: #000000;">0.0</span> <span style="color: #000000;">227208</span> &nbsp;<span style="color: #000000;">2624</span> ? &nbsp; &nbsp; &nbsp; &nbsp;Sl &nbsp; <span style="color: #000000;">17</span>:<span style="color: #000000;">25</span> &nbsp; <span style="color: #000000;">0</span>:00 &nbsp;\_ <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>apache2 <span style="color: #660033;">-k</span> start</div></td></tr></tbody></table></div>
<p>In my case (Ubuntu), the user is www-data. Note : Your process could be named httpd instead of apache.</p>
<h3>Login with this user to see which directories causes problem.</h3>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">david@dragdroid:~$ </span><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #660033;">-i</span> <span style="color: #660033;">-u</span> www-data<br />
<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #c20cb9; font-weight: bold;">sudo</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> password <span style="color: #000000; font-weight: bold;">for</span> david: <br />
$ <span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">-l</span><br />
total <span style="color: #000000;">12</span><br />
<span style="color: #660033;">-rw-r--r--</span> <span style="color: #000000;">1</span> root &nbsp;root &nbsp; <span style="color: #000000;">177</span> <span style="color: #000000;">2011</span>-06-<span style="color: #000000;">29</span> <span style="color: #000000;">15</span>:<span style="color: #000000;">30</span> index.html<br />
lrwxrwxrwx <span style="color: #000000;">1</span> root &nbsp;root &nbsp; &nbsp;<span style="color: #000000;">43</span> <span style="color: #000000;">2011</span>-06-<span style="color: #000000;">29</span> <span style="color: #000000;">16</span>:<span style="color: #000000;">13</span> potdigger -<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>david<span style="color: #000000; font-weight: bold;">/</span>workspace<span style="color: #000000; font-weight: bold;">/</span>php<span style="color: #000000; font-weight: bold;">/</span>potdigger_backend<br />
$ <span style="color: #7a0874; font-weight: bold;">cd</span> potdigger<br />
cd: <span style="color: #000000;">2</span>: can<span style="color: #ff0000;">'t cd to potdigger<br />
$ cd /home/david/workspace/php/potdigger_backend<br />
cd: 3: can'</span>t <span style="color: #7a0874; font-weight: bold;">cd</span> to <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>david<span style="color: #000000; font-weight: bold;">/</span>workspace<span style="color: #000000; font-weight: bold;">/</span>php<span style="color: #000000; font-weight: bold;">/</span>potdigger_backend<br />
$ <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>david<span style="color: #000000; font-weight: bold;">/</span>workspace<span style="color: #000000; font-weight: bold;">/</span>php<br />
cd: <span style="color: #000000;">5</span>: can<span style="color: #ff0000;">'t cd to /home/david/workspace/php<br />
$ cd /home/david/workspace &nbsp; &nbsp;<br />
cd: 6: can'</span>t <span style="color: #7a0874; font-weight: bold;">cd</span> to <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>david<span style="color: #000000; font-weight: bold;">/</span>workspace<br />
$ <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>david <br />
$</div></td></tr></tbody></table></div>
<p>Now we see that we can get to /home/david without any problem. It&#8217;s the workspace/php/potdigger_backend path that it can&#8217;t access.</p>
<h3>Set the executable permission on these directories.</h3>
<p>Open a new terminal window (so that you use your logon user) and type :</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">david@dragdroid:~$ </span><span style="color: #7a0874; font-weight: bold;">pwd</span><br />
<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>david<br />
<span style="color: #666666;">david@dragdroid:~$ </span><span style="color: #c20cb9; font-weight: bold;">chmod</span> a+x workspace workspace<span style="color: #000000; font-weight: bold;">/</span>php workspace<span style="color: #000000; font-weight: bold;">/</span>php<span style="color: #000000; font-weight: bold;">/</span>potdigger_backend<br />
<span style="color: #666666;">david@dragdroid:~$</span></div></td></tr></tbody></table></div>
<h3>Verify that it works</h3>
<p>Use the first window (logged in as www_data) and type :</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>david<span style="color: #000000; font-weight: bold;">/</span>workspace<span style="color: #000000; font-weight: bold;">/</span>php<span style="color: #000000; font-weight: bold;">/</span>potdigger_backend<br />
$ <span style="color: #7a0874; font-weight: bold;">pwd</span><br />
<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>david<span style="color: #000000; font-weight: bold;">/</span>workspace<span style="color: #000000; font-weight: bold;">/</span>php<span style="color: #000000; font-weight: bold;">/</span>potdigger_backend</div></td></tr></tbody></table></div>
<h3>Reload the apache configuration, and boom!</h3>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">david@dragdroid:~$ </span><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>apache2 reload<br />
<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #c20cb9; font-weight: bold;">sudo</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> password <span style="color: #000000; font-weight: bold;">for</span> david: <br />
&nbsp;<span style="color: #000000; font-weight: bold;">*</span> Reloading web server config apache2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; apache2: Could not reliably determine the server<span style="color: #ff0000;">'s fully qualified domain name, using 127.0.1.1 for ServerName &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[ OK ]<br />
david@dragdroid:~$</span></div></td></tr></tbody></table></div>
<p>Here&#8217;s my vhost related config :</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">NameVirtualHost *:80<br />
&lt;VirtualHost *:80&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ServerName potdigger<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; DocumentRoot /var/www/potdigger<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;Directory /var/www/potdigger&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Options Indexes FollowSymLinks MultiViews<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AllowOverride All<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Order allow,deny<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; allow from all<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;/Directory&gt;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; ErrorLog ${APACHE_LOG_DIR}/potdigger-error.log<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; # Possible values include: debug, info, notice, warn, error, crit, alert, emerg.<br />
&nbsp; &nbsp; &nbsp; &nbsp; LogLevel &nbsp;warn<br />
&nbsp; &nbsp; &nbsp; &nbsp; CustomLog ${APACHE_LOG_DIR}/potdigger-access.log combined<br />
<br />
&lt;/VirtualHost&gt;</div></td></tr></tbody></table></div>
<h3> [EDIT June 30th 2011] For Fedora / Red Hat users</h3>
<p>When logging in using the apache user on my Fedora box, I would get a &#8220;This account is currently not available&#8221; error. So here&#8217;s what I did :</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #7a0874; font-weight: bold;">&#91;</span>david<span style="color: #000000; font-weight: bold;">@</span>H20 ~<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #007800;">$HOME</span><br />
<span style="color: #7a0874; font-weight: bold;">&#91;</span>david<span style="color: #000000; font-weight: bold;">@</span>H20 ~<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ <span style="color: #7a0874; font-weight: bold;">pwd</span><br />
<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>david<br />
<span style="color: #7a0874; font-weight: bold;">&#91;</span>david<span style="color: #000000; font-weight: bold;">@</span>H20 ~<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ <span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-ld</span> . workspace workspace<span style="color: #000000; font-weight: bold;">/</span>android workspace<span style="color: #000000; font-weight: bold;">/</span>android<span style="color: #000000; font-weight: bold;">/</span>intuitia workspace<span style="color: #000000; font-weight: bold;">/</span>android<span style="color: #000000; font-weight: bold;">/</span>intuitia<span style="color: #000000; font-weight: bold;">/</span>prototypes workspace<span style="color: #000000; font-weight: bold;">/</span>android<span style="color: #000000; font-weight: bold;">/</span>intuitia<span style="color: #000000; font-weight: bold;">/</span>prototypes<span style="color: #000000; font-weight: bold;">/</span>potdigger_backend workspace<span style="color: #000000; font-weight: bold;">/</span>android<span style="color: #000000; font-weight: bold;">/</span>intuitia<span style="color: #000000; font-weight: bold;">/</span>prototypes<span style="color: #000000; font-weight: bold;">/</span>potdigger_backend<span style="color: #000000; font-weight: bold;">/</span>trunk<br />
drwx------. <span style="color: #000000;">78</span> david david <span style="color: #000000;">4096</span> Jun <span style="color: #000000;">30</span> <span style="color: #000000;">16</span>:<span style="color: #000000;">38</span> .<br />
drwx------ &nbsp; <span style="color: #000000;">5</span> david david <span style="color: #000000;">4096</span> May &nbsp;<span style="color: #000000;">5</span> <span style="color: #000000;">12</span>:<span style="color: #000000;">42</span> workspace<br />
drwxrwxr-x &nbsp;<span style="color: #000000;">23</span> david david <span style="color: #000000;">4096</span> Jun <span style="color: #000000;">27</span> 05:<span style="color: #000000;">43</span> workspace<span style="color: #000000; font-weight: bold;">/</span>android<br />
drwxrwxr-x &nbsp; <span style="color: #000000;">4</span> david david <span style="color: #000000;">4096</span> May <span style="color: #000000;">27</span> <span style="color: #000000;">10</span>:<span style="color: #000000;">57</span> workspace<span style="color: #000000; font-weight: bold;">/</span>android<span style="color: #000000; font-weight: bold;">/</span>intuitia<br />
drwxrwxr-x &nbsp;<span style="color: #000000;">14</span> david david <span style="color: #000000;">4096</span> Jun <span style="color: #000000;">30</span> <span style="color: #000000;">16</span>:<span style="color: #000000;">37</span> workspace<span style="color: #000000; font-weight: bold;">/</span>android<span style="color: #000000; font-weight: bold;">/</span>intuitia<span style="color: #000000; font-weight: bold;">/</span>prototypes<br />
drwxrwxr-x &nbsp; <span style="color: #000000;">4</span> david david <span style="color: #000000;">4096</span> Jun <span style="color: #000000;">30</span> <span style="color: #000000;">16</span>:<span style="color: #000000;">37</span> workspace<span style="color: #000000; font-weight: bold;">/</span>android<span style="color: #000000; font-weight: bold;">/</span>intuitia<span style="color: #000000; font-weight: bold;">/</span>prototypes<span style="color: #000000; font-weight: bold;">/</span>potdigger_backend<br />
drwxrwxr-x &nbsp;<span style="color: #000000;">10</span> david david <span style="color: #000000;">4096</span> Jun <span style="color: #000000;">30</span> <span style="color: #000000;">16</span>:<span style="color: #000000;">37</span> workspace<span style="color: #000000; font-weight: bold;">/</span>android<span style="color: #000000; font-weight: bold;">/</span>intuitia<span style="color: #000000; font-weight: bold;">/</span>prototypes<span style="color: #000000; font-weight: bold;">/</span>potdigger_backend<span style="color: #000000; font-weight: bold;">/</span>trunk</div></td></tr></tbody></table></div>
<p>We can observe that /home/david (.) and /home/david/workspace directories lacks the executable bit.</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #7a0874; font-weight: bold;">&#91;</span>david<span style="color: #000000; font-weight: bold;">@</span>H20 ~<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ <span style="color: #c20cb9; font-weight: bold;">chmod</span> a+x . workspace</div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://www.davidlauzon.net/2011/06/apache-virtual-host-using-a-symlink-to-home-directory/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Howdy! Finally switched to WordPress!</title>
		<link>http://www.davidlauzon.net/2011/06/howdy-finally-switched-to-wordpress/</link>
		<comments>http://www.davidlauzon.net/2011/06/howdy-finally-switched-to-wordpress/#comments</comments>
		<pubDate>Sun, 26 Jun 2011 00:09:13 +0000</pubDate>
		<dc:creator>David On Laptop</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.davidlauzon.net/?p=120</guid>
		<description><![CDATA[I finally made it! Special thanks to Dave Murphy and Jacius for their instructions on migrating from Mephisto to WordPress. Now, I&#8217;ll be able to catchup with some articles!! Stay tuned!]]></description>
			<content:encoded><![CDATA[<p>I finally made it!</p>
<p>Special thanks to <a tittle="Migrated to WordPress" href="http://schwuk.com/articles/2008/02/21/migrated-to-wordpress/">Dave Murphy</a> and <a href="http://blog.jacius.info/2009/11/04/migrated-from-mephisto-to-wordpress/">Jacius</a> for their instructions on migrating from Mephisto to WordPress.</p>
<p>Now, I&#8217;ll be able to catchup with some articles!! Stay tuned!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidlauzon.net/2011/06/howdy-finally-switched-to-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Utilisation de GoogleMaps en Java</title>
		<link>http://www.davidlauzon.net/2011/01/utilisation-de-googlemaps-en-java/</link>
		<comments>http://www.davidlauzon.net/2011/01/utilisation-de-googlemaps-en-java/#comments</comments>
		<pubDate>Sun, 09 Jan 2011 14:30:53 +0000</pubDate>
		<dc:creator>David On Laptop</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[geocoding]]></category>
		<category><![CDATA[jambi]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[qt]]></category>
		<category><![CDATA[webservice]]></category>

		<guid isPermaLink="false">http://davidlauzon/?p=60</guid>
		<description><![CDATA[Introduction Cet article s&#8217;adresse aux développeurs cherchant à intégrer un système cartographique dans leur application Java. Vous trouverez ci-bas les résultats de mes recherches effectués lors de mes charges de laboratoire du cours Analyse et Conception de Logiciel à l&#8217;École de Technologie Supérieure (ÉTS). Survol des possibilités étudiées Voici un schéma qui résume les options possibles. La [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>Cet article s&#8217;adresse aux développeurs cherchant à intégrer un système cartographique dans leur application Java. Vous trouverez ci-bas les résultats de mes recherches effectués lors de mes charges de laboratoire du cours <a href="https://cours.etsmtl.ca/log210/">Analyse et Conception de Logiciel</a> à <a href="http://www.etsmtl.ca/">l&#8217;École de Technologie Supérieure (ÉTS)</a>.</p>
<h2>Survol des possibilités étudiées</h2>
<p>Voici un schéma qui résume les options possibles. La légende est la suivante : en vert les options faciles, en orange difficulté moyenne, en rouge non-recommandée, et en grisées les options non explorées lors de cette recherche.</p>
<p><img src="/uploads/2011/01/sommaire_gmap_options2.png" alt="" title="sommaire_gmap_options2" width="700" class="alignnone size-medium wp-image-65" />
</p>
<h2>Détails</h2>
<p>Voici un tableaux résumant les entrées et sorties pour chacune des méthodes :</p>
<table width="100%">
<tbody>
<tr>
<th>Méthode</th>
<th>Entrées</th>
<th>Sorties</th>
<th>Autres compétences requises</th>
</tr>
<tr>
<td>SWT</td>
<td>JavaScript ou URL</td>
<td>HTML</td>
<td></td>
</tr>
<tr>
<td>DJ NativeSwing</td>
<td>JavaScript ou URL</td>
<td>HTML</td>
<td></td>
</tr>
<tr>
<td>QT Jambi</td>
<td>JavaScript ou URL</td>
<td>HTML</td>
<td>QT</td>
</tr>
<tr>
<td>Projet Web</td>
<td>JavaScript ou URL</td>
<td>HTML</td>
<td>HTML, CSS, Programmation serveur (PHP,JSP,etc.)</td>
</tr>
<tr>
<td>Static Maps API + KML</td>
<td>KML</td>
<td>Image</td>
<td></td>
</tr>
<tr>
<td>Static Maps API + HTTP</td>
<td>String</td>
<td>Image</td>
<td>HTTP et (XML ou JSON)</td>
</tr>
<tr>
<td>GWT</td>
<td>String</td>
<td>HTML</td>
<td>Google Web Toolkit (GWT)</td>
</tr>
<tr>
<td>Flash</td>
<td>String</td>
<td>Flash</td>
<td>ActionScript (AS3)</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<h3>Navigateur web embarqué</h3>
<p>Dans cette solution, il s&#8217;agit d&#8217;utiliser un des différents contrôles Web existants et d&#8217;incorporer carrément un navigateur web dans l&#8217;application. Par la suite il suffit d&#8217;utiliser JavaScript ou d&#8217;envoyer les bons paramètres dans l&#8217;URL pour afficher les directions.</p>
<p>Si j&#8217;avais à construire une application de bureau professionnelle, je choisirait le <a href="http://code.google.com/apis/maps/documentation/flash/">Maps API for Flash</a> (via Adobe Air) si possible car la librairie est très stable ou j&#8217;explorerais les possibilités avec le <a href="http://www.google.com/mobile/maps/">Google Maps for Mobile</a> (<a href="http://www.java.com/en/java_in_action/google_maps.jsp">recommandé par Sun</a>) ou la <a href="http://worldwind.arc.nasa.gov/java/index.html">NASA World Wind</a> (<a href="http://worldwind.arc.nasa.gov/java/demos/">demos</a>)</p>
<h3>QT Jambi</h3>
<p>QT est une librairie graphique (<em>GUI framework</em>) c++, open source et multiplateforme (windows, mac, linux, mobile), développée par Nokia. QT Jambi est un &#8220;port&#8221; de la librairie QT pour Java. Pas besoin de QT pour utiliser QT Jambi, il suffit de télécharger les <a href="http://sourceforge.net/projects/qtjambi/files/4.5.2/">bindings pour votre système</a> et le <a href="http://qt.nokia.com/developer/eclipse-integration">QT Eclipse Integration for Jambi (Java) Plugin</a>. Notez que pour l&#8217;installation du plugin Eclipse sur Windows 64 bits, il faut télécharger les 2 fichiers mentionnés ci-haut en 32 bits.</p>
<p>Voir mon article précédent pour voir <a title="How to use QT Jambi from within Eclipse" href="/2010/02/how-to-use-qt-jambi-from-within-eclipse/">comment utiliser QT Jambi dans Eclipse</a></p>
<h3>Sortie HTML</h3>
<p>L&#8217;avantage d&#8217;avoir une sortie HTML est qu&#8217;il est possible de ré-utiliser les widgets du site de Google Maps. Par contre, l&#8217;intégration d&#8217;un navigateur embarqué dans les applications de bureau (ie: traditionnelle) frôle le <a href="http://code.google.com/apis/maps/faq.html#mapsformobile">bris de la license de Google</a>. Toutefois, cela est parfaitement légal pour la création d&#8217;un site internet.</p>
<h3>Maps Data API</h3>
<p>J&#8217;ai perdu plusieurs heures infructueuses avec l&#8217;API officielle de Google (<a href="http://code.google.com/apis/maps/documentation/mapsdata/">Maps Data API</a>, maintenant désuète). Les exemples officiels requièrent l&#8217;installation d&#8217;un grand nombre de librairies mal documentées &#8211; laissez-moi savoir si vous y arrivez. J&#8217;ai alors cherché pour un autre exemple qui me semblait complet (dont j&#8217;ai perdu l&#8217;adresse), mais sa compilation provoquait une erreur de signature dans l&#8217;appel d&#8217;une des classes de l&#8217;API.</p>
<h3>Point de départ pour la solution avec Microsoft</h3>
<p>(<a href="http://stackoverflow.com/questions/996954/java-api-for-google-maps-or-similar">source</a>) : Microsoft has a collaboration with USGS at <a rel="nofollow" href="http://terraserver-usa.com/">http://terraserver-usa.com/</a>. There is a <a rel="nofollow" href="http://terraserver-usa.com/webservices.aspx">freely available web service</a> with a <a rel="nofollow" href="http://terraserver-usa.com/TerraService2.asmx">WSDL</a>. You can use common Java WSDL binding libraries like <a rel="nofollow" href="http://ws.apache.org/axis2/">Axis</a> or <a rel="nofollow" href="http://cxf.apache.org/">CXF</a> to create java object to access the service.</p>
<h3>Static Maps API + HTTP</h3>
<p>Voici un extrait de code pour cette solution :</p>
<div class="codecolorer-container java blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br />64<br />65<br />66<br />67<br />68<br />69<br />70<br />71<br />72<br />73<br />74<br />75<br />76<br />77<br />78<br />79<br />80<br />81<br />82<br />83<br />84<br />85<br />86<br />87<br />88<br />89<br />90<br />91<br />92<br />93<br />94<br />95<br />96<br />97<br />98<br />99<br />100<br />101<br />102<br />103<br />104<br />105<br />106<br />107<br />108<br />109<br />110<br />111<br />112<br />113<br />114<br />115<br />116<br />117<br />118<br />119<br />120<br />121<br />122<br />123<br />124<br />125<br />126<br />127<br />128<br />129<br />130<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #008000; font-style: italic; font-weight: bold;">/**<br />
&nbsp;* Copyright (c) 2010, Maxime Caumartin, David Martineau<br />
&nbsp;* All rights reserved.<br />
&nbsp;* Redistribution and use in source and binary forms, with or without<br />
&nbsp;* modification, are permitted provided that the following conditions are met:<br />
&nbsp;*<br />
&nbsp;* &nbsp; &nbsp; * Redistributions of source code must retain the above copyright<br />
&nbsp;* &nbsp; &nbsp; &nbsp; notice, this list of conditions and the following disclaimer.<br />
&nbsp;* &nbsp; &nbsp; * Redistributions in binary form must reproduce the above copyright<br />
&nbsp;* &nbsp; &nbsp; &nbsp; notice, this list of conditions and the following disclaimer in the<br />
&nbsp;* &nbsp; &nbsp; &nbsp; documentation and/or other materials provided with the distribution.<br />
&nbsp;* &nbsp; &nbsp; * Neither the names of the developpers nor the<br />
&nbsp;* &nbsp; &nbsp; &nbsp; names of its contributors may be used to endorse or promote products<br />
&nbsp;* &nbsp; &nbsp; &nbsp; derived from this software without specific prior written permission.<br />
&nbsp;*<br />
&nbsp;* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY<br />
&nbsp;* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED<br />
&nbsp;* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE<br />
&nbsp;* DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY<br />
&nbsp;* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES<br />
&nbsp;* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;<br />
&nbsp;* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND<br />
&nbsp;* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT<br />
&nbsp;* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS<br />
&nbsp;* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.<br />
&nbsp;*/</span><br />
<span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">ca.etsmtl.log210.laboratoire1.GIS</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.awt.Dimension</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.awt.Image</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.awt.Toolkit</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.IOException</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.InputStreamReader</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.io.UnsupportedEncodingException</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.net.URL</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.net.URLConnection</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.net.URLEncoder</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.HashMap</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.LinkedHashMap</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">utilities.json.JSONArray</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">utilities.json.JSONException</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">utilities.json.JSONObject</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">utilities.json.JSONTokener</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">utilities.polylineEncoder.PolylineEncoder</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">utilities.polylineEncoder.Track</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">utilities.polylineEncoder.Trackpoint</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">ca.etsmtl.log210.laboratoire1.modele.GestionnaireGIS</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> GoogleMapProvider <span style="color: #000000; font-weight: bold;">implements</span> GestionnaireGIS <span style="color: #009900;">&#123;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">private</span> HashMap<span style="color: #339933;">&lt;</span><span style="color: #003399;">String</span>, String<span style="color: #339933;">&gt;</span> chose <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> LinkedHashMap<span style="color: #339933;">&lt;</span><span style="color: #003399;">String</span>, String<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">private</span> HashMap<span style="color: #339933;">&lt;</span><span style="color: #003399;">String</span>, String<span style="color: #339933;">&gt;</span> autreChose <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> HashMap<span style="color: #339933;">&lt;</span><span style="color: #003399;">String</span>, String<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">Dimension</span> dimmensionCarte<span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">URL</span> polyencodedMap<span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #666666; font-style: italic;">// [...]</span><br />
&nbsp; @Override<br />
&nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">Image</span> getImage<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">IOException</span>, InvalidLocalisationException <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #003399;">StringBuffer</span> b <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">StringBuffer</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">50</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #003399;">Image</span> img<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> s <span style="color: #339933;">:</span> chose.<span style="color: #006633;">keySet</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; b.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span>s<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">append</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>img <span style="color: #339933;">=</span> cache.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>b.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; JSONTokener token <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #003399;">URL</span> u<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #003399;">URLConnection</span> c<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">try</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #003399;">Track</span> t <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Track</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> getLieux<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">length</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; u <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">URL</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://maps.google.com/maps/nav?q=from:&quot;</span><span style="color: #339933;">+</span><span style="color: #003399;">URLEncoder</span>.<span style="color: #006633;">encode</span><span style="color: #009900;">&#40;</span>getLieux<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>, <span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #0000ff;">&quot;%20to:&quot;</span><span style="color: #339933;">+</span><span style="color: #003399;">URLEncoder</span>.<span style="color: #006633;">encode</span><span style="color: #009900;">&#40;</span>getLieux<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span>i<span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span>, <span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; c <span style="color: #339933;">=</span> u.<span style="color: #006633;">openConnection</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Je suis un navigateur web et mon nom est Firefox 3.6</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; c.<span style="color: #006633;">setRequestProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;User-Agent&quot;</span>, <span style="color: #0000ff;">&quot;Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2) Gecko/20100122 Fedora/3.6.1-1.fc13 Firefox/3.6&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; c.<span style="color: #006633;">setRequestProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Accept&quot;</span>, <span style="color: #0000ff;">&quot;text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; c.<span style="color: #006633;">setRequestProperty</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Accept-Language&quot;</span>, <span style="color: #0000ff;">&quot;fr-ca,en;q=0.5&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">InputStreamReader</span> ob <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">InputStreamReader</span> <span style="color: #009900;">&#40;</span>c.<span style="color: #006633;">getInputStream</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; token <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JSONTokener<span style="color: #009900;">&#40;</span>ob<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; JSONObject o <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> JSONObject<span style="color: #009900;">&#40;</span>token<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Dans le protocole HTTP, 200 signifie que notre requete a ete executee avec succes</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>o.<span style="color: #006633;">getJSONObject</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Status&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getInt</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;code&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #cc66cc;">200</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">throw</span> <span style="color: #000000; font-weight: bold;">new</span> InvalidLocalisationException<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; JSONArray arrDep <span style="color: #339933;">=</span> o.<span style="color: #006633;">getJSONArray</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Placemark&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; JSONObject o1 <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>JSONObject<span style="color: #009900;">&#41;</span> arrDep.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; t.<span style="color: #006633;">addTrackpoint</span><span style="color: #009900;">&#40;</span>getTractPointFromJSON<span style="color: #009900;">&#40;</span>o1<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; JSONArray dir <span style="color: #339933;">=</span> o.<span style="color: #006633;">getJSONObject</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Directions&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getJSONArray</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Routes&quot;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .<span style="color: #006633;">getJSONObject</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getJSONArray</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Steps&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> j <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span> <span style="color: #339933;">;</span> j <span style="color: #339933;">&lt;</span> dir.<span style="color: #006633;">length</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> j<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; t.<span style="color: #006633;">addTrackpoint</span><span style="color: #009900;">&#40;</span>getTractPointFromJSON<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>JSONObject<span style="color: #009900;">&#41;</span>dir.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>j<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; t.<span style="color: #006633;">addTrackpoint</span><span style="color: #009900;">&#40;</span>getTractPointFromJSON<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>JSONObject<span style="color: #009900;">&#41;</span>arrDep.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; HashMap<span style="color: #339933;">&lt;?</span>, <span style="color: #339933;">?&gt;</span> hm <span style="color: #339933;">=</span> PolylineEncoder.<span style="color: #006633;">createEncodings</span><span style="color: #009900;">&#40;</span>t, <span style="color: #cc66cc;">10</span>, <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; polyencodedMap <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">URL</span><span style="color: #009900;">&#40;</span>generatePolyencodedMapURL<span style="color: #009900;">&#40;</span>hm<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span>JSONException e<span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// TODO Auto-generated catch block</span><br />
&nbsp; &nbsp; &nbsp; e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; img <span style="color: #339933;">=</span> <span style="color: #003399;">Toolkit</span>.<span style="color: #006633;">getDefaultToolkit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">createImage</span><span style="color: #009900;">&#40;</span>polyencodedMap<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; cache.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span>b.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>, img<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> &nbsp;img<span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> generatePolyencodedMapURL<span style="color: #009900;">&#40;</span>HashMap<span style="color: #339933;">&lt;?</span>, <span style="color: #339933;">?&gt;</span> hm<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">UnsupportedEncodingException</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #003399;">String</span> polyEncURL<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//&quot;http://maps.google.com/maps/api/staticmap?sensor=false&amp;size=800x800&amp;markers=color:blue &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |label:D|H3C+1K3 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&amp;markers=color:blue &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|label:F|&lt;Destination!&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &amp;maptype=roadmap&amp;format=png32&amp;path=weight:5 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |color:blue &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|enc&quot;+hm.keySet().iterator().next().toString()</span><br />
&nbsp; &nbsp; polyEncURL <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://maps.google.com/maps/api/staticmap?sensor=false&amp;size=1280x1024&amp;&quot;</span><span style="color: #339933;">+</span>generatePolylineMarkers<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #0000ff;">&quot;maptype=roadmap&amp;format=png32&amp;path=weight:&quot;</span><span style="color: #339933;">+</span>getLargeurChemin<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #0000ff;">&quot;|color:&quot;</span><span style="color: #339933;">+</span>getCouleurChemin<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #0000ff;">&quot;|enc:&quot;</span> <span style="color: #339933;">+</span> hm.<span style="color: #006633;">values</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">iterator</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">next</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> polyEncURL<span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> generatePolylineMarkers<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">UnsupportedEncodingException</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #003399;">String</span> polyMarkers <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> getLieux<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; polyMarkers <span style="color: #339933;">=</span> polyMarkers <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;markers=color:&quot;</span><span style="color: #339933;">+</span>getCouleurMarqueur<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #0000ff;">&quot;|label:&quot;</span><span style="color: #339933;">+</span><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">chose</span>.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>getLieux<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #0000ff;">&quot;|&quot;</span><span style="color: #339933;">+</span><span style="color: #003399;">URLEncoder</span>.<span style="color: #006633;">encode</span><span style="color: #009900;">&#40;</span>getLieux<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>, <span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #0000ff;">&quot;&amp;#038;&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> polyMarkers<span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> Trackpoint getTractPointFromJSON<span style="color: #009900;">&#40;</span>JSONObject o1<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> JSONException<br />
&nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; JSONObject o2 <span style="color: #339933;">=</span> o1.<span style="color: #006633;">getJSONObject</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Point&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; JSONArray coor1 <span style="color: #339933;">=</span> o2.<span style="color: #006633;">getJSONArray</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;coordinates&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">new</span> Trackpoint<span style="color: #009900;">&#40;</span>coor1.<span style="color: #006633;">getDouble</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>, coor1.<span style="color: #006633;">getDouble</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>, coor1.<span style="color: #006633;">getDouble</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; @Override<br />
&nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> getLieux<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">int</span> i <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #003399;">String</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> tmpStringArray <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span>chose.<span style="color: #006633;">keySet</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">size</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> s <span style="color: #339933;">:</span> chose.<span style="color: #006633;">keySet</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; tmpStringArray<span style="color: #009900;">&#91;</span>i<span style="color: #339933;">++</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> s<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">return</span> tmpStringArray<span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; <span style="color: #666666; font-style: italic;">// [...]</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<h2>Références</h2>
<ul>
<li><a href="http://mapki.com/wiki/Google_Map_Parameters">Google Maps Parameters (quoi passer dans l&#8217;URL)</a></li>
<li><a href="http://code.google.com/apis/maps/documentation/javascript/">Google Maps JavaScript API v3</a></li>
<li><a href="http://code.google.com/apis/maps/documentation/directions/">Google Directions API</a></li>
<li><a href="http://code.google.com/apis/maps/documentation/staticmaps/">Google Static Maps API V2</a></li>
<li><a href="http://code.google.com/apis/maps/documentation/webservices/">Google Maps API Web Services</a></li>
<li><a href="http://code.google.com/apis/maps/documentation/geocoding/">Service de conversion d&#8217;une adresse en KML</a></li>
<li><a href="http://www.eclipse.org/swt/snippets/">SWT Code Snippets</a></li>
<li><a href="http://doc.qt.nokia.com/qtjambi-4.5.2_01/com/trolltech/qt/qtjambi-index.html">QT Jambi 4.5.2 Reference Documentation</a></li>
<li><a href="http://doc.qt.nokia.com/qtjambi-4.5.2_01/index.html">QT Jambi 4.5.2 API</a></li>
<li><a href="http://doc.qt.nokia.com/4.7/index.html">QT 4.7.1 Reference Documentation</a></li>
<li><a href="http://doc.qt.nokia.com/4.7/classes.html">QT 4.7.1 API</a></li>
<li><a href="http://claudiushauptmann.com/tutorial-google-maps-with-java-gwt-and-eclipse.html">Tutorial: Google Maps with Java, GWT and Eclipse</a></li>
<li><a href="http://djproject.sourceforge.net/ns/">DJ NativeSwing</a></li>
<li><a href="http://code.google.com/apis/maps/documentation/flash/">Google Maps API for Flash</a></li>
<li><a href="http://www.google.com/mobile/maps/">Google Maps for Mobile</a></li>
<li><a href="http://worldwind.arc.nasa.gov/java/index.html">NASA World Wind</a></li>
<li><a href="http://developer.mapquest.com/">MapQuest Developer Network</a></li>
<li><a href="http://www.microsoft.com/maps/developers/web.aspx">Microsoft Bing Maps Developer Resources</a></li>
</ul>
<h2>Crédits</h2>
<p>Merci à Maxime de Caumartin pour la contribution de son code Java pour le GoogleMapProvider, et aux autres étudiants pour leurs contributions.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidlauzon.net/2011/01/utilisation-de-googlemaps-en-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Use svn with Eclipse Galileo on Ubuntu 9.10</title>
		<link>http://www.davidlauzon.net/2010/02/use-svn-with-eclipse-galileo-on-ubuntu-9-10/</link>
		<comments>http://www.davidlauzon.net/2010/02/use-svn-with-eclipse-galileo-on-ubuntu-9-10/#comments</comments>
		<pubDate>Sat, 27 Feb 2010 14:25:25 +0000</pubDate>
		<dc:creator>David On Laptop</dc:creator>
				<category><![CDATA[Howtos]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[subclipse]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://davidlauzon/?p=55</guid>
		<description><![CDATA[After wasting a lot of time myself, I thought this could serve some other people&#8230; So here&#8217;s how I did it : First install the Subclipse plugin Run sudo eclipse (that will install plugins system-wide) Eclipse &#62; Install new software &#62; Add Name = &#8220;whatever&#8221; Location = http://subclipse.tigris.org/update_1.6.x OK Work with: &#8220;whatever&#8221; Select these to install [...]]]></description>
			<content:encoded><![CDATA[<p>After wasting a lot of time myself, I thought this could serve some other people&#8230;</p>
<p>So here&#8217;s how I did it :</p>
<ul>
<li>First install the Subclipse plugin
<ol>
<li>Run sudo eclipse (that will install plugins system-wide)</li>
<li>Eclipse &gt; Install new software &gt; Add</li>
<li>Name = &#8220;whatever&#8221;</li>
<li>Location = <strong>http://subclipse.tigris.org/update_1.6.x</strong></li>
<li>OK</li>
<li>Work with: &#8220;whatever&#8221;</li>
<li>Select these to install :
<ul>
<li>CollabNet Merge Client</li>
<li>Subclipse</li>
<li>Subclipse Integration for Mylyn 3.x</li>
<li>Subversion Client Adapter</li>
<li>Subversion JavaHL Native Library Adapter</li>
<li>Subversion Revision Graph</li>
</ul>
</li>
<li>If you get a &#8220;Subversion 1.6 contains a bug that causes Eclipse to crash &#8230;. GNOME keyring &#8230; we recommand &#8230; &#8220;, choose OK.</li>
</ol>
</li>
<li>Next install the Java bindings for SVN
<ol>
<li>sudo apt-get install libsvn-java</li>
<li>Eclipse &gt; Window &gt; Preferences &gt; Team &gt; SVN</li>
<li>If that triggers a &#8220;Failed to load JavaHL Library.&#8221; error, you need to add libsvnjavahl-1 in the Eclipse path :</li>
<li>Just throw a symlink into one of the path in the error message :</li>
<li>
<div class="codecolorer-container java blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sudo ln <span style="color: #339933;">-</span>s <span style="color: #339933;">/</span>usr<span style="color: #339933;">/</span>lib<span style="color: #339933;">/</span>jni<span style="color: #339933;">/</span>libsvnjavahl<span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span>.<span style="color: #006633;">so</span> <span style="color: #339933;">/</span>usr<span style="color: #339933;">/</span>lib<span style="color: #339933;">/</span>libsvnjavahl<span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span>.<span style="color: #006633;">so</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sudo ln <span style="color: #339933;">-</span>s <span style="color: #339933;">/</span>usr<span style="color: #339933;">/</span>lib<span style="color: #339933;">/</span>jni<span style="color: #339933;">/</span>libsvnjavahl<span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span>.<span style="color: #006633;">so</span>.0.0.0 <span style="color: #339933;">/</span>usr<span style="color: #339933;">/</span>lib<span style="color: #339933;">/</span>libsvnjavahl<span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span>.<span style="color: #006633;">so</span>.0.0.0</div></td></tr></tbody></table></div>
</li>
<li>Restart eclipse and step 3 should be solved.</li>
</ol>
</li>
<li>Perhaps you want to use SVN with existing checkout project ?
<ol>
<li>Right-click on your project in Eclipse</li>
<li>Team &gt; Share Project &gt; svn &gt; Validate Conneciton on Finish &gt; Finish</li>
</ol>
</li>
<li><a href="http://subclipse.tigris.org/servlets/ProjectProcess?pageID=rr1TIx">Screenshots of what you can do with Subclipse</a></li>
</ul>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidlauzon.net/2010/02/use-svn-with-eclipse-galileo-on-ubuntu-9-10/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>How to use QT Jambi from within Eclipse</title>
		<link>http://www.davidlauzon.net/2010/02/how-to-use-qt-jambi-from-within-eclipse/</link>
		<comments>http://www.davidlauzon.net/2010/02/how-to-use-qt-jambi-from-within-eclipse/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 14:16:46 +0000</pubDate>
		<dc:creator>David On Laptop</dc:creator>
				<category><![CDATA[Howtos]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[jambi]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[qt]]></category>

		<guid isPermaLink="false">http://davidlauzon/?p=53</guid>
		<description><![CDATA[This article is part 2/2 of using QT Jambi within Eclipse. Click here to read the first part of this article, &#8220;Getting started with QT Jambi on Linux&#8221;. The present article you will learn how to design forms within eclipse and structure your QT code using the MVC pattern : File &#62; New &#62; Other &#62; [...]]]></description>
			<content:encoded><![CDATA[<p>This article is part 2/2 of using QT Jambi within Eclipse. <a title="Getting started with QT Jambi on Linux" href="/2010/01/getting-started-with-qt-jambi-on-linux/">Click here to read the first part of this article, &#8220;Getting started with QT Jambi on Linux&#8221;</a>.</p>
<p>The present article you will learn how to design forms within eclipse and structure your QT code using the MVC pattern :</p>
<ol>
<li>File &gt; New &gt; Other &gt; Qt Jambi Project (Using Designer Form) <img src="/uploads/2010/2/21/jambi_new_project.jpg" alt="" width="421" height="300" /></li>
<li>Name it JambiWeb</li>
<li>Add a new QT Jambi Designer Form and ajust settings like on screenshot. <img src="/uploads/2010/2/21/jambi_new_template_class.jpg" alt="" width="421" height="371" /></li>
<li>This will create 3 files :<br />
<table>
<tbody>
<tr>
<th>File</th>
<th>Description</th>
</tr>
<tr>
<td>src/views/WebView.jui</td>
<td>XML used by the Designer</td>
</tr>
<tr>
<td>src/views/WebView.java</td>
<td>This is the view from the MVC concept, it displays the widgets contained in Ui_WebView.java</td>
</tr>
<tr>
<td>src/ui/views/Ui_WebView.java</td>
<td>Java file generated from the XML (you should not edit this file because it will be automatically replaced when you make changes to the form in the Designer). This file is more like a container for the widgets in the form, it does *not* displays the elements.</td>
</tr>
</tbody>
</table>
</li>
<li>Now in order to respect the MVC pattern, the view should not display itself, but rather we should have a controller to trigger the display of the view. Add WebController class in the controllers package and insert this code :
<div class="codecolorer-container java blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">controllers</span><span style="color: #339933;">;&amp;</span>nbsp<span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">views.WebView</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.trolltech.qt.gui.QApplication</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> WebController <span style="color: #009900;">&#123;</span><br />
<span style="color: #000000; font-weight: bold;">private</span> WebView webView<span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">private</span> Ui_WebView ui<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;">return</span> webView.<span style="color: #006633;">ui</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #000000; font-weight: bold;">new</span> WebController<span style="color: #009900;">&#40;</span>args<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">public</span> WebController<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
QApplication.<span style="color: #006633;">initialize</span><span style="color: #009900;">&#40;</span>args<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
webView <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> WebView<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
webView.<span style="color: #006633;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
initEvents<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
QApplication.<span style="color: #006633;">exec</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> initEvents<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
</li>
<li>Now delete the main() method in views/WebView.java, and the contents should be as follow:
<div class="codecolorer-container java blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">views</span><span style="color: #339933;">;&amp;</span>nbsp<span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.trolltech.qt.gui.*</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> WebView <span style="color: #000000; font-weight: bold;">extends</span> QMainWindow <span style="color: #009900;">&#123;</span><br />
<span style="color: #000000; font-weight: bold;">private</span> Ui_WebView ui <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Ui_WebView<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">public</span> Ui_WebView ui<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;">return</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">ui</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">public</span> WebView<span style="color: #009900;">&#40;</span>QWidget parent<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #000000; font-weight: bold;">super</span><span style="color: #009900;">&#40;</span>parent<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
ui.<span style="color: #006633;">setupUi</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: #339933;">;</span><br />
<br />
setWindowTitle<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;A custom browser for your application&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
</li>
<li>Next let&#8217;s design our interface</li>
<li>Open on views/WebView.jui and choose the &#8220;QT Designer UI Perspective&#8221;. This perspective should bring you a 3-tabbed panel on the right side of Eclipse view.</li>
<li>So choose &#8220;QT Object Inspector&#8221; tab and right click on your QMainWindow item and choose &#8220;add toolbar&#8221;. <img src="/uploads/2010/2/21/jambi_add_toolbar.jpg" alt="" width="1008" height="630" /></li>
<li>At the bottom of the screen, choose the &#8220;QT Action Editor&#8221; tab, and 2 actions (Reload, Stop), and drag &amp; drop them unto the toolbar you are designing.</li>
<li>Next choose &#8220;QT Widget Box&#8221; tab.</li>
<li>Add a QWebView widget and name it &#8220;browser&#8221; (using QT Object Inspector tab)</li>
<li>Add a QLineEdit widget anywhere in the window &#8211; we&#8217;ll add it to the toolbar manually.</li>
<li>Your view should be looking like this : <img src="/uploads/2010/2/21/jambi_add_action_to_toolbar.jpg" alt="" width="1008" height="630" /></li>
<li>Save WebView.jui and go back to the Java perspective to add these lines to views/WebView.java :
<div class="codecolorer-container java blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">public</span> WebView<span style="color: #009900;">&#40;</span>QWidget parent<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #666666; font-style: italic;">// ...</span><br />
ui.<span style="color: #006633;">toolBar</span>.<span style="color: #006633;">addWidget</span><span style="color: #009900;">&#40;</span> ui.<span style="color: #006633;">urlEdit</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
ui.<span style="color: #006633;">toolBar</span>.<span style="color: #006633;">setFloatable</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><br />
ui.<span style="color: #006633;">toolBar</span>.<span style="color: #006633;">setMovable</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><br />
<span style="color: #009900;">&#125;</span><span style="color: #339933;">&amp;</span>nbsp<span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">public</span> Signal0 closed <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Signal0<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
@Override<br />
<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #000066; font-weight: bold;">void</span> closeEvent<span style="color: #009900;">&#40;</span>QCloseEvent event<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">closed</span>.<span style="color: #006633;">emit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
</li>
<li>And let&#8217;s add code to handle the events in controllers/WebController.java :
<div class="codecolorer-container java blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> initEvents<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
ui<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">actionReload</span>.<span style="color: #006633;">triggered</span>.<span style="color: #006633;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>, <span style="color: #0000ff;">&quot;onReloadClicked()&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
ui<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">actionStop</span>.<span style="color: #006633;">triggered</span>.<span style="color: #006633;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>, <span style="color: #0000ff;">&quot;onStopClicked()&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;&amp;</span>nbsp<span style="color: #339933;">;</span><br />
<br />
ui<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">urlEdit</span>.<span style="color: #006633;">returnPressed</span>.<span style="color: #006633;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>, <span style="color: #0000ff;">&quot;onUrlEditReturnPressed()&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
ui<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">browser</span>.<span style="color: #006633;">loadStarted</span>.<span style="color: #006633;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>, <span style="color: #0000ff;">&quot;onLoadStarted()&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
ui<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">browser</span>.<span style="color: #006633;">loadProgress</span>.<span style="color: #006633;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>, <span style="color: #0000ff;">&quot;onLoadProgress(int)&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
ui<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">browser</span>.<span style="color: #006633;">loadFinished</span>.<span style="color: #006633;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>, <span style="color: #0000ff;">&quot;onLoadDone()&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
ui<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">browser</span>.<span style="color: #006633;">urlChanged</span>.<span style="color: #006633;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>, <span style="color: #0000ff;">&quot;onUrlChanged(QUrl)&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
webView.<span style="color: #006633;">closed</span>.<span style="color: #006633;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>, <span style="color: #0000ff;">&quot;onClosed()&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> openURL<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #003399;">String</span> text <span style="color: #339933;">=</span> ui<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">urlEdit</span>.<span style="color: #006633;">text</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>text.<span style="color: #006633;">indexOf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;://&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><br />
text <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://&quot;</span> <span style="color: #339933;">+</span> text<span style="color: #339933;">;</span><br />
<br />
ui<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">browser</span>.<span style="color: #006633;">load</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> QUrl<span style="color: #009900;">&#40;</span>text<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> onReloadClicked<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
ui<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">browser</span>.<span style="color: #006633;">reload</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> onStopClicked<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
ui<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">browser</span>.<span style="color: #006633;">stop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> onUrlEditReturnPressed<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
openURL<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> onUrlChanged<span style="color: #009900;">&#40;</span>QUrl url<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
ui<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">urlEdit</span>.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span>url.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> onLoadStarted<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
ui<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">statusbar</span>.<span style="color: #006633;">showMessage</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Starting to load: &quot;</span> <span style="color: #339933;">+</span> ui<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">urlEdit</span>.<span style="color: #006633;">text</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> onLoadDone<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
ui<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">statusbar</span>.<span style="color: #006633;">showMessage</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Loading done...&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> onLoadProgress<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> x<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
ui<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">statusbar</span>.<span style="color: #006633;">showMessage</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Loading: &quot;</span> <span style="color: #339933;">+</span> x <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; %&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> onClosed<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
ui<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">browser</span>.<span style="color: #006633;">loadProgress</span>.<span style="color: #006633;">disconnect</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: #339933;">;</span><br />
ui<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">browser</span>.<span style="color: #006633;">loadFinished</span>.<span style="color: #006633;">disconnect</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: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
</li>
<li>In the code above you have an exemple of a custom signal (QT&#8217;s observer/observable pattern). Here is how it works : when
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">QMainWindow::closeEvent()</div></td></tr></tbody></table></div>
<p>is triggered by QT when the user closes the app, we then delegates the information to the WebController via the signal </p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">WebView::closed</div></td></tr></tbody></table></div>
<p>. For more details refer to <a href="http://qt.nokia.com/doc/qtjambi-4.5.2_01/com/trolltech/qt/qtjambi-signalsandslots.html">QT Jambi article on signals &amp; slots</a>.</li>
</ol>
<p>But wait a minute! Cool application use icons not text in the toolbar! Yes you can!</p>
<ol>
<li>Download these two images (<img src="/uploads/2010/2/21/refresh32.png" alt="" /> , <img src="/uploads/2010/2/21/stop32.png" alt="" />) and save them in a directory named &#8220;images&#8221; in your eclipse project.</li>
<li>Next add your images directory in your classpath: Project &gt; Properties &gt; Java Build Path &gt; Librairies &gt; Add Class Folder = &#8220;images&#8221;</li>
<li>Add set the icon manually in views/WebView.java :
<div class="codecolorer-container java blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">public</span> WebView<span style="color: #009900;">&#40;</span>QWidget parent<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #666666; font-style: italic;">// ...</span><br />
ui.<span style="color: #006633;">actionReload</span>.<span style="color: #006633;">setIcon</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> QIcon<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;classpath:/refresh32.png&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
ui.<span style="color: #006633;">actionStop</span>.<span style="color: #006633;">setIcon</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> QIcon<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;classpath:/stop32.png&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
</li>
<li>Read on the <a href="http://qt.nokia.com/doc/qtjambi-4.5.2_01/com/trolltech/qt/qtjambi-resourcesystemoverview.html">QT Resource system</a> to understand how this works.</li>
</ol>
<p>Here you go! I hope this article will be usefull to someone!</p>
<h2>Source code</h2>
<p><a href="/uploads/2010/2/21/JambiWeb.zip">final source code for this application</a></p>
<h2>Credits</h2>
<ul>
<li><a href="http://qt.nokia.com/doc/qtjambi-4.5.2_01/com/trolltech/qt/qtjambi-hellowebkit-code.html">http://qt.nokia.com/doc/qtjambi-4.5.2_01/com/trolltech/qt/qtjambi-hellowebkit-code.html</a></li>
<p><a href="http://qt.nokia.com/doc/qtjambi-4.5.2_01/com/trolltech/qt/qtjambi-hellowebkit-code.html"></a></p>
<li><a href="http://qt.nokia.com/doc/qtjambi-4.5.2_01/com/trolltech/qt/qtjambi-hellowebkit-code.html"></a><a href="http://qt.nokia.com/doc/qtjambi-4.5.2_01/com/trolltech/qt/qtjambi-resourcesystem.html">http://qt.nokia.com/doc/qtjambi-4.5.2_01/com/trolltech/qt/qtjambi-resourcesystem.html</a></li>
</ul>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidlauzon.net/2010/02/how-to-use-qt-jambi-from-within-eclipse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting started with QT Jambi on Linux</title>
		<link>http://www.davidlauzon.net/2010/01/getting-started-with-qt-jambi-on-linux/</link>
		<comments>http://www.davidlauzon.net/2010/01/getting-started-with-qt-jambi-on-linux/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 14:04:09 +0000</pubDate>
		<dc:creator>David On Laptop</dc:creator>
				<category><![CDATA[Howtos]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[jambi]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[qt]]></category>

		<guid isPermaLink="false">http://davidlauzon/?p=47</guid>
		<description><![CDATA[In this article I&#8217;ll explain how to install QT Jambi and write your first Hello world program. Installation of QT Jambi SDK Quick Overview of the SDK Integration with Eclipse Your first Jambi Program Jambi Links Installation of QT Jambi SDK First, you need to download the &#8220;Qt Jambi &#8211; Java bindings Binaries&#8221; for your [...]]]></description>
			<content:encoded><![CDATA[<p>In this article I&#8217;ll explain how to install QT Jambi and write your first Hello world program.</p>
<ol>
<li>Installation of QT Jambi SDK</li>
<li>Quick Overview of the SDK</li>
<li>Integration with Eclipse</li>
<li>Your first Jambi Program</li>
<li>Jambi Links</li>
</ol>
<h2>Installation of QT Jambi SDK</h2>
<p>First, you need to download the &#8220;Qt Jambi &#8211; Java bindings Binaries&#8221; for your OS (about 100MB), get it from <a href="http://qt.nokia.com/downloads">here</a>. Since I am using Ubuntu, the following instructions will be for Linux. You can extract the archive where you want, but remember the path because we&#8217;ll need it later on &#8211; I&#8217;ll refer to ita s JAMBI_PATH (/usr/local/lib/qtjambi-linux32-lgpl-4.5.2_01 in this example).</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xzf</span> qtjambi-linux32-lgpl-4.5.2_01.tar.gz<br />
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">mv</span> qtjambi-linux32-lgpl-4.5.2_01 <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span></div></td></tr></tbody></table></div>
<p>Next we need to create a script to get QT Designer to generate .jui files for Java (instead QT/C++ .ui files). Name it jambi-designer.sh and insert the following code:</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #7a0874; font-weight: bold;">cd</span> JAMBI_PATH<br />
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">CLASSPATH</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">pwd</span><span style="color: #000000; font-weight: bold;">`/</span>qtjambi-4.5.2_01.jar:<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">pwd</span><span style="color: #000000; font-weight: bold;">`/</span>qtjambi-examples-4.5.2_01.jar:<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">pwd</span><span style="color: #000000; font-weight: bold;">`/</span>qtjambi-linux32-gcc-4.5.2_01.jar<br />
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">JAVADIR</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>jvm<span style="color: #000000; font-weight: bold;">/</span>java-<span style="color: #000000;">6</span>-sun<span style="color: #000000; font-weight: bold;">/</span>jre<br />
.<span style="color: #000000; font-weight: bold;">/</span>designer.sh</div></td></tr></tbody></table></div>
<p>Make it executable and make it available in your path. Copy also the juic (jambi user interface compiler) which is used to convert the files generated by the Designer to java code.</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">chmod</span> a+x jambi-designer.sh<br />
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>JAMBI_PATH<span style="color: #000000; font-weight: bold;">/</span>jambi-designer.sh &nbsp;<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>jambi-designer<br />
<span style="color: #c20cb9; font-weight: bold;">cp</span> bin<span style="color: #000000; font-weight: bold;">/</span>juic <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><br />
<span style="color: #666666; font-style: italic;"># try it :</span><br />
jambi-designer &nbsp;<span style="color: #000000; font-weight: bold;">&amp;</span></div></td></tr></tbody></table></div>
<h2>Quick Overview of the SDK</h2>
<p>So here you go you got the SDK installed. Now what are these files, do i need to install this huge file on every computer my program will run unto?? Obviously not!</p>
<p>Well here, you to remember that when you&#8217;ll distribute your application, you&#8217;ll need to bundle it with the Jambi core package (qtjambi-4.5.2_01.jar) and the jambi os-dependant package (qtjambi-linux32-gcc-4.5.2_01.jar). That&#8217;s it!</p>
<p>If you want the application to run on Windows as well, you only need to add one jar file per os (you&#8217;ll need to download the whole sdk just to get the .jar your need for each os).</p>
<p>What else am I getting?</p>
<table>
<tbody>
<tr>
<th>Directory / file</th>
<th>Details</th>
</tr>
<tr>
<td>bin</td>
<td>Designer and UI Compiler binaries</td>
</tr>
<tr>
<td>com/trolltech/</td>
<td>Jambi Core &amp; Examples Source code</td>
</tr>
<tr>
<td>doc/</td>
<td>Jambi HTML Documentation (use your browser)</td>
</tr>
<tr>
<td>qtjambi.sh</td>
<td>Execute this script to view the numeros code samples</td>
</tr>
</tbody>
</table>
<p><img src="http://www.davidlauzon.net/assets/2010/2/21/jambi_examples.jpg" alt="" width="442" height="354" /></p>
<p>&nbsp;</p>
<h2>Integration with Eclipse</h2>
<p>So you want code auto-completion for Jambi classes in Eclipse? You&#8217;re dreaming! Nope, actually you can! Just download the &#8220;eclipse integration package&#8221; and extract it in the plugin directory of your Eclipse installation.</p>
<p>Note : I haven&#8217;t been able to install the integration plugin with default Eclipse package in Kubuntu 9.10 because it does not allow you to add plugins as root. So to get around this, just uninstall it from the package manager and install it manually (get <a href="http://www.eclipse.org/downloads/">eclipse here</a>).</p>
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xzf</span> eclipse-java-galileo-SR1-linux-gtk.tar.gz<br />
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">mv</span> eclipse <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>eclipse-3.5.1<br />
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>eclipse-3.5.1<br />
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xzf</span> <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>qtjambi-eclipse-integration-linux32-4.5.2_01.tar.gz<br />
.<span style="color: #000000; font-weight: bold;">/</span>eclipse <span style="color: #660033;">-clean</span></div></td></tr></tbody></table></div>
<p>Next on Eclipse restart, go to Window &gt; Preferences &gt; QT Jambi Preference Page and use these settings :</p>
<ul>
<li>Jambi Location = where you installed the first archive (JAMBI_PATH)</li>
<li>Generate files in separate folder = src/ui</li>
</ul>
<p>&nbsp;</p>
<h2>Your first Jambi Program</h2>
<ol>
<li>Click on File &gt; New &gt; Other &gt; QT Jambi Project.</li>
<li>Add a new class named &#8220;HelloWorld&#8221; and insert this code:</li>
<li>
<div class="codecolorer-container java blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br /></div></td><td><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.trolltech.qt.gui.*</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> HelloWorld <span style="color: #000000; font-weight: bold;">extends</span> QWidget<span style="color: #009900;">&#123;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #666666; font-style: italic;">// Instanciates a Jambi Application and pass it the command-line arguments to allow the QApplication</span><br />
<span style="color: #666666; font-style: italic;">// static instance to handle the arguments it recognizes, such as -font and -style.</span><br />
QApplication.<span style="color: #006633;">initialize</span><span style="color: #009900;">&#40;</span>args<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">// Creates an instance of our QWidget (could be also a QMainWindow, QDialog, etc.)</span><br />
<span style="color: #666666; font-style: italic;">// and set the parent to null</span><br />
HelloWorld helloWorld <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> HelloWorld<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">// Create a new label and sets its parent to our view.</span><br />
QLabel label <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> QLabel<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Ping World!&quot;</span>, helloWorld<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">// Show our view</span><br />
helloWorld.<span style="color: #006633;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">// Execute Jambi Application</span><br />
QApplication.<span style="color: #006633;">exec</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">public</span> HelloWorld<span style="color: #009900;">&#40;</span>QWidget parent<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #000000; font-weight: bold;">super</span><span style="color: #009900;">&#40;</span>parent<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
</li>
</ol>
<p>&nbsp;</p>
<h2>Jambi Links</h2>
<ul>
<li><a href="http://qt.nokia.com/doc/qtjambi-4.5.2_01/com/trolltech/qt/qtjambi-index.html">Jambi Documentation</a> (&#8220;Signals and Slots&#8221; is a recommanded reading)</li>
<li><a href="http://qt.nokia.com/doc/qtjambi-4.5.2_01/index.html">Jambi Classes javadoc</a></li>
<li><a href="file:///usr/local/lib/qtjambi-linux32-lgpl-4.5.2_01/doc/html/index.html">file:///usr/local/lib/qtjambi-linux32-lgpl-4.5.2_01/doc/html/index.html</a> (same as above but on your computer)</li>
<li><a href="http://doc.trolltech.com/4.5/index.html">C++ QT Documentation</a> (the API is the same and sometimes you find more information than on Jambi)</li>
<li><a href="http://www.informit.com/articles/article.aspx?p=1405564">Getting Started Article by Jasmin Blanchette</a> (including a part on how to integrate C++ components with QT Jambi)</li>
<li><a href="http://qt.nokia.com/doc/qtjambi-4.5.2_01/com/trolltech/qt/qtjambi-examples.html">Jambi Examples</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.davidlauzon.net/2010/01/getting-started-with-qt-jambi-on-linux/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>MS SQL Server 2008 with PHP</title>
		<link>http://www.davidlauzon.net/2009/02/ms-sql-server-2008-with-php/</link>
		<comments>http://www.davidlauzon.net/2009/02/ms-sql-server-2008-with-php/#comments</comments>
		<pubDate>Wed, 18 Feb 2009 13:59:49 +0000</pubDate>
		<dc:creator>David On Laptop</dc:creator>
				<category><![CDATA[Howtos]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[sql server]]></category>

		<guid isPermaLink="false">http://davidlauzon/?p=43</guid>
		<description><![CDATA[I personally choose not to use Micro$oft products when it is possible, but sometimes the choice is not given. For these unfortunate who have to deal with SQL Server 2008 (or 2005), here is how to get around without too many swear words and avoid licensing costs. Requirements Windows Vista (Win XP should do also) [...]]]></description>
			<content:encoded><![CDATA[<p>I personally choose not to use Micro$oft products when it is possible, but sometimes the choice is not given. For these unfortunate who have to deal with SQL Server 2008 (or 2005), here is how to get around without too many swear words and avoid licensing costs.</p>
<h4>Requirements</h4>
<ul>
<li>Windows Vista (Win XP should do also)</li>
<li>.Net Framework 3.5 SP1</li>
<li>Windows Installer 4.5</li>
<li>Windows PowerShell 1.0</li>
<li>MS Core XML Services (MSXML) 6.0</li>
</ul>
<p>Note: You need to have genuine windows copy to download PowerShell from Microsoft website; however it is possible to find it elsewhere if you google around.</p>
<h4>Setup SQL Server</h4>
<ol>
<li>Download and install <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=B5D1B8C3-FDA5-4508-B0D0-1311D670E336&amp;displaylang=en">MS SQL Server Express 2008 with Advanced Services</a> and choose the following options:</li>
<li><strong>Single instance</strong> Install (not clustered !)</li>
<li>Name the instance &#8220;SQLExpress&#8221;</li>
<li>In the options box choose &#8220;SQL Server&#8221;, and &#8220;<strong>Management Studio</strong>&#8221; (do not install full-text search, as it requires clustering)</li>
<li>Set the <strong>Server Service Account Name</strong> to &#8220;NT AUTHORITY\NETWORK SERVICE&#8221;, auto</li>
<li>Set the <strong>SQL Server Browser</strong> to &#8220;NT AUTHORITY\NETWORK SERVICE&#8221;, manual</li>
<li>Choose <strong>mixed mode authentication</strong></li>
<li>Set SQL Server to listen on TCP port.
<ol>
<li>Start &#8220;SQL Server Configuration Manager&#8221;</li>
<li>Network Configuration -&gt; Protocols : <strong>enable &#8220;Named Pipes&#8221; and &#8220;TCP/IP&#8221;</strong></li>
<li>Right-click &#8220;TCP/IP&#8221; -&gt; Listen All = Yes&#8221;</li>
<li>In tab &#8220;IP addresses&#8221; -&gt; Section IPAll -&gt; <strong>TCP Dynamic Ports = 1433</strong></li>
<li>Repeat these steps for SQL Native Client.</li>
<li>Restart SQL Server</li>
</ol>
</li>
<li>Create your database and set the owner to user &#8216;sa&#8217;, and change the user sa password.</li>
</ol>
<h4>Setup PHP</h4>
<p>This assumes you have wamp installed, otherwise just change the path.</p>
<ol>
<li>Download the good version of <a href="http://webzila.com/dll/1/ntwdblib.zip">ntwdblib.dll (2000.80.194.0)</a></li>
<li>Overwrite C:\wamp\bin\apache\apache2.2.8\bin\ntwdblib.dll</li>
<li>Overwrite C:\wamp\bin\php\php5.2.6\ntwdblib.dll</li>
<li>Enable <strong>php_mssql.dll</strong> in php.ini</li>
<li>Restart Apache
<div class="codecolorer-container php blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$server</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'BANGKOK\SQLEXPRESS'</span><span style="color: #339933;">;</span> &nbsp;<span style="color: #666666; font-style: italic;">// The format is &quot;HOST\SERVERNAME[,PORT]&quot;</span><br />
<span style="color: #000088;">$username</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'sa'</span><span style="color: #339933;">;</span><br />
<span style="color: #990000;">mssql_connect</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$server</span><span style="color: #339933;">,</span> <span style="color: #000088;">$username</span><span style="color: #339933;">,</span> <span style="color: #000088;">$password</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
</li>
</ol>
<h4>Debugging</h4>
<ul>
<li>You can test if SQL Server is listening on port 1433 by using <a href="http://nmap.org/download.html">NMap/Zenmap for Windows</a> to do an &#8220;Intense scan, all TCP ports&#8221; on localhost, and you should see port 1433 open.</li>
<li>When trying to log within PHP you should see an entry in the log file:
<pre>c:\program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL\Log\ERRORLOG</pre>
</li>
</ul>
<p>I hope this will save you some time and swears!</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidlauzon.net/2009/02/ms-sql-server-2008-with-php/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Capistrano 2 Recipe for Dreamhost Shared Hosting and mod_rails</title>
		<link>http://www.davidlauzon.net/2008/06/capistrano-2-recipe-for-dreamhost-shared-hosting-and-mod_rails/</link>
		<comments>http://www.davidlauzon.net/2008/06/capistrano-2-recipe-for-dreamhost-shared-hosting-and-mod_rails/#comments</comments>
		<pubDate>Mon, 30 Jun 2008 12:30:37 +0000</pubDate>
		<dc:creator>David On Laptop</dc:creator>
				<category><![CDATA[Howtos]]></category>
		<category><![CDATA[capistrano]]></category>
		<category><![CDATA[dreamhost]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://davidlauzon/?p=34</guid>
		<description><![CDATA[Introduction I could not find an updated documentation on how to setup properly a rails application on Dreamhost, so I thought I&#8217;d share the information I gathered.. First off, thanks to the Phusion team, with Passenger (a.k.a. mod_rails), it&#8217;s now very convenient, easy, and cheap to run a rails application on Dreamhost. Also, special thanks to Todd [...]]]></description>
			<content:encoded><![CDATA[<h4>Introduction</h4>
<p>I could not find an updated documentation on how to setup properly a rails application on Dreamhost, so I thought I&#8217;d share the information I gathered.. First off, thanks to the Phusion team, with <a href="http://www.modrails.com/" target="_blank">Passenger (a.k.a. mod_rails)</a>, it&#8217;s now very convenient, easy, and cheap to run a rails application on Dreamhost.</p>
<p>Also, special thanks to <a href="http://gabrito.com/" target="_blank">Todd Huss</a> for discovering the <a href="http://gabrito.com/post/ruby-on-rails-dreamhost-plugin" target="_blank">multi dreamhost user hack</a>. Basically, you need to run each of your rails application on Dreamhost under a different shell user. Their process monitor, will start killing your processes when the total memory per user exceeds 200 MB of virtual memory (VSZ).</p>
<p>So here&#8217;s the guide, even perfect newbees and skript-kiddies should be able to follow :</p>
<h4>The complete step by step</h4>
<p><strong>INFO</strong> : Let Capistrano create the directory structure on the server BEFORE you set the public dir of your application in the edit domain section of the Control Panel. This will avoid you conflicts when Capistrano attemps to create the symlinks.</p>
<ol>
<li>First, configure your new rails application using Dreamhost Control Panel :
<ol>
<li>Create a new repository for your application (<a href="http://www.davidlauzon.net/assets/2008/6/30/dreamhost_create_repository.jpg">screenshot</a>)</li>
<li>Create a new shell / SSH user (read why <a href="http://gabrito.com/post/ruby-on-rails-dreamhost-plugin" target="_blank">here</a>) with the same name as your application (<a href="http://www.davidlauzon.net/assets/2008/6/30/dreamhost_create_user.jpg">screenshot</a>)</li>
<li>Create a new database (<a href="http://www.davidlauzon.net/assets/2008/6/30/dreamhost_create_database.jpg">screenshot</a>)</li>
</ol>
<p>&nbsp;</li>
<li>Add your application to your repository
<ol>
<li>Create your rails skeleton (if it&#8217;s done yet), on your local machine (assuming you use *nix, but should be similar on Windows)
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">$ </span>rails myrailsapp <span style="color: #660033;">--freeze</span></div></td></tr></tbody></table></div>
</li>
<li>Add your application to the repository
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #7a0874; font-weight: bold;">cd</span> myrailsapp<br />
$ <span style="color: #c20cb9; font-weight: bold;">svn mkdir</span> http:<span style="color: #000000; font-weight: bold;">//</span>svn.myrailsappdomain<span style="color: #000000; font-weight: bold;">/</span>myrails<span style="color: #000000; font-weight: bold;">/</span>trunk<br />
$ <span style="color: #c20cb9; font-weight: bold;">svn checkout</span> http:<span style="color: #000000; font-weight: bold;">//</span>svn.myrailsappdomain<span style="color: #000000; font-weight: bold;">/</span>myrails<span style="color: #000000; font-weight: bold;">/</span>trunk .<span style="color: #000000; font-weight: bold;">/</span><br />
$ <span style="color: #c20cb9; font-weight: bold;">svn add</span> &nbsp;<span style="color: #000000; font-weight: bold;">*</span><br />
$ <span style="color: #c20cb9; font-weight: bold;">svn commit</span></div></td></tr></tbody></table></div>
</li>
<li>Exclude database configuration, temporary files, and any user upload directory from the source control :
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">svn copy</span> config<span style="color: #000000; font-weight: bold;">/</span>database.yml config<span style="color: #000000; font-weight: bold;">/</span>database.yml.example<br />
$ <span style="color: #c20cb9; font-weight: bold;">svn remove</span> config<span style="color: #000000; font-weight: bold;">/</span>database.yml <span style="color: #660033;">-f</span><br />
$ <span style="color: #c20cb9; font-weight: bold;">svn propset</span> svn:ignore <span style="color: #ff0000;">&quot;database.yml&quot;</span> config<span style="color: #000000; font-weight: bold;">/</span><br />
$ <span style="color: #c20cb9; font-weight: bold;">svn remove</span> tmp<span style="color: #000000; font-weight: bold;">/*</span><br />
$ <span style="color: #c20cb9; font-weight: bold;">svn propset</span> svn:ignore <span style="color: #ff0000;">&quot;*&quot;</span> tmp<span style="color: #000000; font-weight: bold;">/</span><br />
<span style="color: #666666; font-style: italic;"># If you need to share unversionned user-uploaded files, between deploys :</span><br />
$ <span style="color: #c20cb9; font-weight: bold;">mkdir</span> public<span style="color: #000000; font-weight: bold;">/</span>uploads<br />
$ <span style="color: #c20cb9; font-weight: bold;">svn add</span> public<span style="color: #000000; font-weight: bold;">/</span>uploads<br />
$ <span style="color: #c20cb9; font-weight: bold;">svn propset</span> svn:ignore <span style="color: #ff0000;">&quot;*&quot;</span> public<span style="color: #000000; font-weight: bold;">/</span>uploads<span style="color: #000000; font-weight: bold;">/</span><br />
$ <span style="color: #c20cb9; font-weight: bold;">svn remove</span> log<span style="color: #000000; font-weight: bold;">/*</span><br />
$ <span style="color: #c20cb9; font-weight: bold;">svn propset</span> svn:ignore <span style="color: #ff0000;">&quot;*&quot;</span> log<span style="color: #000000; font-weight: bold;">/</span><br />
$ <span style="color: #c20cb9; font-weight: bold;">svn remove</span> db<span style="color: #000000; font-weight: bold;">/*</span>.sqlite3<br />
$ <span style="color: #c20cb9; font-weight: bold;">svn propset</span> svn:ignore <span style="color: #ff0000;">&quot;*.sqlite3&quot;</span> db<span style="color: #000000; font-weight: bold;">/</span><br />
$ <span style="color: #c20cb9; font-weight: bold;">svn commit</span></div></td></tr></tbody></table></div>
</li>
</ol>
</li>
<li>Next, create the Capistrano recipe :
<ol>
<li>Create recipe skeleton :
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>your<span style="color: #000000; font-weight: bold;">/</span>myrailsapp<br />
$ capify .<br />
<span style="color: #7a0874; font-weight: bold;">&#91;</span>add<span style="color: #7a0874; font-weight: bold;">&#93;</span> writing <span style="color: #000000; font-weight: bold;">`</span>.<span style="color: #000000; font-weight: bold;">/</span>Capfile<span style="color: #ff0000;">'<br />
[add] writing `./config/deploy.rb'</span><br />
<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000; font-weight: bold;">done</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> capified<span style="color: #000000; font-weight: bold;">!</span></div></td></tr></tbody></table></div>
</li>
<li>Replace the content of config/deploy.rb with the following :
<div class="codecolorer-container ruby blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br /></div></td><td><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#008000; font-style:italic;">#############################################################</span><br />
<span style="color:#008000; font-style:italic;">## General</span><br />
<span style="color:#008000; font-style:italic;">#############################################################</span><br />
set <span style="color:#ff3333; font-weight:bold;">:application</span>, <span style="color:#996600;">&quot;myrailsapp&quot;</span><span style="color:#006600; font-weight:bold;">&amp;</span>nbsp;<br />
<br />
<span style="color:#008000; font-style:italic;">#############################################################</span><br />
<span style="color:#008000; font-style:italic;">## Servers</span><br />
<span style="color:#008000; font-style:italic;">#############################################################</span><br />
set <span style="color:#ff3333; font-weight:bold;">:use_sudo</span>, <span style="color:#0000FF; font-weight:bold;">false</span> &nbsp; &nbsp;<span style="color:#008000; font-style:italic;"># Dreamhost does not support sudo</span><br />
set <span style="color:#ff3333; font-weight:bold;">:user</span>, application &nbsp;<span style="color:#008000; font-style:italic;"># Dreamhost SSH User</span><br />
set <span style="color:#ff3333; font-weight:bold;">:domain</span>, <span style="color:#996600;">&quot;myrailsapp.domain.com&quot;</span><br />
<br />
server domain, <span style="color:#ff3333; font-weight:bold;">:app</span>, <span style="color:#ff3333; font-weight:bold;">:web</span><br />
role <span style="color:#ff3333; font-weight:bold;">:db</span>, domain, <span style="color:#ff3333; font-weight:bold;">:primary</span> =<span style="color:#006600; font-weight:bold;">&amp;</span>gt; <span style="color:#0000FF; font-weight:bold;">true</span><br />
<br />
<span style="color:#008000; font-style:italic;">#############################################################</span><br />
<span style="color:#008000; font-style:italic;">## Subversion</span><br />
<span style="color:#008000; font-style:italic;">#############################################################</span><br />
set <span style="color:#ff3333; font-weight:bold;">:scm</span>, <span style="color:#ff3333; font-weight:bold;">:subversion</span><br />
set <span style="color:#ff3333; font-weight:bold;">:scm_user</span>, application &nbsp; <span style="color:#008000; font-style:italic;"># Sets 'my_svn_user' instead, if you are using different name than your app.</span><br />
set <span style="color:#ff3333; font-weight:bold;">:scm_auth_cache</span>, <span style="color:#0000FF; font-weight:bold;">true</span> &nbsp;<span style="color:#008000; font-style:italic;"># Prompts for password once</span><br />
set <span style="color:#ff3333; font-weight:bold;">:scm_password</span>, <span style="color:#CC0066; font-weight:bold;">Proc</span>.<span style="color:#9900CC;">new</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#6666ff; font-weight:bold;">Capistrano::CLI</span>.<span style="color:#9900CC;">password_prompt</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;SCM password for #{scm_user}:&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span><br />
set <span style="color:#ff3333; font-weight:bold;">:repository</span>, &nbsp;<span style="color:#996600;">&quot;http://svn.myrailsappdomain/#{application}/trunk&quot;</span><br />
set <span style="color:#ff3333; font-weight:bold;">:deploy_to</span>, <span style="color:#996600;">&quot;/home/#{user}/#{domain}&quot;</span><br />
<span style="color:#008000; font-style:italic;"># keeps a local checkout of the repository on the server to get faster deployments</span><br />
set <span style="color:#ff3333; font-weight:bold;">:deploy_via</span>, <span style="color:#ff3333; font-weight:bold;">:remote_cache</span><br />
<br />
<span style="color:#008000; font-style:italic;">#############################################################</span><br />
<span style="color:#008000; font-style:italic;">## Tasks</span><br />
<span style="color:#008000; font-style:italic;">#############################################################</span><br />
<br />
namespace <span style="color:#ff3333; font-weight:bold;">:deploy</span> <span style="color:#9966CC; font-weight:bold;">do</span><br />
desc <span style="color:#996600;">&quot;Restart Application (using tmp/restart.txt)&quot;</span><br />
task <span style="color:#ff3333; font-weight:bold;">:restart_passenger</span> <span style="color:#9966CC; font-weight:bold;">do</span><br />
run <span style="color:#996600;">&quot;touch #{current_path}/tmp/restart.txt&quot;</span><br />
<span style="color:#9966CC; font-weight:bold;">end</span><br />
<br />
desc <span style="color:#996600;">&quot;Restarts your application.&quot;</span><br />
task <span style="color:#ff3333; font-weight:bold;">:restart</span> <span style="color:#9966CC; font-weight:bold;">do</span><br />
restart_passenger<br />
<span style="color:#9966CC; font-weight:bold;">end</span><br />
<br />
desc <span style="color:#996600;">&quot;Link shared files&quot;</span><br />
<span style="color:#008000; font-style:italic;">#task :before_symlink do</span><br />
before <span style="color:#ff3333; font-weight:bold;">:symlink</span> <span style="color:#9966CC; font-weight:bold;">do</span><br />
run <span style="color:#996600;">&quot;rm -drf #{release_path}/public/uploads&quot;</span><br />
run <span style="color:#996600;">&quot;ln -s #{shared_path}/uploads #{release_path}/public/uploads&quot;</span><br />
run <span style="color:#996600;">&quot;rm -f #{release_path}/config/database.yml&quot;</span><br />
run <span style="color:#996600;">&quot;ln -s #{shared_path}/database.yml #{release_path}/config/database.yml&quot;</span><br />
<span style="color:#9966CC; font-weight:bold;">end</span><br />
<span style="color:#9966CC; font-weight:bold;">end</span></div></td></tr></tbody></table></div>
</li>
</ol>
</li>
<li>Then, prepare the directory structure on the server :
<ol>
<li>Create the Capistrano structure (releases/, shared/), by typing this on your local machine :
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">$ </span>cap deploy:setup</div></td></tr></tbody></table></div>
</li>
<li>Login to your server to manually create your shared directories and files (if any)
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ <span style="color: #c20cb9; font-weight: bold;">ssh</span> myrailsapp.domain.com<br />
<span style="color: #7a0874; font-weight: bold;">&#91;</span>tootsie<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ <span style="color: #7a0874; font-weight: bold;">cd</span> myrailsapp<span style="color: #000000; font-weight: bold;">/</span>shared</div></td></tr></tbody></table></div>
</li>
<li>Configure your database on the server (you don&#8217;t want this file in your repository) :
<div class="codecolorer-container ruby blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br /></div></td><td><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#008000; font-style:italic;"># config/database.yml&amp;nbsp;</span><br />
<br />
development:<br />
adapter: sqlite3<br />
database: db<span style="color:#006600; font-weight:bold;">/</span>development.<span style="color:#9900CC;">sqlite3</span><br />
timeout: <span style="color:#006666;">5000</span><br />
<br />
test:<br />
adapter: sqlite3<br />
database: db<span style="color:#006600; font-weight:bold;">/</span>test.<span style="color:#9900CC;">sqlite3</span><br />
timeout: <span style="color:#006666;">5000</span><br />
<br />
production:<br />
adapter: mysql<br />
encoding: utf8<br />
database: myrailsapp<br />
username: myrailsapp<br />
password: <span style="color:#006600; font-weight:bold;">&#91;</span>your_db_password<span style="color:#006600; font-weight:bold;">&#93;</span><br />
host: mysql.<span style="color:#006600; font-weight:bold;">&#91;</span>myrailsapp.<span style="color:#9900CC;">domain</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">com</span><br />
timeout: <span style="color:#006666;">5000</span></div></td></tr></tbody></table></div>
</li>
<li>Create your upload directory (OPTIONAL) :
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #7a0874; font-weight: bold;">&#91;</span>tootsie<span style="color: #7a0874; font-weight: bold;">&#93;</span>$ <span style="color: #c20cb9; font-weight: bold;">mkdir</span> uploads</div></td></tr></tbody></table></div>
</li>
</ol>
</li>
<li>Deploy your application. Note : it will only prompt for your SVN password at the first deploy.
<div class="codecolorer-container bash blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">$ </span>cap deploy</div></td></tr></tbody></table></div>
</li>
<li>And finally the most important, configure your domain like this : <img src="/uploads/2008/6/30/dreamhost_edit_rails_domain.jpg" alt="" width="500" height="354" /></li>
</ol>
<h4>[UPDATE 2008/07/01]</h4>
<p>If you need to install custom gems on your account, you can find more info <a title="Dreamhost Wiki : Installing your own gems and RubyGems" href="http://wiki.dreamhost.com/index.php/RubyGems" target="_blank">here</a>, <a title="installing your own packages and gems" href="http://nateclark.com/articles/2006/10/20/dreamhost-your-own-packages-and-gems" target="_blank">here</a> and <a href="http://rails.dreamhosters.com/" target="_blank">here</a>.</p>
<h4>References</h4>
<ol>
<li><a href="http://labs.peritor.com/webistrano/wiki/ConfigurationParameter">http://labs.peritor.com/webistrano/wiki/ConfigurationParameter</a></li>
<li><a href="http://groups.google.ca/group/capistrano/browse_thread/thread/6ef7c7c212547eab">http://groups.google.ca/group/capistrano/browse_thread/thread/6ef7c7c212547eab (for scm_password)</a></li>
<li><a href="http://groups.google.com/group/capistrano/browse_thread/thread/ae7b16a16abf4e5d">http://groups.google.com/group/capistrano/browse_thread/thread/ae7b16a16abf4e5d (for task hookups with namespaces)</a></li>
<li><a href="http://groups.google.com/group/capistrano/web/deploying-on-dreamhost">http://groups.google.com/group/capistrano/web/deploying-on-dreamhost</a></li>
<li><a href="http://gabrito.com/post/ruby-on-rails-dreamhost-plugin">http://gabrito.com/post/ruby-on-rails-dreamhost-plugin</a></li>
<li><a href="http://www.railsforum.com/viewtopic.php?id=8118">http://www.railsforum.com/viewtopic.php?id=8118</a></li>
<li><a href="http://wiki.dreamhost.com/Capistrano">Dreamhost Wiki : Capistrano</a></li>
<li><a href="http://wiki.dreamhost.com/Ruby_on_Rails">Dreamhost Wiki : Ruby_on_Rails</a></li>
<li><a href="http://manuals.rubyonrails.com/read/chapter/97">Capistrano Manual</a></li>
</ol>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.davidlauzon.net/2008/06/capistrano-2-recipe-for-dreamhost-shared-hosting-and-mod_rails/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

