<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>gulati.info</title>
	
	<link>http://gulati.info</link>
	<description>A blog about web development, web design, and just about anything.</description>
	<lastBuildDate>Mon, 05 Jul 2010 12:30:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/gulati" /><feedburner:info uri="gulati" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><geo:lat>42.12531</geo:lat><geo:long>-72.440574</geo:long><feedburner:emailServiceId>gulati</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Back From A Long Break</title>
		<link>http://feedproxy.google.com/~r/gulati/~3/Inep5DDVl7w/</link>
		<comments>http://gulati.info/2010/07/back-from-a-long-break/#comments</comments>
		<pubDate>Mon, 05 Jul 2010 10:43:12 +0000</pubDate>
		<dc:creator>Austin</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://gulati.info/?p=1864</guid>
		<description><![CDATA[Hey guys, it&#8217;s been a while since I last updated this blog. I think that I&#8217;m finally coming back &#8211; in some way or another. First of all, to everyone who has commented asking for help: you probably have long since needed the answer to the questions that you have asked me, but I plan [...]]]></description>
			<content:encoded><![CDATA[<p>Hey guys, it&#8217;s been a while since I last updated this blog. I think that I&#8217;m finally coming back &#8211; in some way or another.<br />
<span id="more-1864"></span></p>
<div class="aligncenter"><img src="http://gulati.info/wp-content/uploads/2010/07/break-1.png" alt="" title="" width="600" height="160" class="alignnone size-full wp-image-1867" /></div>
<p>First of all, to everyone who has commented asking for help: you probably have long since needed the answer to the questions that you have asked me, but I plan on answering them as soon as I can. I wish that I had been around to answer this stream of questions as they came in as that would have been much more helpful to you guys. Also, I plan on focusing another post or two on regular expressions and the redirection plugin as that seems to be where most of the questions are coming from.</p>
<p>Second of all, I&#8217;m not sure what I&#8217;m going to do with this blog. I&#8217;m pretty sure that I&#8217;m going to be moving most of the popular posts to my new blog (which will be mentioned in a post shortly) and then continuing to use this blog as a personal blog instead of a web development blog. I&#8217;m hoping to make the transition as seamless as possible, but bear with me as it occurs.</p>
<p>Third of all, I&#8217;m wondering if I still have any subscribers after this long break. So if you still subscribe, please leave a comment! I look forward to hearing from you.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/gulati?a=Inep5DDVl7w:JcHka-3LB1c:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/gulati?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/gulati?a=Inep5DDVl7w:JcHka-3LB1c:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/gulati?i=Inep5DDVl7w:JcHka-3LB1c:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/gulati?a=Inep5DDVl7w:JcHka-3LB1c:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/gulati?i=Inep5DDVl7w:JcHka-3LB1c:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/gulati?a=Inep5DDVl7w:JcHka-3LB1c:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/gulati?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/gulati/~4/Inep5DDVl7w" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://gulati.info/2010/07/back-from-a-long-break/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://gulati.info/2010/07/back-from-a-long-break/</feedburner:origLink></item>
		<item>
		<title>4 Ways to Learn PHP</title>
		<link>http://feedproxy.google.com/~r/gulati/~3/MHYlsjQBd-Q/</link>
		<comments>http://gulati.info/2010/01/4-ways-to-learn-php/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 23:39:11 +0000</pubDate>
		<dc:creator>Austin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Learn PHP]]></category>
		<category><![CDATA[Learning Methods]]></category>

		<guid isPermaLink="false">http://gulati.info/?p=1780</guid>
		<description><![CDATA[Before I started getting into code style, I talked a lot of learning PHP. I&#8217;m going to be revisiting that topic now. Here&#8217;s a list of a few ways that you can learn PHP. Chances are that you won&#8217;t learn using only one of these methods &#8211; you&#8217;ll have to combine them to get anywhere. [...]]]></description>
			<content:encoded><![CDATA[<p>Before I started getting into code style, I talked a lot of learning PHP. I&#8217;m going to be revisiting that topic now. Here&#8217;s a list of a few ways that you can learn PHP.<br />
<span id="more-1780"></span></p>
<div class="aligncenter"><img src="http://gulati.info/wp-content/uploads/2010/01/4-ways.png" alt="4 Ways to Learn PHP" title="4 Ways to Learn PHP" width="600" height="160" class="alignnone size-full wp-image-1846" /></div>
<p>Chances are that you won&#8217;t learn using only one of these methods &#8211; you&#8217;ll have to combine them to get anywhere. This list is mostly relevant to those who do not know PHP (but would want to learn it), but for those who already know it, try to think about how you first learned as you are reading this list.</p>
<h3>Methods of learning</h3>
<ol>
<li>
<h4>Classic tutorials</h4>
<p>Tutorials that I classify as &#8220;classic&#8221; tutorials are the ones that pretty much hold your hand as you first learn the language. They tell you what to do and why you&#8217;re doing it and then hope that you remember the reasons and remember how you did things. I&#8217;ll be talking more about resources that provide these classic tutorials in the future (I&#8217;ll be evaluating all of them to help decide which is the best), but for now check out <a href="http://www.w3schools.com/php/default.asp">W3Schools</a>.</li>
<li>
<h4>My tutorials (or similar)</h4>
<p>A few months ago, I tried providing my own tutorials to the community. They didn&#8217;t really get that much attention, so I eventually stopped, but a good amount of them already existed. My goal was to try to teach PHP by forcing coders to learn themselves. I don&#8217;t really find it that helpful to be told exactly what to do. It&#8217;s great when you&#8217;re trying to achieve something that is common, but what if you want to do something with PHP that doesn&#8217;t have a clear cut tutorial? Instead of providing how-tos, I provided people with a list of what they needed to achieve, and then expected people to search around and teach themselves how to get things done. Here&#8217;s a <a href="http://gulati.info/2009/08/a-quick-recap/">list of the tutorials and their solutions</a>. Also, if anyone has used these tutorials, or wants more of them, please leave a comment!</li>
<li>
<h4>Other non-specific resources</h4>
<p>Instead of using tutorials, you could just teach yourself using other resources. This method is like using my tutorials except you are deciding what you need to achieve on your own. You&#8217;re going out to the web and searching for what you need. The best resources here are <a href="http://google.com">Google</a> and <a href="http://php.net">PHP&#8217;s homepage</a>.</li>
<li>
<h4>The assistance of others</h4>
<p>This is probably the least common as a single method but the most common when combined with other methods. Getting assistance from others is very helpful, especially if you have a specific problem. I&#8217;m thinking actually talking to them and getting help from them, so reading what others have written wouldn&#8217;t fall under this one.</li>
</ol>
<h3>The best method</h3>
<p>The best method all depends on your personal learning styles. It also depends on your drive to learn the language and your need to apply the language to what you want to get done. If you are learning the language just to try to expand your knowledge, it might be harder to use the third method since you don&#8217;t really have anything that you want to achieve. If you have well defined goals that you want to achieve, you will definitely have the drive that you will need to learn the language using the third method.</p>
<p>Overall, the best method is a combination of all of the methods. Except for the last method, which should be placed wherever it is needed in the process, the different methods could be used in the order above. Actually, I learned using the methods in the order above. I started off using specific tutorials on W3Schools. After that, I started trying to do small tasks that my friend would give me. After I was fairly confident with my coding, I took on a larger project and just used Google or PHP.net whenever I needed something. At first, I was very dependent on these resources, but after a while I was fluent in the language.</p>
<p>If you don&#8217;t know PHP and you&#8217;re looking to learn it, how do you plan on learning it? If you already know PHP, how did you learn it? Also, if you can think of a method that isn&#8217;t on this list (I know that I can think of some), please share. I&#8217;m looking forward to hearing your thoughts!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/gulati?a=MHYlsjQBd-Q:tKskvQsTS88:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/gulati?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/gulati?a=MHYlsjQBd-Q:tKskvQsTS88:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/gulati?i=MHYlsjQBd-Q:tKskvQsTS88:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/gulati?a=MHYlsjQBd-Q:tKskvQsTS88:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/gulati?i=MHYlsjQBd-Q:tKskvQsTS88:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/gulati?a=MHYlsjQBd-Q:tKskvQsTS88:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/gulati?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/gulati/~4/MHYlsjQBd-Q" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://gulati.info/2010/01/4-ways-to-learn-php/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://gulati.info/2010/01/4-ways-to-learn-php/</feedburner:origLink></item>
		<item>
		<title>Many Ways to Integrate HTML into PHP</title>
		<link>http://feedproxy.google.com/~r/gulati/~3/wbPfJTA-Q3o/</link>
		<comments>http://gulati.info/2010/01/many-ways-to-integrate-html-into-php/#comments</comments>
		<pubDate>Wed, 13 Jan 2010 21:00:17 +0000</pubDate>
		<dc:creator>Austin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Clean Code]]></category>
		<category><![CDATA[Code Organization]]></category>
		<category><![CDATA[Integrate HTML Into PHP]]></category>

		<guid isPermaLink="false">http://gulati.info/?p=1737</guid>
		<description><![CDATA[It&#8217;s a good practice to separate back end logic (PHP) from front end markup (HTML). That isn&#8217;t always possible or the best choice, especially if you are working on a small web application. Here&#8217;s some of the ways to cleanly integrate HTML into PHP. Times to use this As I said above, separating the back [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s a good practice to separate back end logic (PHP) from front end markup (HTML). That isn&#8217;t always possible or the best choice, especially if you are working on a small web application. Here&#8217;s some of the ways to cleanly integrate HTML into PHP.<br />
<span id="more-1737"></span></p>
<div class="aligncenter"><img src="http://gulati.info/wp-content/uploads/2009/12/integrate-1.png" alt="Integrating HTML into PHP" title="Integrating HTML into PHP" width="600" height="160" class="alignnone size-full wp-image-1797" /></div>
<h3>Times to use this</h3>
<p>As I said above, separating the back end logic from the front end markup is a great practice. I don&#8217;t always do this, though. Unless you&#8217;re using a template engine, such as <a href="http://www.smarty.net/">Smarty</a>, it isn&#8217;t always practical to separate the back end from the front end. You still should if the project is large enough, but if it isn&#8217;t it&#8217;s not worth it in my mind.</p>
<p>When I described <a href="http://gulati.info/2009/11/my-method-of-organization-for-new-projects/">my method of organization</a> for most projects, I had a directly called &#8216;elements&#8217; that contained all of the front end elements. The scripts in that folder still contain logic, though. I don&#8217;t use a template engine, so it&#8217;s impossible to have completely segregate the logic from the markup.</p>
<h3>Integrating HTML</h3>
<p>Instead, here&#8217;s a few ways to integrate HTML into your PHP logic while still keeping things clean.</p>
<h4>Double quotes and braces</h4>
<p>This is probably the method that I use most often. Here&#8217;s an example:</p>
<pre class="brush: php;">echo &quot;&lt;div&gt;{$variableOne}&lt;/div&gt;&quot;;
echo &quot;&lt;div class=\&quot;class_one\&quot;&gt;{$variableTwo}&lt;/div&gt;&quot;;
echo &quot;&lt;div class=\&quot;class_two\&quot;&gt;{$variableThree} to {$variableFour}&lt;/div&gt;&quot;;
</pre>
<p>I find that this is really clean and easy to scan. It&#8217;s easy to see the variables in the code since they all begin with {$ and end with }. I also use code highlighting, so that helps.</p>
<h4>Single quotes and concatenation</h4>
<p>This is another popular method. The speeds of this method and the previous have been debated, but I don&#8217;t think that it really matters. The difference is in nano seconds. If you really want to optimize things, there are a lot more changes that you could make that would have more of an effect than switching between single quotes and double quotes.</p>
<pre class="brush: php;">echo '&lt;div&gt;' . $variableOne . '&lt;/div&gt;';
echo '&lt;div class=&quot;class_one&quot;&gt;' . $variableTwo . '&lt;/div&gt;';
echo '&lt;div class=&quot;class_two&quot;&gt; ' . $variableThree . ' to ' . $variableFour . '&lt;/div&gt;';
</pre>
<p>An advantage of this method is that you don&#8217;t have to escape double quotes that may appear in HTML. I find this method harder to read than the previous, especially if there are short strings between variables. It&#8217;s hard to quickly tell the difference between <code>$variableThree . ' to ' . $variableFour</code> and <code>$variableThree . 'to' . $variableFour</code>, especially if you include spaces between the periods as I do.</p>
<h4>Jump out of PHP</h4>
<p>This method is most popular for large blocks of code. It can great really repetitive to just keep outputting HTML from PHP, so why not just write the HTML and then add in the PHP where necessary?</p>
<pre class="brush: xml;">&lt;div&gt;
	&lt;?php echo $variableOne; ?&gt;
&lt;/div&gt;
&lt;div class=&quot;class_one&quot;&gt;
	&lt;?php echo $variableTwo; ?&gt;
&lt;/div&gt;
&lt;div class=&quot;class_two&quot;&gt;
	&lt;?php echo $variableThree; ?&gt; to &lt;?php echo $variableFour; ?&gt;
&lt;/div&gt;</pre>
<p>An advantage of this method is that it&#8217;s much easier to retain the indent structure of HTML. A disadvantage is that it can get repetitive to keep using <code><?php echo $variableOne; ?></code> to output variables. It&#8217;s possible to use the shorthand <code><?=$variableOne?></code>, but that may not work on all servers. It also doesn&#8217;t work as well if you have a lot of logic and conditional statements instead of just variables.</p>
<h4>A combination of them all</h4>
<p>The best choice is probably to just use all of these methods as needed. You should decide on whether you will use single quotes or double quotes and then be consistent with your decision. Then, jump out of PHP where needed and use single quotes or double quotes where needed. Here&#8217;s an example of a combination:</p>
<pre class="brush: xml;">&lt;div&gt;
	&lt;?php echo $variableOne; ?&gt;
&lt;/div&gt;
&lt;div class=&quot;class_one&quot;&gt;
	&lt;?php echo $variableTwo; ?&gt;
&lt;/div&gt;
&lt;div class=&quot;class_two&quot;&gt;
	&lt;?php echo &quot;{$variableThree} to {$variableFour}&quot;; ?&gt;
&lt;/div&gt;</pre>
<p>Since it feels really redundant to jump into PHP, echo a variable, jump out of PHP, output a string, jump back into PHP, echo another variable, jump back out of PHP, I combined that part to just use double quotes. This method probably best represents the way that I code. I may have used double quotes for this, since it would only be three lines, but for the example I expanded it and then added in the PHP.</p>
<h3>What about you?</h3>
<p>What methods do you use to integrate HTML into PHP? Do you use any methods other than the ones listed here? Please leave a comment, I look forward to hearing your thoughts!</p>
<p>(thumbnail by <a href="http://www.flickr.com/photos/f-l-e-x/3096005116/">f-l-e-x</a>, banner by <a href="http://www.flickr.com/photos/powerhouse_museum_photography/2730231201/">Powerhouse Museum</a>)</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/gulati?a=wbPfJTA-Q3o:UnEyHmZ6qAA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/gulati?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/gulati?a=wbPfJTA-Q3o:UnEyHmZ6qAA:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/gulati?i=wbPfJTA-Q3o:UnEyHmZ6qAA:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/gulati?a=wbPfJTA-Q3o:UnEyHmZ6qAA:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/gulati?i=wbPfJTA-Q3o:UnEyHmZ6qAA:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/gulati?a=wbPfJTA-Q3o:UnEyHmZ6qAA:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/gulati?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/gulati/~4/wbPfJTA-Q3o" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://gulati.info/2010/01/many-ways-to-integrate-html-into-php/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		<feedburner:origLink>http://gulati.info/2010/01/many-ways-to-integrate-html-into-php/</feedburner:origLink></item>
		<item>
		<title>The Secret of Clear and Understandable PHP</title>
		<link>http://feedproxy.google.com/~r/gulati/~3/ABz-KFvvuL0/</link>
		<comments>http://gulati.info/2010/01/the-secret-of-clear-understandable-php/#comments</comments>
		<pubDate>Mon, 11 Jan 2010 21:00:43 +0000</pubDate>
		<dc:creator>Austin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Clean PHP]]></category>
		<category><![CDATA[Code Organization]]></category>

		<guid isPermaLink="false">http://gulati.info/?p=1634</guid>
		<description><![CDATA[Writing clear code isn&#8217;t just about writing code with good syntax &#8211; there&#8217;s another very important aspect of writing code. The secret to writing clear and understandable code is to have clear logic. You don&#8217;t always have to jump straight into writing code. Take the time to determine what needs to be done and the [...]]]></description>
			<content:encoded><![CDATA[<p>Writing clear code isn&#8217;t just about writing code with good syntax &#8211; there&#8217;s another very important aspect of writing code.<br />
<span id="more-1634"></span></p>
<div class="aligncenter"><img src="http://gulati.info/wp-content/uploads/2009/12/clear-1.png" alt="The Secret of Clear and Understandable PHP" title="The Secret of Clear and Understandable PHP" width="600" height="160" class="alignnone size-full wp-image-1687" /></div>
<p>The secret to writing clear and understandable code is to have clear logic. You don&#8217;t always have to jump straight into writing code. Take the time to determine what needs to be done and the best way to do it. Logic is the very important portion of coding.</p>
<h3>Organize your thoughts</h3>
<p>You need to find a way to organize your thoughts before you start to code. There&#8217;s many ways to do this. Here&#8217;s a few examples:</p>
<h4>Pseudocode</h4>
<p>Pseudocode is essentially code that is written in English (or any other natural language) instead of a programming language. It can help you organize what you need to get done before you actually write the code. For example, if I was making a login script, here&#8217;s the pseudocode that I would write:</p>
<pre>if nothing has been submitted, then
	the login form is displayed
else if something has been submitted, then
	check if the user that was entered is valid
	if the user is valid, then
		set the cookies and session variables to show that the user has logged in
		redirect the user to the home page
	else if the user isn't valid, then
		display any necessary errors
		display the login form again</pre>
<p>There&#8217;s obviously many different ways to write pseudocode. My method of writing it is very casual and it barely resembles a program. Pseudocode can also be written so that it resembles the program that is going to be written but leaves out details that a person would not need to understand the code. You can learn more about pseudocode on <a href="http://en.wikipedia.org/wiki/Pseudocode">Wikipedia</a>.</p>
<h4>Flowcharting</h4>
<p>Flowcharting is pretty much the visual alternative to writing pseudocode. Here&#8217;s a simple example of a flow chart, similar to the example that I gave above.</p>
<div class="aligncenter"><img src="http://gulati.info/wp-content/uploads/2009/12/flowchart-11.png" alt="Example Flowchart" title="Example Flowchart" width="306" height="640" class="alignnone size-full wp-image-1665" /></div>
<p>Flowcharting is helpful because it&#8217;s really easy to follow the flow of the logic and see what should happen when the script is executed. You can learn more about flow charting on <a href="http://en.wikipedia.org/wiki/Flowchart">Wikipedia</a>. Also, <a href="http://www.drawanywhere.com/">DrawAnywhere</a> is the tool that I used to make the example flowchart.</p>
<h4>Referencing applications already in action</h4>
<p>This isn&#8217;t really a method of organizing your logic, but instead a method of coming up with your logic in the first place. If you have never worked with whatever you are working on in the past, you may not know what to put into your pseudocode or flowchart. To help you figure things out, you can reference other sites that have already implemented the system that you are trying to set up. This works for anything that&#8217;s general and is already used somewhere on the web, such as a login system.</p>
<p>To do this, just find an example of what you are trying to do, and then try all of the possibilities. See what the script does to react to your input. You won&#8217;t be able to see what&#8217;s happening on the back end, but you should be able to figure out the overall flow of the script by just viewing the front end.</p>
<h3>Write code that reflects your organization</h3>
<p>It&#8217;s great if you do do something that I listed above to organize your thoughts, but you still need to make your code reflect that organization. Otherwise, you&#8217;ll just end up with a mess of code that seems to not have been planned out at all.</p>
<p>If you have written pseudocode, then you already have a basic structure for your code. For example, if I was writing code based on the pseudocode posted above, I would write:</p>
<pre class="brush: php;">&lt;?php

	if( !isset( $_POST['submit'] ) ) {					// if nothing has been submitted, then
		require_once( 'login_form.php' );					// the login form is displayed
	} else {								// else if something has been submitted, then
		$username = mysql_real_escape_string( $_POST['username'] );	// check if the user that was entered is valid
		$not_valid = check_username( $username );
		if( $not_valid == false ) {						// if the user is valid, then
			setcookie( ... );							// set the cookies and session variables to show that the user has logged in
			header( 'Location: index.php' );					// redirect the user to the home page
		} else {								// else if the user isn't valid, then
			echo $not_valid;							// display any necessary errors
			require_once( 'login_form.php' );					// display the login form again
		}
	}

?&gt;</pre>
<p>Note how the pseudocode corresponds directly with the actual code. By the way, this is just a really simple example to show you how things correspond, it&#8217;s not actual code that would work.</p>
<p>After getting used to doing this, you should be able to visualize the psuedocode or flowchart in your head, and then just go straight to writing the code. It&#8217;s definitely very helpful if you actually create the pseudocode or flowchart if you aren&#8217;t yet at that point.</p>
<p>Questions? Comments? Please leave a comment! I look forward to hearing your thoughts.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/gulati?a=ABz-KFvvuL0:_8LsirYd1vw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/gulati?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/gulati?a=ABz-KFvvuL0:_8LsirYd1vw:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/gulati?i=ABz-KFvvuL0:_8LsirYd1vw:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/gulati?a=ABz-KFvvuL0:_8LsirYd1vw:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/gulati?i=ABz-KFvvuL0:_8LsirYd1vw:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/gulati?a=ABz-KFvvuL0:_8LsirYd1vw:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/gulati?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/gulati/~4/ABz-KFvvuL0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://gulati.info/2010/01/the-secret-of-clear-understandable-php/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://gulati.info/2010/01/the-secret-of-clear-understandable-php/</feedburner:origLink></item>
		<item>
		<title>Different Brace Styles in PHP</title>
		<link>http://feedproxy.google.com/~r/gulati/~3/rjnfKHGso78/</link>
		<comments>http://gulati.info/2010/01/different-brace-styles-in-php/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 21:00:53 +0000</pubDate>
		<dc:creator>Austin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Clean Code]]></category>
		<category><![CDATA[Code Organization]]></category>
		<category><![CDATA[Code Styles]]></category>
		<category><![CDATA[PHP and Braces]]></category>

		<guid isPermaLink="false">http://gulati.info/?p=1717</guid>
		<description><![CDATA[I&#8217;ve decided that I&#8217;ve been talking about coding styles for too long to not focus on any individual styles. So, let&#8217;s focus on a specific aspect of coding: brace styles. Overview of brace styles Many language constructs in PHP use braces, such as for,while, if, switch, etc. Where should the braces be placed? All of [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve decided that I&#8217;ve been talking about coding styles for too long to not focus on any individual styles. So, let&#8217;s focus on a specific aspect of coding: brace styles.<br />
<span id="more-1717"></span></p>
<div class="aligncenter"><img src="http://gulati.info/wp-content/uploads/2009/12/brace-1.png" alt="Different Brace Styles in PHP" title="Different Brace Styles in PHP" width="600" height="160" class="alignnone size-full wp-image-1776" /></div>
<h3>Overview of brace styles</h3>
<p>Many language constructs in PHP use braces, such as <code>for</code>,<code>while</code>, <code>if</code>, <code>switch</code>, etc. Where should the braces be placed? All of the different styles have different reasons behind them. I&#8217;m going to talk about all of the different styles individually and then assess the situation as a whole.</p>
<h4>K&amp;R style</h4>
<p>This style was first introduced by Kernighan and Ritchie&#8217;s book The C Programming Language. It puts braces on the same line as the control statements. Here&#8217;s an example:</p>
<pre class="brush: php;">	if( $conditionOne ) {
		functionOne();
		$variableOne = 1;
	} else {
		functionTwo();
		while( $conditionTwo ) {
			functionThree();
			$variableTwo++;
		}
	}
	functionFour();</pre>
<p>The advantages of this style are that the braces line up with the control statements that &#8220;own&#8221; them.</p>
<div class="aligncenter"><img src="http://gulati.info/wp-content/uploads/2009/12/kandr-11.png" alt="K&amp;R Example" title="K&amp;R Example" width="640" height="57" class="alignnone size-full wp-image-1731" /></div>
<p>It could be viewed that the actual &#8220;owner&#8221; of the closing brace is the opening brace, so it should line up with that. Another advantage is that code takes up less space since braces do not require lines on their own. A disadvantage is that it&#8217;s harder to scan for beginning and ending braces when using this style. I don&#8217;t really agree that that is a disadvantage though, I find it quite easy to find the opening brace from the closing brace. Since everything inside of the control statement is indented, you just have to go straight up from the closing brace to find the line with the opening brace. In my opinion, the control statement is much more important than the brace itself, so it&#8217;s better than when you follow the closing brace straight up you find the control statement.</p>
<h4>Allman style</h4>
<p>The Allman style is sometimes referred to as the &#8220;ANSI style&#8221;. It puts braces on lines of their own and indents them to be aligned with the control statement. Here&#8217;s an example:</p>
<pre class="brush: php;">	if( $conditionOne )
	{
		functionOne();
		$variableOne = 1;
	}
	else
	{
		functionTwo();
		while( $conditionTwo )
		{
			functionThree();
			$variableTwo++;
		}
	}
	functionFour();
</pre>
<p>Instead of the brace lining up with only the control statement, it lines up with the opening brace too.</p>
<div class="aligncenter"><img src="http://gulati.info/wp-content/uploads/2009/12/allman-11.png" alt="Allman Example" title="Allman Example" width="640" height="71" class="alignnone size-full wp-image-1734" /></div>
<p>An advantage is that the control statement can be commented out to still have syntactically correct code. For example:</p>
<pre class="brush: php;">	// if( $conditionOne )
	{
		functionOne();
		$variableOne = 1;
	}
</pre>
<p>A disadvantage is that each brace takes up a line of its own. This was a problem back when programmers were limited to working from terminal with small resolutions, but today it isn&#8217;t much a problem. Code readability is more important than code length.</p>
<h4>Whitesmiths style</h4>
<p>The Whitesmiths style is essentially the same as the Allman style, but braces are indented to be aligned with the body of code instead of the control statement. Here&#8217;s an example:</p>
<pre class="brush: php;">if( $conditionOne )
	{
	functionOne();
	$variableOne = 1;
	}
else
	{
	functionTwo();
	while( $conditionTwo )
		{
		functionThree();
		$variableTwo++;
		}
	}
functionFour();</pre>
<p>I&#8217;m not going to highlight how things are aligned for this one. It&#8217;s pretty much the same as the previous except that things are indented a little differently. It has the same advantages and disadvantages.</p>
<h4>GNU style</h4>
<p>This style is the average of the previous two. The braces are indented to be in the middle of the control statement and the body of code. Here&#8217;s an example:</p>
<pre class="brush: php;">if( $conditionOne )
  {
	functionOne();
	$variableOne = 1;
  }
else
  {
	functionTwo();
	while( $conditionTwo )
	  {
		functionThree();
		$variableTwo++;
	  }
  }
functionFour();</pre>
<p>Since a tab block is equal to four spaces, the braces are indented two spaces or one half of a tab block.  This one has the same advantages and disadvantages as the last two. It&#8217;s a little easy to see the control statements and the different blocks of code in this one. Plus, all of the braces are indented so that they aren&#8217;t aligned with anything else, so it&#8217;s easy to see where the control blocks begin and end.</p>
<h4>Horstmann style</h4>
<p>The Horstmann style is similar to the Allman style. The only difference is that the first statement in the code body is placed on the same line of the opening brace. Here&#8217;s an example:</p>
<pre class="brush: php;">if( $conditionOne )
{	functionOne();
	$variableOne = 1;
}
else
{	functionTwo();
	while( $conditionTwo )
	{	functionThree();
		$variableTwo++;
	}
}
functionFour();</pre>
<p>An advantage of this is that it saves space. A disadvantage is that it&#8217;s harder to see where things start. Things are pretty much more cluttered. As I said earlier, readability is more important than the conservation of space.</p>
<h4>Banner style</h4>
<p>Banner style is pretty much K&amp;R style except that the closing braces are also indented. Here&#8217;s what it would look like:</p>
<pre class="brush: php;">if( $conditionOne ) {
	functionOne();
	$variableOne = 1;
	}
else {
	functionTwo();
	while( $conditionTwo ) {
		functionThree();
		$variableTwo++;
		}
	}
functionFour();</pre>
<p>I don&#8217;t really think that there are any advantages to this style. Most people who use it do so because it makes it easier to see the control statements. The closing braces are indented because they aren&#8217;t as significant as the opening control statements.</p>
<h4>Pico style</h4>
<p>This is the final style. It&#8217;s used mostly with the Pico programming language. It&#8217;s similar to the Hortstmann style, but the closing brace is put on the same line as the last control statement. Here&#8217;s an example:</p>
<pre class="brush: php;">if( $conditionOne )
{	functionOne();
	$variableOne = 1; }
else
{	functionTwo();
	while( $conditionTwo )
	{	functionThree();
		$variableTwo++; } }
functionFour();</pre>
<p>This is the most compressed style, but that doesn&#8217;t mean that it is the best. I find it very hard to read &#8211; it&#8217;s over compressed.</p>
<h3>The best style</h3>
<p>Which style do you prefer? That&#8217;s pretty much what it comes down to. There isn&#8217;t a single best style. All of the different styles have their advantages and disadvantages. Moreover, these are styles, not rules or regulations. Just as no one can dictate your clothing style, no one can dictate your coding style. You don&#8217;t have to use any of the styles listed here &#8211; they are just the most popular styles.</p>
<p>My favorite is the K&amp;R style. I find it easiest to read. At this point, I&#8217;m so accustomed to using it that I don&#8217;t think about it.</p>
<p>What style do you use? Why do you use it? Please leave a comment, I look forward to hearing your thoughts!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/gulati?a=rjnfKHGso78:jLvAnzhn4y8:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/gulati?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/gulati?a=rjnfKHGso78:jLvAnzhn4y8:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/gulati?i=rjnfKHGso78:jLvAnzhn4y8:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/gulati?a=rjnfKHGso78:jLvAnzhn4y8:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/gulati?i=rjnfKHGso78:jLvAnzhn4y8:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/gulati?a=rjnfKHGso78:jLvAnzhn4y8:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/gulati?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/gulati/~4/rjnfKHGso78" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://gulati.info/2010/01/different-brace-styles-in-php/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://gulati.info/2010/01/different-brace-styles-in-php/</feedburner:origLink></item>
		<item>
		<title>Should You Develop Your Own Coding Styles?</title>
		<link>http://feedproxy.google.com/~r/gulati/~3/bcqBlSEhaLY/</link>
		<comments>http://gulati.info/2010/01/should-you-develop-your-own-coding-styles/#comments</comments>
		<pubDate>Mon, 04 Jan 2010 21:00:17 +0000</pubDate>
		<dc:creator>Austin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Code Organization]]></category>
		<category><![CDATA[Code Styles]]></category>

		<guid isPermaLink="false">http://gulati.info/?p=1706</guid>
		<description><![CDATA[In a recent post, I listed a few good places to learn different coding styles and which coding styles are most accepted. Now, let&#8217;s decide if it&#8217;s better to develop your own coding styles or to use the recommended styles of others. Developing your own styles There are a few advantages to developing your own [...]]]></description>
			<content:encoded><![CDATA[<p>In a recent post, I listed a few good places to learn different coding styles and which coding styles are most accepted. Now, let&#8217;s decide if it&#8217;s better to develop your own coding styles or to use the recommended styles of others.<br />
<span id="more-1706"></span></p>
<div class="aligncenter"><img src="http://gulati.info/wp-content/uploads/2009/12/styles-2.png" alt="Should You Develop Your Own Coding Styles?" title="Should You Develop Your Own Coding Styles?" width="600" height="160" class="alignnone size-full wp-image-1751" /></div>
<h3>Developing your own styles</h3>
<p>There are a few advantages to developing your own coding styles.</p>
<ol>
<li>If you develop your own coding styles you will be coding in a way that works for you. You have complete control over the way that you code, so you can choose to do things in a way that makes sense to you. It&#8217;s fairly easy to change your coding styles if your preferences change. You shouldn&#8217;t make changes while working on the same project, but it&#8217;s fine to do things differently from project to project until you find what you like best.</li>
<li>If you are doing things the way that you want to do them, it will probably take you less time. This one could go either way, though. You could develop your own habits that you will be very familiar with and able to implement quickly. Or, you could utilize the styles of others that would take a little while to learn in the beginning but save you time in the long run.</li>
<li>It&#8217;s much easier to develop your own styles. You don&#8217;t have to worry about deciding if something fits the style guidelines that you are trying to meet, you just have to make sure that things are consistent. Developing your own styles doesn&#8217;t require any extra learning, only applying what you know in a manner that makes sense to you.</li>
</ol>
<h3>Using the styles of others</h3>
<p>There are also a few advantages to using the styles of others. By the way, by &#8220;using the styles of others&#8221; I mean following the coding guidelines that I featured in this previous post or following similar guidelines.</p>
<ol>
<li>Your coding style may be more accepted if you follow the standards used by others. Your code won&#8217;t be something that you just hacked up, it will be something that follows a respected set of guidelines. It&#8217;s very possible to create clean and understandable code while using your own guidelines, but if you use an already established set of guidelines it&#8217;s pretty much guaranteed that your code will be understood by others.</li>
<li>You will be more prepared to work with others if you use coding standards that you may not be completely comfortable with. Chances are that if you make the transition from working alone to working with a team, you will no longer be able to do things as you want them done. You will have to follow the coding standards that everyone else on the team also follows. If you become accustomed to doing this while working on your own projects, you won&#8217;t have to adjust.</li>
<li>It&#8217;s a lot easier to follow standards if you have a set list of standards in front of you. If you are making your own standards, it can be difficult to keep track of all of the different rules. When using the styles of others, you have a definite list.</li>
</ol>
<h3>What&#8217;s the difference?</h3>
<p>There really isn&#8217;t one. It all depends on how much you value the style of your code. If you are very concerned with writing clean code, you may pay more attention that if you just want to get the job done. Moreover, it&#8217;s not that hard to adjust between developing your own styles or using the styles of others. If you are used to putting braces at the end of lines, and then you suddenly have to change your style and put them on new lines of their own, it won&#8217;t take you very long to adjust to hitting the enter key.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/gulati?a=bcqBlSEhaLY:spcoHEhHxXY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/gulati?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/gulati?a=bcqBlSEhaLY:spcoHEhHxXY:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/gulati?i=bcqBlSEhaLY:spcoHEhHxXY:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/gulati?a=bcqBlSEhaLY:spcoHEhHxXY:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/gulati?i=bcqBlSEhaLY:spcoHEhHxXY:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/gulati?a=bcqBlSEhaLY:spcoHEhHxXY:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/gulati?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/gulati/~4/bcqBlSEhaLY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://gulati.info/2010/01/should-you-develop-your-own-coding-styles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://gulati.info/2010/01/should-you-develop-your-own-coding-styles/</feedburner:origLink></item>
		<item>
		<title>Resources for Writing Clean Code</title>
		<link>http://feedproxy.google.com/~r/gulati/~3/1jl9ma3FtOM/</link>
		<comments>http://gulati.info/2010/01/resources-for-writing-clean-code/#comments</comments>
		<pubDate>Fri, 01 Jan 2010 23:00:33 +0000</pubDate>
		<dc:creator>Austin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Clean PHP]]></category>
		<category><![CDATA[Resource List]]></category>

		<guid isPermaLink="false">http://gulati.info/?p=1692</guid>
		<description><![CDATA[Recently, I have been talking a lot about writing clean code. Instead of me talking more about it, here&#8217;s a few other resources that can help you. Clean Code by Robert C. Martin As suggested by AllanC on a previous post, Clean Code is a book written to help you improve your coding habits. It [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I have been talking a lot about writing clean code. Instead of me talking more about it, here&#8217;s a few other resources that can help you.<br />
<span id="more-1692"></span></p>
<div class="aligncenter"><img src="http://gulati.info/wp-content/uploads/2009/12/resources-1.png" alt="Resources for Writing Clean Code" title="Resources for Writing Clean Code" width="600" height="160" class="alignnone size-full wp-image-1760" /></div>
<h3><em>Clean Code</em> by Robert C. Martin</h3>
<p>As suggested by AllanC on a previous post, <em>Clean Code</em> is a book written to help you improve your coding habits. It covers a wide range of topics (such as meaningful names, pertinence of comments, code formatting, etc). Martin gives in-depth explanation for every point that he makes and includes real world examples. I haven&#8217;t read the book myself (it&#8217;s on my todo list!), but I&#8217;ve heard that it&#8217;s a difficult read. Some experience with Java is needed to fully appreciate the examples given. This book will definitely change your viewpoint on programming and what it means to have &#8220;clean code&#8221;. You can find the book on <a href="http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882">Amazon</a>. Also, here&#8217;s a <a href="http://blog.objectmentor.com/articles/2008/04/08/clean-code-whew">table of contents</a> and (if you scroll down to the <a href="http://blog.objectmentor.com/articles/2008/04/08/clean-code-whew#comments">comments</a>) a few reviews of the book.</p>
<h3>Wikipedia: Programming style</h3>
<p>Wikipedia&#8217;s <a href="http://en.wikipedia.org/wiki/Programming_style">article on programming style</a> has all sorts of information on coding habits and styles. It focuses on the appearance of the code more so than the logic behind the code. It covers a large amount of practices, such as the use of whitespace and indenting. The great part of this resource is that the page links out to many other pages that are focused on more specific topics. The information on Wikipedia on programming style is not limited to just this article &#8211; it includes much, much more.</p>
<h3>Zend Framework&#8217;s Coding Standards</h3>
<p>The reference guide of the Zend Framework includes a <a href="http://framework.zend.com/manual/en/coding-standard.html">whole section</a> dedicated to coding standards and style. You don&#8217;t have to follow the coding standards there strictly unless you are contributing code to the project, but you can still read the recommendations that are made and learn from them. Everything is covered in this in-depth guide. The guide also includes PHP examples, which is great if you are working with PHP.</p>
<h3>CodeIgniter&#8217;s Style Guide</h3>
<p>CodeIgniter&#8217;s <a href="http://codeigniter.com/user_guide/general/styleguide.html">style guide</a> is similar in purpose to the Zend Framework reference. It provides people guidelines to use when submitting code to the open source project. As with the Zend Framework guide, you can still follow the coding standards even if you aren&#8217;t contributing to the project. This guide is helpful in that it gives examples of what doesn&#8217;t follow the coding standards as well as what does.</p>
<h3>Drupal&#8217;s Coding Standards</h3>
<p>There&#8217;s not much to say about Drupal&#8217;s <a href="http://drupal.org/coding-standards">coding standards</a> that hasn&#8217;t been already said. This guide isn&#8217;t as in-depth as the previous but it still provides standards that can be followed.</p>
<p>Basically, the best way to utilize these resources is to look through them until you find standards that you like. You can then learn the standards and perfect them. The most important thing is that you are consistent. If you start off a project planning to follow specific standards, you should continue following those standards throughout the project.</p>
<p>But what if you would rather develop your own set of standards instead of following the standards created by others? I&#8217;ll be doing a post on this in the near future &#8211; stay tuned.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/gulati?a=1jl9ma3FtOM:Bgf2GPmbvBg:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/gulati?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/gulati?a=1jl9ma3FtOM:Bgf2GPmbvBg:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/gulati?i=1jl9ma3FtOM:Bgf2GPmbvBg:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/gulati?a=1jl9ma3FtOM:Bgf2GPmbvBg:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/gulati?i=1jl9ma3FtOM:Bgf2GPmbvBg:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/gulati?a=1jl9ma3FtOM:Bgf2GPmbvBg:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/gulati?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/gulati/~4/1jl9ma3FtOM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://gulati.info/2010/01/resources-for-writing-clean-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://gulati.info/2010/01/resources-for-writing-clean-code/</feedburner:origLink></item>
		<item>
		<title>Deleting A Feedburner Feed Item</title>
		<link>http://feedproxy.google.com/~r/gulati/~3/EzTJj4pyieY/</link>
		<comments>http://gulati.info/2009/11/deleting-a-feedburner-feed-item/#comments</comments>
		<pubDate>Sun, 22 Nov 2009 19:43:39 +0000</pubDate>
		<dc:creator>Austin</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Delete Feedburner Feed Items]]></category>
		<category><![CDATA[Feedburner]]></category>

		<guid isPermaLink="false">http://gulati.info/?p=1595</guid>
		<description><![CDATA[Feedburner doesn&#8217;t have a clear way to delete items from your feed &#8211; here&#8217;s a short guide that will walk you through it. The Story I was working on a post a few days back when I accidentally hit the &#8216;Publish&#8217; button. The post (which was only a small way towards being finished) was automatically [...]]]></description>
			<content:encoded><![CDATA[<p>Feedburner doesn&#8217;t have a clear way to delete items from your feed &#8211; here&#8217;s a short guide that will walk you through it.<br />
<span id="more-1595"></span></p>
<div class="aligncenter"><img src="http://gulati.info/wp-content/uploads/2009/11/feedburner-2.png" alt="feedburner-2" title="feedburner-2" width="600" height="160" class="alignnone size-full wp-image-1629" /></div>
<h3>The Story</h3>
<p>I was working on a post a few days back when I accidentally hit the &#8216;Publish&#8217; button. The post (which was only a small way towards being finished) was automatically added to my blog index and my blog&#8217;s feed. Feedburner, being the antsy antelope that it is, added it to my Feedburner feed only minutes after. I quickly removed the new post, but it still appeared in my Feedburner feed.</p>
<p>Feedburner caches feeds so that it doesn&#8217;t have to download them every time someone accesses them. Once the cache was updated to include my fraction of a post that I had published, it stayed there even after I removed the post from my blog&#8217;s feed by making it a draft again.</p>
<p>I figured out a way to delete items from a Feedburner feed. It&#8217;s actually pretty simple. Here goes nothing.</p>
<h3>Deleting an Item From Your Feed</h3>
<p>Follow these steps to delete an item from your feed:</p>
<ol>
<li><strong>Remove the item from your blog&#8217;s feed.</strong> When dealing with WordPress, there&#8217;s two ways of doing this. You can either set the item to be a draft again, or delete it. If you aren&#8217;t dealing with WordPress, this is a fairly simple task so you can probably figure it out for yourself. ;) In general, if the post does not appear on your blog&#8217;s index, it probably isn&#8217;t in your feed.</li>
<li><strong>&#8220;Nuke&#8221; your feed in Feedburner.</strong> You can do this by heading over to Feedburner and then clicking on the &#8216;Troubleshootize&#8217; tab. Scroll down until you see the header &#8216;The Nuclear Option: &#8220;Resyncing&#8221; your feed&#8217; and click the button to &#8216;Resync Now&#8217;. It&#8217;s kind of odd to find this option here, so that&#8217;s why I&#8217;m making a blog post about it. It was the last place that I decided to look. The option is also hidden under the page fold so it&#8217;s harder to find.</li>
</ol>
<p>It&#8217;s as simple as that. The resync option is played up to be a catastrophic event (&#8220;nuking&#8221; your feed), but it&#8217;s painless. Your feed will be rebuilt from your updated blog feed that does not include the extra post instantly.</p>
<p>Questions? Having trouble? Leave a comment!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/gulati?a=EzTJj4pyieY:igJZ53_NznM:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/gulati?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/gulati?a=EzTJj4pyieY:igJZ53_NznM:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/gulati?i=EzTJj4pyieY:igJZ53_NznM:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/gulati?a=EzTJj4pyieY:igJZ53_NznM:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/gulati?i=EzTJj4pyieY:igJZ53_NznM:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/gulati?a=EzTJj4pyieY:igJZ53_NznM:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/gulati?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/gulati/~4/EzTJj4pyieY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://gulati.info/2009/11/deleting-a-feedburner-feed-item/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		<feedburner:origLink>http://gulati.info/2009/11/deleting-a-feedburner-feed-item/</feedburner:origLink></item>
		<item>
		<title>My Method Of Organization For New Projects</title>
		<link>http://feedproxy.google.com/~r/gulati/~3/A-R-D92LdjQ/</link>
		<comments>http://gulati.info/2009/11/my-method-of-organization-for-new-projects/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 01:04:24 +0000</pubDate>
		<dc:creator>Austin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Clean PHP]]></category>
		<category><![CDATA[Directory Organization]]></category>

		<guid isPermaLink="false">http://gulati.info/?p=1581</guid>
		<description><![CDATA[As I touched on in my post about keeping your code clean, there&#8217;s more to coding than just writing good code. It&#8217;s also about organizing your scripts efficiently. Here&#8217;s my method of organizing scripts. (source) I started using this method a few months ago. It isn&#8217;t perfect, but it works for fairly small web applications [...]]]></description>
			<content:encoded><![CDATA[<p>As I touched on in my <a href="http://gulati.info/2009/11/clean-your-php/">post</a> about keeping your code clean, there&#8217;s more to coding than just writing good code. It&#8217;s also about organizing your scripts efficiently. Here&#8217;s my method of organizing scripts.<br />
<span id="more-1581"></span></p>
<div class="aligncenter"><img src="http://gulati.info/wp-content/uploads/2009/11/organize-2.png" alt="My Method of Organization For New Projects" title="My Method of Organization For New Projects" width="600" height="160" class="alignnone size-full wp-image-1616" /><br />(<a href="http://www.flickr.com/photos/starlamay/2996088231/">source</a>)</div>
<p>I started using this method a few months ago. It isn&#8217;t perfect, but it works for fairly small web applications that I build on the fly.</p>
<h3>Directory Structure</h3>
<p>My directory structure looks like this:</p>
<div class="aligncenter"><img src="http://gulati.info/wp-content/uploads/2009/11/scripts-1.png" alt="My Directory Structure" title="My Directory Structure" width="486" height="277" class="alignnone size-full wp-image-1583" /></div>
<p>Here&#8217;s a brief rundown of what goes in each directory:</p>
<ol>
<li><strong>styles/</strong> &#8211; Everything frontend goes here.  Nothing is at the root of the directory usually, only in subfolders.
<ol>
<li><strong>styles/css/</strong> &#8211; Fairly self explanatory, all of the CSS files go here.</li>
<li><strong>styles/img/</strong> &#8211; Again, fairly self explanatory, all of the images go here.</li>
</ol>
</li>
<li><strong>support/</strong> &#8211; Everything backend goes here. Nothing is at the root of the directory usually, only in subfolders.
<ol>
<li><strong>support/ajax/</strong> &#8211; Any scripts that are accessed via AJAX are put here. I like to segregate these from other scripts so that they all have similar include patterns. They will require files from the <strong>support/config/</strong> directory, so I may have a script that includes all of these files and then is included by one of the scripts that is directly accessed via AJAX.</li>
<li><strong>support/config/</strong> &#8211; All and any configuration files go here.</li>
<li><strong>support/element/</strong> &#8211; This is where all of the individual page elements go. I&#8217;ll talk about these a little bit more later. This is pretty much the area where front end meets backend.</li>
<li><strong>support/includes/</strong> &#8211; This is where all of the &#8216;support&#8217; scripts go. These will be scripts containing functions or classes that are used by the page element scripts.</li>
<li><strong>support/js/</strong> &#8211; The JavaScript files are found here. In my opinion, this could go in either spot. If you look at the organization as styles vs support, as the directory names suggest, this would go in the support folder. If you look at it as frontend vs backend, it would go in the frontend folder. Put it wherever you think it should go.</li>
</ol>
</li>
<li><strong>index.php</strong> &#8211; This script handles all incoming requests. Using Apache&#8217;s mod_rewrite, I rewrite all URLs to point to this script. All of the information about the page being accessed is transformed in $_GET variables by mod_rewrite.</li>
</ol>
<h3>Index.php &#8211; The Handler</h3>
<p>Here&#8217;s an example of what index.php may look like:</p>
<pre class="brush: php;">&lt;?php

	require_once( 'support/config/general.php' );
	// (other configuration and includes scripts are required here)

	$controller = $_GET['cont'];
	$action = $_GET['act'];
	$argument = $_GET['arg'];

	if( empty( $controller ) ) {
		require_once( 'support/elements/home.php' );
	} elseif( $controller == 'users' ) {
		require_once( 'support/elements/users.php' );
	} elseif( $controller == 'extras' ) {
		require_once( 'support/elements/extras.php' );
	}
?&gt;
</pre>
<p>This script does all of the core includes and sets things up for the next script. Then, it sets up all of the variables that determine what is displayed. I split up every request into three parts: the <strong>controller</strong>, <strong>action</strong>, and <strong>argument</strong>. The controller and action are required for all requests. If either do not appear, they are usually assumed to be home and index, respectfully. The argument is optional. These three variables can describe just about any request that is made. Trying to view someone&#8217;s user profile? The controller would be users, the action would be profile, and the argument would the id of the user that you&#8217;re trying to view. Trying to post a topic? The controller would be forums, the action would be newtopic, and the argument would be the parent forum that you are trying to post under.</p>
<p>Index.php decides which element (all of the elements are essentially controllers) and then includes the necessary files. When the element script takes over from there, it determines what to do according to the action and argument.</p>
<h3>Why I Like This System</h3>
<p>I find that this system simplifies the process. Every directory has a certain type of scripts or files that it contains. All of these scripts or files have the same purpose.  I believe that the directories are set up logically while still keeping it simple. This could be a lot more complicated, but it doesn&#8217;t have to be. It isn&#8217;t designed to be used for large scale web applications, only medium to small ones.</p>
<p>Things are extremely easy to debug when using this system. If there is a problem with a certain module, I can open up the controller script for that module and see what the problem is. As long as global functions (in the includes/ directory) are kept simple, and don&#8217;t do a larger job than they have to, things can pretty much only go wrong with each individual module.</p>
<p><em>What&#8217;s your method of organizing projects? Do you like my method? Please leave a comment!</em></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/gulati?a=A-R-D92LdjQ:GPnS9Cvc4bc:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/gulati?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/gulati?a=A-R-D92LdjQ:GPnS9Cvc4bc:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/gulati?i=A-R-D92LdjQ:GPnS9Cvc4bc:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/gulati?a=A-R-D92LdjQ:GPnS9Cvc4bc:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/gulati?i=A-R-D92LdjQ:GPnS9Cvc4bc:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/gulati?a=A-R-D92LdjQ:GPnS9Cvc4bc:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/gulati?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/gulati/~4/A-R-D92LdjQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://gulati.info/2009/11/my-method-of-organization-for-new-projects/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://gulati.info/2009/11/my-method-of-organization-for-new-projects/</feedburner:origLink></item>
		<item>
		<title>9 Ultimate Web Services That Could Help You With Your Next Project</title>
		<link>http://feedproxy.google.com/~r/gulati/~3/PVV9kTdElpI/</link>
		<comments>http://gulati.info/2009/11/9-ultimate-web-services-that-could-help-you-with-your-next-project/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 19:52:45 +0000</pubDate>
		<dc:creator>Austin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Amazon Web Services]]></category>
		<category><![CDATA[Google Maps]]></category>
		<category><![CDATA[Twitter API]]></category>
		<category><![CDATA[Web Services]]></category>

		<guid isPermaLink="false">http://gulati.info/?p=1560</guid>
		<description><![CDATA[As time progresses, the web becomes more and more connected. Information and data are becoming much easier to access. Here&#8217;s 9 ultimate web services that can help you with your next project. Twitter APIAh, Twitter. As little as I care about how Ryan Seacrest is eating a green apple, Twitter is a popular service and [...]]]></description>
			<content:encoded><![CDATA[<p>As time progresses, the web becomes more and more connected. Information and data are becoming much easier to access. Here&#8217;s 9 ultimate web services that can help you with your next project.<br />
<span id="more-1560"></span></p>
<div class="aligncenter"><img src="http://gulati.info/wp-content/uploads/2009/11/services-1.png" alt="9 Ultimate Web Services That Could Help You With Your Next Project" title="9 Ultimate Web Services That Could Help You With Your Next Project" width="600" height="160" class="alignnone size-full wp-image-1577" /></div>
<ol>
<li><strong>Twitter API</strong><br />Ah, Twitter. As little as I care about how Ryan Seacrest is <a href="http://twitter.com/RyanSeacrest/status/5771633412">eating a green apple</a>, Twitter is a popular service and including it in your web application usually adds to the success of it. Twitter has a <a href="http://apiwiki.twitter.com/">robust API</a> that will give you access to just about anything that you need.</li>
<li><strong>Last.fm API</strong><br />When it comes to music, Last.fm is just about unbeatable. Using <a href="http://www.last.fm/api">their web services</a>, you can access a large amount of data, including artists and their popular tracks, images of artists, and play counts of popular tracks.</li>
<li><strong>Amazon Product Advertising API</strong><br />Amazon&#8217;s Product Advertising API, one of many web services offered by Amazon, is an easy way to get information of products. It can also be used to sell items and earn money through Amazon&#8217;s affiliate program. You can find their documentation <a href="http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/">here</a>. Also, check out <a href="http://gulati.info/2009/08/amazon-php-api/">a post</a> that I did recently covering a little bit about using their API.</li>
<li><strong>Google Maps API</strong><br />Using the Google Maps API, you can embed Google Maps in any web page. There isn&#8217;t an easier way to display maps to your users. The API is well documented and easy to use. You can find the documentation for the Google Maps API <a href="http://code.google.com/apis/maps/">here</a>.</li>
<li><strong>Facebook API</strong><br />With Facebook being even more popular than Twitter, it&#8217;s obvious why the Facebook API is important. The Facebook API is an important part of developing Facebook Applications. You can find the documentation <a href="http://wiki.developers.facebook.com/index.php/Main_Page">here</a>.</li>
<li><strong>YouTube API</strong><br />YouTube is the most popular video site on the web. They have a fairly simple API with two core parts &#8211; the data API, which lets you search for videos or upload them, and the player API, which lets you embed YouTube videos in your web pages. You can find the documentation for both APIs <a href="http://code.google.com/apis/youtube/overview.html">here</a>.</li>
<li><strong>OAuth</strong><br />OAuth is a protocol that allows 3rd party applications to interact with service providers. An example of this is Twitter. A user can visit a web application with OAuth and login to their Twitter account without giving their password to the application. The application can then access whatever it needs from Twitter. You can learn more about OAuth <a href="http://oauth.net/">here</a>.</li>
<li><strong>Yahoo! Maps Web Service</strong><br />The Yahoo! Maps Web Service is a web service similar to Google Maps. It allows you to embed maps on your website or geocode addresses. I would consider using it over the Google Maps service if all that I needed was geocoding. Yahoo! offers a really simple <a href="http://developer.yahoo.com/maps/rest/V1/geocode.html">geocoding API</a>. You can find the documentation for the whole API <a href="http://developer.yahoo.com/maps/">here</a>.</li>
<li><strong>MediaWiki API</strong><br />The MediaWiki API gives you access to the largest encyclopedia on the web: Wikipedia. You can use it to fetch articles, edit articles, add new articles, or do just about anything else. You can find the documentation for the MediaWiki API <a href="http://www.mediawiki.org/wiki/API">here</a>.
</ol>
<p>Have you ever used any of these web services? How have they helped you? What do you think the tenth web service in the list should be? <strong>Please leave a comment!</strong></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/gulati?a=PVV9kTdElpI:5tfYUzOLjr8:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/gulati?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/gulati?a=PVV9kTdElpI:5tfYUzOLjr8:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/gulati?i=PVV9kTdElpI:5tfYUzOLjr8:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/gulati?a=PVV9kTdElpI:5tfYUzOLjr8:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/gulati?i=PVV9kTdElpI:5tfYUzOLjr8:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/gulati?a=PVV9kTdElpI:5tfYUzOLjr8:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/gulati?d=TzevzKxY174" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/gulati/~4/PVV9kTdElpI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://gulati.info/2009/11/9-ultimate-web-services-that-could-help-you-with-your-next-project/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://gulati.info/2009/11/9-ultimate-web-services-that-could-help-you-with-your-next-project/</feedburner:origLink></item>
	</channel>
</rss>
