<?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>Getting a Website is Easy</title>
	<atom:link href="http://www.gettingawebsiteiseasy.co.uk/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.gettingawebsiteiseasy.co.uk/blog</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Wed, 21 Oct 2009 10:39:10 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Book Review: The 4-Hour Work Week by Timothy Ferriss</title>
		<link>http://www.gettingawebsiteiseasy.co.uk/blog/?p=35</link>
		<comments>http://www.gettingawebsiteiseasy.co.uk/blog/?p=35#comments</comments>
		<pubDate>Wed, 21 Oct 2009 10:39:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.gettingawebsiteiseasy.co.uk/blog/?p=35</guid>
		<description><![CDATA[
This is a new bit I&#8217;d like to do to add to my other posts, a book review of some excellent books that I&#8217;ve read and think my readers will benefit from. The first one is titled &#8220;The 4-Hour Work Week&#8221; by Timothy Ferriss. So here we go.
Published in April 2007 by Random House,  The [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-2305" title="4hr" src="http://www.webdesignideas.org/wp-content/uploads/2009/10/4hr.jpg" alt="4hr" width="520" height="500" /></p>
<p>This is a new bit I&#8217;d like to do to add to my other posts, a book review of some excellent books that I&#8217;ve read and think my readers will benefit from. The first one is titled &#8220;The 4-Hour Work Week&#8221; by Timothy Ferriss. So here we go.</p>
<p>Published in April 2007 by Random House,  The 4-Hour Workweek, made Timothy famous as it hit number one on the New York Times and Wall Street Journal best seller list. This transformed Ferriss, an unknown Princeton graduate, into a sort of celebrity.  The success of his book is attributed to his heavy marketing through his blogs, a marketing technique that has since been adopted by many in the trade.</p>
<p>The 4-Hour Workweek has attracted a lot of attention, mainly because of the intriguing title, and has received different kinds of reactions ranging from adulation to scorn. While some considers his ideas too outlandish, others regard them as very practical and timely.  Of course, Ferriss wants people to take notice of his book, hence the title, although he does not actually mean to really reduce the workweek to only 4 hours.  The main idea of Ferris is to cut down one&#8217;s workweek dramatically to give oneself much time for other life&#8217;s activities. As he claimed in his book, Ferriss spent more than 50 hours a week working with software and nutritional supplement business.  Realizing that he might end up forever in front of his computer, he felt that he has to change his life and the way he works, coming up with the ideas for The 4-Hour Workweek.</p>
<p>Ferriss is a believer and ardent follower of the Pareto Principle, also known as the 80-20 rule, or the principle of factor sparsity, which states that for many events, roughly 80% of the effects come from 20% of the causes.  The principle was an offshoot of the idea of Italian economist Vilfredo Pareto  who observed at the turn of the 20th century that 80% of the land in Italy was owned by only 20% of the population. In business, it is observed that 80% of the sales come from 20% of the clients.  While 80% &#8211; 20% sharing is not absolute, many real systems have percentages somewhere around this region in their imbalance of distribution.<span></span></p>
<p>Ferriss&#8217; idea is to apply automation to business so that only a minimal time will be required to produce the maximum result. By investing 20% of time/effort, he hopes to get around 80% of the expected results.  This could be done by using more efficient practices such as hiring virtual assistants from overseas who can do one&#8217;s job for a meager $5 or less per hour. While this idea is just an offshoot of the widespread practice of business outsourcing, Ferriss utilized this to benefit not only large businesses but also small and mid-sized businesses or even start-up businessmen who operate business by themselves.  Even an overworked employee can hire overseas assistants to help him do his job and get a lot of free hours for other activities. What Ferriss advocates is actually outsourcing one&#8217;s life and to enjoy the freed hours for other activities that are not normally available for someone who is trapped in the 9-5 rat race.</p>
<p>While the idea could sound attractive, especially with the success of business process outsourcing employed by large corporations, it does not sound as feasible as Ferriss wants to put it.  You cannot outsource that much function of business and let it run on autopilot as successful business outsourcing will require a close supervision and strict control.  Doing otherwise could have the business spiral out of control because the outsourced employees can do only as much as they were told to do, bereft of the necessary leeway and freedom of action to make decision on their own. Not every businessman can be as lucky as Ferriss who took a one year hiatus from his business only to find that he made more money while he was gone. He must have stumbled on some geniuses who ran his business while he was away!</p>
<p>Ferriss’ discussion on information overload and his proposed solutions are also suspect.  While it is true that most people are overburden by too much information that they have to digest on a daily basis, we cannot just ignore information that we feel are eating much of our time, leading us to go below our money-earning potential. Ferriss proposed Extreme Selective Ignorance as an answer to the information overload but this is not likely to work with most businesses.  Businesses today are global and are grounded on an intricate web of interrelationship where even a minor incident or event in a remote part of the globe could have repercussions on the economy in general and to a certain type of business in particular. Businessmen therefore must be keenly aware of everything that is going on around them to make them prepare to take actions or make adjustments in their business plans as unfolding events may demand.  While Ferriss speaks of distractions the internet offers, we have to be reminded that his book The 4-Hour Workweek became a best seller because of the internet, specifically the blogs.</p>
<p>The book is also a step-by-step guide to designing a luxury lifestyle. All an individual needs is to sit down and decide what he wants from life.  This is a bold attempt to define life’s philosophy as each person is enjoined to make early decisions and determine a way of finding money necessary to make such decisions work. The assumption is that people can be happy only by working less, traveling more and enjoying a bacchanalian life, while counting all the money he made while his outsourced personnel ran the show. He considers people who enjoy their jobs and the challenges that go with them as rather outmoded.</p>
<p>The success of Ferriss’ book can mainly be attributed to the fact that it caters to what people want to hear, giving hope, with himself as the example, that working less, earning more and living a full and satisfying life is really possible. It gives people ideas on how to cut corners and be successful (whatever it means) right away.  The book is rich in time-saving ideas and resources which can be applied in many instances and is therefore worth reading but it falls short in philosophy and over-all message. This is not a good read for people who find enjoyment in the long hours they work, especially those who touch other people’s lives every single minute they spend in the workplace, regardless of the amount of money they receive. This book is not for the healthcare workers who brave the risks of infectious diseases, not for the firefighters who spend days battling forest fires or members of the armed services who stay in the battlefield for months; they have different philosophies in life.</p>
<p></p>
<h3>You Might Also Like:</h3>
<ul>
<li><a href="http://www.webdesignideas.org/2009/01/13/camtasia-studio-review/" title="Camtasia Studio Review">Camtasia Studio Review</a></li>
<li><a href="http://www.webdesignideas.org/2008/12/01/product-review-of-adobe-cs4-suite/" title="Product Review of Adobe CS4 Suite">Product Review of Adobe CS4 Suite</a></li>
<li><a href="http://www.webdesignideas.org/2008/06/11/ie8-already-i-just-got-used-to-ie7/" title="IE8 Already? I Just Got Used To IE7!">IE8 Already? I Just Got Used To IE7!</a></li>
<li><a href="http://www.webdesignideas.org/2008/06/03/the-macbook-air-why/" title="The MacBook Air: Why?">The MacBook Air: Why?</a></li>
</ul>
<p><img src="http://www.webdesignideas.org/?ak_action=api_record_view&amp;id=2304&amp;type=feed" alt="" /><img src="http://feeds.feedburner.com/~r/WebDesignIdeas/~4/DKYA3gMR8HU" height="1" width="1" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gettingawebsiteiseasy.co.uk/blog/?feed=rss2&amp;p=35</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Blue &amp; Yellow Sidebar For Color Scheme Inspiration</title>
		<link>http://www.gettingawebsiteiseasy.co.uk/blog/?p=34</link>
		<comments>http://www.gettingawebsiteiseasy.co.uk/blog/?p=34#comments</comments>
		<pubDate>Wed, 21 Oct 2009 10:39:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.gettingawebsiteiseasy.co.uk/blog/?p=34</guid>
		<description><![CDATA[
While visiting some hosting sites for website design ideas and inspiration, I found this one the had a nice blue and yellow combination with a hint of gray colored backgrounds and pale yellow for the navigation hover effect. These colors work really well together and I think I&#8217;ll be using this color scheme for my [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-2301" title="hostsidebar" src="http://www.webdesignideas.org/wp-content/uploads/2009/10/hostsidebar.jpg" alt="hostsidebar" width="520" height="439" /></p>
<p>While visiting some hosting sites for website design ideas and inspiration, I found this one the had a nice blue and yellow combination with a hint of gray colored backgrounds and pale yellow for the navigation hover effect. These colors work really well together and I think I&#8217;ll be using this color scheme for my next project. Notice the glossy effect on the buttons too, looks pretty nice and elegant.</p>
<p>Source: <a rel="nofollow" href="http://webhostinggeeks.com/" target="_blank">WebHostingGeeks.com</a></p>
<h3>You Might Also Like:</h3>
<ul>
<li><a href="http://www.webdesignideas.org/2008/08/17/nice-color-choices-and-precise-navigation/" title="Nice Color Choices and Precise Navigation">Nice Color Choices and Precise Navigation</a></li>
<li><a href="http://www.webdesignideas.org/2008/02/20/color-schemes-and-navigation-design-ideas/" title="Color Schemes and Navigation Design Ideas">Color Schemes and Navigation Design Ideas</a></li>
<li><a href="http://www.webdesignideas.org/2009/03/03/beautiful-nautical-design/" title="Beautiful Nautical Design">Beautiful Nautical Design</a></li>
<li><a href="http://www.webdesignideas.org/2009/01/20/clean-navigation-with-a-message-overlay/" title="Clean Navigation With A Message Overlay">Clean Navigation With A Message Overlay</a></li>
<li><a href="http://www.webdesignideas.org/2009/01/19/great-retro-rusty-navigation-design/" title="Great Retro Rusty Navigation Design">Great Retro Rusty Navigation Design</a></li>
</ul>
<p><img src="http://www.webdesignideas.org/?ak_action=api_record_view&amp;id=2300&amp;type=feed" alt="" /><img src="http://feeds.feedburner.com/~r/WebDesignIdeas/~4/ePHoBoPrYMc" height="1" width="1" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gettingawebsiteiseasy.co.uk/blog/?feed=rss2&amp;p=34</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Structural Approach to Web Design</title>
		<link>http://www.gettingawebsiteiseasy.co.uk/blog/?p=33</link>
		<comments>http://www.gettingawebsiteiseasy.co.uk/blog/?p=33#comments</comments>
		<pubDate>Wed, 21 Oct 2009 10:39:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.gettingawebsiteiseasy.co.uk/blog/?p=33</guid>
		<description><![CDATA[
Photo credit: rudiriet
When designing a website, several factors are taken into consideration. One of the main objectives that designers often are required to satisfy is the usability of the website. It is important to note that if you have specific objectives to promote user friendliness instead of aesthetics that a structure-first approach to designing web [...]]]></description>
			<content:encoded><![CDATA[<div><img class="alignnone size-full wp-image-2297" title="structure" src="http://www.webdesignideas.org/wp-content/uploads/2009/10/structure.jpg" alt="structure" width="520" /></div>
<p>Photo credit: <a rel="cc:attributionURL" href="http://www.flickr.com/photos/rudiriet/">rudiriet</a></p>
<p>When designing a website, several factors are taken into consideration. One of the main objectives that designers often are required to satisfy is the usability of the website. It is important to note that if you have specific objectives to promote user friendliness instead of aesthetics that a structure-first approach to designing web sites should be used. A structure first methodology, which can look like an unintuitive way to design web sites for visually oriented designers actually carry several advantages.</p>
<p>Structure-first web design approaches are pedagogical; the designers are required to conceptualize the design as a separate but interrelated step. They are also practical, if you consider the functionality and effectiveness of a site it is measured by the validity of solid HTML code, which requires a separation between structures of the document by using tags and aesthetics by using Cascading Style Sheets.</p>
<p>Taking on a structural perspective in web design ensures that the contents of your web site will maintain readability in cases where the styling rules are disabled in your user’s browser. In situations where the user browses the pages by using a handheld device, like cell phones your visual formatting and assistive technology like screen readers are often ignored. A structural focus leads to the generation of many flexible web pages, which are viewable by users in several ways. These pages are easily reformatted if necessary, and can easily be revised and updated.<span></span></p>
<p>Remember that although an aesthetic approach will provide you with more creative freedom; it comes with its own disadvantages. When designing content that needs fast access and is usability centric you must take into consideration that the demographic targeted for the web site’s specific function might not benefit from a visual approach. Projects which require database searches or make use of a web design to post a large quantity of research or analytical data will often need to restrict its visual limitation to providing graphical representation or navigation aids which will help its users find the specific information it is looking for in an accurate and speedy manner.</p>
<p>Taking on a structural approach to web design makes sure that the designer doesn’t fall into the death trap of creating an overly flamboyant page and get lost in his creative impulses. One of your major priorities as a web designer is to ensure the fluidity of your content in any web browsing consideration. If you decided to put a lot of visuals in your programming there is a higher chance that the page will do two things which are not favorable to the user; pages might load slowly and content will not be visible right away depending on their connection speed and several browsing situations will prevent your website from loading properly or from displaying as how you intended for its design.</p>
<p>There are various ways of creating your website, weather you decide to take on a structure-first approach to web design or take a visual approach it is important to consider the type of end users you plan to  market your website to, chose whether to prioritize style or function and create informed decisions based on it.</p>
<h3>You Might Also Like:</h3>
<ul>
<li><a href="http://www.webdesignideas.org/2009/07/23/web-design-and-global-considerations/" title="Web Design and Global Considerations">Web Design and Global Considerations</a></li>
<li><a href="http://www.webdesignideas.org/2009/07/22/5-important-tips-for-web-design-success/" title="5 Important Tips for Web Design Success">5 Important Tips for Web Design Success</a></li>
<li><a href="http://www.webdesignideas.org/2009/05/18/inspiring-web-design-ideas/" title="Inspiring Web Design Ideas">Inspiring Web Design Ideas</a></li>
<li><a href="http://www.webdesignideas.org/2009/04/16/my-web-design-site-flynewmediacom-gets-re-designed/" title="My Web Design Site, FlyNewMedia.com, Gets Re-Designed">My Web Design Site, FlyNewMedia.com, Gets Re-Designed</a></li>
<li><a href="http://www.webdesignideas.org/2008/06/30/iso50a-site-packed-with-inspiration/" title="ISO50…A Site Packed with Inspiration!">ISO50&#8230;A Site Packed with Inspiration!</a></li>
</ul>
<p><img src="http://www.webdesignideas.org/?ak_action=api_record_view&amp;id=2296&amp;type=feed" alt="" /><img src="http://feeds.feedburner.com/~r/WebDesignIdeas/~4/9tB50Mhg3KA" height="1" width="1" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gettingawebsiteiseasy.co.uk/blog/?feed=rss2&amp;p=33</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why We Click? – Another Way of Looking at Web Design</title>
		<link>http://www.gettingawebsiteiseasy.co.uk/blog/?p=32</link>
		<comments>http://www.gettingawebsiteiseasy.co.uk/blog/?p=32#comments</comments>
		<pubDate>Wed, 21 Oct 2009 10:39:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.gettingawebsiteiseasy.co.uk/blog/?p=32</guid>
		<description><![CDATA[by Giancarlo Gallegos
Have you ever wondered why we choose certain web sites over other web sites? Let us take my case for example. Two days ago, I wanted to check for a USB stick that looks like a camera. I had only one intention, to buy a flash drive looking camera. As I typed it [...]]]></description>
			<content:encoded><![CDATA[<p><em>by Giancarlo Gallegos</em></p>
<p><img class="alignright size-full wp-image-2288" title="ques" src="http://www.webdesignideas.org/wp-content/uploads/2009/09/ques.jpg" alt="ques" width="262" height="196" />Have you ever wondered why we choose certain web sites over other web sites? Let us take my case for example. Two days ago, I wanted to check for a USB stick that looks like a camera. I had only one intention, to buy a flash drive looking camera. As I typed it in Google, I had hundreds of listing of USB sticks with a REAL camera attached to it. WOW! How did I fair in my search? Let us say, I ended up wasting 2 hours of my time browsing websites and getting distracted with all the cool stuff I saw especially the retro cassette 4 GB usb flash drive. Did I eventually buy a USB stick? Nope, I totally lost interest when I saw cassette USB stick.</p>
<p>So what makes us chose websites over the others? <em>Disclaimer</em>. I am not a psychologist. However, I have always been fascinated with human behavior. Here is my theory: We are attracted to a site if it evokes certain emotions. I was reading this book on the psychology of web design. The author mentioned an interesting point that most human behavior are governed by the unconscious. The author said, “<em>To get us to click, they have to persuade us. But donʼt make the mistake of thinking that the best way to persuade us is to make a logical presentation</em>”.<span></span></p>
<p>We know that all websites have target behaviors. They are either get us to buy, to register, to donate, to read, to follow and to click. But how do they get us to buy, register, donate, read, follow and click? If, we, designers understood how our minds work, we can create effective websites that engages our target market to make that sought after “click”.</p>
<p>In my reading and research of the “psychology of clicking.” Clicking a website is a result of several factors.</p>
<p><strong>We click because we think we are gaining something.</strong> When we act or interact we are motivated by gain. Whether it is business gain, increased intelligence or bragging rights, often times we find ourselves checking a website because it means something better for us.</p>
<p><strong>We click because we are curious.</strong> Many of us click because we are simply curious about what is in the site, what we will find in the site, if what we heard are true.</p>
<p><strong>We click because we trust. </strong>When we decide to click or navigate a website, we make several assessments in a blink of an eye—Will this be a waste of time? Will the site I click to be safe? Will the information I seek be relevant? Will I get what I need efficiently? We need to feel a sense of reliability and trust in what we are doing when we decide to interact. When we do, we are more likely to interact with a sense of purpose.</p>
<p><img class="alignnone size-full wp-image-2285" title="amaz" src="http://www.webdesignideas.org/wp-content/uploads/2009/09/amaz.jpg" alt="amaz" width="520" height="433" /></p>
<p>However, these reasons does not seem to provide an adequate understanding on the science of the click. In my research, I discovered that the human psychology plays a major role in why we chose websites over other sites. Here is what I discovered:</p>
<p><strong>We value what others think.</strong> Most people view themselves as independent thinkers. The truth is that the need to fit in and belong are wired in our nature. We want to fit in. We want to be like the crowd. There is a strong drive that when people are in social situations, they look at others to see how to behave. This is especially true when we are uncertain about what action to take. Take the online ratings for example. If we see a product that has only one out of five stars, we do not even take a closer look. However, if the product has around five out of five, we are curious why people rated it like that. This is because online ratings validate that other people opinion are important and if they think it is good then it must be good. In addition, if the online rating provided a personal experience with the product or service, we feel that we are making the right decision in clicking into that product.</p>
<p><em><strong>Tip:</strong> Add reviewer feedback to your website. If you can add names and dates to the feedback it becomes a power tool in making us click. </em></p>
<p><strong>We click because there is a sense of obligation</strong>. What happens if someone gives us a gift? It triggers a feeling of indebtedness. We feel the need to reciprocate that act of giving. Anytime something is given away at a Web site, it creates a feeling of indebtedness and reciprocity. Take antivirus softwares for personal computers. They often provide free download of their software for a 30 day trial period. You run it and test on your computer and it works. It cleans all the viruses out. Out of relief, you now feel obliged to buy the software as it has already proven its use to you and solved your problem.</p>
<p><img class="alignnone size-full wp-image-2286" title="mcaff" src="http://www.webdesignideas.org/wp-content/uploads/2009/09/mcaff.jpg" alt="mcaff" width="520" height="381" /></p>
<p><em><strong>Tip:</strong> Give away free information in your website. For example, if an e-commerce site sells a camera, there could be a portion of the site that features an excellent guide in taking pictures. If users come to the site to read about taking pictures, and they appreciate the information that is provided for free, they might feel as if they have been given a gift. This does not guarantee that they will buy the camera but it does increase the likelihood they keep away from a competitor.
<div>
<h5>Sponsored Links</h5>
</div>
<p></em></p>
<p><strong>We click because we feel that there is less of that product.</strong> If something is scarce, it will seem more desirable and more valuable to us. Showing a limited stock or a limited time frame motivates us to act. We treasure exclusivity, rarity, uniqueness and we act quickly when opportunities arise. We are absolutely pushovers when things have a time limit. This work because we perceive a chance to miss the deal if we donʼt act.</p>
<p><em><strong>Tip:</strong> When you design an e-commerce website, try to invoke scarcity. Add the phrase “only &lt;number of items&gt; left in stock.” You would discover that many people will feel better if they hurry up and purchase that item before they are all gone. </em></p>
<p><strong>We follow the rule of the first.</strong> If you type a query in google search, do you look at the very last page of the search results? No. All of us go to the first page first listing. And if we are interested enough we go to the second page of the results. This is the rule of first. The reason for this is that our mind freezes if we see a lot of options. We may say we prefer a lot of options, but the reality if there are a lot of choices, we canʼt decide.</p>
<p><img class="alignnone size-full wp-image-2287" title="goog" src="http://www.webdesignideas.org/wp-content/uploads/2009/09/goog.jpg" alt="goog" width="520" height="173" /></p>
<p><em><strong>Tip:</strong> Create a website that if we see something we like, we can get it right away. If we cannot promise to give it immediately, let the web user know it will be very soon. In addition, if you have a product or information that you want the web user to use, list it as the first product or information in your website. Chances are it will have a strong pull among your web users. </em></p>
<p><strong>We are afraid to lose.</strong> Remember the old adage, “ A bird in the hand is worth two in the bush.” We are most afraid of losing what we already have. We are reluctant to take away or subtract items. Letʼs take for example the model of a computer you are configuring has the better processor. It is “included in price”. If you want to spend less money, then you chose a lesser processor and subtract money. If we feel that we cannot afford the entire package, we have to face the idea of taking away options &#8212; an idea we donʼt necessarily like. Why? Because, if we experience the whole package, we are most likely to be reluctant to take something away.</p>
<p><em><strong>Tip:</strong> In designing a e-commerce website try creating a layout that includes everything you want to sell and add a choice of subtracting rather than adding items. More often than not, the web user will be reluctant to lose what they, in some sense, feel they already have. </em></p>
<p>In the end, we are but social animals. Many of our decisions stems from the fact that we want to fit in and belong to a community. We will always figure out a way to use whatever technology out there to be able to communicate and be social. Hence, the growth of many social networking sites such as Facebook, LinkedIn, Twitter, MySpace, etc.</p>
<p><em><strong>Giancarlo Gallegos</strong> is a writer, communications designer photographer, entrepreneur, and a post production professional based on New Zealand. He is the official photographer for a little pink pig’s travel blog called The Adventures of Spider Pig. You can view his work on <a href="http://www.giancarlogallegos.com">www.giancarlogallegos.com</a>. On his spare time, he travels, cooks, drinks coffee and mind maps new ideas.</em></p>
<div>Have you ever wondered why we<br />
chose certain web sites over other<br />
web sites? Let us take my case for<br />
example. Two days ago, I wanted to<br />
check for a USB stick that looks like<br />
a camera. I had only one intention,<br />
to buy a flash drive looking camera.<br />
As I typed it in Google, I had<br />
hundreds of listing of USB sticks with<br />
a REAL camera attached to it.<br />
WOW! How did I fair in my search?<br />
Let us say, I ended up wasting 2<br />
hours of my time browsing websites<br />
and getting distracted with all the<br />
cool stuff I saw especially the retro<br />
cassette 4 GB usb flash drive. Did I<br />
eventually buy a USB stick? Nope, I totally lost interest when I saw cassette USB stick.<br />
So what makes us chose websites over the others? Disclaimer. I am not a psychologist.<br />
However, I have always been fascinated with human behavior. Here is my theory: We are<br />
attracted to a site if it evokes certain emotions. I was reading this book on the psychology<br />
of web design. The author mentioned an interesting point that most human behavior are<br />
governed by the unconscious. The author said, “To get us to click, they have to persuade<br />
us. But donʼt make the mistake of thinking that the best way to persuade us is to make a<br />
logical presentation”.<br />
We know that all websites have target behaviors. They are either get us to buy, to register,<br />
to donate, to read, to follow and to click. But how do they get us to buy, register, donate,<br />
read, follow and click? If, we, designers understood how our minds work, we can create<br />
effective websites that engages our target market to make that sought after “click”.<br />
In my reading and research of the “psychology of clicking.” Clicking a website is a result of<br />
several factors.<br />
We click because we think we are gaining something. When we act or interact we are<br />
motivated by gain. Whether it is business gain, increased intelligence or bragging rights,<br />
often times we find ourselves checking a website because it means something better for<br />
us.<br />
We click because we are curious. Many of us click because we are simply curious about<br />
what is in the site, what we will find in the site, if what we heard are true.<br />
We click because we trust. When we decide to click or navigate a website, we make<br />
several assessments in a blink of an eye—Will this be a waste of time? Will the site I click<br />
to be safe? Will the information I seek be relevant? Will I get what I need efficiently? We<br />
need to feel a sense of reliability and trust in what we are doing when we decide to<br />
interact. When we do, we are more likely to interact with a sense of purpose.Have you ever wondered why we<br />
chose certain web sites over other<br />
web sites? Let us take my case for<br />
example. Two days ago, I wanted to<br />
check for a USB stick that looks like<br />
a camera. I had only one intention,<br />
to buy a flash drive looking camera.<br />
As I typed it in Google, I had<br />
hundreds of listing of USB sticks with<br />
a REAL camera attached to it.<br />
WOW! How did I fair in my search?<br />
Let us say, I ended up wasting 2<br />
hours of my time browsing websites<br />
and getting distracted with all the<br />
cool stuff I saw especially the retro<br />
cassette 4 GB usb flash drive. Did I<br />
eventually buy a USB stick? Nope, I totally lost interest when I saw cassette USB stick.<br />
So what makes us chose websites over the others? Disclaimer. I am not a psychologist.<br />
However, I have always been fascinated with human behavior. Here is my theory: We are<br />
attracted to a site if it evokes certain emotions. I was reading this book on the psychology<br />
of web design. The author mentioned an interesting point that most human behavior are<br />
governed by the unconscious. The author said, “To get us to click, they have to persuade<br />
us. But donʼt make the mistake of thinking that the best way to persuade us is to make a<br />
logical presentation”.<br />
We know that all websites have target behaviors. They are either get us to buy, to register,<br />
to donate, to read, to follow and to click. But how do they get us to buy, register, donate,<br />
read, follow and click? If, we, designers understood how our minds work, we can create<br />
effective websites that engages our target market to make that sought after “click”.<br />
In my reading and research of the “psychology of clicking.” Clicking a website is a result of<br />
several factors.<br />
We click because we think we are gaining something. When we act or interact we are<br />
motivated by gain. Whether it is business gain, increased intelligence or bragging rights,<br />
often times we find ourselves checking a website because it means something better for<br />
us.<br />
We click because we are curious. Many of us click because we are simply curious about<br />
what is in the site, what we will find in the site, if what we heard are true.<br />
We click because we trust. When we decide to click or navigate a website, we make<br />
several assessments in a blink of an eye—Will this be a waste of time? Will the site I click<br />
to be safe? Will the information I seek be relevant? Will I get what I need efficiently? We<br />
need to feel a sense of reliability and trust in what we are doing when we decide to<br />
interact. When we do, we are more likely to interact with a sense of purpose.</div>
<h3>You Might Also Like:</h3>
<ul>
<li><a href="http://www.webdesignideas.org/2009/05/12/huge-list-of-395-web-design-resources/" title="Huge List Of 395+ Web Design Resources">Huge List Of 395+ Web Design Resources</a></li>
<li><a href="http://www.webdesignideas.org/2008/05/27/new-graphic-design-jobs-board-unveiled-recently/" title="New Graphic Design Jobs Board Unveiled Recently">New Graphic Design Jobs Board Unveiled Recently</a></li>
<li><a href="http://www.webdesignideas.org/2008/02/11/vintage-background-pattern-design-ideas/" title="Vintage Backgrounds">Vintage Backgrounds</a></li>
<li><a href="http://www.webdesignideas.org/2009/05/25/490-killer-designer-resources/" title="490 Killer Designer Resources">490 Killer Designer Resources</a></li>
<li><a href="http://www.webdesignideas.org/2008/06/19/how-to-create-a-mini-site-that-runs-on-autopilot-and-makes-you-money-while-you-sleep/" title="How To Create A Mini Site That Runs On Autopilot And Makes You Money While You Sleep!">How To Create A Mini Site That Runs On Autopilot And Makes You Money While You Sleep!</a></li>
</ul>
<p><img src="http://www.webdesignideas.org/?ak_action=api_record_view&amp;id=2284&amp;type=feed" alt="" /><img src="http://feeds.feedburner.com/~r/WebDesignIdeas/~4/uUvK9MQhtyY" height="1" width="1" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gettingawebsiteiseasy.co.uk/blog/?feed=rss2&amp;p=32</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Three Awesome Web Design Lists For Inspiration</title>
		<link>http://www.gettingawebsiteiseasy.co.uk/blog/?p=31</link>
		<comments>http://www.gettingawebsiteiseasy.co.uk/blog/?p=31#comments</comments>
		<pubDate>Wed, 21 Oct 2009 10:39:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.gettingawebsiteiseasy.co.uk/blog/?p=31</guid>
		<description><![CDATA[Fresh, just from the oven, three awesome, creative inspiring lists to get your creative juices flowing.
Beautiful Examples of Inset Typography in Web Design

&#160;
48 Creative Websites Designed in Blue 

&#160;
50 Amazing Flash Website Designs

You Might Also Like:

Unique Navigation Setup
Eye Catching Flash Website
Incredible Magazine-Style Designs
Beautiful, Clean Website Design &#038; An Awesome Tool
Fun Web Agency Site, Great Use [...]]]></description>
			<content:encoded><![CDATA[<p>Fresh, just from the oven, three awesome, creative inspiring lists to get your creative juices flowing.</p>
<h3><a title="Permanent Link to Beautiful Examples of Inset Typography in Web Design" rel="bookmark" href="http://sixrevisions.com/design-showcase-inspiration/beautiful-examples-of-inset-typography-in-web-design/">Beautiful Examples of Inset Typography in Web Design</a></h3>
<p><a title="Permanent Link to Beautiful Examples of Inset Typography in Web Design" rel="bookmark" href="http://sixrevisions.com/design-showcase-inspiration/beautiful-examples-of-inset-typography-in-web-design/"><img class="alignnone size-full wp-image-2276" title="inset" src="http://www.webdesignideas.org/wp-content/uploads/2009/09/inset.jpg" alt="inset" width="520" height="251" /></a></p>
<p>&nbsp;</p>
<h3><a title="Permanent Link to 48 Creative Websites Designed in Blue" rel="bookmark" href="http://thedesignmag.com/48-creative-websites-designed-in-blue.html">48 Creative Websites Designed in Blue </a></h3>
<p><a title="Permanent Link to 48 Creative Websites Designed in Blue" rel="bookmark" href="http://thedesignmag.com/48-creative-websites-designed-in-blue.html"><img class="alignnone size-full wp-image-2277" title="creative-mooty" src="http://www.webdesignideas.org/wp-content/uploads/2009/09/creative-mooty.jpg" alt="creative-mooty" width="520" height="313" /></a></p>
<p>&nbsp;</p>
<h3><a title="50 Amazing Flash Website Designs" rel="bookmark" href="http://www.webdesigndev.com/inspiration/50-amazing-flash-website-designs">50 Amazing Flash Website Designs</a></h3>
<p><a title="50 Amazing Flash Website Designs" rel="bookmark" href="http://www.webdesigndev.com/inspiration/50-amazing-flash-website-designs"><img class="alignnone size-full wp-image-2278" title="comcast" src="http://www.webdesignideas.org/wp-content/uploads/2009/09/comcast.jpg" alt="comcast" width="520" height="240" /></a></p>
<h3>You Might Also Like:</h3>
<ul>
<li><a href="http://www.webdesignideas.org/2008/04/13/unique-navigation-setup/" title="Unique Navigation Setup">Unique Navigation Setup</a></li>
<li><a href="http://www.webdesignideas.org/2009/08/26/eye-catching-flash-website/" title="Eye Catching Flash Website">Eye Catching Flash Website</a></li>
<li><a href="http://www.webdesignideas.org/2009/08/12/incredible-magazine-style-designs/" title="Incredible Magazine-Style Designs">Incredible Magazine-Style Designs</a></li>
<li><a href="http://www.webdesignideas.org/2009/04/29/beautiful-clean-website-design-and-an-awesome-tool/" title="Beautiful, Clean Website Design &amp; An Awesome Tool">Beautiful, Clean Website Design &#038; An Awesome Tool</a></li>
<li><a href="http://www.webdesignideas.org/2009/03/27/fun-web-agency-site-great-use-of-flash/" title="Fun Web Agency Site, Great Use Of Flash">Fun Web Agency Site, Great Use Of Flash</a></li>
</ul>
<p><img src="http://www.webdesignideas.org/?ak_action=api_record_view&amp;id=2275&amp;type=feed" alt="" /><img src="http://feeds.feedburner.com/~r/WebDesignIdeas/~4/GGIhbw_6uwo" height="1" width="1" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gettingawebsiteiseasy.co.uk/blog/?feed=rss2&amp;p=31</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Writing web applications with CodeIgniter – Part 2</title>
		<link>http://www.gettingawebsiteiseasy.co.uk/blog/?p=30</link>
		<comments>http://www.gettingawebsiteiseasy.co.uk/blog/?p=30#comments</comments>
		<pubDate>Wed, 21 Oct 2009 10:39:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.gettingawebsiteiseasy.co.uk/blog/?p=30</guid>
		<description><![CDATA[Last week, we covered the basic structure of a CodeIgniter application. Let&#8217;s now jump right into developing a simple todo list application using CodeIgniter. We will be keeping the actual functionality of the application itself simple here, as the goal here is to give a good overview on what it takes to build a CI [...]]]></description>
			<content:encoded><![CDATA[<p>Last week, we covered the basic structure of a CodeIgniter application. Let&#8217;s now jump right into developing a simple todo list application using CodeIgniter. We will be keeping the actual functionality of the application itself simple here, as the goal here is to give a good overview on what it takes to build a CI application from scratch.</p>
<p>Okay, the first thing you have to do is to download and extract the <a href="http://codeigniter.com/download.php">latest build</a> of <a href="http://codeigniter.com/">CodeIgniter</a>. Next, download the controllers, models and views that I have used in this <a href="http://download.sourcebits.com/web/todoapp_files.zip">sample todo list application</a>. You should refer to these files as you read the tutorial. Here is the <a href="http://todo.publishy.com/">demo</a> of the sample application (use &#8220;demo&#8221; as username and password). </p>
<p><strong>Directory structure</strong></p>
<p>All the files related to our application will be placed in the <strong>&quot;system/application&quot;</strong> folder:</p>
<p><img src="http://www.webdevelopmentbits.com/wp-content/uploads/2009/10/dirStructure.png" align="CI directory structure" /></p>
<p>As you can see, we have to place our controllers, views and models in their correspondng /controllers, /views and /models directories. Initially, we will have a sample controller (Welcome) in the /controllers directory, and its corresponding Welcome view in the /views directory. The model directory will be empty. </p>
<p>The /config directory consists of various files which will help us fine-tune the CI framework to our development environment. We will ignore the other directories in the /application directory for the time being. </p>
<p><strong>Some basic configuration first</strong></p>
<p>We need to modify some of the configuration files in the /config folder to set up the framework: </p>
<ul>
<li><strong>database.php</strong> &#8211; this is where we will be filling up our database connectivity details. The file has ample comments to help you  fill in all the necessary details correctly! </li>
<li><strong>config.php</strong> &#8211; we have to fill in the path to our CI root folder here in the variable: <em>$config['base_url']</em></li>
<li><strong>autoload.php</strong> &#8211; this file allows us to autoload any libraries or helpers that CodeIgniter provides us so that they are available across the entire system. We will be using the session library and the url helper class, so initialise the <em>$autoload['libraries']</em> and <em>$autoload['helper']</em> variables to:
    </p>
<ul>
<li><strong>$autoload['libraries'] = array(&#8217;database&#8217;,&#8217;session&#8217;);</strong></li>
<li><strong>$autoload['helper'] = array(&#8217;url&#8217;); </strong></li>
</ul>
</li>
</ul>
<p>By default, all CI URLs will have a &quot;.index.php&quot; included in them. E.g. <strong>example.com/index.php/blog/edit</strong></p>
<p>To remove this, we can optionally place a<strong> .htaccess</strong> file in your CI root folder with the following content:</p>
<pre>RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|scripts|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L] </pre>
<p>With the above rule in place, all requests other than those for index.php, images, css, scripts and robots.txt are treated as  a request for your index.php file.</p>
<p><strong>CodeIgniter session class </strong></p>
<p>Before we go further, let&#8217;s have a brief review of CodeIgniter&#8217;s sessions class, which will be using in this application to keep track of the user&#8217;s session. CI&#8217;s session class can handle user session data stored using either cookies or in a database. CodeIgniter&#8217;s session class does not utilize native PHP sessions. To make use of the session class in our application, we must either initialize it in a controller&#8217;s constructor, or we have to auto-load it so that it will run in the background, and will be available for us across the entire system. To load the session class manually in the controller&#8217;s constructor, we do that by calling:</p>
<pre>$this-&gt;load-&gt;library('session');</pre>
<p>To auto-load the session class, we have to open the file <strong>&quot;application/config/autoload.php</strong>&quot; and add the item to the &quot;autoload&quot; array as I have mentioned in configuration step above. </p>
<p>Reading and writing data to the session class is a breeze! To write data to a user&#8217;s session, we simply do:</p>
<pre>$this-&gt;session-&gt;set_userdata('some_variable', 'some_value'); </pre>
<p>And, to retrieve the data again, we just call:</p>
<pre>$item = $this-&gt;session-&gt;userdata('item');</pre>
<p>Apart from that, CI&#8217;s session class by default, provides us with the following information:</p>
<ul>
<li>user&#8217;s unique Session ID</li>
<li>user&#8217;s IP Address</li>
<li>user&#8217;s User Agent data (the first 50 characters of the browser data string)</li>
<li>user&#8217;s &quot;last activity&quot;  time stamp </li>
</ul>
<p><strong>Our application features: </strong></p>
<p>With that, out of the way, let&#8217;s get started. Our to-do-list application will have the following &quot;features&quot;:</p>
<ul>
<li>a simple user sign up and login system</li>
<li>session management using CI&#8217;s session class </li>
<li>a single to-do list which allows multiple users to add and delete items using AJAX</li>
</ul>
<p><strong>Database schema</strong></p>
<p>Given the rather simple nature of our application, it&#8217;s not too difficult to identify what database tables we will be needing upfront. We will need two tables:</p>
<ul>
<li><strong>users</strong> : stores the user id, username and the hashed password.</li>
<li><strong>items</strong> : stores the to-do list items and their attributes like item_id, user_id (ID of the user who created it)</li>
</ul>
<pre>CREATE TABLE IF NOT EXISTS `items` (
 `item_id` bigint(20) NOT NULL auto_increment,
 `user_id` bigint(20) NOT NULL,
 `item_text` varchar(255) NOT NULL, `is_done` int(11) NOT NULL,
 PRIMARY KEY  (`item_id`)
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1; 

CREATE TABLE IF NOT EXISTS `users` (
 `user_id` bigint(20) NOT NULL auto_increment,
 `username` varchar(100) NOT NULL,
 `password` varchar(100) NOT NULL,
 PRIMARY KEY  (`user_id`)
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
</pre>
<p>Setting up the above tables in the database which you have mentioned in your database.php configuration file above. </p>
<p>Here is a breakdown of all the controllers, views and model we will be needing for this application. I will explain the purpose of each of them, as we go about tackling them. </p>
<p><img src="http://www.webdevelopmentbits.com/wp-content/uploads/2009/10/file_overview.png" alt="Overview of all the CI files" />&nbsp;</p>
<p><strong>The login controller</strong></p>
<p>The login controller first checks whether the user is already logged in &#8211; in which case, we simply redirect him to the dashboard. This, we do by checking whether the &quot;logged_in&quot; field exists in the user&#8217;s session data. We are using CI&#8217;s session class for this: </p>
<pre>if( $this-&gt;session-&gt;userdata('logged_in') )	// user already logged in
{
	header(&quot;Location: &quot; . base_url() . &quot;index.php&quot; );
	die();
}</pre>
<p>The login controller serves two needs:</p>
<ul>
<li>render the login form initially for a user who wants to sign in to the system </li>
<li>when the user submits the login form, authenticate the user and either redirect him to the dashboard or show an error message</li>
</ul>
<p>When the controller is called, we can find out whether we should render the login form, or treat the request as a login form submission by checking for the POST variable &#8216;login&#8217;, which is the name of the &quot;login&quot; submit button in the login form. </p>
<pre>if( $this-&gt;input-&gt;post('login') )
{
	// treat this as a login form submission
}

else {
	// render the login form
}
</pre>
<p>If it&#8217;s NOT a login form submission, we simply load the <strong>login_view</strong> defined in <strong>application/views/login_view.php. </strong>This file will render the login form. </p>
<p>On the other hand, if its is a login form submission, we first retrieve the username and password variable from the POST request. We then load the Users_model class, and use its validate() function to authenticate the user. If the user&#8217;s username and password match, his user_id field from the database is returned. Else, a -1 is returned. For a valid user, we initialise his session by:</p>
<pre>$newdata = array(
 'user_id'  =&gt; $user_id,
 'username'  =&gt; $username,
 'logged_in' =&gt; TRUE
 );

 $this-&gt;session-&gt;set_userdata($newdata);</pre>
<p>We then redirect him to the dashboard. If the username and password provided do not match, we load the <strong>login_view</strong> by passing a variable &#8216;$message&#8217; that contains the error to be displayed.</p>
<p><strong>The Dashboard </strong></p>
<p>The welcome controller is the default controller for CodeIgniter. It will already be found in the /application/controllers directory, and this is the controller that will be called when you access our application&#8217;s URL directly without using any URL segments, as discussed in the previous article. Let us just make use of this controller for our application&#8217;s dashboard. Assuming the user has already logged in successfully, let&#8217;s build our application&#8217;s dashboard &#8211; the page the visitor first sees after logging in. In our case, it will be a page which will display a set of to-do items, and in addition, provide a way to enter a new to-do item or modify the done/not-done status of any existing item using AJAX. Here is the index() function of the welcome controller. </p>
<pre>function index()
{

	if( !$this-&gt;session-&gt;userdata('logged_in') )	// user NOT logged in
	{
		header(&quot;Location: &quot; . base_url() . &quot;index.php/login&quot; );
		die();
	} 

 	$this-&gt;load-&gt;model('items_model','items');
        $data['all_items'] =
$this-&gt;items-&gt;fetch_all_items($this-&gt;session-&gt;userdata('user_id'));
 	$this-&gt;load-&gt;view('dashboard_view',$data);
 }</pre>
<p>The welcome controller will check whether the user is logged in (using the session data set earlier in the login controller).  If the user is not logged in, or his session has expired, we will redirect him to the login page.  The <strong>base_url()</strong> function belongs to the URL helper that we autoloaded in our configuration, and it returns the base URL of our application (including the &quot;/&quot; at the end of the URL). Otherwise, we will load the Items_model class which will be used to interact with the items table in the database. The fetch_all_items() function of the item_model class will fetch all the todo items of this particular logged in user from the &quot;items&quot; table. The only other thing to note here is that we are using the session class to retrieve the user id of the user that we have stored as session data when the user successfully logs in to the system.  </p>
<pre>function fetch_all_items($user_id)
{
  // fetch the to-do items of the user identified by $user_id:
  $query = $this-&gt;db-&gt;query(&quot;SELECT * FROM items WHERE user_id = $user_id&quot;);
  return $query-&gt;result();
} </pre>
<p> The index() function of the Welcome controller then loads the view &quot;<strong>dashboard_view</strong>&quot;, defined in &quot;dashboard_view.php&quot; in the <strong>system/application/views</strong> directory. When the view is loaded, we are passing to it the todo items we fetched from the database using the Items_model class. The view then renders all the to-do items on the page. </p>
<p><strong>dashboard_view.php</strong> links to an external stylesheet (todoapp.css) and a JavaScript file (todoapp.js). The AJAX functionality is defined in the JavaScript file. In our application, we are using AJAX to add a new todo item to the list, and also update the done/not-done status of any of the todo items. The function addNewItem() in the JavaScript file is bound to the click event of the &quot;Add&quot; button. </p>
<p>The addNewItem() function, when fired, makes an AJAX POST request to the &quot;<strong>add</strong>&quot; controller which will handle the addition of a new todo item. The add controller will return the ID field of the newly added todo item in the database. If the operation is a success (if the ID returned in not -1), we simply append the new todo item (along with a checkbox) to the bottom of the existing items. We also clear the text in the textfield. </p>
<p>The updateItem() function is bound to the click event on each of the checkboxes. When fired, it checks whether the checkbox that the user clicked is selected or not, and it sends this information to the &quot;<strong>update</strong>&quot; controller. </p>
<p><strong> The add controller</strong></p>
<p>In all the controllers, we will have to first check if the user is logged in, before we carry out any action. For a valid user, we retrieve the text of the new todo item to be added (from the POST variable sent to the script) using: </p>
<pre>$this-&gt;input-&gt;post('item_text',TRUE)</pre>
<p>The second parameter is set &#8216;TRUE&#8217; to indicate that the input must be filtered to negate XSS (cross site scripting) attempts. XSS is a major problem faced by many web applications, and as a golden rule, any input which might potentially get rendered on the front end must be passed through an XSS filter that escapes/strips out the dangerous elements. As an added precaution we also check whether the todo item&#8217;s text is not empty, and if all is clear, we load the &quot;Items_model&quot; class once again, and call the add_item() function to add the todo item to the database. The add_item() function uses another handy function that CI provides, to escape the data by adding single quotes around the data: </p>
<pre>$item_text = $this-&gt;db-&gt;escape($item_text);</pre>
<p><strong>The update controller</strong></p>
<p>What the update controller does is similar to the add controller and also fairly straight forward. It simply retrieves the POST variables sent to it (the ID of the item which is to be updated, and its updated status). The update controller then loads the Items_model and invokes the update_item() function to peform the update. </p>
<p><strong>The logout controller</strong></p>
<p>The logout controller destroys the session data of the user, and then redirects him to the login page once again.</p>
<pre>$this-&gt;session-&gt;sess_destroy();
header(&quot;Location: &quot; . base_url() . &quot;index.php/login&quot; );</pre>
<p><strong>User registration</strong></p>
<p>Finally, let&#8217;s get to the user registration, which is handled by The Register controller. First off, I should mention here that for the sake of simplicity, I have implemented a very simple registration form, with absolutely no spam control! </p>
<p>The Register controller is similar to the Login controller in that &#8211; it again serves both the purposes of rendering the registration form, and as well as handling the form submission. The register_view simply asks the user to pick a username and password. The &lt;form&gt;&#8217;s action attribute points to the URL of the register controller. </p>
<p>When the form is submitted, the Register controller first checks to see that both the username and password fields are not empty. It then loads the &quot;Users_model&quot; which handles all database operations concerned with the &quot;Users&quot; table. We will invoke the is_valid_username() of the Users_model to see whether the username that the user has chosen already exists (the function returns a -1 if no such username is found on the system). If it a username is indeed found (in which case the function will return the ID of the user), we will initialise a $message variable with the text &quot;That username already exists.&quot; and load the register view again, by passing the $message variable for rendering. </p>
<pre>if( $this-&gt;users-&gt;is_valid_username($this-&gt;db-&gt;escape($username)) != -1 )
{
	// username already exists
	$data['message'] = &quot;That username already exists.&quot;;
}
...
$this-&gt;load-&gt;view('register_view', $data); </pre>
<p>If the user has chosen a non-existing username, then we go ahead and add the user to the database by calling the Users_model&#8217;s add_user() function, by passing the username and his hashed password. We are simply using a plain SHA1 hash here to store the password (which is again considered not secure enough without <a href="http://en.wikipedia.org/wiki/Salt_(cryptography)">salting</a>, but enough for our simple application). Once the user is added to the MySQL database, we use the nifty &quot;<strong><a href="http://in.php.net/mysql_insert_id">mysql_insert_id()</a></strong>&quot; PHP function to retrieve the auto increment ID field of the user row just added to the &quot;users&quot; table. After a successful account creation, we initialise the user&#8217;s session and redirect him to the dashboard, so the user can start using the application right away.</p>
<p>With that, we come to the end of this second part of CodeIgniter tutorial. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.gettingawebsiteiseasy.co.uk/blog/?feed=rss2&amp;p=30</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Writing web applications with CodeIgniter: Part 1</title>
		<link>http://www.gettingawebsiteiseasy.co.uk/blog/?p=29</link>
		<comments>http://www.gettingawebsiteiseasy.co.uk/blog/?p=29#comments</comments>
		<pubDate>Wed, 21 Oct 2009 10:39:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.gettingawebsiteiseasy.co.uk/blog/?p=29</guid>
		<description><![CDATA[CodeIgniter is a PHP framework that makes writing secure web applications a breeze. Being extremely light weighted, it&#8217;s an impressive toolkit which promotes the Model-View-Controller (MVC) approach to software development. CodeIgniter&#8217;s incredibly useful libraries, helpers and simplicity give you a sound foundation to quickly build your web apps on. This will be the first part [...]]]></description>
			<content:encoded><![CDATA[<p>CodeIgniter is a PHP framework that makes writing secure web applications a breeze. Being extremely light weighted, it&#8217;s an impressive toolkit which promotes the Model-View-Controller (MVC) approach to software development. CodeIgniter&#8217;s incredibly useful libraries, helpers and simplicity give you a sound foundation to quickly build your web apps on. This will be the first part of a series of tutorials focusing on CodeIgniter. Today, let&#8217;s get started with the basics of CodeIgniter and familiarize ourselves with the structure and semantics of a CI application. </p>
<p>I am assuming that you are already familiar with the <a href="http://en.wikipedia.org/wiki/Model–view–controller">MVC pattern</a>, so let&#8217;s briefly see how it applies to a typical CI application.</p>
<p><strong>View</strong> &#8211; A view is simply the content which a user sees rendered on a any page. It can be either a full web page, or even code snippets like the header or the footer of a web page. The view&#8217;s primary aim is to render data on the screen, which will be passed to it by a controller. </p>
<p><strong>Controller</strong> &#8211;  A controller handles the actual application logic. It acts as an intermediate between the View (front end) and the Model (the data). The controller, typically fetches records from a database via a model class, and then passes it to a view for rendering. </p>
<p><strong>Model</strong> &#8211; A model is concerned with reading and writing data to and from a data souce &#8211; in our case, a database. It essentially consists of functions which help you isolate database operations from your core application logic. In CodeIgniter, a model is not necessary, should you wish to manipulate the database from a controller itself.</p>
<p><strong>The URL structure</strong></p>
<p>One great thing about CodeIgniter is that it generates URLs which is search engine friedly and also extremely logical for programmers. Instead of using query strings (like <em>index.php?action=display&amp;id=223</em>) to pass variables, it uses a very semantic segment based URL structure. By default, the CI URLs are parsed this way: </p>
<p><em>example.com/controller_class_name/function_name/ID1/ID2</em></p>
<p>As we can see, the first segment of the URL refers to the name of the controller class, the second part referring to the function in the controller that should be invoked, and the subsequent parts representing  various parameter values that can be passed to the function. Having understood that, it&#8217;s a good time to see the structure of a controller class. </p>
<p>Let&#8217;s take a simple example of a blog. Let us say we want a page where we want to show the entries of a blog, we can have a controller &quot;show&quot; which will be defined this way: </p>
<pre>class Show extends Controller {

	function index()
	{
		// access a model class to fetch all the blog posts
			...
		// invoke a view and pass to it the blog posts to render
	}
}
</pre>
<p>There are a couple of things to note here:</p>
<ul>
<li>all controller classes begin with a capital letter in CI &#8211; i.e <strong>S</strong>how</li>
<li>we will be saving the above file as &quot;show.php&quot; &#8211; the file name is essentially the same as the class name, except that the class name&#8217;s first character has to be in capital case. </li>
<li>the index() function will be the default function of the class &#8211; much like your main() function in a C program!</li>
<li>you will access the above controller with the following URL: example.com/show/index or just example.com/show</li>
</ul>
<p>Remember that the first segment refers to the controller name and the second segment refers to the function name. Since the index function is the default function for the controller, we can leave it out from the URL. We can add another function to the class, called <strong>entry</strong> &#8211; which will display a specific blog entry identified by an identifier: </p>
<pre>function entry($entry_id)
{
	// access a model class to fetch the blog post with ID $entry_id
		...
	// invoke a view and pass to it the blog post to render
} </pre>
<p>Now, to display a particular blog entry, we access the URL: example.com/show/entry/123 , where the &quot;123&quot; is (say) the ID of the blog entry to be rendered. Pretty easy, right ? </p>
<p>Now, let&#8217;s define a CI model class. Continuing with the same blog example, let&#8217;s say that the name of the model class which will handle our blog entries is &quot;Entry_model&quot;:</p>
<pre>class Entry_model extends Model {

	function Entry_mode()
	{
		parent:Model();
	}

	function fetch_post($entry_id)
	{
		// do your database query and return the record...
	}
}</pre>
<p>Now, to invoke the method fetch_post() from the controller, we do: </p>
<pre>$this-&gt;load-&gt;model(Entry_model');
$blog_entry = $this-&gt;Entry_model-&gt;fetch_post($entry_id); </pre>
<p>Again, it&#8217;s very intuitive. We load the model class, and then, invoke a method from the model class which will return the blog entry record. The naming convention for the model class is the same as that for a controller &#8211; the class name should start with a capital letter. Thus, the above model class is called &quot;Entry_model&quot; and it will be defined in the file &quot;entry_model.php&quot;. </p>
<p>Finally, let&#8217;s get to how CodeIgniter handles the View. As I have already stated above, CI is very flexible in how you want to define a view. A view can be a whole page, or page fragments like header, footer, navigation, sidebar etc. It&#8217;s always a good practise to logically break down the layout of a web page into a number of components, as it  promotes code reusabilty. </p>
<p>As for now, for simplicity, let&#8217;s just say that our blog entry will be rendered using a single view. So, we will basically have a .php file that contains the structure (design) of the blog and which will display the blog entry that is passed to it from the controller through the form of variables. Let&#8217;s say our view (which display a blog entry) is called &quot;entry_view.php&quot;: </p>
<pre>&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Showing a blog entry&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;?php
	echo &quot;&lt;h1&gt;$entry_title&lt;/h1&gt;&quot;;
	echo $entry_text;
?&gt;

&lt;/body&gt;
&lt;/html&gt;</pre>
<p>When we invoke the view from the controller, we will pass in the variables $entry_title and $entry_text. Here is how we invoke the view we have defined above from a controller:</p>
<pre>$data['entry_title'] = &quot;A blog post title&quot;;$data['entry_text'] = &quot;Lorem ipsum dolor sit amet...&quot;;$this-&gt;load-&gt;view('entry_view', $data); </pre>
<p>I have shown a very simple example of how data is passed from the controller to a view above. The variables that will be used in the view are defined as elements of an associative array. To load a view, we call it by its filename &#8211; we don&#8217;t have to use &quot;.php&quot; extension unless we are using some other extension for the view files.</p>
<p>With that, I have covered the basic skeleton of a CI application. Stay tuned for the next article, in which I will walk you through on how to build a simple application using CodeIgniter, and also cover some more advanced concepts along the way! </p>
]]></content:encoded>
			<wfw:commentRss>http://www.gettingawebsiteiseasy.co.uk/blog/?feed=rss2&amp;p=29</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating an inline contact form</title>
		<link>http://www.gettingawebsiteiseasy.co.uk/blog/?p=28</link>
		<comments>http://www.gettingawebsiteiseasy.co.uk/blog/?p=28#comments</comments>
		<pubDate>Wed, 21 Oct 2009 10:39:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.gettingawebsiteiseasy.co.uk/blog/?p=28</guid>
		<description><![CDATA[Customer feedback is arguably one of the most critical factors determining the success of a product over a period of time. Hence, it&#8217;s not surprising that many websites have some form of contact form or another to encourage users to write back to them. Most of these &#8220;contact&#8221; pages tend to be on a separate [...]]]></description>
			<content:encoded><![CDATA[<p>Customer feedback is arguably one of the most critical factors determining the success of a product over a period of time. Hence, it&#8217;s not surprising that many websites have some form of contact form or another to encourage users to write back to them. Most of these &#8220;contact&#8221; pages tend to be on a separate page which is usually part of the navigation or is linked to with phrases like &#8220;we encourage your feedback&#8221; or &#8220;do get in touch with us&#8221;, etc.</p>
<p>However, I have often noticed that many people (unless they genuinely needed help), either back away from submitting their  comments (when they are confronted by a large  textarea on the contact page), or simply move away from the site as the contact page loads.</p>
<p>Today, let&#8217;s spice things up a bit by using jQuery to load a lightweight inline contact form. So, instead of loading a separate contact form page when the &#8220;contact us&#8221; link is clicked, we will just have a small textarea opens up dynamically right next to  the link &#8211; so that the user can type his feedback and it can be  submitted rightaway using AJAX. Our main aim here is to encourage more users to provide feedback and although I don&#8217;t have actual data to prove whether an inline form will be any more helpful, I have used it in a  couple of places, and it did appear to bring in more casual feedback  about the site, features etc. Ok, let&#8217;s get started. Here is the <strong><a href="http://www.webdevelopmentbits.com/temp/inline_form_demo.html">demo</a></strong> of how it will all look in the end.</p>
<p>Okay, first let&#8217;s have a hypothetical page in which we want to make use of the inline contact form. The call of action, is obviously the &#8220;We would love to hear your feedback&#8221; link, which has the id &#8220;a_inline_form&#8221;. Initially, this hyperlink will simply point to the default contact form page. We will have the inline form in a DIV with id &#8220;inline_form&#8221;, which will be hidden initially.</p>
<pre>#inline_form {
		/* keep the inline form hidden initially */
		display: none;

		position: relative;
		padding: 10px;
		width: 260px;
	}</pre>
<p>We will now use jQuery to &#8220;hijack&#8221; this link and fire our inline contact form into action:</p>
<pre> // toggle visibility of inline form when link is clicked
$("#a_inline_form").click( function() {

	$("#inline_form").toggle(200);

	$("#inline_form").css( "left", $("#a_inline_form").position().left +
                                                $("#a_inline_form").width() );

	$("#inline_form").css("top", "-40px");

	// get cursor to texarea, ready to receive keystrokes!
	$("#inlinecmt").focus();	

	// return false to prevent default link behaviour
	return false;
});</pre>
<p>The above code is fairly self explanatory &#8211; I just want to describe how we are positioning the inline form. jQuery allows us to very easily retrieve the left offset position of an element (even when it&#8217;s not absolutely or relatively positioned!) using &#8220;$(elem).position().left&#8221; property.</p>
<p>In this example, I wanted to place the inline form right next to the comment link. To do that, we can simply set the &#8220;left&#8221; CSS property of the inline form to a value that&#8217;s the sum of the left offset of the feedback link and the width of the comment link &#8211; this will of course place the inline form right next to the feedback link. In addition, we also set the cursor focus to the inline form so that the textarea is ready to receive input right away.</p>
<p>We have a simple &#8220;ok&#8221; button underneath the textarea which will be used to submit the form. We will once again &#8220;hijack&#8221; the form submit event using jQuery and perform the form submission using AJAX. I have omitted the actual form submission and processing here.</p>
<pre>$("#inline_form").submit( function() {

	// make your ajax POST call here...

	$("#a_inline_form").after('&lt;span class="msg"&gt;Thanks for the comment!' +
                               '&lt;/span&gt;');
	$("#inline_form").hide(200);

	setTimeout( '$(".msg").hide()', 2000);

	// return false to prevent default form submission behavior
	return false;
});</pre>
<p>Now, once the AJAX call is successful, we need to notify that to the user and thank him for the feedback. I have chosen to do that by inserting a message right after the feedback link and hiding it (using setTimeout() ) after 2 seconds. Don&#8217;t forget to hide the inline form too. With that, our inline form is up and ready to go!</p>
<p>This is by no means a replacement for the traditional contact form, but it will be handy in places where one requires casual feedback from users. And as you would have already noticed, we have used JavaScript here unobtrusively &#8211; so in case the user has JavaScript disabled, the feedback link merely loads the <a href="http://www.webdevelopmentbits.com/temp/inline_form_contact.html">default contact page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gettingawebsiteiseasy.co.uk/blog/?feed=rss2&amp;p=28</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Avoiding long polling</title>
		<link>http://www.gettingawebsiteiseasy.co.uk/blog/?p=27</link>
		<comments>http://www.gettingawebsiteiseasy.co.uk/blog/?p=27#comments</comments>
		<pubDate>Wed, 21 Oct 2009 10:39:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.gettingawebsiteiseasy.co.uk/blog/?p=27</guid>
		<description><![CDATA[Right from Twitter to Google Wave, real time information streaming via the browser seems to be the most &#34;happening&#34; thing on the web arena currently. However, feeding real time information as and when it is available to an user using your web application is not as straight forward as it is on a desktop environment. [...]]]></description>
			<content:encoded><![CDATA[<p>Right from Twitter to Google Wave, real time information streaming via the browser seems to be the most &quot;happening&quot; thing on the web arena currently. However, feeding real time information as and when it is available to an user using your web application is not as straight forward as it is on a desktop environment. HTTP is a stateless protocol which does not currently support a two way communication link between the server and the user&#8217;s computer via the browser. </p>
<p>The simplest way to simulate  real time streaming of information is to poll the server every N seconds, and to display the information (if any). The number N will determine how real time the resulting stream of updates will look to a viewer. This model is simply called, polling. Now, polling is bad because it repeatedly connects and disconnects to the server, which when scaled across thousands of users, cause severe strain on your server. This problem becomes even more apparent in cases when the poller returns with empty data most of the times. </p>
<p>The jQuery snippet below polls the server every 3 seconds for new information and displays it in a simple alert box.</p>
<pre>
function callComplete(response) {
	alert("Response received is: "+response);
};

function connect() {
	// when the call completes, callComplete() will be called along with
	// the response returned
	$.post('/path/to/script.php', {}, callComplete, 'json');
};

$(document).ready( function() {
	setInterval(connect,3000);
}
</pre>
</p>
<p><strong>Long polling</strong></p>
<p>This technique is an optimisation of the traditional polling method. In long polling, once the client makes a connection with the server (via JavaScript), the server waits for the data requested by the client to become available. If it&#8217;s not immediately available, the server (being a PHP script for example) loops and sleeps. When the data is available, the server returns the data to the client and the connection closes. When this happens, the client again reconnects with the server (in the callback function of your original AJAX request). </p>
<p>This method is definitely an improvement over mindless polling, as we will avoid repeatedly opening and closing connections when data is not available for long periods of time. However, it is important to be aware of the server side technical limitations of long polling. Since connections might be kept alive for long durations of time, your web server must be capable of handling such large numbers of simultaneous connections. We talked about how certain light weight webservers outperformed Apache in this particular area in the last article. </p>
<p>Let&#8217;s look at a very simple jQuery/PHP long polling example: </p>
<pre>function callComplete(response) {
	alert("Response received is: "+response);
	// reconnect to the server
	connect();
};

function connect() {
	// when the call completes, callComplete() will be called along with
	// the response returned
	$.post('/path/to/script.php', {}, callComplete, 'json');
};

$(document).ready( function() {
	connect();
}
</pre>
</p>
<p>In the PHP end, we do:</p>
<pre>
while(1) {

	$data = &quot;some data fetched from the DB&quot;;

	// if we have new data, return it to the client
	if(!empty($data)) {
		echo json_encode($data);
		break;
	}

	sleep(3000);	// we sleep for 3s and check again for data
}
</pre>
<p><strong>COMET streaming </strong></p>
<p>COMET is a generic term that refers to the use a persistent HTTP connection for the web server to &quot;push&quot; data to the client as and when it arrives. If you have ever wondered how Gmail is able to notify you of a new email message seconds after it is sent, this is what they use to push the new email notifications to the front end. </p>
<p>However, as often is the case with JavaScript, the cross browser compatibility issues mean that a host of methods (targeting different browsers) are used to implement such an interaction. The upside is that these methods rely purely on JavaScript, and hence not dependent on any specific client side plugin. A detailed exploration of these different methods and their caveats is beyond the scope of this article, but let&#8217;s get a quick overview of these methods.</p>
<p><strong>Hidden iframe technique:</strong> A hidden iframe html element is embedded onto the page, which points to the URL on the server which handles the persistent connection. The server will then push the data as it arrives to the iframe, using &lt;script&gt; tags. This content is then channeled to the parent window using JavaScript. This method is based on the fact that many browsers evaluate JavaScript chunks as they are received, even if the complete page has not finished loading yet. However this method is prone to cause the &quot;loading&quot; icon or status bar message to appear all the time (since we are using a persistent HTTP connection, the browsers tend to believe that the page is yet to finish loading fully). </p>
<p><strong>XMLHttpRequest using Interactive readyState:</strong> This method is targetted towards Firefox, Safari and Chrome, which support the interactive readyState property of the XHR object, and fires events every time a chunk of data is received from the server. </p>
<p><strong>Server-Sent events: </strong>This is a feature (from the <a href="http://whatwg.org">WHATWG</a> Web Applications 1.0 specification) supported by Opera since v9, using which we can push events from the server directly to the visitor&#8217;s browser. Refer to <a href="http://my.opera.com/WebApplications/blog/show.dml/438711">this article</a> on how it&#8217;s used. </p>
<p>As you can see, it&#8217;s quite a mouthful, and hence implementing COMET streaming which works uniformly across all major browsers is not a task for the faint hearted (not forgetting that the webserver must also be able to handle a large number of persistent connection). The good news is that quite a lot of the hard work has already been done for you. There are various opensource COMET servers and client libraries which you can use to deploy a COMET application pretty safely. Here are a few of them for your exploration: </p>
<p><strong><a href="http://orbited.org">Orbited</a>:</strong> &quot;Orbited is an HTTP daemon that is optimized for long-lasting comet  connections. Orbited allows you to write real-time web  applications, such as a chat room or instant messaging client, without  using any external plugins like Flash or Java. &quot;</p>
<p><a href="http://cometdproject.dojotoolkit.org/"><strong>Cometd:</strong></a> &quot;Cometd is a scalable HTTP-based event routing bus that uses a Ajax Push technology pattern known as Comet.&quot; </p>
<p><strong><a href="http://meteorserver.org/">Meteor</a>:</strong> &quot;Meteor is an open source HTTP server, designed to offer developers a simple means of integrating streaming data into web applications without the need for page refreshes.&quot;</p>
<p><a href="http://pi.kodfabrik.com/documentation/plugin/pi.comet/"><strong>Comet Pi:</strong></a> This is a standalone JavaScript library which you can use to handle the various cross browser issues that COMET causes. You can use pi.comet with any serverside language. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.gettingawebsiteiseasy.co.uk/blog/?feed=rss2&amp;p=27</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Light weight alternatives to Apache</title>
		<link>http://www.gettingawebsiteiseasy.co.uk/blog/?p=26</link>
		<comments>http://www.gettingawebsiteiseasy.co.uk/blog/?p=26#comments</comments>
		<pubDate>Wed, 21 Oct 2009 10:39:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.gettingawebsiteiseasy.co.uk/blog/?p=26</guid>
		<description><![CDATA[When it comes to choosing a Linux web  server, Apache, as we all know, is almost a de facto standard. There is even a chance  that your web host does not even offer (or worse, know of) an alternative web  server. So, it&#8217;s not a big surprise that many developers don&#8217;t know [...]]]></description>
			<content:encoded><![CDATA[<p>When it comes to choosing a Linux web  server, Apache, as we all know, is almost a de facto standard. There is even a chance  that your web host does not even offer (or worse, know of) an alternative web  server. So, it&#8217;s not a big surprise that many developers don&#8217;t know too much  about what other alternatives are available to them.</p>
<p>There is of course no denying that Apache  is indeed an old war horse, and an extremely robust and mature one at that. But,  even as stable as Apache is, it has one main drawback &#8211; it occupies a large  memory footprint due to its request-per-process model, and is therefore mediocre  at handling multiple concurrent requests when you have a limited RAM. This can  be a problem when you are starting out small, with a rented 256 MB VPS for your  application. Even if you are a big player, light weight Apache alternatives can  help increase the throughput of your servers. Youtube, for instance, was using  Lighttpd, a light-weight web server to serve millions of videos everyday (prior  to their acquisition by Google).</p>
<p>Ok enough digressing, let’s now take a look  at some of the open source alternatives to Apache.</p>
<p><strong>Lighttpd</strong></p>
<p><a href="http://www.lighttpd.net/">Lighttpd</a>, pronounced as Lighty, is a single  threaded web server optimized for a large number of keep-alive connections,  which is often a requirement for high traffic web applications. It was  originally developed by the German programmer Jan Kneschke to solve the  <a href="http://www.kegel.com/c10k.html">C10k problem</a> (handle 10,000 parallel  connections using a single server). Apart from Youtube as I have already  mentioned, Wikipedia, Meebo and Sourceforge all use Lighttpd. Lighttpd is rich  with features, and offers mod_rewrite (URL rewriting), FastCGI support, HTTP  compression, amongst many other features. I was able to install and configure  Lighttpd in a few minutes, and it is extremely light-weight (less than 1MB). I  was able to get PHP/MySQL running in a couple of minutes, using the FastCGI  interface.</p>
<p>One drawback, which I have seen repeatedly  mentioned in many forums and blogs on the web (I could not verify these claims  with my own tests), is that Lighttpd seems to suffer from memory leaks &#8211;  which often required scheduled server restarts.</p>
<p><strong>Nginx</strong></p>
<p><a href="http://nginx.net/">Nginx</a>, pronounced as Engine-X, is a web  server originating from Russia, and is written by <a href="http://sysoev.ru/en/">Igor  Sysoev</a>. Unlike Lighttpd, Nginx is not a single  threaded webserver (it instead uses a single master process which delegates  work to a small number of worker processes), but is another popular light  weight web server alternative. It is supported by more than 20% of Russian  virtual hosts, and is gaining lots of attention these days in other parts of  the world too.</p>
<p>Nginx is excellent at serving static files  and also supports reverse proxying. Like Lighttpd, I was able to get Nginx up  and running in a few minutes. However, it does not come up with default FastCGI  support &#8211; so getting PHP/MySQL working was a little tricky. It involves  spawning a FastCGI process manually. I found <a href="http://bc-dev.net/2008/05/07/mysql-nginx-and-php-on-ubuntu-804/">this tutorial helpful</a>.</p>
<p><strong>Erlang based alternatives</strong></p>
<p>Erlang is a concurrent programming language  designed by Ericsson to support distributed, soft real time applications, which  has been opensourced since 1998. I definitely want to write more about how  scalable Erlang is, but this is not the article for that. So, let’s just say  that Erlang is tailor-made for high demand applications which need to handle  multiple concurrent connections &#8211; like a web server.</p>
<p><a href="http://yaws.hyber.org/">YAWS</a> (Yet Another Web Server) and <a href="http://code.google.com/p/mochiweb/">Mochiweb</a> are two Erlang based  web servers which I found to be highly scalable and light-weight.</p>
<p>A load test conducted matching Yaws against  Apache found that Apache failed at 4,000 concurrent connections, while Yaws  continued functioning with over 80,000 concurrent connections (<a href="http://www.sics.se/~joe/apachevsyaws.html">source</a>). I did have some trouble installing  and configuring YAWS though. The documentation is scarce, to say the least.</p>
<p>Mochiweb is actually an Erlang library for  building your own light-weight HTTP server. Don&#8217;t be put off by that statement!  A simple server can be built with just a few lines of code. I installed and  tested Mochiweb too, and I found it pretty easy. If you are interested, here is  <a href="http://beebole.com/en/blog/erlang/how-to-quickly-set-up-ubuntu-804-loaded-with-erlang-mochiweb-and-nginx/">a tutorial which I found helpful</a>.</p>
<p><strong> So should you ditch Apache?</strong></p>
<p>This decision depends on a number of  factors. Like I have already stated, if you want to make the best out of the  limited resources you have, then a light-weight web server is definitely  advantageous. However, from my experience with playing with the above  alternatives, if you do decide to go with one of them, you should be prepared to  roughen it out. Poor documentation and support (the mailing lists and forums  are generally helpful, but you can never completely rely on them when you are  suddenly facing an issue in a production environment) could end up making  things difficult for you. Don&#8217;t get me wrong, I am not saying that these servers are not  production-ready yet (they <em>are</em> pretty  stable), but there is always an off-chance you might just hit upon some snag.  In that case, you probably have to roughen it out.</p>
<p>A reasonable choice would be to front  Apache with one of these light weight web servers. In effect, you can use them  for load balancing. Using reverse-proxying, you can handle the static files  (like CSS and images) using a light weight web server, and route the dynamic  requests to Apache.</p>
<p>So, in future, I hope you will consider an  Apache alternative, should your needs be better satisfied by a light-er web  server. If you have experience using any of the above alternatives, do share  your views in the comments!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gettingawebsiteiseasy.co.uk/blog/?feed=rss2&amp;p=26</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
