<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>exuber.net</title>
	
	<link>http://www.exuber.net</link>
	<description>web, design and programming</description>
	<pubDate>Wed, 21 May 2008 14:49:36 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/Exuber" type="application/rss+xml" /><item>
		<title>A bit of Open Flash Chart</title>
		<link>http://feeds.feedburner.com/~r/Exuber/~3/294958075/</link>
		<comments>http://www.exuber.net/2008/05/21/a-bit-of-open-flash-chart/#comments</comments>
		<pubDate>Wed, 21 May 2008 11:00:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[how-tos]]></category>

		<guid isPermaLink="false">http://www.exuber.net/?p=32</guid>
		<description><![CDATA[There are several chart framework that are open source or at least free out there. Some time a go I have a chance to use Open Flash Chart. This article will give some introduction on how to use Open Flash Chart. 
A chart should show some data. Andy budd from clear left once said on [...]]]></description>
			<content:encoded><![CDATA[<p>There are several chart framework that are open source or at least free out there. Some time a go I have a chance to use Open Flash Chart. This article will give some introduction on how to use Open Flash Chart. </p>
<p>A chart should show some data. Andy budd from clear left once <a href="http://www.andybudd.com/archives/2006/10/7_habits_of_a_highly_successful_freelance_web_designer/">said on his blog</a>:</p>
<blockquote><p>It’s important not to specialise at the expense of your other skills. Clients and agencies like well rounded people with a wide set of interests. Your skills should resemble an inverted T. Generally very broad but with one (or preferably more) areas of deep knowledge.</p></blockquote>
<p>So just for fun I then have an idea to create an inverted T skill chart.</p>
<p><strong>Step.1 Requirements</strong><br />
Open flash chart. Please <a href="http://teethgrinder.co.uk/open-flash-chart/download.php">download the package</a> before proceeding.</p>
<p><strong>Step.2 Setup</strong><br />
Once you have download the package, extract it. You will see some folder. For this tutorial we will use PHP so we only concern about the &#8220;php-ofc-library&#8221; folder (I will get into python in another post). We need to copy this folder to our application folder. My setup looks like this:<br />
<a href='http://www.exuber.net/wp-content/uploads/2008/05/folder.jpg'><img src="http://www.exuber.net/wp-content/uploads/2008/05/folder.jpg" alt="" title="folder setup" width="400" height="85" class="alignnone size-full wp-image-33" /></a></p>
<p><strong>Step.3 Code</strong><br />
To get the chart running we basically need to do 2 things.<br />
1. generate a set of data<br />
2. invoke the flash object and supply it with correct parameter</p>
<p>So, first thing first, let us create the data, save this code into data.php</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
</pre></td><td class="code"><pre class="php"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">include_once</span> <span style="color: #ff0000;">'php-ofc-library/open-flash-chart.php'</span><span style="color: #66cc66;">;</span>
&nbsp;
<span style="color: #ff0000">$skill_score</span> <span style="color: #66cc66;">=</span> <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">7</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">7</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">7</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">9</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">7</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">6</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">6</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">1</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #ff0000">$skill_name</span>  <span style="color: #66cc66;">=</span> <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'Ruby'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'HTML'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'Python'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'PHP'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'C/C++'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'CSS'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'XML'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'MySQL'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'PostgreSQL'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// create bar chart with 50% opacity, and set color to #0066CC</span>
<span style="color: #ff0000">$bar</span> <span style="color: #66cc66;">=</span> <span style="color: #000000; font-weight: bold;">new</span> bar<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">50</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'#0066CC'</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span> 
<span style="color: #808080; font-style: italic;">// set our data to skill score</span>
<span style="color: #ff0000">$bar</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">data</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000">$skill_score</span><span style="color: #66cc66;">;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// create the graph</span>
<span style="color: #ff0000">$g</span> <span style="color: #66cc66;">=</span> <span style="color: #000000; font-weight: bold;">new</span> graph<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #808080; font-style: italic;">// set graph title and set some style</span>
<span style="color: #ff0000">$g</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">title</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'Skill Chart'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'{font-size: 12px;}'</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// set our graph data to $bar</span>
<span style="color: #ff0000">$g</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">data_sets</span><span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000">$bar</span><span style="color: #66cc66;">;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// set x legend title, size and color</span>
<span style="color: #ff0000">$g</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">set_x_legend</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'Skills'</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">12</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'#C11B01'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #808080; font-style: italic;">// set label style size, text color, orientation, label step,</span>
<span style="color: #ff0000">$g</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">set_x_label_style</span><span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">10</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'#000000'</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">1</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #808080; font-style: italic;">// set x labels to list of our skill name</span>
<span style="color: #ff0000">$g</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">set_x_labels</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000">$skill_name</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
&nbsp;
<span style="color: #ff0000">$g</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">set_y_min</span><span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #ff0000">$g</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">set_y_max</span><span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">10</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #ff0000">$g</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">y_label_steps</span><span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">10</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// set y legend title, size and color</span>
<span style="color: #ff0000">$g</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">set_y_legend</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'Score'</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">12</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'#C11B01'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// generate the data</span>
<span style="color: #000066;">echo</span> <span style="color: #ff0000">$g</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">render</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>That is it for the first part. If you open this file through browser, you will have something like:</p>
<blockquote><p>
&#038;title=Skill+Chart,{font-size: 12px;}&#038;<br />
&#038;x_legend=Skills,12,#C11B01&#038;<br />
&#038;x_label_style=10,#000000,0,1&#038;<br />
&#038;x_axis_steps=1&#038;<br />
&#038;y_legend=Score,12,#C11B01&#038;<br />
&#038;y_ticks=5,10,10&#038;<br />
&#038;x_labels=Ruby,HTML,Python,PHP,C%2FC%2B%2B,CSS,XML,MySQL,PostgreSQL&#038;<br />
&#038;y_min=0&#038;<br />
&#038;y_max=10&#038;<br />
&#038;bar=50,#0066CC&#038;<br />
&#038;values=1,7,7,7,9,7,6,6,1&#038;
</p></blockquote>
<p>You can see how the chart look like by opening directing your browser to:	http://localhost/[your_folder]/open-flash-chart.swf?data=http://localhost/[your_folder]/data.php<br />
You should have something like:<br />
<a href='http://www.exuber.net/wp-content/uploads/2008/05/full.jpg'><img src="http://www.exuber.net/wp-content/uploads/2008/05/full-300x244.jpg" alt="" title="chart" width="300" height="244" class="alignnone size-medium wp-image-34" /></a></p>
<p>Now we need to create a way to feed the data into the flash. Edit the index.php and write:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="php"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">include_once</span> <span style="color: #ff0000;">'php-ofc-library/open_flash_chart_object.php'</span><span style="color: #66cc66;">;</span>
<span style="color: #808080; font-style: italic;">// create the flash object</span>
open_flash_chart_object<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">500</span><span style="color: #66cc66;">,</span> <span style="color: #808080; font-style: italic;">// width of the flash object</span>
                         <span style="color: #cc66cc;">500</span><span style="color: #66cc66;">,</span> <span style="color: #808080; font-style: italic;">// height of the flash object</span>
                         <span style="color: #ff0000;">'http://'</span><span style="color: #66cc66;">.</span> <span style="color: #ff0000">$_SERVER</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'SERVER_NAME'</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">.</span><span style="color: #ff0000;">'/skill/data.php'</span><span style="color: #66cc66;">,</span>  <span style="color: #808080; font-style: italic;">// point to data url</span>
                         <span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">,</span> <span style="color: #808080; font-style: italic;">// do not use javascript</span>
                         <span style="color: #ff0000;">'http://'</span><span style="color: #66cc66;">.</span> <span style="color: #ff0000">$_SERVER</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'SERVER_NAME'</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">.</span><span style="color: #ff0000;">'/skill'</span> <span style="color: #808080; font-style: italic;">// base url</span>
<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>You should notice that I do not use Javascript. I tried but whenever I set the Javascript parameter to true it won&#8217;t work. </p>
<p>And that is it we are done. Go to your browser and point to the index.php. You should have something like the previous picture except it does not take up the whole screen.</p>
<p><strong>ExtJs and Open Flash Chart</strong><br />
For one of my projects, I need to embedd the chart into a ExtJs form. So I tought I might share how to do that as well.</p>
<p><strong>Step 1. Requirement</strong><br />
	Other than above requirement, you will of course need extjs. <a href="http://extjs.com/products/extjs/download.php">Download the library</a> and extract it in the &#8216;\js&#8217; directory.We also need a plugin. ExtJs community has come out with a flash plugin. I got the plugin from ExtJs forum. I can&#8217;t seem to find it anymore, and the plugin has no indication of the author. You can get my local copy <a href='http://www.exuber.net/wp-content/uploads/2008/05/flashplugin.js'>here</a>. Copy this file into &#8216;\js&#8217; folder. So your &#8216;\js&#8217; folder should have &#8216;extjs&#8217; folder, &#8216;flashplugin.js&#8217; file and our actual code &#8217;skill.js&#8217; file. Of course we haven&#8217;t type anything into the &#8217;skill.js&#8217; file.</p>
<p><strong>Step 2. The code</strong><br />
Open the &#8217;skill.js&#8217; anf fill it with this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
</pre></td><td class="code"><pre class="javascript">Ext.<span style="color: #003366; font-weight: bold;">namespace</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'exuber'</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
exuber.<span style="color: #006600;">skill</span> = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> site_url = <span style="color: #3366CC;">'http://localhost/skill/'</span>; <span style="color: #009900; font-style: italic;">// base url</span>
&nbsp;
    <span style="color: #009900; font-style: italic;">//public</span>
    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #66cc66;">&#123;</span>
        init : <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
            <span style="color: #009900; font-style: italic;">// create chart panel</span>
            skillChart = <span style="color: #003366; font-weight: bold;">new</span> Ext.<span style="color: #006600;">Panel</span><span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">&#123;</span>
                layout: <span style="color: #3366CC;">'fit'</span>,
                height: <span style="color: #CC0000;">300</span>,
                width: <span style="color: #CC0000;">720</span>,
                swf: site_url + <span style="color: #3366CC;">'open-flash-chart.swf'</span>,
                flashvars: <span style="color: #66cc66;">&#123;</span>data: site_url+<span style="color: #3366CC;">'data.php'</span>, height: <span style="color: #CC0000;">295</span>, width: <span style="color: #CC0000;">650</span> <span style="color: #66cc66;">&#125;</span>, <span style="color: #009900; font-style: italic;">// flash variable, data and dimensions</span>
                plugins: <span style="color: #003366; font-weight: bold;">new</span> Ext.<span style="color: #006600;">ux</span>.<span style="color: #006600;">FlashPlugin</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #009900; font-style: italic;">// use the plugin</span>
                region:<span style="color: #3366CC;">'north'</span> <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
            contact = <span style="color: #003366; font-weight: bold;">new</span> Ext.<span style="color: #006600;">Panel</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#123;</span>
                layout: <span style="color: #3366CC;">'fit'</span>,
                width: <span style="color: #CC0000;">720</span>,
                region:<span style="color: #3366CC;">'center'</span>,
                buttons: <span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#123;</span>
                    text:<span style="color: #3366CC;">'Like what you see ? Hire Me'</span>,
                    handler: <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
                        Ext.<span style="color: #006600;">MessageBox</span>.<span style="color: #000066;">alert</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'Thank you'</span>, <span style="color: #3366CC;">'Thank you for your interest.This is just an example though.'</span><span style="color: #66cc66;">&#41;</span>;
                        <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
            <span style="color: #009900; font-style: italic;">//create window</span>
            scoreWindow = <span style="color: #003366; font-weight: bold;">new</span> Ext.<span style="color: #006600;">Window</span><span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">&#123;</span> 
                draggable: <span style="color: #003366; font-weight: bold;">false</span>,
                width:<span style="color: #CC0000;">728</span>,
                layout: <span style="color: #3366CC;">'fit'</span>,
                title:<span style="color: #3366CC;">'My Skill'</span>,
                closable:<span style="color: #003366; font-weight: bold;">false</span>,
                collapsible: <span style="color: #003366; font-weight: bold;">false</span>,
                resizable: <span style="color: #003366; font-weight: bold;">false</span>,
                plain:<span style="color: #003366; font-weight: bold;">true</span>
            <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
            scoreWindow.<span style="color: #006600;">add</span><span style="color: #66cc66;">&#40;</span> skillChart <span style="color: #66cc66;">&#41;</span>;  
            scoreWindow.<span style="color: #006600;">add</span><span style="color: #66cc66;">&#40;</span> contact <span style="color: #66cc66;">&#41;</span>;  
            scoreWindow.<span style="color: #006600;">show</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;			
        <span style="color: #66cc66;">&#125;</span>
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre></td></tr></table></div>

<p>Also edit the &#8216;index.html&#8217; with this code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre>&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
    &lt;title&gt;My skill&lt;/title&gt;
    &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;js/ext2/resources/css/ext-all.css&quot; /&gt;
    &lt;script type=&quot;text/javascript&quot; src=&quot;js/ext2/adapter/ext/ext-base.js&quot;&gt;&lt;/script&gt;
    &lt;script type=&quot;text/javascript&quot; src=&quot;js/ext2/ext-all.js&quot;&gt;&lt;/script&gt;
    &lt;script type=&quot;text/javascript&quot; src=&quot;js/flashplugin.js&quot;&gt;&lt;/script&gt;
    &lt;script type=&quot;text/javascript&quot; src=&quot;js/skill.js&quot;&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></td></tr></table></div>

<p>Done!! You should have something like:<br />
<a href='http://www.exuber.net/wp-content/uploads/2008/05/result.jpg'><img src="http://www.exuber.net/wp-content/uploads/2008/05/result-300x194.jpg" alt="" title="result" width="300" height="194" class="alignnone size-medium wp-image-36" /></a><br />
With a bit of work you can make a better looking chart, for different kinds of data.<br />
Here is what I made some time a go.<br />
<a href='http://www.exuber.net/wp-content/uploads/2008/05/golfzone.jpg'><img src="http://www.exuber.net/wp-content/uploads/2008/05/golfzone-262x300.jpg" alt="" title="chart" width="262" height="300" class="alignnone size-medium wp-image-35" /></a><br />
Of course there a lot more good-looking chart out there. <a href="http://teethgrinder.co.uk/open-flash-chart/">Open Flash Chart</a> is a good place to start.</p>
<img src="http://feeds.feedburner.com/~r/Exuber/~4/294958075" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.exuber.net/2008/05/21/a-bit-of-open-flash-chart/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.exuber.net/2008/05/21/a-bit-of-open-flash-chart/</feedburner:origLink></item>
		<item>
		<title>Admiring Alex Buga site</title>
		<link>http://feeds.feedburner.com/~r/Exuber/~3/293415433/</link>
		<comments>http://www.exuber.net/2008/05/19/admiring-alex-buga-site/#comments</comments>
		<pubDate>Mon, 19 May 2008 11:15:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[snapshots]]></category>

		<guid isPermaLink="false">http://www.exuber.net/?p=28</guid>
		<description><![CDATA[<a href="http://www.exuber.net/2008/05/19/admiring-alex-buga-site/"><img src="http://www.exuber.net/wp-content/plugins/yet-another-photoblog/YapbThumbnailer.php?post_id=28&w=208&h=151&zc=1" width="208" height="151" style="float:left;padding:0 10px 10px 0;" ></a>I stumble upon this website sometime a go and can&#8217;t stop admiring it.
Nice background texture. Some hand drawn image as header and footer. Nice semi transparent boxes.
You can move the lamp left and right. Very interesting. It uses mootools. A very neat effect.
Overall cooool site.
You should go visit the the site.
Some screen shot:



]]></description>
			<content:encoded><![CDATA[<a href="http://www.exuber.net/2008/05/19/admiring-alex-buga-site/"><img src="http://www.exuber.net/wp-content/plugins/yet-another-photoblog/YapbThumbnailer.php?post_id=28&w=208&h=151&zc=1" width="208" height="151" style="float:left;padding:0 10px 10px 0;" ></a><p>I stumble upon this website sometime a go and can&#8217;t stop admiring it.<br />
Nice background texture. Some hand drawn image as header and footer. Nice semi transparent boxes.<br />
You can move the lamp left and right. Very interesting. It uses mootools. A very neat effect.<br />
Overall cooool site.</p>
<p>You should go <a href="http://www.alexbuga.com">visit the the site</a>.</p>
<p>Some screen shot:<br />
<a href='http://www.exuber.net/wp-content/uploads/2008/05/content.png'><img src="http://www.exuber.net/wp-content/uploads/2008/05/content.png" alt="" title="impressive header" width="500" height="135" class="alignnone size-full wp-image-29" /></a><br />
<a href='http://www.exuber.net/wp-content/uploads/2008/05/footer.png'><img src="http://www.exuber.net/wp-content/uploads/2008/05/footer.png" alt="" title="footer with a sense humor" width="400" height="67" class="alignnone size-full wp-image-30" /></a><br />
<a href='http://www.exuber.net/wp-content/uploads/2008/05/form.png'><img src="http://www.exuber.net/wp-content/uploads/2008/05/form.png" alt="" title="nice looking form" width="400" height="243" class="alignnone size-full wp-image-31" /></a></p>
<img src="http://feeds.feedburner.com/~r/Exuber/~4/293415433" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.exuber.net/2008/05/19/admiring-alex-buga-site/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.exuber.net/2008/05/19/admiring-alex-buga-site/</feedburner:origLink></item>
		<item>
		<title>CakePHP, Captcha and User Registration</title>
		<link>http://feeds.feedburner.com/~r/Exuber/~3/292799990/</link>
		<comments>http://www.exuber.net/2008/05/06/cakephp-captcha-and-user-registration/#comments</comments>
		<pubDate>Tue, 06 May 2008 15:22:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[how-tos]]></category>

		<guid isPermaLink="false">http://www.exuber.net/?p=27</guid>
		<description><![CDATA[User registration is a common thing in web development. To ensure that only human registered as a user, it is common to use Completely Automated Public Turing test to tell Computers and Humans Apart (CAPTCHA).
There are several CAPTCHA library available. This article will show how you can integrate 2 such library to provide CAPTCHA verification [...]]]></description>
			<content:encoded><![CDATA[<p>User registration is a common thing in web development. To ensure that only human registered as a user, it is common to use <strong>C</strong>ompletely <strong>A</strong>utomated <strong>P</strong>ublic <strong>T</strong>uring test to tell <strong>C</strong>omputers and <strong>H</strong>umans <strong>A</strong>part (CAPTCHA).</p>
<p>There are several CAPTCHA library available. This article will show how you can integrate 2 such library to provide CAPTCHA verification for user registration.</p>
<p>The library I used are kCAPTCHAand reCAPTCHA. Let&#8217;s start with reCAPTCHA.</p>
<p>reCAPTCHA is recommended as the official CAPTCHA implementation by the original CAPTCHA creators. Here is how you do it, step-by-step:</p>
<p>1. <a title="reCAPTCHA library for PHP" href="http://recaptcha.googlecode.com/files/recaptcha-php-1.10.zip">Download the library</a>.</p>
<p>2. <a href="http://recaptcha.net/api/getkey?app=php">Sign up for the API key</a>. reCAPTCHA is a web service so you need to sign up for API key to be able to use it.  Notice on signing up , you will be asked to fill in a domain name. As far as I know you can put anything, I tried putting my domain and localhost, both accepted. After signing up you will have two keys one public key (for the user) and the other a private key (for communication between our server with reCAPTCHA server).</p>
<p>3. Extract and put the result at your vendors folder ( [web]/app/vendors/ ).</p>
<p>4. Create a component file</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
</pre></td><td class="code"><pre class="php"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">class</span> RecaptchaComponent <span style="color: #000000; font-weight: bold;">extends</span> Object
<span style="color: #66cc66;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #ff0000">$publickey</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">&quot;...&quot;</span><span style="color: #66cc66;">;</span> <span style="color: #808080; font-style: italic;">// use your public key here</span>
    <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #ff0000">$privatekey</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">&quot;...&quot;</span><span style="color: #66cc66;">;</span> <span style="color: #808080; font-style: italic;">// user your private key here</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> startup<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&amp;</span><span style="color: #ff0000">$controller</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#123;</span>
        <span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">controller</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000">$controller</span><span style="color: #66cc66;">;</span>
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> render<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#123;</span>
        vendor<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'recaptcha/recaptchalib'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
&nbsp;
        <span style="color: #ff0000">$error</span> <span style="color: #66cc66;">=</span> <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">;</span>
&nbsp;
        <span style="color: #000066;">echo</span> recaptcha_get_html<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">publickey</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000">$error</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> verify<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#123;</span>
        vendor<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'recaptcha/recaptchalib'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
&nbsp;
        <span style="color: #ff0000">$resp</span> <span style="color: #66cc66;">=</span> recaptcha_check_answer <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">privatekey</span><span style="color: #66cc66;">,</span>
                                  <span style="color: #ff0000">$_SERVER</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;REMOTE_ADDR&quot;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">,</span>
                                  <span style="color: #ff0000">$_POST</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;recaptcha_challenge_field&quot;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">,</span>
                                  <span style="color: #ff0000">$_POST</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">&quot;recaptcha_response_field&quot;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
&nbsp;
        <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$resp</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">is_valid</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
            <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">;</span>
        <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
            <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">;</span>
        <span style="color: #66cc66;">&#125;</span>
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>store this at [web]/app/controllers/components/recaptcha.php</p>
<p>5. Create User Model and User Controller</p>
<p>Model:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
</pre></td><td class="code"><pre class="php"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">class</span> User <span style="color: #000000; font-weight: bold;">extends</span> AppModel
<span style="color: #66cc66;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #ff0000">$name</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'User'</span><span style="color: #66cc66;">;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">/**
     * validation rules
     */</span>
    <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #ff0000">$validate</span> <span style="color: #66cc66;">=</span> <span style="color: #000066;">array</span> <span style="color: #66cc66;">&#40;</span>
		<span style="color: #ff0000;">'user_login'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span>	
			<span style="color: #ff0000;">'exists'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span>
					<span style="color: #ff0000;">'rule'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'checkUnique'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'user_login'</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>  
					<span style="color: #ff0000;">'message'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">'The Username you entered has been taken.'</span>
			<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
			<span style="color: #ff0000;">'minLength'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span>
					<span style="color: #ff0000;">'rule'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'minLength'</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>  
					<span style="color: #ff0000;">'message'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">'Username must at least be 3 character long.'</span>
			<span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
		<span style="color: #ff0000;">'user_pass'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span>
			<span style="color: #ff0000;">'mingLength'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span>
				<span style="color: #ff0000;">'rule'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'minLength'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'6'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
				<span style="color: #ff0000;">'message'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">'Mimimum 6 characters long'</span>
			<span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
		<span style="color: #ff0000;">'user_name'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span>
			<span style="color: #ff0000;">'minLength'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span>
					<span style="color: #ff0000;">'rule'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'minLength'</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>  
					<span style="color: #ff0000;">'message'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">'Username must at least be 3 character long.'</span>
			<span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
		<span style="color: #ff0000;">'user_email'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #000066;">array</span> <span style="color: #66cc66;">&#40;</span>
			<span style="color: #ff0000;">'email'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span> 
				<span style="color: #ff0000;">'rule'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">'email'</span><span style="color: #66cc66;">,</span>
				<span style="color: #ff0000;">'message'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">'Please supply a valid email address.'</span>
			<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
			<span style="color: #ff0000;">'exists'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span>
				 <span style="color: #ff0000;">'rule'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'checkUnique'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'user_email'</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>  
				 <span style="color: #ff0000;">'message'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">'The email you entered has been registered.'</span>
			<span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#41;</span>
	<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
&nbsp;
	<span style="color: #808080; font-style: italic;">/** 
	* Validate if the data is unique.
	*
	* @param $data         The data to be compared.
	* @param $fieldName    The field name to check.
	* @return true         If the field name unique. False otherwise.
	*/</span>
	<span style="color: #000000; font-weight: bold;">function</span> checkUnique<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000">$data</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000">$fieldName</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
	        <span style="color: #ff0000">$valid</span> <span style="color: #66cc66;">=</span> <span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">;</span>
		<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #000066;">isset</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$fieldName</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&amp;&amp;</span> <span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">hasField</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$fieldName</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #ff0000">$valid</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">isUnique</span><span style="color: #66cc66;">&#40;</span><span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$fieldName</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000">$data</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #ff0000">$valid</span><span style="color: #66cc66;">;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>store this as [web]/app/models/users.php.</p>
<p>Controller:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
</pre></td><td class="code"><pre class="php"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">class</span> UsersController <span style="color: #000000; font-weight: bold;">extends</span> AppController
<span style="color: #66cc66;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #ff0000">$name</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'Users'</span><span style="color: #66cc66;">;</span>
    <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #ff0000">$components</span> <span style="color: #66cc66;">=</span> <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Auth'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'Recaptcha'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span> 
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> beforeFilter<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">Auth</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">fields</span> <span style="color: #66cc66;">=</span> <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'username'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">'user_login'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'password'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">'user_pass'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
        <span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">Auth</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">allow</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'register'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'recaptcha'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
&nbsp;
    <span style="color: #808080; font-style: italic;">/**
     * This method handle the user registration process.
     * It will first of all, get the user basic information.
     * After user submit the information, a hash key will be generated and 
     * stored in the database. An email will then send to user and pending
     * for user activation
     */</span>
    <span style="color: #000000; font-weight: bold;">function</span> register<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#123;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">!</span><span style="color: #000066;">empty</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">data</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
           <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">data</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'User'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'user_pass'</span><span style="color: #66cc66;">&#93;</span> 
                    <span style="color: #66cc66;">==</span> <span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">Auth</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">password</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">data</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'User'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'user_pass_confirm'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                    <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>  <span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">Recaptcha</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">verify</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
                        <span style="color: #ff0000">$temp</span> <span style="color: #66cc66;">=</span> <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span> 
                                <span style="color: #ff0000;">'user_registered'</span><span style="color: #66cc66;">=&gt;</span> <span style="color: #000066;">date</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Y-m-d'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> 
                                <span style="color: #ff0000;">'user_activation_key'</span><span style="color: #66cc66;">=&gt;</span>sha1<span style="color: #66cc66;">&#40;</span> <span style="color: #000066;">time</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> 
                                <span style="color: #ff0000;">'user_status'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
                        <span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">data</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'User'</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">=</span> <span style="color: #000066;">array_merge</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">data</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'User'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000">$temp</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
                        <span style="color: #000066;">unset</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">data</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'User'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'captcha'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
&nbsp;
                        <span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">User</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">create</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
                        <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">User</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">save</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">data</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
                            <span style="color: #808080; font-style: italic;">// do other stuff here like send activation email to user</span>
                            <span style="color: #808080; font-style: italic;">// or/and redirect to other page</span>
                        <span style="color: #66cc66;">&#125;</span>
                    <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
                        <span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">Session</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">setFlash</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'captcha verification failed'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
                    <span style="color: #66cc66;">&#125;</span>
            <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
                <span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">Session</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">setFlash</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'password mismatch'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
            <span style="color: #66cc66;">&#125;</span>
        <span style="color: #66cc66;">&#125;</span> 
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> recaptcha<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#123;</span>
        <span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">Recaptcha</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">render</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>store this as [web]/app/controllers/users_controller.php.</p>
<p>6. Create the view</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="php"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000066;">echo</span> <span style="color: #ff0000">$form</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">create</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'User'</span><span style="color: #66cc66;">,</span> <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'action'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">'register'</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #000066;">echo</span> <span style="color: #ff0000">$form</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">input</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'user_login'</span><span style="color: #66cc66;">,</span> <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'label'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">'User Name :'</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #000066;">echo</span> <span style="color: #ff0000">$form</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">input</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'user_name'</span><span style="color: #66cc66;">,</span> <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'label'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">'Full name :'</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #000066;">echo</span> <span style="color: #ff0000">$form</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">input</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'user_email'</span><span style="color: #66cc66;">,</span> <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'label'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">'Email :'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #000066;">echo</span> <span style="color: #ff0000">$form</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">input</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'user_pass'</span><span style="color: #66cc66;">,</span> <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'label'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">'Password :'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'type'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">'password'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #000066;">echo</span> <span style="color: #ff0000">$form</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">input</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'user_pass_confirm'</span><span style="color: #66cc66;">,</span> <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'label'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">'Retype Password :'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'type'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">'password'</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">requestAction</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'users/recaptcha'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #000066;">echo</span> <span style="color: #ff0000">$form</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">submit</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #000066;">echo</span> <span style="color: #ff0000">$form</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">end</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>store this as [web]/app/views/register.ctp.</p>
<p>7. voila!, We are done!!</p>
<p>Now, let&#8217;s move on to kCAPTCHA. It is pretty much the same. Unlike reCAPTCHA, kCAPTCHA is not a web service. So you need not sign up for anything.</p>
<p>1. <a title="kCAPTCHA library" href="http://www.captcha.ru/kcaptcha.zip">Download the library</a>.</p>
<p>2. Extract and put the result at your vendors folder ( [web]/app/vendors/ ).</p>
<p>3. Create component.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="php"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">class</span> KCaptchaComponent <span style="color: #000000; font-weight: bold;">extends</span> Object
<span style="color: #66cc66;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">function</span> startup<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&amp;</span><span style="color: #ff0000">$controller</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#123;</span>
        <span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">controller</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000">$controller</span><span style="color: #66cc66;">;</span>
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> render<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#123;</span>
        vendor<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'kcaptcha/kcaptcha'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
        <span style="color: #ff0000">$kcaptcha</span> <span style="color: #66cc66;">=</span> <span style="color: #000000; font-weight: bold;">new</span> KCAPTCHA<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
        <span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">controller</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">Session</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">write</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'captcha'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000">$kcaptcha</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">getKeyString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>store this as [web]/app/controllers/components/kcaptcha.php</p>
<p>4. The Users model is the same as above.</p>
<p>5. The User controller is pretty much the same, but I will rewrite the whole code anyway.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
</pre></td><td class="code"><pre class="php"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">class</span> UsersController <span style="color: #000000; font-weight: bold;">extends</span> AppController
<span style="color: #66cc66;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #ff0000">$name</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'Users'</span><span style="color: #66cc66;">;</span>
    <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #ff0000">$components</span> <span style="color: #66cc66;">=</span> <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Auth'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'KCaptcha'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span> 
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> beforeFilter<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">Auth</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">fields</span> <span style="color: #66cc66;">=</span> <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'username'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">'user_login'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'password'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">'user_pass'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
        <span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">Auth</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">allow</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'register'</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">'kcaptcha'</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
&nbsp;
    <span style="color: #808080; font-style: italic;">/**
     * This method handle the user registration process.
     * It will first of all, get the user basic information.
     * After user submit the information, a hash key will be generated and 
     * stored in the database. An email will then send to user and pending
     * for user activation
     */</span>
    <span style="color: #000000; font-weight: bold;">function</span> register<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#123;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #66cc66;">!</span><span style="color: #000066;">empty</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">data</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
           <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">data</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'User'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'user_pass'</span><span style="color: #66cc66;">&#93;</span> 
                    <span style="color: #66cc66;">==</span> <span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">Auth</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">password</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">data</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'User'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'user_pass_confirm'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                   <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #000066;">strtolower</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">data</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'User'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'captcha'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">==</span> <span style="color: #000066;">strtolower</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">Session</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">read</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'captcha'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                        <span style="color: #ff0000">$temp</span> <span style="color: #66cc66;">=</span> <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span> 
                                <span style="color: #ff0000;">'user_registered'</span><span style="color: #66cc66;">=&gt;</span> <span style="color: #000066;">date</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'Y-m-d'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> 
                                <span style="color: #ff0000;">'user_activation_key'</span><span style="color: #66cc66;">=&gt;</span>sha1<span style="color: #66cc66;">&#40;</span> <span style="color: #000066;">time</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> 
                                <span style="color: #ff0000;">'user_status'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
                        <span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">data</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'User'</span><span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">=</span> <span style="color: #000066;">array_merge</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">data</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'User'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000">$temp</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
                        <span style="color: #000066;">unset</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">data</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'User'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'captcha'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
&nbsp;
                        <span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">User</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">create</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
                        <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">User</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">save</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">data</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
                             <span style="color: #808080; font-style: italic;">// do other stuff here like send activation email to user</span>
                            <span style="color: #808080; font-style: italic;">// or/and redirect to other page</span>
                        <span style="color: #66cc66;">&#125;</span>
                    <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
                        <span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">Session</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">setFlash</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'captcha verification failed'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
                    <span style="color: #66cc66;">&#125;</span>
            <span style="color: #66cc66;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
                <span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">Session</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">setFlash</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'password mismatch'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
            <span style="color: #66cc66;">&#125;</span>
        <span style="color: #66cc66;">&#125;</span> 
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> kcaptcha<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#123;</span>
        <span style="color: #ff0000">$this</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">KCaptcha</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">render</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span> 
    <span style="color: #66cc66;">&#125;</span>     
<span style="color: #66cc66;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>store this as [web]/app/controllers/users_controller.php</p>
<p>6. The view</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="php"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000066;">echo</span> <span style="color: #ff0000">$form</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">create</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'User'</span><span style="color: #66cc66;">,</span> <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'action'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">'register'</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #000066;">echo</span> <span style="color: #ff0000">$form</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">input</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'user_login'</span><span style="color: #66cc66;">,</span> <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'label'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">'User Name :'</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #000066;">echo</span> <span style="color: #ff0000">$form</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">input</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'user_name'</span><span style="color: #66cc66;">,</span> <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'label'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">'Full name :'</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #000066;">echo</span> <span style="color: #ff0000">$form</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">input</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'user_email'</span><span style="color: #66cc66;">,</span> <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'label'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">'Email :'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #000066;">echo</span> <span style="color: #ff0000">$form</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">input</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'user_pass'</span><span style="color: #66cc66;">,</span> <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'label'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">'Password :'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'type'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">'password'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #000066;">echo</span> <span style="color: #ff0000">$form</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">input</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'user_pass_confirm'</span><span style="color: #66cc66;">,</span> <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'label'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">'Retype Password :'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'type'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">'password'</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #000066;">echo</span> <span style="color: #ff0000">$form</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">input</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'captcha'</span><span style="color: #66cc66;">,</span> <span style="color: #000066;">array</span><span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'label'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">'Please type the text presented in the image : '</span><span style="color: #66cc66;">,</span>
                                    <span style="color: #ff0000;">'before'</span> <span style="color: #66cc66;">=&gt;</span> <span style="color: #ff0000;">'&lt;img src=&quot;'</span><span style="color: #66cc66;">.</span> <span style="color: #ff0000">$html</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">url</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'/users/kcaptcha'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">.</span> <span style="color: #ff0000;">'&quot;'</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span> 
<span style="color: #000066;">echo</span> <span style="color: #ff0000">$form</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">submit</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #000066;">echo</span> <span style="color: #ff0000">$form</span><span style="color: #66cc66;">-&gt;</span><span style="color: #006600;">end</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>store this as [web]/app/views/register.ctp.</p>
<p>7. voila!, We are done!!</p>
<p>Here is same screenshots showing CAPTCHA user registration in action.</p>
<p><a href="http://localhost/blog/wp-content/uploads/2008/05/shot-recap.png"><img class="alignnone size-full wp-image-36" title="reCAPTCHA in action" src="http://localhost/blog/wp-content/uploads/2008/05/shot-recap.png" alt="" width="300" height="328" /></a><a href="http://localhost/blog/wp-content/uploads/2008/05/capt.png"><img class="alignnone size-full wp-image-35" title="kCAPCTHA in action" src="http://localhost/blog/wp-content/uploads/2008/05/capt.png" alt="" width="300" height="353" /></a></p>
<img src="http://feeds.feedburner.com/~r/Exuber/~4/292799990" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.exuber.net/2008/05/06/cakephp-captcha-and-user-registration/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.exuber.net/2008/05/06/cakephp-captcha-and-user-registration/</feedburner:origLink></item>
		<item>
		<title>Setting up the stack on Linux</title>
		<link>http://feeds.feedburner.com/~r/Exuber/~3/292799991/</link>
		<comments>http://www.exuber.net/2008/04/30/setting-up-the-stack-on-linux/#comments</comments>
		<pubDate>Wed, 30 Apr 2008 14:39:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[articles]]></category>

		<guid isPermaLink="false">http://www.exuber.net/?p=19</guid>
		<description><![CDATA[I am software and web developer. This occupation usually requires the use of a lot tools. On Windows I would typically install Microsoft Visual Studio, XAMPP, Python and many more. Linux has several programming tools ready after installation. For one you do not have to install Python. You do however need to install gcc, not [...]]]></description>
			<content:encoded><![CDATA[<p>I am software and web developer. This occupation usually requires the use of a lot tools. On Windows I would typically install Microsoft Visual Studio, XAMPP, Python and many more. Linux has several programming tools ready after installation. For one you do not have to install Python. You do however need to install gcc, not included after installation.</p>
<p>Here is the list of tools I installed:</p>
<ul>
<li>GCC</li>
<p>On Ubuntu just type :</p>
<p>sudo apt-get install gcc</p>
<p>You can also use:</p>
<p>sudo apt-get install build-essential</p>
<p>The later will install g++ and several other lib. In my case I use the later command.</p>
<li>Netbeans</li>
<p>I am used to program under IDE on Windows. I understand IDE is not particulary popular in Linux world. Most of them use Vim of Emacs. I am not familiar with both. Well I use Vim from time to time but only for simple editing. Emacs they say, have a steep learning curve, it takes time.<br />
Okay, let&#8217;s see&#8230; there are several IDE for Linux i.e <a href="http://www.eclipse.org/" target="_blank">Eclipse</a>, <a href="http://www.netbeans.org" target="_blank">Netbeans</a>, and <a href="http://anjuta.sourceforge.net" target="_blank">Anjuta</a>.<br />
I have tried Netbeans on Windows and my response is positive. So I chose to install Netbeans.</p>
<p>Here is how you install Netbeans on Ubuntu Linux<br />
1. <a href="http://java.sun.com/javase/downloads/index.jsp" target="_self">Download the latest JDK</a> from Sun.<br />
2. Install fakeroot and java-package from universe to repackage the jdk as a .deb</p>
<p>sudo apt-get install fakeroot java-package</p>
<p>3. Once done create the .deb jdk package</p>
<p>fakeroot make-jpkg jdk-6uxxx-linux-i586.bin</p>
<p>4. Install the package sudo dpkg -i sun-j2sdkxxxx+updatexxx_i386.deb<br />
5. Make sun java your java</p>
<p>sudo update-alternative &#8211;config java</p>
<p>6. Download the latest Netbeans from the official site.<br />
7. Execute the file and follow the instructions.<br />
8. You are done.</p>
<li>WingIDE</li>
<p>I like programming in Python. And I have been using WingIDE on Windows, so I thought I should install it on Linux as well. The version I use is the free WingIDE 101.  You should <a href="http://wingware.com/pub/wingide-101/3.0.5/wingide-101-3.0_3.0.5-1_i386.deb">download</a> the application before proceeding. After that by simply double-click the &#8220;.deb&#8221; file the Wingide would be installed. However there won&#8217;t be a shortcut available on &#8216;Application&#8217;-&gt;&#8217;Programming&#8217;.<br />
You can add the shortcut by doing:<br />
1. Right-click on &#8216;Applications&#8217; and choose &#8216;Edit Menus&#8217;.<br />
2. Select &#8216;Programming&#8217; from the left tree panel and click &#8216;New Item&#8217; on the right panel.<br />
3. Set type to &#8216;Application&#8217;.<br />
4. Fill in the name, in my case I type in WingIDE.<br />
5. For the command text-field, fill in &#8216;/usr/bin/wing-101-3.0&#8242; (the installation directory).<br />
6. <a href="ftp://wingide.com/pub/wingide/support/wing48.png">Download WingIDE icon</a> and put the icon on a directory, in my case &#8216;/usr/share&#8217;. Click the icon button on the left. Browse to &#8216;/usr/share&#8217; directory click open. And choose the icon you put there earlier.</p>
<li>SVN</li>
<p>Simply type:</p>
<p>sudo apt-get install subversion</p>
<li>Glade</li>
<p>Simply type:</p>
<p>sudo aptitude install glade-3</ul>
<p>That is it. You are now ready to start developing software in Linux.</p>
<p><a href="http://www.exuber.net/wp-content/uploads/2008/04/netbean-boot.png"><img class="alignnone size-thumbnail wp-image-21" title="netbean booting up" src="http://www.exuber.net/wp-content/uploads/2008/04/netbean-boot-150x150.png" alt="" width="150" height="150" /></a><a href="http://www.exuber.net/wp-content/uploads/2008/04/netbean-action.png"><img class="alignnone size-thumbnail wp-image-20" title="netbean in action" src="http://www.exuber.net/wp-content/uploads/2008/04/netbean-action-150x150.png" alt="" width="150" height="150" /></a><a href="http://www.exuber.net/wp-content/uploads/2008/04/wingide-bootup.png"><img class="alignnone size-thumbnail wp-image-23" title="WingIDE booting up" src="http://www.exuber.net/wp-content/uploads/2008/04/wingide-bootup-150x150.png" alt="" width="150" height="150" /></a><a href="http://www.exuber.net/wp-content/uploads/2008/04/wingide-action.png"><img class="alignnone size-thumbnail wp-image-22" title="WingIDE in action" src="http://www.exuber.net/wp-content/uploads/2008/04/wingide-action-150x150.png" alt="" width="150" height="150" /></a><a href="http://www.exuber.net/wp-content/uploads/2008/04/glade-action.png"><img class="alignnone size-thumbnail wp-image-24" title="glade in action" src="http://www.exuber.net/wp-content/uploads/2008/04/glade-action-150x150.png" alt="" width="150" height="150" /></a></p>
<img src="http://feeds.feedburner.com/~r/Exuber/~4/292799991" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.exuber.net/2008/04/30/setting-up-the-stack-on-linux/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.exuber.net/2008/04/30/setting-up-the-stack-on-linux/</feedburner:origLink></item>
		<item>
		<title>Migrating to Linux</title>
		<link>http://feeds.feedburner.com/~r/Exuber/~3/292799992/</link>
		<comments>http://www.exuber.net/2008/04/29/migrating-to-linux/#comments</comments>
		<pubDate>Tue, 29 Apr 2008 05:30:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[articles]]></category>

		<guid isPermaLink="false">http://www.exuber.net/?p=18</guid>
		<description><![CDATA[I have always been a Microsoft product user. Well, simply because there was not many choices.
Most of the people I know uses Windows. In college it was consider cool to use Linux. But only several people went beyond installing them. Most of the time I install Linux in a dual-partition setup. I play with it [...]]]></description>
			<content:encoded><![CDATA[<p>I have always been a Microsoft product user. Well, simply because there was not many choices.<br />
Most of the people I know uses Windows. In college it was consider cool to use Linux. But only several people went beyond installing them. Most of the time I install Linux in a dual-partition setup. I play with it once in a while but never completely liked it. Everything seems so difficult in Linux back then. The driver was scarce (if any). And all the software was weird. Editing is quite annoying back then. Cause I used to ctrl-x to cut and ctrl-p to paste. It did not work at the time (I forgot the editor I used). And software installation was weird at best. In windows you have installer, where with a click you can setup the software. In Linux many application needs to build from source. And then there RPM, supposedly it helps software deployment problem. But for me it just not as easy as in Windows. Later on when VM became well known, I always have a Linux installed as virtual machine. But never on a single dedicated computer. Always as a backup never as main operating system.</p>
<p>Over the years however I am beginning to like Linux very much. And decided I should have a single dedicated computer that uses Linux. So I bought an Acer 4512 and installed Linux on them. Ubuntu Linux that is. You can find the installation instruction <a title="installing ubuntu" href="http://learningcomputer.info/2007/11/17/the-solution-for-antheros-wifi-problems-acer-4520-on-ubuntu/" target="_blank">here</a> or a more elaborate one <a title="installing ubuntu" href="http://ubuntuforums.org/showthread.php?t=510352&amp;page=11" target="_blank">here</a>. I find the first guide simple and it worked. The second guide gives you more detail and alternative if something went wrong.</p>
<p>And it was great. Some screen shot:</p>
<p><a href="http://www.exuber.net/wp-content/uploads/2008/04/screenshot.png"><img class="alignnone size-thumbnail wp-image-16" title="desktop" src="http://www.exuber.net/wp-content/uploads/2008/04/screenshot-150x150.png" alt="" width="150" height="150" /></a><a href="http://www.exuber.net/wp-content/uploads/2008/04/dua.png"><img class="alignnone size-thumbnail wp-image-5" title="slick window switcher" src="http://www.exuber.net/wp-content/uploads/2008/04/dua-150x150.png" alt="" width="150" height="150" /></a><a href="http://www.exuber.net/wp-content/uploads/2008/04/satu.png"><img class="alignnone size-thumbnail wp-image-15" title="switching between application" src="http://www.exuber.net/wp-content/uploads/2008/04/satu-150x150.png" alt="" width="150" height="150" /></a><a href="http://www.exuber.net/wp-content/uploads/2008/04/tiga.png"><img class="alignnone size-thumbnail wp-image-17" title="multiple workspace" src="http://www.exuber.net/wp-content/uploads/2008/04/tiga-150x150.png" alt="" width="150" height="150" /></a></p>
<p>Right out of the box the OS just works. What about the application/software installation? Installing a new application on Ubuntu Linux is easy. You can add/remove program from the menu. or use the synaptic package manager from system menu. Or you can use the command line. The command line (which I used to think primitive, you need to type and remember all those commands ) turned out to be the most efficient<br />
ways to carry out some task. And Linux has pipe, in which you can chain several command in a single command. Very efficient.</p>
<p>If you are new to Linux, here is several bundled software get you up and running:</p>
<ul>
<li>gedit, a quite advanced editor, it has spell check and support a lot of syntax highlight mode.</li>
<li>OpenOffice, open source office application, with it you can create documents, spreadsheet, etc.</li>
<li>Pidgin, an instant messaging application, it supports multiple protocols.</li>
<li>Firefox,  internet browser.</li>
<li>Evolution, Email suite.</li>
<li>GIMP, a photo editor application.</li>
<li>F-Spot, a photo management utility.</li>
</ul>
<p><a href="http://www.exuber.net/wp-content/uploads/2008/04/gedit.png"><img class="alignnone size-thumbnail wp-image-9" title="gedit in action" src="http://www.exuber.net/wp-content/uploads/2008/04/gedit-150x150.png" alt="" width="150" height="150" /></a><a href="http://www.exuber.net/wp-content/uploads/2008/04/oo.png"><img class="alignnone size-thumbnail wp-image-13" title="open office in action" src="http://www.exuber.net/wp-content/uploads/2008/04/oo-150x150.png" alt="" width="150" height="150" /></a><a href="http://www.exuber.net/wp-content/uploads/2008/04/pidgin.png"><img class="alignnone size-thumbnail wp-image-14" title="pidgin in action" src="http://www.exuber.net/wp-content/uploads/2008/04/pidgin-150x150.png" alt="" width="150" height="150" /></a><a href="http://www.exuber.net/wp-content/uploads/2008/04/firefox.png"><img class="alignnone size-thumbnail wp-image-7" title="firefox in action" src="http://www.exuber.net/wp-content/uploads/2008/04/firefox-150x150.png" alt="" width="150" height="150" /></a><a href="http://www.exuber.net/wp-content/uploads/2008/04/evolution.png"><img class="alignnone size-thumbnail wp-image-6" title="evolution mail client in action" src="http://www.exuber.net/wp-content/uploads/2008/04/evolution-150x150.png" alt="" width="150" height="150" /></a><a href="http://www.exuber.net/wp-content/uploads/2008/04/gimp.png"><img class="alignnone size-thumbnail wp-image-11" title="gimp booting up" src="http://www.exuber.net/wp-content/uploads/2008/04/gimp-150x150.png" alt="" width="150" height="150" /></a><a href="http://www.exuber.net/wp-content/uploads/2008/04/gimp-2.png"><img class="alignnone size-thumbnail wp-image-12" title="gimp in action" src="http://www.exuber.net/wp-content/uploads/2008/04/gimp-2-150x150.png" alt="" width="150" height="150" /></a><a href="http://www.exuber.net/wp-content/uploads/2008/04/f-spot.png"><img class="alignnone size-thumbnail wp-image-8" title="f-spot in action" src="http://www.exuber.net/wp-content/uploads/2008/04/f-spot-150x150.png" alt="" width="150" height="150" /></a></p>
<p>To increase your productivity, here is some shortcut:</p>
<p>1. ALT+ F1 : opens application menu.<br />
2. ALT+ F2 : display run dialog.<br />
3. CTRL + ALT+ D : minimizes all windows.<br />
4. print screen : capture screen.<br />
5. ALT+ print screen : capture active window.<br />
6. CTRL + ALT+ left-arrow : switch to workspace left of the current workspace.<br />
6. CTRL + ALT+ right-arrow : switch to workspace right of the current workspace.<br />
6. CTRL + ALT+ up-arrow : switch to workspace above of the current workspace.<br />
6. CTRL + ALT+ down-arrow : switch to workspace below of the current workspace.<br />
7. ALT + TAB : switch to other window.<br />
8. ALT + ESC : switch to other window in reverse order.</p>
<p>You can get the complete list <a href="http://www.novell.com/coolsolutions/tip/2289.html" target="_blank">here</a>, or just ask Google.</p>
<img src="http://feeds.feedburner.com/~r/Exuber/~4/292799992" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.exuber.net/2008/04/29/migrating-to-linux/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.exuber.net/2008/04/29/migrating-to-linux/</feedburner:origLink></item>
	</channel>
</rss>
