<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>On Tech and Software &#187; tutorial</title>
	<atom:link href="http://jmgtan.com/tag/tutorial/feed/" rel="self" type="application/rss+xml" />
	<link>http://jmgtan.com</link>
	<description>Random thoughts on technology, ventures, algorithms, frameworks, gadgets and THE MAN</description>
	<lastBuildDate>Fri, 02 Jul 2010 11:14:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Improve Eclipse Editor (HTML/CSS)</title>
		<link>http://jmgtan.com/2010/02/25/improve-eclipse-editor-htmlcss/</link>
		<comments>http://jmgtan.com/2010/02/25/improve-eclipse-editor-htmlcss/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 13:40:26 +0000</pubDate>
		<dc:creator>Jan Michael Tan</dc:creator>
				<category><![CDATA[How-To]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://jmgtan.com/?p=283</guid>
		<description><![CDATA[I&#8217;ve been having problems with editing html and css files in Eclipse for quite some time now, even when I&#8217;m using the latest version of Eclipse, Galileo, and the latest version of PDT. Typing constantly lags, and just typing a short string sometimes takes around 12 seconds to appear. My machine is no wuss either, [...]]]></description>
			<content:encoded><![CDATA[<p></p>
<p>I&#8217;ve been having problems with editing html and css files in Eclipse for quite some time now, even when I&#8217;m using the latest version of Eclipse, Galileo, and the latest version of PDT. Typing constantly lags, and just typing a short string sometimes takes around 12 seconds to appear. My machine is no wuss either, its a Macbook Pro with 4gb of ram, and I&#8217;ve allocated 2gb of that for eclipse alone. The problem stems from constant validation when typing even though the validators are suspended/disabled. To remedy this problem follow the following steps:</p>
<ol>
<li>Go to Preference window</li>
<li>Expand the General tab</li>
<li>Expand the Editors tab</li>
<li>Click on the Structured Text Editor then disable the following:
<ol>
<li>Report problems as you type</li>
<li>Inform when unsupported content type is in editor</li>
<li>Enable folding</li>
<li>Enable semantic highlighting</li>
</ol>
</li>
</ol>
<p>That helped me alot in making Eclipse usable again for PHP development, now I can return to Eclipse from using Netbeans.</p>
<p><em>Update: Although Eclipse became usable with the tweaks above, I got spoiled with Netbeans&#8217; speed especially the speed of code completion in PHP. Its nice being able to work with both PHP and Java without changing perspective. Now if only Netbeans&#8217; would improve their Subversion support, that would be epic (well at least for me)!</em></p>
<p></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fjmgtan.com%2F2010%2F02%2F25%2Fimprove-eclipse-editor-htmlcss%2F&amp;linkname=Improve%20Eclipse%20Editor%20%28HTML%2FCSS%29"><img src="http://jmgtan.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://jmgtan.com/2010/02/25/improve-eclipse-editor-htmlcss/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrading to Symfony 1.4 from PEAR based 1.2</title>
		<link>http://jmgtan.com/2010/01/03/upgrading-to-symfony-1-4-from-pear-based-1-2/</link>
		<comments>http://jmgtan.com/2010/01/03/upgrading-to-symfony-1-4-from-pear-based-1-2/#comments</comments>
		<pubDate>Mon, 04 Jan 2010 02:26:45 +0000</pubDate>
		<dc:creator>Jan Michael Tan</dc:creator>
				<category><![CDATA[How-To]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[symfony]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://jmgtan.com/?p=199</guid>
		<description><![CDATA[I&#8217;ve been working on a project, which started on 1.2.7, for almost 6 months now and have been upgrading it religiously along the 1.2.x branch which stopped at 1.2.10. We&#8217;re currently entering the testing stage, and being as curious as I am opted to create a 1.4 branch from the current trunk and started the [...]]]></description>
			<content:encoded><![CDATA[<p></p>
<p>I&#8217;ve been working on a project, which started on 1.2.7, for almost 6 months now and have been upgrading it religiously along the 1.2.x branch which stopped at 1.2.10. We&#8217;re currently entering the testing stage, and being as curious as I am opted to create a 1.4 branch from the current trunk and started the upgrade process while merging fixes from the trunk as fixes come in. We&#8217;re using the PEAR-based approach which allows us to quickly upgrade the base installation as soon as a new release comes in. Although i&#8217;m planning to migrate it to the subversion approach soon, but thats another blog post.</p>
<p><span id="more-199"></span></p>
<p>So lets start with the upgrade, symfony 1.4 and 1.3 is basically the same feature-wised but the former lacks the backwards compatibility that the latter provides, basically 1.3 is just a stepping stone to upgrade to 1.4. The Symfony team really did a great job on the seamless upgrade process. Also to have a better background on the upgrade process read the upgrade document from their website (<a href="http://www.symfony-project.org/tutorial/1_4/en/upgrade" target="_blank">http://www.symfony-project.org/tutorial/1_4/en/upgrade</a>). Ok, so lets start with the upgrade.</p>
<p>Lets uninstall symfony 1.2</p>
<pre class="brush: bash;">

pear uninstall symfony/symfony
</pre>
<p>Then install symfony 1.3</p>
<pre class="brush: bash;">

pear install symfony/symfony-1.3.1
</pre>
<p>Once installed, make sure to upgrade the plugins, rebuild the models, and clear the cache to make sure you&#8217;re using the new files. Now you can opt to continue upgrading to 1.4 and drop the backwards compatibility or just stick with 1.3 for the time being, both of which are being supported but 1.4 is a LTS release, meaning that it has a longer support period than 1.3. Before upgrading to 1.4 it is important to remove old class files, symfony provides a build-in task to ease the transition. Just execute this command and symfony will list down all of the deprecated stuff that should be remove/modified, they also provided documentation on what to replace the deprecated stuff with (<a href="http://www.symfony-project.org/tutorial/1_4/en/deprecated" target="_blank">http://www.symfony-project.org/tutorial/1_4/en/deprecated</a>)</p>
<pre class="brush: bash;">

symfony project:validate
</pre>
<p>So now that you&#8217;ve removed/modified all of the deprecated stuff, upgrading is quite similar to 1.3.</p>
<p>Remove the old symfony installation</p>
<pre class="brush: bash;">

pear uninstall symfony/symfony
</pre>
<p>Install the new one</p>
<pre class="brush: bash;">

pear install symfony/symfony-1.4.1
</pre>
<p>Then just clear the cache. Also the freeze/unfreeze task has been removed in 1.4; it may or may not be important to you but I use it when deploying to our servers, one quick fix is to just create a lib/vendor folder and copy/paste the symfony folder found in your PEAR installation folder, and then modifying the include call in the config/ProjectConfiguration.class.php file. So now you have a easily upgradable and independent symfony installation inside your app.</p>
<p></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fjmgtan.com%2F2010%2F01%2F03%2Fupgrading-to-symfony-1-4-from-pear-based-1-2%2F&amp;linkname=Upgrading%20to%20Symfony%201.4%20from%20PEAR%20based%201.2"><img src="http://jmgtan.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://jmgtan.com/2010/01/03/upgrading-to-symfony-1-4-from-pear-based-1-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Symfony Forms Tutorial: Quick Registration Form</title>
		<link>http://jmgtan.com/2009/07/09/symfony-forms-tutorial-quick-registration-form/</link>
		<comments>http://jmgtan.com/2009/07/09/symfony-forms-tutorial-quick-registration-form/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 09:27:23 +0000</pubDate>
		<dc:creator>Jan Michael Tan</dc:creator>
				<category><![CDATA[How-To]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[symfony]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://jmgtan.com/?p=148</guid>
		<description><![CDATA[I was initially skeptical about these numerous form frameworks that are coming out, I would initially opt to create forms and validations the old fashion way, but after giving symfony forms a shot; I can honestly say i&#8217;m converted! Lets start the tutorial by creating a basic registration form with a captcha. I would assume [...]]]></description>
			<content:encoded><![CDATA[<p></p>
<p>I was initially skeptical about these numerous form frameworks that are coming out, I would initially opt to create forms and validations the old fashion way, but after giving symfony forms a shot; I can honestly say i&#8217;m converted! Lets start the tutorial by creating a basic registration form with a captcha. I would assume you know the basics of symfony if not go to their website (<a title="Symfony" href="http://www.symfony-project.org" target="_blank">http://www.symfony-project.org</a>) and check out their tutorial.</p>
<p><span id="more-148"></span></p>
<p>After setting up the project, app and modules we will install the plugin sfFormExtraPlugin so we can use ReCaptcha:</p>
<pre class="brush: bash;">
symfony plugin:install sfFormExtraPlugin
</pre>
<p>After that, go to <a title="ReCaptcha" href="http://www.recaptcha.net" target="_blank">http://www.recaptcha.net</a> and register to acquire a public and private key; we&#8217;ll use that later. Now lets start creating the form class</p>
<pre class="brush: php;">
class RegistrationForm extends sfForm {
const PUBLIC_KEY = 'PASTE YOUR PUBLIC KEY FROM RECAPTCHA';
const PRIVATE_KEY = 'PASTE YOUR PRIVATE KEY FROM RECAPTCHA';

public function configure() {
$this-&gt;setWidgets(array(
'username'=&gt;new sfWidgetFormInput(array(), array('size'=&gt;32)),
'password'=&gt;new sfWidgetFormInputPassword(array(), array('size'=&gt;32)),
'confirm_password'=&gt;new sfWidgetFormInputPassword(array(), array('size'=32)),
'email'=&gt;new sfWidgetFormInput(array(), array('size'=&gt;32)),
'captcha'=&gt;new sfWidgetFormReCaptcha(array(
'public_key'=&gt;self::PUBLIC_KEY
))
));

$this-&gt;widgetSchema-&gt;setNameFormat('register[%s]'); //this acts as a namespace and also will be use later for binding POST

$this-&gt;setValidators(array(
'username'=&gt;new sfValidatorString(array('max_length'=&gt;50), array('max_length'=&gt;'Max length of username is 50')),
'password'=&gt;new sfValidatorString(),
'confirm_password'=&gt;new sfValidatorString(),
'email'=&gt;new sfValidatorEmail(),
'captcha'=&gt;new sfValidatorReCaptcha(array('private_key' =&gt; self::PRIVATE_KEY), array('captcha' =&gt; 'Didn\'t match captcha'))
));

$this-&gt;validatorSchema-&gt;setPostValidator(new sfValidatorSchemaCompare('password', sfValidatorSchemaCompare::EQUAL, 'confirm_password', array(), array('invalid' =&gt; 'Passwords do not match')));

$this-&gt;widgetSchema-&gt;setLabels(array(
'username'=&gt;'Username',
'password'=&gt;'Password',
'confirm_password'=&gt;'Confirm Password',
'email'=&gt;'Email Address',
'captcha'=&gt;'Captcha'
));
}
}
</pre>
<p>The code in your actions.class.php would be as follows</p>
<pre class="brush: php;">
public function executeRegister(sfWebRequest $r) {
$this-&gt;form = new RegistrationForm();
if($r-&gt;isMethod('post')) {
$captcha = array(
'recaptcha_challenge_field' =&gt; $request-&gt;getParameter('recaptcha_challenge_field'),
'recaptcha_response_field'  =&gt; $request-&gt;getParameter('recaptcha_response_field'),
);

$this-&gt;form-&gt;bind(array_merge($request-&gt;getParameter('register'), array('captcha' =&gt; $captcha)));
if($this-&gt;form-&gt;isValid()) {
$values = $this-&gt;form-&gt;getValues(); //associative array of values
//you can access the POST data like $values['username'] or $values['email']
//do database insertion or other processsing here
}
}
}
</pre>
<p>And lastly displaying the form in your corresponding template would be as follows</p>
<pre class="brush: php;">
&amp;lt;?php echo $form ?&gt;
</pre>
<p>In the next article, we would be discussing how to customize your form layout.</p>
<p></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fjmgtan.com%2F2009%2F07%2F09%2Fsymfony-forms-tutorial-quick-registration-form%2F&amp;linkname=Symfony%20Forms%20Tutorial%3A%20Quick%20Registration%20Form"><img src="http://jmgtan.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://jmgtan.com/2009/07/09/symfony-forms-tutorial-quick-registration-form/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
