<?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>Tutorialzine &#187; Articles</title>
	<atom:link href="http://tutorialzine.com/category/articles/feed/" rel="self" type="application/rss+xml" />
	<link>http://tutorialzine.com</link>
	<description>Web Development Tutorials &#38; Resources</description>
	<lastBuildDate>Wed, 01 Feb 2012 14:50:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>iPhorm Plugin Winners</title>
		<link>http://tutorialzine.com/2012/01/iphorm-plugin-winners/</link>
		<comments>http://tutorialzine.com/2012/01/iphorm-plugin-winners/#comments</comments>
		<pubDate>Thu, 05 Jan 2012 19:33:05 +0000</pubDate>
		<dc:creator>Martin Angelov</dc:creator>
				<category><![CDATA[Tzine]]></category>

		<guid isPermaLink="false">http://tutorialzine.com/?p=1796</guid>
		<description><![CDATA[<div><a href="http://tutorialzine.com/2012/01/iphorm-plugin-winners/"><img src="http://cdn.tutorialzine.com/img/featured/1796.jpg" /></a></div> Announcing the winners of the iPhorm WordPress plugin giveaway.]]></description>
			<content:encoded><![CDATA[<div><a href="http://tutorialzine.com/2012/01/iphorm-plugin-winners/"><img src="http://cdn.tutorialzine.com/img/featured/1796.jpg" /></a></div> <p>Just before the holidays, you took part in the <a title="Win a copy of the iPhorm WordPress plugin!" href="http://tutorialzine.com/2011/12/win-a-copy-of-iphorm-wordpress-plugin/">iPhorm WordPress Plugin Giveaway</a>, where two of you had a chance of winning a copy of the plugin. Now it is time to draw the winners!</p>
<p>And the two of you who got a late Christmas present are <strong>WPH</strong> and <strong>Mike Dedmon</strong>. They have been contacted and will receive their prizes shortly.</p>
<div id="attachment_1797" class="wp-caption alignnone" style="width: 630px"><a href="http://cdn.tutorialzine.com/wp-content/uploads/2012/01/winners.jpg"><img class="size-full wp-image-1797" title="iPhorm winners" src="http://cdn.tutorialzine.com/wp-content/uploads/2012/01/winners.jpg" alt="iPhorm winners" width="620" height="260" /></a><p class="wp-caption-text">iPhorm winners</p></div>
<p>For those of you who did not win, I wish the best of luck next time!</p>
]]></content:encoded>
			<wfw:commentRss>http://tutorialzine.com/2012/01/iphorm-plugin-winners/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Win a copy of the iPhorm WordPress plugin!</title>
		<link>http://tutorialzine.com/2011/12/win-a-copy-of-iphorm-wordpress-plugin/</link>
		<comments>http://tutorialzine.com/2011/12/win-a-copy-of-iphorm-wordpress-plugin/#comments</comments>
		<pubDate>Wed, 21 Dec 2011 19:00:06 +0000</pubDate>
		<dc:creator>Martin Angelov</dc:creator>
				<category><![CDATA[Tzine]]></category>

		<guid isPermaLink="false">http://tutorialzine.com/?p=1775</guid>
		<description><![CDATA[<div><a href="http://tutorialzine.com/2011/12/win-a-copy-of-iphorm-wordpress-plugin/"><img src="http://cdn.tutorialzine.com/img/featured/1775.jpg" /></a></div> Win a copy of the premium iPhorm WordPress plugin.]]></description>
			<content:encoded><![CDATA[<div><a href="http://tutorialzine.com/2011/12/win-a-copy-of-iphorm-wordpress-plugin/"><img src="http://cdn.tutorialzine.com/img/featured/1775.jpg" /></a></div> <p>WordPress is undoubtedly the most popular CMS in the world. It is used for so much more than the authors initially envisioned. With all of its wonderful features and incredible plugins, you can build anything – from a personal blog to a fully-fledged online shop.</p>
<p>With the holidays right around the corner, we decided to give away <strong>two copies</strong> of the iPhorm plugin which will help you create forms for your website with an easy to use drag-and-drop builder directly from WordPress.</p>
<div id="attachment_1776" class="wp-caption alignnone" style="width: 630px"><a href="http://www.themecatcher.net/iphorm-form-builder"><img class="size-full wp-image-1776" title="The iPhorm Plugin" src="http://cdn.tutorialzine.com/wp-content/uploads/2011/12/620-300-for-tutorialzine.png" alt="The iPhorm Plugin" width="620" height="300" /></a><p class="wp-caption-text">The iPhorm Plugin</p></div>
<p><a href="http://www.themecatcher.net/iphorm-form-builder" target="_blank">iPhorm</a> is a WordPress plugin that makes building forms easy with elements that include email address, date and time, file uploads and many more. The form submissions are received as emails or directly in your dashboard. Designers have full control on how the forms looks, and for everybody else, two themes are provided. For a live demo, see <a href="http://demos.themecatcher.net/iphorm-form-builder/wp-admin" target="_blank">here</a>.</p>
<h3>How to Win</h3>
<p>For a chance to win a copy of the plugin, do the following:</p>
<ul>
<li>Leave a comment below this article;</li>
<li>Tweet it.</li>
</ul>
<p>The winners will be announced on <strong>January 5th 2012</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://tutorialzine.com/2011/12/win-a-copy-of-iphorm-wordpress-plugin/feed/</wfw:commentRss>
		<slash:comments>81</slash:comments>
		</item>
		<item>
		<title>IM Creator Lifetime Subscription Winners</title>
		<link>http://tutorialzine.com/2011/12/im-creator-lifetime-subscription-winners/</link>
		<comments>http://tutorialzine.com/2011/12/im-creator-lifetime-subscription-winners/#comments</comments>
		<pubDate>Thu, 15 Dec 2011 11:04:14 +0000</pubDate>
		<dc:creator>Martin Angelov</dc:creator>
				<category><![CDATA[Tzine]]></category>

		<guid isPermaLink="false">http://tutorialzine.com/?p=1743</guid>
		<description><![CDATA[<div><a href="http://tutorialzine.com/2011/12/im-creator-lifetime-subscription-winners/"><img src="http://cdn.tutorialzine.com/img/featured/1743.jpg" /></a></div> Announcing the winners for the IM Creator Giveaway.]]></description>
			<content:encoded><![CDATA[<div><a href="http://tutorialzine.com/2011/12/im-creator-lifetime-subscription-winners/"><img src="http://cdn.tutorialzine.com/img/featured/1743.jpg" /></a></div> <p>Ten days ago you took part in the <a href="http://tutorialzine.com/2011/12/win-lifetime-subscription-imcreator/">IM Creator giveaway</a>, where three of you had a chance to win a lifetime subscription for their new web site building service. Now it is time to draw the winners!</p>
<p>And they are <strong>kit</strong>, <strong>Richard Bland</strong> and <strong>Chen YH</strong>. They have been contacted and will receive their prizes soon.</p>
<div id="attachment_1746" class="wp-caption alignnone" style="width: 630px"><img class="size-full wp-image-1746" title="The Winners" src="http://cdn.tutorialzine.com/wp-content/uploads/2011/12/winners.jpg" alt="The Winners" width="620" height="260" /><p class="wp-caption-text">The Winners</p></div>
<p>I am wishing the best of luck in the coming competitions for those of you who did not win!</p>
]]></content:encoded>
			<wfw:commentRss>http://tutorialzine.com/2011/12/im-creator-lifetime-subscription-winners/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Win a lifetime subscription to IM Creator!</title>
		<link>http://tutorialzine.com/2011/12/win-lifetime-subscription-imcreator/</link>
		<comments>http://tutorialzine.com/2011/12/win-lifetime-subscription-imcreator/#comments</comments>
		<pubDate>Mon, 05 Dec 2011 22:01:30 +0000</pubDate>
		<dc:creator>Martin Angelov</dc:creator>
				<category><![CDATA[Tzine]]></category>

		<guid isPermaLink="false">http://tutorialzine.com/?p=1716</guid>
		<description><![CDATA[<div><a href="http://tutorialzine.com/2011/12/win-lifetime-subscription-imcreator/"><img src="http://cdn.tutorialzine.com/img/featured/1716.jpg" /></a></div> The folks behind IM Creator have generously offered three lifetime licenses for their premium plan to Tzine readers.]]></description>
			<content:encoded><![CDATA[<div><a href="http://tutorialzine.com/2011/12/win-lifetime-subscription-imcreator/"><img src="http://cdn.tutorialzine.com/img/featured/1716.jpg" /></a></div> <p>Every website is different. From complex online stores that test your development skills, to presentation oriented pages that depend heavily on design, and everything in between. But there is a right tool for any job. You can use an open source CMS to lift the development burden off complex sites, but it would be an overkill for simpler ones.</p>
<p>This is where a tool like IM Creator comes into play.</p>
<div id="attachment_1717" class="wp-caption alignnone" style="width: 630px"><a href="http://imcreator.com/?utm_source=tutorialzine&amp;utm_medium=article&amp;utm_content=article&amp;utm_campaign=tutorialzine"><img class="size-full wp-image-1717" title="IM Creator Lifetime License" src="http://cdn.tutorialzine.com/wp-content/uploads/2011/12/banner.jpg" alt="IM Creator Lifetime License" width="620" height="340" /></a><p class="wp-caption-text">IM Creator Lifetime License</p></div>
<p><a href="http://imcreator.com/?utm_source=tutorialzine&amp;utm_medium=article&amp;utm_content=article&amp;utm_campaign=tutorialzine">IM Creator</a> is a new simple and free HTML-based drag and drop website builder that allows you to create your website in a trouble-free, accessible and pleasant experience. With IM Creator, you can build a beautiful site, fast. <a href="http://app.imcreator.com/start?utm_source=tutorialzine&amp;utm_medium=article&amp;utm_content=article&amp;utm_campaign=tutorialzine">Start</a> from an existing design or make a new one - it’s up to you.</p>
<h3>The Prize</h3>
<p>The folks behind IM Creator have generously offered three lifetime licenses for their premium plan to Tutorialzine readers (valued at $95/year each). The offer applies to new clients of their service.</p>
<h3>How to Win</h3>
<p>For a chance to win a lifetime subscription, do the following:</p>
<ul>
<li>Leave a comment below this article;</li>
<li>Tweet it.</li>
</ul>
<p>The winners will be announced on <strong>December 15th 2011</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://tutorialzine.com/2011/12/win-lifetime-subscription-imcreator/feed/</wfw:commentRss>
		<slash:comments>90</slash:comments>
		</item>
		<item>
		<title>4Templates Premium Theme Winners</title>
		<link>http://tutorialzine.com/2011/12/4templates-permium-theme-winners/</link>
		<comments>http://tutorialzine.com/2011/12/4templates-permium-theme-winners/#comments</comments>
		<pubDate>Thu, 01 Dec 2011 09:52:53 +0000</pubDate>
		<dc:creator>Martin Angelov</dc:creator>
				<category><![CDATA[Tzine]]></category>

		<guid isPermaLink="false">http://tutorialzine.com/?p=1710</guid>
		<description><![CDATA[<div><a href="http://tutorialzine.com/2011/12/4templates-permium-theme-winners/"><img src="http://cdn.tutorialzine.com/img/featured/1710.jpg" /></a></div> Announcing the winners of the 4Templates giveaway.]]></description>
			<content:encoded><![CDATA[<div><a href="http://tutorialzine.com/2011/12/4templates-permium-theme-winners/"><img src="http://cdn.tutorialzine.com/img/featured/1710.jpg" /></a></div> <p>A week ago, you took part in the <a href="http://tutorialzine.com/2011/11/win-a-premium-theme-from-4templates/">4Templates giveaway</a>. The curtains are closed, so are the comments, and now is time to draw the winners using the <a href="http://demo.tutorialzine.com/2010/09/giveaway-randomizer-app-jquery/randomizer.html">giveaway randomizer app</a> from a while back.</p>
<p>The winners are: <strong>Momcilo</strong>, <strong>SubZero</strong> and <strong>Imran</strong>. They get to choose a premium theme or template from <a href="http://www.4templates.com/">4Templates</a> for free.</p>
<div id="attachment_1711" class="wp-caption alignnone" style="width: 630px"><img class="size-full wp-image-1711" title="4Templates Winners" src="http://cdn.tutorialzine.com/wp-content/uploads/2011/12/the-winners.jpg" alt="4Templates Winners" width="620" height="444" /><p class="wp-caption-text">4Templates Winners</p></div>
<p>For those that did not win, I am wishing best of luck in the giveaways that come!</p>
]]></content:encoded>
			<wfw:commentRss>http://tutorialzine.com/2011/12/4templates-permium-theme-winners/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Win a premium theme from 4Templates!</title>
		<link>http://tutorialzine.com/2011/11/win-a-premium-theme-from-4templates/</link>
		<comments>http://tutorialzine.com/2011/11/win-a-premium-theme-from-4templates/#comments</comments>
		<pubDate>Tue, 22 Nov 2011 10:20:11 +0000</pubDate>
		<dc:creator>Martin Angelov</dc:creator>
				<category><![CDATA[Tzine]]></category>

		<guid isPermaLink="false">http://tutorialzine.com/?p=1684</guid>
		<description><![CDATA[<div><a href="http://tutorialzine.com/2011/11/win-a-premium-theme-from-4templates/"><img src="http://cdn.tutorialzine.com/img/featured/1684.jpg" /></a></div> With the help of our friends at 4Templates, three of you will have a chance to win a premium theme or template of their choice for free.]]></description>
			<content:encoded><![CDATA[<div><a href="http://tutorialzine.com/2011/11/win-a-premium-theme-from-4templates/"><img src="http://cdn.tutorialzine.com/img/featured/1684.jpg" /></a></div> <p>We are all programmers and writing code is what we do best. But there is a common pain we all share &#8211; making our sites look as good as they function. Lets face it &#8211; design is hard. Luckily for us however, there is a quick solution to this &#8211; a beautifully designed theme that is ready for use.</p>
<p>With the help of our friends at 4Templates, three of you will have a chance to win a <strong>premium theme or template of their choice for free</strong>.</p>
<div id="attachment_1685" class="wp-caption alignnone" style="width: 630px"><a href="http://www.4templates.com/"><img class="size-full wp-image-1685" title="Win a premium theme from 4Templates" src="http://cdn.tutorialzine.com/wp-content/uploads/2011/11/4t-620x300.jpg" alt="Win a premium theme from 4Templates" width="620" height="300" /></a><p class="wp-caption-text">Win a premium theme from 4Templates</p></div>
<p><a href="http://www.4templates.com/" target="_blank">4Templates.com</a> has hundreds of awesome website templates and WordPress themes with amazing graphics, standards compliant XHTML and CSS code, PSD files, and great tech support whenever you need it. And with everything under 30 bucks, you&#8217;ll always find something that works great no matter the project or budget.</p>
<h3>How to win?</h3>
<p>To participate, do the following:</p>
<ul>
<li>Leave a comment;</li>
<li>Tweet about this post.</li>
</ul>
<p>The winners will be announced on <strong>December 1st 2011</strong> in a followup post.</p>
]]></content:encoded>
			<wfw:commentRss>http://tutorialzine.com/2011/11/win-a-premium-theme-from-4templates/feed/</wfw:commentRss>
		<slash:comments>109</slash:comments>
		</item>
		<item>
		<title>For Developers: When to Choose a VPS</title>
		<link>http://tutorialzine.com/2011/10/for-developers-when-to-choose-a-vps/</link>
		<comments>http://tutorialzine.com/2011/10/for-developers-when-to-choose-a-vps/#comments</comments>
		<pubDate>Tue, 11 Oct 2011 19:35:23 +0000</pubDate>
		<dc:creator>Martin Angelov</dc:creator>
				<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://tutorialzine.com/?p=1634</guid>
		<description><![CDATA[<div><a href="http://tutorialzine.com/2011/10/for-developers-when-to-choose-a-vps/"><img src="http://cdn.tutorialzine.com/img/featured/1634.jpg" /></a></div> Upgrading from a shared hosting account to a Virtual Private Server is a worthy investment that opens great opportunities to the way you can develop web applications. But is it really worth the extra effort?]]></description>
			<content:encoded><![CDATA[<div><a href="http://tutorialzine.com/2011/10/for-developers-when-to-choose-a-vps/"><img src="http://cdn.tutorialzine.com/img/featured/1634.jpg" /></a></div> <p>As a website owner, you&#8217;ve probably heard that Google is using your page load times as a metric in their ranking algorithm. It is not given a lot of weight, but even for usability reasons, having a fast website means having happier visitors (and more of them). With tools like Google&#8217;s <a href="http://code.google.com/speed/page-speed/" target="_blank">Page Speed</a> and the <a href="https://addons.mozilla.org/en-US/firefox/addon/yslow/" target="_blank">YSlow firefox addon</a>, you quickly run out of optimization tips to do on the page level. You need to dig deeper for real speed gains.</p>
<p>If you are a web developer, this post is for you. It goes over some of the experience I had with moving Tutorialzine to and configuring a <a href="http://en.wikipedia.org/wiki/Virtual_private_server" target="_blank">VPS</a> (virtual private server), the logical step after shared hosting.</p>
<p>You may wonder why it took nearly two years for me to decide to migrate this website. Well, it&#8217;s because</p>
<h3>Shared hosting is not a bad idea</h3>
<p>Coming to think of it, the Internet Revolution didn&#8217;t occur because of Google, Twitter, nor Facebook, as much as it did for offering a cheap way for people to publish content online. And it doesn&#8217;t get much cheaper than shared web hosting &#8211; thousands of websites on a single server, utilizing every bit of performance and bandwidth. And every couple of years, as servers become more and more powerful, it is possible to host ever larger websites on that same cheap platform.</p>
<h4>Bad reputation</h4>
<p>But then, why does shared hosting have such a bad reputation? It is actually a combination of several factors. Having learned to use Google before asking trivial questions, I didn&#8217;t need much support from my web host. On the rare occasions that I did (usually to report issues like downtime, unreachable database server or undelivered email), it usually took about 24 hours to receive a response. While this has more to do with the company itself than shared hosting, it is still part of the experience. But before judging too harsh, keep in mind that <strong>you can&#8217;t expect miracles for $5 per month</strong>.</p>
<p>There is another bad practice that nearly all shared hosting providers are guilty of &#8211; <strong>overselling</strong>. Going after maximum returns, companies cram more websites than what is possible for a single server to handle, in the hope that not everyone will be using what they are promised. The result &#8211; bad performance and frequent downtime. Of course, I have to admin that there has been good progress in this area in recent years, but it is because of the more powerful hardware, and not that companies have become nicer to their customers.</p>
<p>However, you can work around this problem &#8211; with WordPress plugins such as <a href="http://wordpress.org/extend/plugins/w3-total-cache/" target="_blank">W3 Total Cache</a>, I managed to optimize the page load times of this site, and with services like <a href="http://maxcdn.com/" target="_blank">MaxCDN</a> (which kindly sponsor Tutorialzine), I was able to increase the download speed of static files like images, stylesheets and JS files by moving them onto a fast delivery network. So as a result, I had livable performance even on a commodity web hosting provider.</p>
<p>The bad news is that this comes at a price. Although my website was as optimized as possible this still didn&#8217;t save it from</p>
<h4>The downtime</h4>
<p>We&#8217;ve all felt the frustration when a favorite website is unavailable; it is even worse if it&#8217;s <strong>yours</strong>. Downtime is a clear sign that your oversold web host is struggling with the load. It is understandable, once you take into account the millions of pageviews it has to serve every day. But there is another issue that becomes clear once you try to set up your own LAMP server: commodity web hosts aren&#8217;t tuned for speed, they are tuned for security. Isolating users from one-another on a shared system is an absolute must, which means that no system-wide caching or other performance optimizations are possible. They also have to stick to the slow Apache, as it is the most feature-rich webserver that a lot of software (including WordPress) depends on.</p>
<div id="attachment_1643" class="wp-caption alignnone" style="width: 630px"><a href="http://dashboard.tutorialzine.com/"><img class="size-full wp-image-1643   " title="Response Time" src="http://cdn.tutorialzine.com/wp-content/uploads/2011/10/performance-improvements.png" alt="Tutorialzine's response time (lower is better). October 9th marks the transfer to VPS." width="620" height="260" /></a><p class="wp-caption-text">Tutorialzine&#39;s response time (lower is better). October 9th marks the transfer to VPS.</p></div>
<h3>Here comes salvation</h3>
<p>The obvious choice is to ditch shared hosting entirely and move to VPS. This is your individual slice of a real server, over which you have complete control. You can choose the OS (most likely a server-friendly Linux distribution) and the software on the machine, so you can install pretty much what you want. It is more expensive than the $5/m hosting plan, but you get guaranteed performance and the freedom that comes with it.</p>
<p>Sounds exciting? Yes, indeed! So you order one, spend a couple of hours following one of the friendly getting started guides, fire up your browser and discover that your website is <em><strong>as slow as it used to be</strong></em>. But how come?! You followed all the steps, embraced the open source philosophy, and still it isn&#8217;t much better.</p>
<h4>The bad news</h4>
<p>It is easy to have a <a href="http://en.wikipedia.org/wiki/LAMP_%28software_bundle%29" target="_blank">LAMP</a> stack up and running, but it is hard to have it running fast. As a minimum you will need to be <span style="text-decoration: underline;">comfortable at the termina</span>l, doing <span style="text-decoration: underline;">basic Linux administration</span>, configuring <span style="text-decoration: underline;">web servers</span>, setting up <span style="text-decoration: underline;">virtual hosts</span>, <span style="text-decoration: underline;">email</span> and <span style="text-decoration: underline;">dns</span>, while at the same time keeping you system secure. With a VPS you are on your own. If you don&#8217;t have experience working with linux, or the time and energy to read and experiment as things happen (a quite debilitating task, trust me), you are going to have a bad time.</p>
<p>Moving Tutorialzine required several days of testing different configurations, installing software and tweaking. I also had to read about all the topics above and become familiar with a lot of command-line utilities. But was it worth it? Of course it was. I now have complete control on my set up and can install <a href="http://nodejs.org" target="_blank">exciting software</a> that I couldn&#8217;t have hoped to find on a regular web host. The site is also much snappier than before, which will benefit everybody.</p>
<h3>How to decide</h3>
<p>Choosing where and how to host your website is not easy. Right now there are a lot of alternatives to shared hosting that do not require you to set up your own virtual server. There are cloud platforms like <a href="http://www.heroku.com/" target="_blank">Heroku</a> and <a href="https://phpfog.com/" target="_blank">PHP Fog</a>, or grid hosting solutions that aim to narrow the gap between VPS and shared hosting. If you don&#8217;t want to spend time on a command line, I suggest that you give these a try.</p>
<p>For me going with VPS was a natural choice, as I had already spent some time reading about linux, so it was about time to put the things I have picked up over the last year into practice. But I will not be cancelling my hosting account any time soon. It is still a nice fit for simple or low volume client websites.</p>
<h3>What is your experience?</h3>
<p>Have you tried any of the cloud platforms? Do you keep a hosting account lying around? Share it in the comment section.</p>
]]></content:encoded>
			<wfw:commentRss>http://tutorialzine.com/2011/10/for-developers-when-to-choose-a-vps/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>15 Powerful jQuery Tips and Tricks for Developers</title>
		<link>http://tutorialzine.com/2011/06/15-powerful-jquery-tips-and-tricks-for-developers/</link>
		<comments>http://tutorialzine.com/2011/06/15-powerful-jquery-tips-and-tricks-for-developers/#comments</comments>
		<pubDate>Wed, 29 Jun 2011 14:14:08 +0000</pubDate>
		<dc:creator>Martin Angelov</dc:creator>
				<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://tutorialzine.com/?p=1518</guid>
		<description><![CDATA[<div><a href="http://tutorialzine.com/2011/06/15-powerful-jquery-tips-and-tricks-for-developers/"><img src="http://cdn.tutorialzine.com/img/featured/1518.jpg" /></a></div> In this article we will take a look at 15 jQuery techniques for your effective use of the library. We will start with a few tips about performance and continue with some of the library's more obscure features.]]></description>
			<content:encoded><![CDATA[<div><a href="http://tutorialzine.com/2011/06/15-powerful-jquery-tips-and-tricks-for-developers/"><img src="http://cdn.tutorialzine.com/img/featured/1518.jpg" /></a></div> <p>In this article we will take a look at 15 jQuery techniques which will be useful for your effective use of the library. We will start with a few tips about performance and continue with short introductions to some of the library&#8217;s more obscure features.</p>
<h3>1) Use the Latest Version of jQuery</h3>
<p>With all the innovation taking place in the jQuery project, one of the easiest ways to improve the performance of your web site is to simply use the latest version of jQuery. Every release of the library introduces optimizations and bug fixes, and most of the time upgrading involves only changing a script tag.</p>
<p>You can even include jQuery directly from Google&#8217;s servers, which provide <a href="http://code.google.com/apis/libraries/devguide.html" target="_blank">free CDN hosting</a> for a number of JavaScript libraries.</p>
<pre class="brush:html">&lt;!-- Include a specific version of jQuery --&gt;
&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"&gt;&lt;/script&gt;

&lt;!-- Include the latest version in the 1.6 branch --&gt;
&lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"&gt;&lt;/script&gt;</pre>
<p>The latter example will include the latest 1.6.x version automatically as it becomes available, but as pointed out on <a href="http://css-tricks.com/7924-google-cdn-naming/" target="_blank">css-tricks</a>, it is cached only for an hour, so you better not use it in production environments.</p>
<h3>2) Keep Selectors Simple</h3>
<p>Up until recently, retrieving DOM elements with jQuery was a finely choreographed combination of parsing selector strings, JavaScript loops and inbuilt APIs like <code>getElementById()</code>, <code>getElementsByTagName()</code> and <code>getElementsByClassName()</code>. But now, all major browsers support <code>querySelectorAll()</code>, which understands CSS query selectors and brings a <a href="http://ejohn.org/blog/queryselectorall-in-firefox-31/" target="_blank">significant performance gain</a>.</p>
<p>However, you should still try to optimize the way you retrieve elements. Not to mention that a lot of users still use older browsers that force jQuery into traversing the DOM tree, which is slow.</p>
<pre class="brush:js">$('li[data-selected="true"] a')	// Fancy, but slow
$('li.selected a')	// Better
$('#elem')	// Best</pre>
<p>Selecting by id is the fastest. If you need to select by class name, prefix it with a tag &#8211; <code>$('li.selected')</code>. These optimizations mainly affect older browsers and mobile devices.</p>
<p>Accessing the DOM will always be the slowest part of every JavaScript application, so minimizing it is beneficial. One of the ways to do this, is to cache the results that jQuery gives you. The variable you choose will hold a jQuery object, which you can access later in your script.</p>
<pre class="brush:js">var buttons = $('#navigation a.button');

// Some prefer prefixing their jQuery variables with $:
var $buttons = $('#navigation a.button');</pre>
<p>Another thing worth noting, is that jQuery gives you a large number of <a href="http://api.jquery.com/category/selectors/jquery-selector-extensions/" target="_blank">additional selectors</a> for convenience, such as <code>:visible</code>, <code>:hidden</code>, <code>:animated</code> and more, which are not valid CSS3 selectors. The result is that if you use them the library cannot utilize <code>querySelectorAll()</code>. To remedy the situation, you can first select the elements you want to work with, and later filter them, like this:</p>
<pre class="brush:js">$('a.button:animated');	// Does not use querySelectorAll()
$('a.button').filter(':animated');	// Uses it</pre>
<p>The results of the above are the same, with the exception that the second example is faster.</p>
<h3>3) jQuery Objects as Arrays</h3>
<p>The result of running a selector is a jQuery object. However, the library makes it appear as if you are working with an array by defining index elements and a length.</p>
<pre class="brush:js">// Selecting all the navigation buttons:
var buttons = $('#navigation a.button');

// We can loop though the collection:
for(var i=0;i&lt;buttons.length;i++){
	console.log(buttons[i]);	// A DOM element, not a jQuery object
}

// We can even slice it:
var firstFour = buttons.slice(0,4);</pre>
<p>If performance is what you are after, using a simple <code>for</code> (or a <code>while</code>) loop instead of <code>$.each()</code>, can make your code <a href="http://jsfiddle.net/martinaglv/NcRsV/" target="_blank">several times faster</a>.</p>
<p>Checking the length is also the only way to determine whether your collection contains any elements.</p>
<pre class="brush:js">if(buttons){	// This is always true
	// Do something
}

if(buttons.length){ // True only if buttons contains elements
	// Do something
}</pre>
<h3>4) The Selector Property</h3>
<p>jQuery provides a property which contains the selector that was used to start the chain.</p>
<pre class="brush:js">$('#container li:first-child').selector    // #container li:first-child
$('#container li').filter(':first-child').selector    // #container li.filter(:first-child)</pre>
<p>Although the examples above target the same element, the selectors are quite different. The second one is actually invalid &#8211; you can&#8217;t use it as the basis of a new jQuery object. It only shows that the filter method was used to narrow down the collection.</p>
<h3>5) Create an Empty jQuery Object</h3>
<p>Creating a new jQuery object can bring significant overhead. Sometimes, you might need to create an empty object, and fill it in with the <a href="http://api.jquery.com/add/" target="_blank">add()</a> method later.</p>
<pre class="brush:js">var container = $([]);
container.add(another_element);</pre>
<p>This is also the basis for the <a href="http://jsperf.com/jquery-each-vs-quickeach" target="_blank">quickEach() method</a> that you can use as a faster alternative to the default <code>each()</code>.</p>
<h3>6) Select a Random Element</h3>
<p>As I mentioned above, jQuery adds its own selection filters. As with everything else in the library, you can also create your own. To do this simply add a new function to the <code>$.expr[':']</code> object. One awesome use case was presented by Waldek Mastykarz on <a href="http://blog.mastykarz.nl/jquery-random-filter/" target="_blank">his blog</a>: creating a selector for retrieving a random element. You can see a slightly modified version of his code below:</p>
<pre class="brush:js">(function($){
    var random = 0;

    $.expr[':'].random = function(a, i, m, r) {
        if (i == 0) {
            random = Math.floor(Math.random() * r.length);
        }
        return i == random;
    };

})(jQuery);

// This is how you use it:
$('li:random').addClass('glow');</pre>
<h3>7) Use CSS Hooks</h3>
<p>The <a href="http://api.jquery.com/jQuery.cssHooks/" target="_blank">CSS hooks API</a> was introduced to give developers the ability to get and set particular CSS values. Using it, you can hide browser specific implementations and expose a unified interface for accessing particular properties.</p>
<pre class="brush:js">$.cssHooks['borderRadius'] = {
        get: function(elem, computed, extra){
            // Depending on the browser, read the value of
            // -moz-border-radius, -webkit-border-radius or border-radius
        },
        set: function(elem, value){
            // Set the appropriate CSS3 property
        }
};

// Use it without worrying which property the browser actually understands:
$('#rect').css('borderRadius',5);</pre>
<p>What is even better, is that people have already built a rich <a href="https://github.com/brandonaaron/jquery-cssHooks" target="_blank">library of supported CSS hooks</a> that you can use for free in your next project.</p>
<h3>8) Use Custom Easing Functions</h3>
<p>You have probably heard of the jQuery <a href="http://gsgd.co.uk/sandbox/jquery/easing/" target="_blank">easing plugin</a> by now &#8211; it allows you to add effects to your animations. The only shortcoming is that this is another JavaScript file your visitors have to load. Luckily enough, you can simply copy the effect you need from the <a href="http://gsgd.co.uk/sandbox/jquery/easing/jquery.easing.1.3.js" target="_blank">plugin file</a>, and add it to the <code>jQuery.easing</code> object:</p>
<pre class="brush:js">$.easing.easeInOutQuad = function (x, t, b, c, d) {
	if ((t/=d/2) &lt; 1) return c/2*t*t + b;
	return -c/2 * ((--t)*(t-2) - 1) + b;
};

// To use it:
$('#elem').animate({width:200},'slow','easeInOutQuad');</pre>
<h3>9) The $.proxy()</h3>
<p>One of the drawbacks to using callback functions in jQuery has always been that when they are executed by a method of the library, the context is set to a different element. For example, if you have this markup:</p>
<pre class="brush:html">&lt;div id="panel" style="display:none"&gt;
	&lt;button&gt;Close&lt;/button&gt;
&lt;/div&gt;</pre>
<p>And you try to execute this code:</p>
<pre class="brush:js">$('#panel').fadeIn(function(){
	// this points to #panel
	$('#panel button').click(function(){
		// this points to the button
		$(this).fadeOut();
	});
});</pre>
<p>You will run into a problem &#8211; the button will disappear, not the panel. With <code>$.proxy</code>, you can write it like this:</p>
<pre class="brush:js">$('#panel').fadeIn(function(){
	// Using $.proxy to bind this:

	$('#panel button').click($.proxy(function(){
		// this points to #panel
		$(this).fadeOut();
	},this));
});</pre>
<p>Which will do what you expect. The <code>$.proxy</code> function takes two arguments &#8211; your original function, and a context. It returns a new function in which the value of this is always fixed to the context. You can read more about <a href="http://api.jquery.com/jQuery.proxy/" target="_blank">$.proxy in the docs</a>.</p>
<h3>10) Determine the Weight of Your Page</h3>
<p>A simple fact: the more content your page has, the more time it takes your browser to render it. You can get a quick count of the number of DOM elements on your page by running this in your console:</p>
<pre class="brush:js">console.log( $('*').length );</pre>
<p>The smaller the number, the faster the website is rendered. You can optimize it by removing redundant markup and unnecessary wrapping elements.</p>
<h3>11) Turn your Code into a jQuery Plugin</h3>
<p>If you invest some time in writing a piece of jQuery code, consider turning it into a plugin. This promotes code reuse, limits dependencies and helps you organize your project&#8217;s code base. Most of the <a href="http://tutorialzine.com/category/tutorials/">tutorials on Tutorialzine</a> are organized as plugins, so that it is easy for people to simply drop them in their sites and use them.</p>
<p>Creating a jQuery plugin couldn&#8217;t be easier:</p>
<pre class="brush:js">(function($){
	$.fn.yourPluginName = function(){
		// Your code goes here
		return this;
	};
})(jQuery);</pre>
<p>Read a detailed tutorial on <a href="http://tutorialzine.com/2011/02/converting-jquery-code-plugin/">turning jQuery code into a plugin</a>.</p>
<h3>12) Set Global AJAX Defaults</h3>
<p>When triggering AJAX requests in your application, you often need to display some kind of indication that a request is in progress. This can be done by displaying a loading animation, or using a dark overlay. Managing this indicator in every single <code>$.get</code> or <code>$.post</code> call can quickly become tedious.</p>
<p>The best solution is to set global AJAX defaults using one of jQuery&#8217;s methods.</p>
<pre class="brush:js">// ajaxSetup is useful for setting general defaults:
$.ajaxSetup({
	url			: '/ajax/',
	dataType	: 'json'
});

$.ajaxStart(function(){
	showIndicator();
	disableButtons();
});

$.ajaxComplete(function(){
	hideIndicator();
	enableButtons();
});

/*
	// Additional methods you can use:
	$.ajaxStop();
	$.ajaxError();
	$.ajaxSuccess();
	$.ajaxSend();
*/</pre>
<p>Read the docs about <a href="http://api.jquery.com/category/ajax/" target="_blank">jQuery&#8217;s AJAX functionality</a>.</p>
<h3>13) Use delay() for Animations</h3>
<p>Chaining animation effects is a powerful tool in every jQuery developer&#8217;s toolbox. One of the more overlooked features is that you can introduce delays between animations.</p>
<pre class="brush:js">// This is wrong:
$('#elem').animate({width:200},function(){
	setTimeout(function(){
		$('#elem').animate({marginTop:100});
	},2000);
});

// Do it like this:
$('#elem').animate({width:200}).delay(2000).animate({marginTop:100});</pre>
<p>To appreciate how much time jQuery&#8217;s <code>animation()</code> save us, just imagine if you had to manage everything yourself: you would need to set timeouts, parse property values, keep track of the animation progress, cancel when appropriate and update numerous variables on every step.</p>
<p>Read the docs about <a href="http://api.jquery.com/category/effects/" target="_blank">jQuery animations</a>.</p>
<h3>14) Make Use of  HTML5 Data Attributes</h3>
<p>HTML5 data attributes are a simple means to embed data in a webpage. It is useful for exchanging data between the server and the front end, something that used to require outputting &lt;script&gt; blocks or hidden markup.</p>
<p>With the recent updates to the jQuery <code>data()</code> method, HTML5 data attributes are pulled automatically and are available as entries, as you can see from the example below:</p>
<pre class="brush:html">&lt;div id="d1" data-role="page" data-last-value="43" data-hidden="true"
	data-options='{"name":"John"}'&gt;
&lt;/div&gt;</pre>
<p>To access the data attributes of this div, you would use code like the one below:</p>
<pre class="brush:js">$("#d1").data("role");			// "page"
$("#d1").data("lastValue");		// 43
$("#d1").data("hidden");		// true;
$("#d1").data("options").name;	// "John";</pre>
<p>Read more about <a href="http://api.jquery.com/data/" target="_blank">data() in the jQuery docs</a>.</p>
<h3>15) Local Storage and jQuery</h3>
<p>Local storage is a dead simple API for storing information on the client side. Simply add your data as a property of the global <code>localStorage</code> object:</p>
<pre class="brush:js">localStorage.someData = "This is going to be saved across page refreshes and browser restarts";</pre>
<p>The bad news is that it is not supported in older browsers. This is where you can use one of the <a href="http://plugins.jquery.com/plugin-tags/localstorage" target="_blank">many jQuery plugins</a> that provide different fallbacks if <code>localStorage</code> is not available, which makes client-side storage work almost everywhere.</p>
<p>Here is an example using the <a href="http://www.jstorage.info/" target="_blank">$.jStorage jQuery plugin</a>:</p>
<pre class="brush:js">// Check if "key" exists in the storage
var value = $.jStorage.get("key");
if(!value){
	// if not - load the data from the server
 	value = load_data_from_server();
 	// and save it
	$.jStorage.set("key",value);
}

// Use value</pre>
<h3>To Wrap it Up</h3>
<p>The techniques presented here will give you a head start in effectively using the jQuery library. If you want something to be added to this list, or if you have any suggestions, use the comment section below.</p>
]]></content:encoded>
			<wfw:commentRss>http://tutorialzine.com/2011/06/15-powerful-jquery-tips-and-tricks-for-developers/feed/</wfw:commentRss>
		<slash:comments>31</slash:comments>
		</item>
		<item>
		<title>FormBuilder Giveaway, Winners Announced!</title>
		<link>http://tutorialzine.com/2011/01/formbuilder-giveaway-winners-announced/</link>
		<comments>http://tutorialzine.com/2011/01/formbuilder-giveaway-winners-announced/#comments</comments>
		<pubDate>Mon, 10 Jan 2011 18:19:10 +0000</pubDate>
		<dc:creator>Martin Angelov</dc:creator>
				<category><![CDATA[Tzine]]></category>

		<guid isPermaLink="false">http://tutorialzine.com/?p=1323</guid>
		<description><![CDATA[<div><a href="http://tutorialzine.com/2011/01/formbuilder-giveaway-winners-announced/"><img src="http://cdn.tutorialzine.com/img/featured/1323.jpg" /></a></div> Announcing the winners of our FormBuilder giveaway.]]></description>
			<content:encoded><![CDATA[<div><a href="http://tutorialzine.com/2011/01/formbuilder-giveaway-winners-announced/"><img src="http://cdn.tutorialzine.com/img/featured/1323.jpg" /></a></div> <p>As this is the first post of the year, I would like to thank all of Tutorialzine&#8217;s wonderful readers for the amazing support over the past twelve months. In 2011 you will continue to enjoy the highest quality tutorials and articles on the site.</p>
<p>Over 220 people took part in the <a href="http://tutorialzine.com/2010/12/announcing-formbuilder-win-a-free-copy/" target="_blank">FormBuilder giveaway</a>, proving that forms are in fact one of the most tedious aspects of web development. But, lets not keep you waiting any longer. Using last year&#8217;s <a href="http://tutorialzine.com/2010/09/giveaway-randomizer-app-jquery/" target="_blank">Giveaway Randomizer App</a>, I selected five of you to receive a free copy of the script.</p>
<div id="attachment_1324" class="wp-caption alignnone" style="width: 630px"><img class="size-full wp-image-1324" title="The Winners" src="http://cdn.tutorialzine.com/wp-content/uploads/2011/01/formbuilder-giveaway-winners.jpg" alt="The Winners" width="620" height="260" /><p class="wp-caption-text">The Winners</p></div>
<p>The winners are:</p>
<ul>
<li>Marcelo Conceição;</li>
<li>Daniel Henrique;</li>
<li>Feed55;</li>
<li>gabriel;</li>
<li>brum;</li>
</ul>
<p>They have been contacted and will receive their prizes shortly.</p>
]]></content:encoded>
			<wfw:commentRss>http://tutorialzine.com/2011/01/formbuilder-giveaway-winners-announced/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Announcing FormBuilder, Win a Free Copy!</title>
		<link>http://tutorialzine.com/2010/12/announcing-formbuilder-win-a-free-copy/</link>
		<comments>http://tutorialzine.com/2010/12/announcing-formbuilder-win-a-free-copy/#comments</comments>
		<pubDate>Tue, 28 Dec 2010 14:07:36 +0000</pubDate>
		<dc:creator>Martin Angelov</dc:creator>
				<category><![CDATA[Tzine]]></category>

		<guid isPermaLink="false">http://tutorialzine.com/?p=1314</guid>
		<description><![CDATA[<div><a href="http://tutorialzine.com/2010/12/announcing-formbuilder-win-a-free-copy/"><img src="http://cdn.tutorialzine.com/img/featured/1314.jpg" /></a></div> Announcing FormBuilder, the latest script from ZineScripts. Five of you have a chance to win a free copy.]]></description>
			<content:encoded><![CDATA[<div><a href="http://tutorialzine.com/2010/12/announcing-formbuilder-win-a-free-copy/"><img src="http://cdn.tutorialzine.com/img/featured/1314.jpg" /></a></div> <p>It has been a while since I last released a new script on ZineScripts, so I decided it was about time to implement one of the ideas that I&#8217;ve had for quite a while now.</p>
<h3>Because Forms Suck</h3>
<p>If you&#8217;ve spent any time as a web developer, you&#8217;ve surely come across one of the most tedious aspects of the job. <span style="text-decoration: underline;">Forms</span>. No matter how many times you&#8217;ve created one, nor how much code you have amassed, it is still tedious as hell for a number of reasons:</p>
<ul>
<li><strong>Validation</strong> You absolutely have to validate user emails, check if important fields are left empty, and in some cases even validate phone numbers, zip codes, dates and so much more. You also need a friendly way of displaying those errors;</li>
<li><strong>Captchas</strong> You don&#8217;t want spam bots to submit your form;</li>
<li><strong>Markup</strong> You still have to write all the markup for the forms;</li>
<li><strong>Design</strong> You&#8217;ve put so much time in designing your form, only for it to be ruined by the non consistent browser controls;</li>
<li><strong>AJAX</strong> After you&#8217;re done with the validation, you will have the pleasure of implementing it all over again on the client side.</li>
</ul>
<p>This is where <a href="http://www.zinescripts.com/products/formbuilder/" target="_blank">FormBuilder</a> comes into play. It solves all of the above in an easy, programmer &#8211; friendly manner.</p>
<h3>What is FormBuilder?</h3>
<p>It is a PHP script that you can upload to your web hosting space. It can build web forms with unlimited length, complete with validation, captcha, error display and custom design by reading a configuration file. Here is what a typical contact form (<a href="http://demo.zinescripts.com/formbuilder/" target="_blank">see it here</a>) looks like :</p>
<pre class="brush:php">$config['fields']	= array(
	array(
		'label' 	=&gt; 'Your name',
		'type'		=&gt; 'textField',
		'required'	=&gt; true,
		'errorText'	=&gt; 'Please enter a valid name.',
		'fromName'	=&gt; true
	),
	array(
		'label' 	=&gt; 'Email',
		'type'		=&gt; 'textField',
		'required'	=&gt; true,
		'validation'=&gt; 'email',
		'errorText'	=&gt; 'Please enter a valid email.',
		'fromEmail'	=&gt; true
	),
	array(
		'label'		=&gt; 'Subject',
		'type'		=&gt; 'select',
		'default'	=&gt; 0,
		'items'		=&gt; array('Please Choose','Business proposition','Partnership','General Inquiry'),
	),
	array(
		'label' 	=&gt; 'Message',
		'type'		=&gt; 'textArea',
		'required'	=&gt; true,
		'errorText'	=&gt; 'You are missing a message.'
	)
);
</pre>
<p>With this approach, developers and designers can finally have a breath of fresh air and automate the dirty work. You can learn more about what FormBuilder is capable of, including tutorials and examples at its <a href="http://www.zinescripts.com/products/formbuilder/" target="_blank">official page</a>.</p>
<div id="attachment_1316" class="wp-caption alignnone" style="width: 630px"><a href="http://www.zinescripts.com/products/formbuilder/"><img class="size-full wp-image-1316" title="A FormBuilder - Powered Contact Form" src="http://cdn.tutorialzine.com/wp-content/uploads/2010/12/ajax_form_validation.jpg" alt="A FormBuilder - Powered Contact Form" width="620" height="460" /></a><p class="wp-caption-text">A FormBuilder - Powered Contact Form</p></div>
<h3>Win a Free Copy!</h3>
<p>Five of you will have a chance to win a <strong>free copy</strong> of FormBuilder, complete with sources and PSDs by doing the following:</p>
<ul>
<li>Leave a comment below;</li>
<li>Tweet about this post;</li>
</ul>
<p>The winners will be announced on <em><strong>January 10th</strong></em> in a follow up post.</p>
]]></content:encoded>
			<wfw:commentRss>http://tutorialzine.com/2010/12/announcing-formbuilder-win-a-free-copy/feed/</wfw:commentRss>
		<slash:comments>246</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using apc
Page Caching using apc
Object Caching 698/791 objects using apc
Content Delivery Network via cdn.tutorialzine.com

Served from: tutorialzine.com @ 2012-02-03 21:58:08 -->
