<?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>nomadhacker</title>
	<atom:link href="http://www.nomadhacker.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nomadhacker.com</link>
	<description>mental ramblings of a self-aknowledged geek</description>
	<lastBuildDate>Sun, 04 Oct 2009 00:23:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>NaNoWriMo or Bust!</title>
		<link>http://www.nomadhacker.com/writing/nanowrimo-or-bust/</link>
		<comments>http://www.nomadhacker.com/writing/nanowrimo-or-bust/#comments</comments>
		<pubDate>Sat, 03 Oct 2009 22:47:55 +0000</pubDate>
		<dc:creator>nomadhacker</dc:creator>
				<category><![CDATA[writing]]></category>
		<category><![CDATA[nanowrimo]]></category>

		<guid isPermaLink="false">http://www.nomadhacker.com/?p=119</guid>
		<description><![CDATA[I have recently signed up for the National Novel Writing Month Challenge! (NaNoWriMo).  NaNoWriMo is an annual, month-long challenge that takes place during the month of November.  The idea is to write a 50,000 word long novel in exactly one month.
There are no style restrictions, and editing is actually discouraged.  The goal [...]]]></description>
			<content:encoded><![CDATA[<p>I have recently signed up for the National Novel Writing Month Challenge! (NaNoWriMo).  <a href="http://www.nanowrimo.org/">NaNoWriMo</a> is an annual, month-long challenge that takes place during the month of November.  The idea is to write a 50,000 word long novel in exactly one month.</p>
<p>There are no style restrictions, and editing is actually discouraged.  The goal is to get out and write, to just splurge everything down on the paper and get an actual novel completed, instead of endlessly thinking about the plot, or getting caught in the tinkering trap of endlessly tweaking and rewriting things.</p>
<p>There&#8217;s no contest, and no prize for best novel.  The only prize is to have a complete 50,000 word piece of writing that you&#8217;ve created.</p>
<p>I&#8217;ve been neglecting my writing lately.  Instead anything I create is more likely to be crafted in PHP or C# than the English language.  Don&#8217;t get me wrong, I do enjoy grokking a tricky piece of code, but there&#8217;s a more creative side to myself that I&#8217;ve always enjoyed exploring, and it hasn&#8217;t been getting much play lately.  It will feel good to get back to actual writing again.  I feel like the <a href="http://www.nanowrimo.org/">NaNoWriMo</a> challenge is exactly the sort of event I need to get started again.</p>
<p>So that leaves me with a little more than one month to get ready.  I need set up a space to write, find some typing paper (yes I&#8217;m using a typewriter), and figure out what to write.  Anyone have any suggestions?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nomadhacker.com/writing/nanowrimo-or-bust/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why JQuery</title>
		<link>http://www.nomadhacker.com/jquery/why-jquery/</link>
		<comments>http://www.nomadhacker.com/jquery/why-jquery/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 17:37:30 +0000</pubDate>
		<dc:creator>nomadhacker</dc:creator>
				<category><![CDATA[Jquery]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.nomadhacker.com/?p=111</guid>
		<description><![CDATA[I used to be one of those &#8216;He-Man&#8217; coders.  Why do I need to use libraries or frameworks?  I&#8217;l just code it all by hand and it&#8217;ll be leaner and more efficient.  Why would you bother to have an extra 15k download?  That&#8217;s an extra server call! You get the idea.
While [...]]]></description>
			<content:encoded><![CDATA[<p>I used to be one of those &#8216;He-Man&#8217; coders.  Why do I need to use libraries or frameworks?  I&#8217;l just code it all by hand and it&#8217;ll be leaner and more efficient.  Why would you bother to have an extra 15k download?  That&#8217;s an extra server call! You get the idea.</p>
<p>While there certainly are some libraries or frameworks that are too big or that run slower, that&#8217;s more a sign of a poorly made library than anything else.  JQuery is no poorly made library.</p>
<p>You may load an extra few killobytes of data once, but you more than make up for that in the code you don&#8217;t write.  That 15k contains lots of time and code-saving features that can help turn something that used to take you 5 lines of code into an elegant one-liner, streamlining your code and actually making your JavaScript more efficient.</p>
<p>The first time I saw how much power was wrapped up in simple the simple calls of JQuery, I had gone to Desert Code Camp, basically a free coder&#8217;s day camp in Phoenix with presentations on a bunch of different topics.  Looking to fill in time before the Cocoa programming intro, I hopped into the JQuery session.</p>
<p>The first thing the presenter did was probably familiar to many who have used JQuery before.  He wrote a two-inch single line of code to perform list striping, that effect you get when every other line in a list or table is a separate background color.<br />
<code>$("tr:even").css("background-color", "#eeeeee");</code><br />
He then went on to show off a couple of one-line effects like fading, roll-ups, show/hide, and while he was at it he showed off some of the drop-dead simple css-based selectors to get just the right items.</p>
<p>Needless to say I immediately went home and jumped on the jquery site, picked up a book on JQuery, and started learning the syntax.  Since then I&#8217;ve started working it into my own projects and projects at work.  I&#8217;ve even started rewriting some old stuff to use JQuery simply because it&#8217;s that much better.  Projects at work that would have taken me two weeks or more I&#8217;m able to get done in under a week with the time I&#8217;m saving from JQuery.</p>
<p>Does this all sound a little hard to believe?  An exaggeration?  Can it end World Hunger, too?  Nope, I guarantee it&#8217;s real, and once you start seeing your code collapsing into half its previous size, you&#8217;ll wonder why you&#8217;d never learned JQuery sooner.</p>
<p>Ready to dive in?  Honestly there&#8217;s not a lot to learn to get started.  Simply run over to JQuery&#8217;s site and start looking through the documentation, run to Borders and pick up a book, or just stay tuned here in the next couple days and I&#8217;ll be giving a quick intro.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nomadhacker.com/jquery/why-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Importing Older Drivel</title>
		<link>http://www.nomadhacker.com/site-updates/importing-older-drivel/</link>
		<comments>http://www.nomadhacker.com/site-updates/importing-older-drivel/#comments</comments>
		<pubDate>Sat, 12 Sep 2009 01:42:29 +0000</pubDate>
		<dc:creator>nomadhacker</dc:creator>
				<category><![CDATA[Site Updates]]></category>

		<guid isPermaLink="false">http://www.nomadhacker.com/?p=108</guid>
		<description><![CDATA[So just to clean up and simplify things, I&#8217;m merging my old wordpress.com blog with this one.  I&#8217;ve imported some older posts over here and am making my wordpress-hosted abandonment official.  There weren&#8217;t a lot of posts imported, but if you were browsing the archives and found some older ones from waaayyy back, that&#8217;s why. [...]]]></description>
			<content:encoded><![CDATA[<p>So just to clean up and simplify things, I&#8217;m merging my old wordpress.com blog with this one.  I&#8217;ve imported some older posts over here and am making my wordpress-hosted abandonment official.  There weren&#8217;t a lot of posts imported, but if you were browsing the archives and found some older ones from waaayyy back, that&#8217;s why.  Just FYI.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nomadhacker.com/site-updates/importing-older-drivel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Guy&#8230;of Science!</title>
		<link>http://www.nomadhacker.com/coolness/the-guy-of-science/</link>
		<comments>http://www.nomadhacker.com/coolness/the-guy-of-science/#comments</comments>
		<pubDate>Fri, 11 Sep 2009 15:23:51 +0000</pubDate>
		<dc:creator>nomadhacker</dc:creator>
				<category><![CDATA[Coolness]]></category>
		<category><![CDATA[bill nye]]></category>
		<category><![CDATA[johnny]]></category>
		<category><![CDATA[science]]></category>

		<guid isPermaLink="false">http://www.nomadhacker.com/?p=80</guid>
		<description><![CDATA[Belated post about going to see Science Guy Bill Nye himself with my stepson, who enjoyed it maybe even more than I.]]></description>
			<content:encoded><![CDATA[<p>I haven&#8217;t gotten a chance to mention this yet, (see last post) but I got to see Bill Nye in person a couple months ago.  Bill was giving a talk at nearby St. Louis University on environmental sustainability that was free and open to the public.  Given such a bargain-basement price, of course we went and got there plenty early.</p>
<p>The coolest part about all this is that I wasn&#8217;t the only one who was excited about this (nor probably the most excited).  My 7 year old stepson Johnny just about imploded with excitement when he found out.</p>
<p>Johnny&#8217;s a huge Bill Nye fan.  He watches the Bill Nye videos and reads Bill&#8217;s books from the local library like a lot of kids his age play video games (he really likes video games, too).  So Isa and I decided that it would be a good surprise to take him to this talk&#8230;of Science!</p>
<p>We didn&#8217;t tell him we were going.  That day we left my parents after visiting for the day, and instead of driving straight home, we drove to SLU.  When we parked, Johnny asked why we were stopping.</p>
<p>&#8216;We just feel like getting out and walking around for a minute.&#8217;</p>
<p>He didn&#8217;t question at all, but just got out and walked with us, even though it was pretty cold.</p>
<p>Finally, we passed by a sign as we were getting close to the assembly hall with a big picture of his Science-ness on it.</p>
<p>&#8220;We&#8217;re going to get to see Bill Nye?&#8221; Johnny all but vibrated through the floor.</p>
<p>So we continued in to the convention room to hear Bill speak about environmental sustainability to a bunch of college students.  We figured it would be cool for Johnny to get to see Bill Nye in person, but that he probably wouldn&#8217;t get much out of it considering the target crowd.</p>
<p>&#8220;I&#8217;m going to remember this everyday for all my life,&#8221; Johnny proclaimed.</p>
<p>The next day we were visiting my parents, and Johnny was telling them all about how we were part of the &#8216;Space Generation&#8217; and how the sky on Mars is beige in color.</p>
<p>Sounds like we&#8217;ve got another little &#8216;Science Guy&#8217; developing already.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nomadhacker.com/coolness/the-guy-of-science/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cliff&#8217;s notes</title>
		<link>http://www.nomadhacker.com/my-life/cliffs-notes/</link>
		<comments>http://www.nomadhacker.com/my-life/cliffs-notes/#comments</comments>
		<pubDate>Fri, 11 Sep 2009 03:24:09 +0000</pubDate>
		<dc:creator>nomadhacker</dc:creator>
				<category><![CDATA[my life]]></category>
		<category><![CDATA[life updates]]></category>

		<guid isPermaLink="false">http://www.nomadhacker.com/uncategorized/cliffs-notes/</guid>
		<description><![CDATA[Well it has been a while since I&#8217;ve posted anything here, as you well know by the ear-shattering sound of nothingness coming from over here the last couple months.  Not an excuse but it has been pretty busy here lately.
To catch you up on the goings-on, here is the official Cliff&#8217;s notes version of [...]]]></description>
			<content:encoded><![CDATA[<p>Well it has been a while since I&#8217;ve posted anything here, as you well know by the ear-shattering sound of nothingness coming from over here the last couple months.  Not an excuse but it has been pretty busy here lately.</p>
<p>To catch you up on the goings-on, here is the official Cliff&#8217;s notes version of the last few months of my life, with full version to follow shortly.</p>
<p>First up, I got married. After a year up planning the Big Day finally arrived.  The ceremony was great, the church was beautiful and everything went off without a problem.  The reception afterward was very elegant, everyone said so.  And&#8211;very importantly for us&#8211;the photos came out great.</p>
<p>Well getting married was a lot to plan, but a few weeks before the wedding I found out I got an excellent new job at GoDaddy.  In Arizona.  So in the last couple weeks before the wedding we also had a move to plan.  Fortunately Isa&#8217;s the plan ahead type and everything went smoothly.</p>
<p>When we got down here of course we needed to find a place to live, and then here was settling into the new job.  Then, just about a month ago, my Dad found out he was going to need bypass surgery.  I flew back and my brother drove home from school to be there.  Fortunately the doctors found his blockages before he had a heart attack, and they&#8217;re getting really handy with heart surgery nowadays.  It&#8217;s almost become a routine thing.  Still it is a pretty big event and can really make you worry.</p>
<p>Finally, just this week, Isa and I made the switch and got iPhones, on which I am composing this post.</p>
<p>Anyway, that catches up most of the major events that have been occuring lately.  Hopefully things have settled enough that I&#8217;ll be able to keep connected more, and maybe be able to get back to working on my movie reviews site.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nomadhacker.com/my-life/cliffs-notes/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Introducing Conditionals</title>
		<link>http://www.nomadhacker.com/php-programming/introducing-conditionals/</link>
		<comments>http://www.nomadhacker.com/php-programming/introducing-conditionals/#comments</comments>
		<pubDate>Mon, 02 Mar 2009 23:52:29 +0000</pubDate>
		<dc:creator>nomadhacker</dc:creator>
				<category><![CDATA[PHP Programming]]></category>
		<category><![CDATA[Conditionals]]></category>
		<category><![CDATA[If]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.nomadhacker.com/?p=73</guid>
		<description><![CDATA[Conditionals basically allow you to tell PHP what to do, depending on certain conditions.  This is where you really start getting into PHP programming.  This is where you’ll find the ‘If…Then’ you may have seen before in programming.
Conditionals aren’t too hard.  The most basic form of a conditional is the ‘If’ statement.
If something is true…
Then [...]]]></description>
			<content:encoded><![CDATA[<p>Conditionals basically allow you to tell PHP what to do, depending on certain conditions.  This is where you really start getting into PHP programming.  This is where you’ll find the ‘If…Then’ you may have seen before in programming.</p>
<p>Conditionals aren’t too hard.  The most basic form of a conditional is the ‘If’ statement.</p>
<p>If something is true…<br />
Then do something else</p>
<p>In PHP this is written like so…</p>
<p><code>if (something) {<br />
something else<br />
}</code></p>
<p>Let’s look at an example.</p>
<p><code>$a = 2;<br />
$b = 1;<br />
if ($a &gt; $b){<br />
echo $a;<br />
}</code></p>
<p>So in this example, we first test whether $a is greater than $b (using the &gt; symbol again from Algebra).  If this is true, we print the value of $a.  In this case, the browser would see the number 2 because $a is indeed greater than $b.</p>
<p>However, say $b was equal to 3.  In that case, we would not print the value of a, and the PHP interpreter would simply continue its merry little way on to the rest of the code.</p>
<p>You can put more than one statement in the curly braces of an ‘If’ statement, by the way.  We could also have:</p>
<p><code>if ($a &gt; $b){<br />
echo ‘A is greater&lt;br /&gt;’;<br />
echo $a;<br />
}</code></p>
<p>This would output:</p>
<blockquote><p>A is greater<br />
2</p></blockquote>
<p>Notice I included the html &lt;br /&gt; in there.  You have to include whatever html tags you need, including line breaks, inside the strings you send to PHP.</p>
<p>Now what if we wanted to test to see if $a and $b were equal?  Well, like I mentioned in the previous section, we use two equals signs for this:</p>
<p><code>if ($a == $b){<br />
echo ‘They are equal’;<br />
}</code></p>
<p>If the two numbers are equal, and only if they are equal, the browser will see ‘They are equal’ printed.</p>
<p>However, as I warned before, you must be careful not to use the single equals sign for this.</p>
<p><code>if ($a = $b){<br />
echo ‘They are equal’;<br />
}</code></p>
<p>Because that will assign the value of $b to $a.  So even if $a started out as 3 and $b started out as 56, this would be considered a true statement, because PHP would assign the value of 56 to $a, and then declare it a true statement.  So our browser would always see ‘They are equal’ even if they are not.</p>
<p>Using our form example from a past lesson, we could display a message only if someone put ‘Fred’ in as their username.</p>
<p><code>if( $_POST[‘username’] == ‘fred’){<br />
echo ‘Heya Fred!’;<br />
}</code></p>
<p>So you can hopefully begin to see how some of the magic happens when you send that web form.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nomadhacker.com/php-programming/introducing-conditionals/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple Math with PHP</title>
		<link>http://www.nomadhacker.com/php-programming/simple-math-with-php/</link>
		<comments>http://www.nomadhacker.com/php-programming/simple-math-with-php/#comments</comments>
		<pubDate>Sat, 28 Feb 2009 23:42:23 +0000</pubDate>
		<dc:creator>nomadhacker</dc:creator>
				<category><![CDATA[PHP Programming]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.nomadhacker.com/?p=69</guid>
		<description><![CDATA[PHP has built-in math functionality for most of your mathematical desires.  Here are a few of the common math operators and what they do:
+      adds numbers
-    subtracts
*    multiplies
/    divides
%    modulus (the remainder of a division)
These are pretty common and you’re probably pretty familiar with these.  Though the modulus operator at the bottom may be [...]]]></description>
			<content:encoded><![CDATA[<p>PHP has built-in math functionality for most of your mathematical desires.  Here are a few of the common math operators and what they do:</p>
<p>+      adds numbers<br />
-    subtracts<br />
*    multiplies<br />
/    divides<br />
%    modulus (the remainder of a division)</p>
<p>These are pretty common and you’re probably pretty familiar with these.  Though the modulus operator at the bottom may be a bit strange.  It’s needed because if you divide two integers, PHP is still going to return an integer with no decimal or remainder.  For example:</p>
<p><code>echo 5/2;</code></p>
<p>Would output</p>
<blockquote><p>2</p></blockquote>
<p>If you were to use:</p>
<p><code>echo 5%2;</code></p>
<p>You would get 1, which is the remainder of 5 divided by 2.</p>
<p>Notice that the numbers don’t have quotation marks around them like text does.  Numbers don’t need them.  If you put quotation marks around ‘2’, then it would be the string ‘2’, not the actual number 2.  You can’t do math on text.</p>
<p>Let’s look at a few examples of using PHP for math:</p>
<p><code>$num1 = 3;<br />
$num2 = 2;</p>
<p>echo $num1 * $num2;</code></p>
<p>outputs</p>
<blockquote><p>6</p></blockquote>
<p><code>echo $num1 - $num2;</code></p>
<p>outputs</p>
<blockquote><p>1</p></blockquote>
<p><code>echo $num2 - $num1;</code></p>
<p>outputs</p>
<blockquote><p>-1</p></blockquote>
<p>…and so forth.</p>
<p>Now, we can also assign the value of whatever mathematical operation to a variable as we’re doing it.  Like so…</p>
<p><code>$total = $num1 + $num2;<br />
echo $total;</code></p>
<p>outputs</p>
<blockquote><p>5</p></blockquote>
<p>Or</p>
<p><code>$total = $num1 * $num2;</code></p>
<p>outputs</p>
<blockquote><p>6</p></blockquote>
<p>Basically PHP will do whatever is on the right side of the equals sign first, then assign the value to the variable on the left.</p>
<p>Just like with Algebra, the PHP math functions do things in the ‘Order of Operations’.  So multiplication and division first, then addition and subtraction, etc.</p>
<p><code>$num1 - $num2 * $num3;</code></p>
<p>would first multiply $num2 and $num3, and subtract the result from $num1.  However, also just like with Algebra, you can also use parentheses to control what order things are done in.  So…</p>
<p><code>($num1 - $num2) * $num3;</code></p>
<p>would first subtract $num2 from $num1, and then multiply times $num3.</p>
<p>There is one major difference from normal Algebra in how PHP handles math.  Notice how PHP uses the equals sign to assign values to variables.  PHP does not use an equals sign like we traditionally think of it, to state equivalence.  That is,</p>
<p><code>$num1 = $num2;</code></p>
<p>Assigns the value of $num2 to $num1.  It does not say, $num1 is equal to $num2.  Or compare $num1 to $num2.  To talk about the more traditional comparison we’re expecting, we use two equals signs together.</p>
<p><code>$num1 == $num2;</code></p>
<p>This tests whether the two values are equal.  It’s a very common mistake to interchange these.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nomadhacker.com/php-programming/simple-math-with-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>More Fun with PHP Strings</title>
		<link>http://www.nomadhacker.com/php-programming/more-fun-with-php-strings/</link>
		<comments>http://www.nomadhacker.com/php-programming/more-fun-with-php-strings/#comments</comments>
		<pubDate>Fri, 27 Feb 2009 18:21:35 +0000</pubDate>
		<dc:creator>nomadhacker</dc:creator>
				<category><![CDATA[PHP Programming]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[strings]]></category>

		<guid isPermaLink="false">http://www.nomadhacker.com/?p=65</guid>
		<description><![CDATA[PHP is a pretty good language to work with text.  Some programming languages have separate types for single characters (chars) and strings.  With PHP it’s pretty much all the same.  Some languages (I’m looking at you C!) don’t allow strings at all, and only have characters.  So, with as much as PHP keeps out of [...]]]></description>
			<content:encoded><![CDATA[<p>PHP is a pretty good language to work with text.  Some programming languages have separate types for single characters (chars) and strings.  With PHP it’s pretty much all the same.  Some languages (I’m looking at you C!) don’t allow strings at all, and only have characters.  So, with as much as PHP keeps out of your way, strings aren’t that bad.</p>
<p>Last time we talked a little bit about dealing with text.  We went over single versus double quotes, and outputting text to the browser with echo.  What if you want to do other things with your text, like add to it for example?</p>
<p>You can concatenate, or add strings together with a period.</p>
<p><code>$foo = ‘some text’;<br />
$fee = ‘ blah blah’;<br />
echo $foo.$fee;</code></p>
<p>gives us…</p>
<blockquote><p>some text blah blah</p></blockquote>
<p>You can concatenate variables, like in the above example.  Or you can include strings of text.</p>
<p><code>echo $foo.‘ text in the middle ’.$fee;</code></p>
<p>One thing to remember is to include spaces in your strings you assign to a variable.  If you look at the above foo/fee examples, I put spaces before or after some of the strings so that it would be outputted with a space between the two strings.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nomadhacker.com/php-programming/more-fun-with-php-strings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Datatypes</title>
		<link>http://www.nomadhacker.com/php-programming/php-datatypes/</link>
		<comments>http://www.nomadhacker.com/php-programming/php-datatypes/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 18:13:56 +0000</pubDate>
		<dc:creator>nomadhacker</dc:creator>
				<category><![CDATA[PHP Programming]]></category>
		<category><![CDATA[datatypes]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.nomadhacker.com/?p=58</guid>
		<description><![CDATA[Programming languages all support different types of data, such as numbers or text.  But to the programming language, it gets even more specific.  There are many different kinds of numbers, for example, depending on whether it has a decimal or not.
Some common datatypes:
int  &#8211; an integer, or whole number without a decimal
float – floating point [...]]]></description>
			<content:encoded><![CDATA[<p>Programming languages all support different types of data, such as numbers or text.  But to the programming language, it gets even more specific.  There are many different kinds of numbers, for example, depending on whether it has a decimal or not.</p>
<p>Some common datatypes:<br />
<strong>int</strong>  &#8211; an integer, or whole number without a decimal<br />
<strong>float</strong> – floating point numbers, basically a number with a decimal<br />
<strong>double</strong> – same as a float, but more specific.  It can hold longer values and more decimal places<br />
<strong>bool</strong> – Boolean values.  Basically true or false<br />
<strong>string</strong> – strings of text<br />
<strong>array</strong> – a special type of variable which can hold a whole set of other variables inside it.</p>
<p>As we mentioned last lesson, some languages don’t let you change what type of data a variable holds.  So if you created a variable named foo that was an integer, you could not put a text string inside that variable later.  But you also could not put a floating point number inside that variable, even though they’re both numbers.</p>
<p>Also, unlike some languages, you do not have to ‘declare’ a variable.  Declaring a variable basically tells the programming language to set aside some memory for the variable for you to place values in.  In JavaScript, for example, you cannot be in the middle of a script and suddenly assign a value to variable foo.  You have to declare it before hand.</p>
<p><em>Example JavaScript:</em></p>
<p>first you have to declare it:</p>
<p><code>int foo;</code></p>
<p>then you could use it:</p>
<p><code>foo = 12;</code></p>
<p>With PHP, however, since you do not have to declare variables beforehand, you can create one whenever you need one.  For example, if you’re doing some things with numbers, and suddenly need to hold a value temporarily, you can do that with PHP by just assigning the value to the variable.</p>
<p><code>$foo = something</code></p>
<p>PHP implicitly declares $foo and sets the value into it whenever you first assign a value to it.</p>
<p>What this all means is that PHP gives you a lot of freedom with variables compared to other languages, but it also means you have to be careful.  Since you can place different kinds of values in a variable willy-nilly, you could call that variable later in a math operation, only to be foiled in your math plans because you forgot you put a string inside there earlier.</p>
<p><code>$foo = 1;<br />
Blah blah blah, more php code…<br />
$foo = ‘some string’;<br />
Blah blah blah, more php….<br />
$foo + 3</code><br />
…  Uh, oh.  We forgot we made foo into a string.</p>
<p>Or, you might accidentally name a variable the same as a variable you used before, overwriting the values, not realizing why you’re getting wrong answers.</p>
<p>Or finally, if you misspell something when you’re assigning something to a variable, PHP will just create a new variable.  PHP won’t be able to tell you there’s an error.</p>
<p><code>$fooo = something;<br />
echo $foo;</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nomadhacker.com/php-programming/php-datatypes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Forms + PHP = BFF</title>
		<link>http://www.nomadhacker.com/php-programming/forms-php-bff/</link>
		<comments>http://www.nomadhacker.com/php-programming/forms-php-bff/#comments</comments>
		<pubDate>Fri, 20 Feb 2009 18:12:57 +0000</pubDate>
		<dc:creator>nomadhacker</dc:creator>
				<category><![CDATA[PHP Programming]]></category>
		<category><![CDATA[Forms]]></category>
		<category><![CDATA[GET]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[POST]]></category>

		<guid isPermaLink="false">http://www.nomadhacker.com/?p=53</guid>
		<description><![CDATA[Here's the very basics on how PHP works with forms]]></description>
			<content:encoded><![CDATA[<p>One great way to use PHP is to use web forms to get data from visitors to your site.  You’re all probably familiar with the standard HTML forms:<br />
<code><br />
&lt;form method=“post” action=“page.php”&gt;<br />
Please enter your name: &lt;input type=“text” name=“username” /&gt;<br />
&lt;input type=“submit” value=“Send” /&gt;<br />
&lt;/form&gt;<br />
</code></p>
<p>See those extra attributes in the form tag, method and action?  Those are how you can send things to a PHP script on another page.</p>
<p>The action is obviously the page that you’re going to send the browser to.  The PHP script will be able to get the data you send it.  How it gets that data depends on that other part, the method.</p>
<p>So say you want to get that username on page.php, and do something with it.  Since we know our form was sent as a ‘post’ form, we can access the data like this:</p>
<p><code>$_POST[‘username’];</code></p>
<p>That’s it.  Now when a user enters their information on the form page, and the form takes them to page.php, you can set up a welcome message, like this:</p>
<p><code>echo “Welcome, ”;<br />
echo $_POST[‘username’]”;</code></p>
<h2>POST and GET</h2>
<p>You can send a form more than one way.  We used POST as a method for our last example.  But you might also see forms with method=‘get’.  What’s the difference?</p>
<p>Both POST and GET will send the same text data to the server.  But GET actually sends the data in the URLs.  Remember those content management systems with the confusing page urls?</p>
<p><code>index.php?action=blah&amp;somethingelse=booger</code></p>
<p>Those are the GET variables.   You access them in PHP very similarly to the POST:</p>
<p><code>$_GET[‘username’];</code></p>
<p>But the data is sent in the URL.  So, you’re limited if you want to try and send large amounts of text.  Also, urls with GET variables are somewhat less secure, because it’s easy to see what information is getting sent in the browser address bar.  Not to mention, if you want to upload binary data, like a form to upload a picture.</p>
<p>So why don’t people use POST all the time?  Well, sometimes you need a url you can bookmark and come back to with the variables already included.  For example, Google’s search uses get data to send the search information.  That way you can bookmark your search results and come back to them.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nomadhacker.com/php-programming/forms-php-bff/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
