<?xml version="1.0" encoding="UTF-8" ?>
				<?xml-stylesheet type="text/xsl" href="gns-news.xsl" ?>
				<?xml-stylesheet type="text/css" href="gns-news.css" ?>
				<rss version="2.0"> 
	                    <channel> 
	                    	<title>The GNS News!</title> 
	                        	<link>http://geeksneversleep.com/</link> 
	                        	<description>Keep up with everything worth reading on GNS! Use this feed to make sure you never miss a byte!</description> 
	                        	<language>en-us</language> 
	                        	<image> 
	                         	<title>The GNS News!</title> 
	                            	<url>http://geeksneversleep.com/images/Newspaper_Feed_128x128.png</url> 
	                            	<link>http://geeksneversleep.com/</link> 
	                            	<width>128</width> 
	                            	<height>128</height> 
	                        	</image>
						<copyright>Copyright 2008 geeksneversleep.com</copyright>
						<docs>http://blogs.law.harvard.edu/tech/rss/</docs>
						<lastBuildDate>December 26 2008  23:56:04 EST</lastBuildDate><item> 
	                	<title>OOP and C#: Making a Sample Class</title> 
	                	<description><![CDATA[Understanding the principles of OOP (object-oriented programming) is very important for those who wish to become .NET programmers. The .NET Framework is built on the premise that everything is an Object. Since C# was created specifically to natively implement the .NET Framework, it stands to reason that C# is a good language to demonstrate the development of an object from a logical construct to a piece of working code. The code we will develop here can also be modified to work in pretty much any language that supports OOP. So, get your pencils and notepads ready, kids. It&#39;s time to build an object!




Introduction


Topics


The Construct


The Outline


Encapsulate the Attributes


Create the Class Code


The Finished Class


Download the Code [ download ]




Summary


Comments



The Construct

OOP is all about using code to represent some thing, some real-life object that we can quantify the various aspects of. So, the first step we need to
make is to decide on the thing we want to model. For our purposes, we should probably make it as simple an object as we can, since a complicated
object requires a lot of complicated code to reproduce, code-wise. So... how about a box? It has enough attributes to be interesting, but is simple enough to 
not require us to write lines and lines of code. Hmm. I like it. A box it is!

The Outline

So, now that we have an object to model, let&#39;s think about how we would be able to reproduce that object in code. Hmm. We know all boxes have these three attributes: height, width, and length. Feel free to add any other attributes you can think of, but these three are the bare minimum we need. Using those attributes, we can easily calculate a few more attributes: volume and surface area. We&#39;ll stick to those two calculated attributes, for now.


So, let&#39;s see what we have so far:


Object: Box.
Attributes:

height
width
length
volume
surface area




Not too shabby. That&#39;s all we need to make the first version of our object, as seen below:


Box

length
height
width
volume
surface area


Encapsulate the Attributes

One of the most important tenets of OOP is that we do not want to just let any ol&#39; piece of code manipulate our object&#39;s attributes. We want to protect our attributes from all code except that which we give explicit permission. This is a process called encapsulation. Think of it as insulating our attributes. We do this by changing each of our attribute&#39;s modifier, or accessibility level. C# has a bunch of intermediate modifiers, but for now we will only worry about the extremes: private and public. Public attributes are openly accessible by all code, whereas private attributes are only accessible from the code that is within the same scope as the attributes. So, if we want to make our Box attributes hidden from code outside our Box code, we simply make them private, like so:


Box
private:

length
height
width
volume
surface area



Now, I know what some of you are thinking: if nothing can access those attributes, how do I set their values? Good catch! There are three ways we can do this. One method involves something we call a constructor, which I&#39;ll get into later. Another way is to create what we call functions, or methods, if you were to insist on proper C# nomenclature, to set and/or get the value of each attribute. C# also gives us a nice programming construct called a property, which, depending on how it is used in your code, will either get or set the value of your attribute. I really like properties, so the code we will be developing will use them. Our properties are identified by using a capitalized version of the attribute name, and should be public, since we want to make them accessible to external code. Our object now looks something like this:


Box
private:

length
height
width
volume
surface area


public:

Length
Height
Width
Volume
Surface area


Create the Class Code

At this point, we&#39;ve worked through enough of the logic of our object to start working on a real chunk of code. In C#, we can use the class construct to build our object. It&#39;s actually remarkably simple, which is one reason I like C# so much.


We&#39;re only going to create the actual class code here. If you were writing this class for a real project, say a class library or some C# application, we would need to add something called a namespace to this class code. We are not working on a project that needs compiling, though, so for now, don&#39;t worry about it. I just wanted to make sure you were aware that this code will need some adjustments if you want to see it in action...


First, we need to define the beginning and end of the Box class. This is actually pretty easy:



class Box
{
}




The keyword class informs the compiler that we are creating an object blueprint. The open and close curly braces, { &nbsp; }, define the scope of the class. Next, we add our attributes to the class. We also need to decide on what type of values we want each attribute to hold. I like flexibility, so I&#39;m going to choose the widest data type I can, double, for all the attributes. Also, we don&#39;t really need to specify that the attributes are private, since C# makes them private by default, but I like to anyway. It&#39;s a good habit to get into, in my opinion. So, we should have something like this, now:



class Box
{
&nbsp;&nbsp; private double length;
&nbsp;&nbsp; private double height;
&nbsp;&nbsp; private double width;
&nbsp;&nbsp; private double volume;
&nbsp;&nbsp; private double surface_area;
}




Here&#39;s the fun part: the properties. The properties will share the same data type as the attribute each is matched with. However, each property will be public, rather than private, since we want to use these properties to modify or view the value of each attribute. Each property defines its own scope, and within that scope we place two more keywords: get and set. The get part of the property is used to view the value of our attribute, using the keyword return. The set part of the property is used to change the value of our attribute, using the keyword value.  I will explain this process more in just a moment, but first, let&#39;s see what our class looks like with the properties added:



class Box
{
&nbsp;&nbsp; private double length;
&nbsp;&nbsp; private double height;
&nbsp;&nbsp; private double width;
&nbsp;&nbsp; private double volume;
&nbsp;&nbsp; private double surface_area;

&nbsp;&nbsp; public double Length
&nbsp;&nbsp; {
&nbsp;&nbsp; &nbsp;&nbsp; get{ return length; }
&nbsp;&nbsp; &nbsp;&nbsp; set{ length = value; }
&nbsp;&nbsp; }

&nbsp;&nbsp; public double Height
&nbsp;&nbsp; {
&nbsp;&nbsp; &nbsp;&nbsp; get{ return height; }
&nbsp;&nbsp; &nbsp;&nbsp; set{ height = value; }
&nbsp;&nbsp; }

&nbsp;&nbsp; public double Width
&nbsp;&nbsp; {
&nbsp;&nbsp; &nbsp;&nbsp; get{ return width; }
&nbsp;&nbsp; &nbsp;&nbsp; set{ width = value; }
&nbsp;&nbsp; }

&nbsp;&nbsp; public double Volume
&nbsp;&nbsp; {
&nbsp;&nbsp; &nbsp;&nbsp; get{ return volume; }
&nbsp;&nbsp; &nbsp;&nbsp; set{ volume = value; }
&nbsp;&nbsp; }

&nbsp;&nbsp; public double Surface_Area
&nbsp;&nbsp; {
&nbsp;&nbsp; &nbsp;&nbsp; get{ return surface_area; }
&nbsp;&nbsp; &nbsp;&nbsp; set{ surface_area = value; }
&nbsp;&nbsp; }

}




Now that we have our properties in place, we should probably work out the logic for calculating our Box object&#39;s volume and surface area. Volume is easy; we simply multiply length by width by height. Surface area is a little trickier: we basically have to find the area of six different rectangles. We know that there are only three unique sides, so a simple formula could be this: 2 x ( length x height ) + 2 x ( length x width ) + 2 x ( height x width ), or 2 x ( length x ( width + height ) + height x width ). So, now that we know how to calculate our volume and surface area, we should add a couple of methods to our class so that we can make these calculations whenever we need to.



class Box
{
[ ... ]

&nbsp;&nbsp; public void Calculate_Volume( )
&nbsp;&nbsp; {
&nbsp;&nbsp; &nbsp;&nbsp; volume = length * width * height;
&nbsp;&nbsp; }

&nbsp;&nbsp; public void Calculate_Surface_Area( )
&nbsp;&nbsp; {
&nbsp;&nbsp; &nbsp;&nbsp; surface_area = 2 * ( length * ( width  + height ) + height * width );
&nbsp;&nbsp; }

}




At this point, all the fundamental parts of our class are set. We could use this blueprint to create Box objects in a project, if we were so inclined. There is one more thing we should do, however. It would be really useful to be able to set the dimensions of our Box when we create it, instead of having to create the Box and then set the dimensions using the properties. We can add this ability by creating overloaded constructors. A constructor is a very specialized method that is called every time we create an instance of a class object. In C#, if we don&#39;t create a constructor in our class code, the compiler adds one for us. This default constructor cannot accept any arguments, however, so it&#39;s usefulness is somewhat limited. If we need a constructor to be able to accept arguments, then we create overloaded constructors. An overloaded constructor has the exact same name as the default constructor, but we add parameters to it to match the kind of data we want to pass in. So, if we want to be able to set the dimensions of out Box when we create it, we might add something like this:



class Box
{
[ ... ]

&nbsp;&nbsp; public Box( double len, double wid, double hgt )
&nbsp;&nbsp; {
&nbsp;&nbsp; &nbsp;&nbsp; length = len;
&nbsp;&nbsp; &nbsp;&nbsp; width = wid;
&nbsp;&nbsp; &nbsp;&nbsp; height = hgt;
&nbsp;&nbsp; }

[ ... ]
}




We are almost done, but we have to do one more thing. Since we created an overloaded constructor, the C# compiler will no longer add the default constructor for us. Since every class must supply a default constructor, we have to create one or we will not be able to use our nice, shiny, new class code. Thankfully, default constructor are simple to make: we simply use the code from the overload, but remove the parameters and set all of our dimensions equal to zero, like so:



class Box
{
&nbsp;&nbsp; public Box(  )
&nbsp;&nbsp; {
&nbsp;&nbsp; &nbsp;&nbsp; length = 0;
&nbsp;&nbsp; &nbsp;&nbsp; width = 0;
&nbsp;&nbsp; &nbsp;&nbsp; height = 0;
&nbsp;&nbsp; }

[ ... ]
}



The Finished Class

And we're done! Here is our new Box class, with everything we talked about in one file:



class Box
{
&nbsp;&nbsp; private double length;
&nbsp;&nbsp; private double height;
&nbsp;&nbsp; private double width;
&nbsp;&nbsp; private double volume;
&nbsp;&nbsp; private double surface_area;

&nbsp;&nbsp; public Box(  )
&nbsp;&nbsp; {
&nbsp;&nbsp; &nbsp;&nbsp; length = 0;
&nbsp;&nbsp; &nbsp;&nbsp; width = 0;
&nbsp;&nbsp; &nbsp;&nbsp; height = 0;
&nbsp;&nbsp; }

&nbsp;&nbsp; public Box( double len, double wid, double hgt )
&nbsp;&nbsp; {
&nbsp;&nbsp; &nbsp;&nbsp; length = len;
&nbsp;&nbsp; &nbsp;&nbsp; width = wid;
&nbsp;&nbsp; &nbsp;&nbsp; height = hgt;
&nbsp;&nbsp; }

&nbsp;&nbsp; public double Length
&nbsp;&nbsp; {
&nbsp;&nbsp; &nbsp;&nbsp; get{ return length; }
&nbsp;&nbsp; &nbsp;&nbsp; set{ length = value; }
&nbsp;&nbsp; }

&nbsp;&nbsp; public double Height
&nbsp;&nbsp; {
&nbsp;&nbsp; &nbsp;&nbsp; get{ return height; }
&nbsp;&nbsp; &nbsp;&nbsp; set{ height = value; }
&nbsp;&nbsp; }

&nbsp;&nbsp; public double Width
&nbsp;&nbsp; {
&nbsp;&nbsp; &nbsp;&nbsp; get{ return width; }
&nbsp;&nbsp; &nbsp;&nbsp; set{ width = value; }
&nbsp;&nbsp; }

&nbsp;&nbsp; public double Volume
&nbsp;&nbsp; {
&nbsp;&nbsp; &nbsp;&nbsp; get{ return volume; }
&nbsp;&nbsp; &nbsp;&nbsp; set{ volume = value; }
&nbsp;&nbsp; }

&nbsp;&nbsp; public double Surface_Area
&nbsp;&nbsp; {
&nbsp;&nbsp; &nbsp;&nbsp; get{ return surface_area; }
&nbsp;&nbsp; &nbsp;&nbsp; set{ surface_area = value; }
&nbsp;&nbsp; }

&nbsp;&nbsp; public void Calculate_Volume( )
&nbsp;&nbsp; {
&nbsp;&nbsp; &nbsp;&nbsp; volume = length * width * height;
&nbsp;&nbsp; }

&nbsp;&nbsp; public void Calculate_Surface_Area( )
&nbsp;&nbsp; {
&nbsp;&nbsp; &nbsp;&nbsp; surface_area = 2 * ( length * ( width  + height ) + height * width );
&nbsp;&nbsp; }

}



Download the Code

If you for some reason want or need the code for this tutorial, click here to download a zipped copy, Enjoy!

The Wrap Up

While not the best of walk-throughs, I do think the information I presented here is fairly useful. This is very similar to the technique I use every time I write a small project, and I hasn&#39;t failed me yet...]]>[...]</description>
	                	<pubDate>January 02 2009  03:14:19 EST</pubDate>
	                	<link>http://geeksneversleep.com/page/OOP-and-Csharp-Making-a-Sample-Class</link> 
	            	</item><item> 
	                	<title>HTML + CSS = A Calendar? Cool!</title> 
	                	<description><![CDATA[I&#39;ve always liked those little date/calendar icons some blogs have for each of their entries, but I could never figure out how they managed to make the date correct. Then I found this article: Creating a Blog Entry Date Calendar Icon Look with CSS, Mostly. The author, one Shirley E. Kaiser, M.A., wrote a nice article on one possible way of using HTML and CSS to create the appearance of a date icon.


I thought this idea was pretty neat, and adopted the code she presented for this website. With a little imagination, you can pretty much use this same idea for just about anything.

My widget

As I mentioned, I made use of her example to create the calendar icon. I first hard-coded the month, date, and year to get the proportions how I wanted them. Once I had the CSS in place, it was a simple matter of adding a sprinkle of PHP to the template to set the month, date, and year.




Try it yourself!

If you like this little bit of CSS magic, feel free to use the following code in  your own projects. Just take a moment to stop by Ms. Kaiser&#39;s web site and say thanks.
 
calendar.css


/*{ Calender Styling } */

.calender { 
float: left; 
width: 50px; 
height: 50px; 
border: solid 1px #404040;
 text-align: center; 
 color: #404040; 
 background-color: #fff; 
 padding: 0; 
 margin: 5px; 
 }

.month, .date, .year { padding: 1px 0; margin: 0; }

.month { 
color: #fffbff; 
text-transform: uppercase; 
font-size: 9px; 
background: #880000 url("images/titlebar-red.png") repeat-x; 
border-bottom: solid 1px #404040; 
}

.date { 
font-size: 14px; 
font-weight: 600; 
color: #880000; 
}

.year { font-size: 8px; padding: 0; }


 
calendar.html


&lt;!-- calendar HTML --&gt;
&lt;div class="calender"&gt;
&lt;p class="month"&gt;
&lt;/p&gt;
&lt;p class="date"&gt;
&lt;/p&gt;
&lt;p class="year"&gt;
&lt;/p&gt;
&lt;/div&gt;



For this sample, I used a PHP function, getdate, to have the PHP engine build me an array of the day, month, year, etc. of whenever the page is served. If you are loading a previous entry, say, from a database, you will want to pass a time-stamp into the function. I found this format gave me the best results:


Month 00 0000 HH:MM:SS

calendar.php


&lt;?php
// getdate() with no arguements will get the current 
// date/time from the system clock.
// Vist http://us2.php.net/getdate to see the entire date

// array generated by getdate().
$date=getdate();
// trim month to three characters. 
// CSS will transform the remaining part of the month 
// into UPPERCASE.
$month=substr( $date['month'], 0, 3 );
$day = $date['mday'];
$year = $date['year'];
?&gt;

&lt;!-- calendar HTML --&gt;
&lt;div class="calender"&gt;
&lt;p class="month"&gt;
&lt;?php echo( $month ); ?&gt;
&lt;/p&gt;
&lt;p class="date"&gt;
&lt;?php echo( $day ); ?&gt;
&lt;/p&gt;
&lt;p class="year"&gt;
&lt;?php echo( $year ); ?&gt;
&lt;/p&gt;
&lt;/div&gt;



Download

Get the source code for this tutorial here: calendar.zip]]>[...]</description>
	                	<pubDate>December 20 2008  23:39:14 EST</pubDate>
	                	<link>http://geeksneversleep.com/page/HTML-CSS-Calendar</link> 
	            	</item><item> 
	                	<title>Something Wicked, This Way Comes...</title> 
	                	<description><![CDATA[Those of you who have actually read my About page know that I originally built this web site to serve as a place to find code snippets and/or explanations of some of the more technical aspects of programming and web design. So far, I havn&#39;t really accomplished that goal. Most of the entries I've posted have been more of a history lesson than anything. Part of the reason: I&#39;ve been trying to refine the layout of my site as I go along and learn more about web design. Now that I have a reasonably stable design, I can start focusing on doing what I set out to...


So, other than a minor change to the navigation menu, expect to see less change in style and much more content!


:)]]>[...]</description>
	                	<pubDate>December 18 2008 12:05:00 EST</pubDate>
	                	<link>http://geeksneversleep.com/page/Something-Wicked-This-Way-Comes</link> 
	            	</item><item> 
	                	<title>Opining About My Future</title> 
	                	<description><![CDATA[I was recently asked this question by my Technical Writing instructor to think about as part of our final exam and I thought you might enjoy my response:



Final Exam Question: What field(s) will my chosen field have to interact with using technical documents, and how? Think about 10 - 15 years from now.


My chosen field? Software engineering. What fields will I have to interact with? Ha. A list of fields I won&#39;t interact with would probably be much shorter. It would seem at first glance that nearly every field interacts with software in one fashion or another, from the attorney using a catalog system to research relevant prior cases to the zoologist using a productivity suite to publish the results of his latest study. Students and scientists use web browsers and search engines to gather information for their studies. Businesses use web services to communicate sales data to central offices. Defense agencies use GPS and satellite telemetry to coordinate tactical exercises. These, and many others, are all examples of people using technology in one fashion or another, and each of these technologies is driven by software, be it embedded in logic controllers or executed from within an operating system.


All of this technology requires documentation to develop the software, to train users of the software, and to help other developers maintain the software. There are entire industries devoted to nothing more than helping businesses properly develop software, or teaching new users how to use such things as the Windows operating system, the Microsoft Office suite, or the various parts of Adobe's Creative Suite.

 
This trend to bound to continue well into the future, since more and more of our everyday activities are based around the technology that has so pervaded our lives.]]>[...]</description>
	                	<pubDate>December 08 2008 14:38:00 EST</pubDate>
	                	<link>http://geeksneversleep.com/page/Opining-About-My-Future</link> 
	            	</item><item> 
	                	<title>Commercial Software Recommendations</title> 
	                	<description><![CDATA[Everyone likes free (I know I do!), but sometimes free software just doesn't perform as well as you need it to. So, what's a geek to do, you may ask? Well, try, try, and try as many trial versions of software as you can, and when you find something you really like, plunk down your hard-earned moolah on a subscription or license.


Here is a list of software I have gladly paid for:




VIPRE is an anti-virus/anti-spyware tool from Sunbelt Software. I love this program for two reasons: it's very good at protecting me from malware, and it doesn't take a lot of system resources to do so. It also has a very clean, simple interface, which is one of the reasons I recommend it to everyone. A one-year subscription currently costs $29.95, which is a steal compared to any competitor's product.




Another great product from Sunbelt, CounterSpy is an anti-spyware application, and is my hands-down, no-doubt-about-it, all-time-favorite for keeping spyware and adware off my PC. The current version of CounterSpy uses a variation of the VIPRE scan engine, and sports a very similar interface. A subscription will cost you $19.95, and you can upgrade to VIPRE, later, for only $9.95.





If you happen to have a lot of memory, and some CPU cycles to spare, you might consider PCTools' Spyware Doctor. It's been annually ranked one of the best anti-spyware programs available. The one caveat is that it is a bit resource greedy...



If you have any recommendations for additions to this list, let me know, and I will consider adding it.]]>[...]</description>
	                	<pubDate>November 30 2008 21:44:00 EST</pubDate>
	                	<link>http://geeksneversleep.com/page/Commercial-Software-Recommendations</link> 
	            	</item><item> 
	                	<title>My Favorite Free Security Software</title> 
	                	<description><![CDATA[Not everyone has the money or inclination to pay $50 or more for a (bloated) security suite from the big boys (McAfee, Symantec, Trend Micro), but that doesn&#39;t mean you have to be content with sub-standard protection. There is quite a bit of good, free, software available that is not only as good as, but sometimes better than, commercial software.


The following is a short list of software I have used and recommend.


COMODO free products (firewall, anti-virus, anti-spyware, anti-rootkit, security suite)
a2 Free (anti-spyware)
AVG Free (anti-virus)
Avast4Home (anti-virus)
WinPatrol 2008 (process guard)
Spybot Search &amp; Destroy (anti-spyware, process guard)]]>[...]</description>
	                	<pubDate>November 25 2008 13:34:00 EST</pubDate>
	                	<link>http://geeksneversleep.com/page/My-Favorite-Free-Security-Software</link> 
	            	</item><item> 
	                	<title>Java Classes</title> 
	                	<description><![CDATA[If you are familiar with creating classes in C/C++, I have some good news and some bad news...


Good news: The concept of classes is the same in every OOP language, so you&#39;re at least one step ahead of new programmers.


Bad news: The syntax you used in C/C++ is different enough that you&#39;re probably going to spend a lot of time cursing at the Java compiler...

Similarities

Java is loosely based on C++, and implements OOP is more or less the same way. You can implement your code logic (say, from pseudo-code or UML diagrams) without much trouble, even if it was developed with specific C++ libraries in mind, as an equivalent library is probably available in the JRE (Java Runtime Environment).

Differences

While Java takes quite a bit of its base syntax from C and C++, it IS a different language, with its own quirks and strengths. One of the things that confused me when I first started to learn Java was the keywords it uses for its class structure. For instance, instead of namespace,Java uses package. Instead of inherits, you get extends.


Take a gander at this sample I put together for you:

&bull; SampleClass.java


class SampleClass
{
&nbsp;&nbsp; public SampleClass( 
void ) // constructor
&nbsp;&nbsp; {
&nbsp;&nbsp; /* place code here that needs to execute
&nbsp;&nbsp; when an instance of our class is created */
&nbsp;&nbsp; }

&nbsp;&nbsp; 
// private internal variables and functions go here
&nbsp;&nbsp; private int age;
&nbsp;&nbsp; private char[] name = 
new char[50];

&nbsp;&nbsp; /* public shared variables and external functions
&nbsp;&nbsp; go here */
&nbsp;&nbsp; public int GetAge( 
void )
&nbsp;&nbsp; {
&nbsp;&nbsp;&nbsp;&nbsp; return age;
&nbsp;&nbsp; }

&nbsp;&nbsp; public void SetAge( 
int value )
&nbsp;&nbsp; {
&nbsp;&nbsp;&nbsp;&nbsp; age = value;
&nbsp;&nbsp; }
}


The low-down...

This is a prototype for a java function/method:


return type function-name ( parameter type parameter-name )]]>[...]</description>
	                	<pubDate>November 21 2008 16:08:00 EST</pubDate>
	                	<link>http://geeksneversleep.com/page/Java-Classes</link> 
	            	</item><item> 
	                	<title>Visual Basic</title> 
	                	<description><![CDATA[Depending on who you ask, VisualBasic.NET (VB.NET) is either the next iteration of VisualBasic 6.0, or is a complete replacement. The conflict arises from certain complaints VB6 programmers have made; namely, that their legacy code is severely broken (won&#39;t compile, or executes incorrectly) by changes made to the core of the language. These changes were necessary to implement VB in the .NET environment. First released in 2001 as part of the original offering of Microsoft&#39;s new .NET Framework, subsequent versions have addressed some of those complaints... 




Overview


Intro


Advantages


Drawbacks


Definition




Topics


File structure


Conditional Statements


Classes




Summary


Comments



Advantages

While it pains me to do so, I will admit that VisualBasic.NET (VB.NET) does have some redeeming qualities. First and foremost, VB.NET is much easier to read than most of its contemporaries. For this reason alone, I would recommend it as a starting point for beginning programmers.

Drawbacks?

My biggest beef with VB.NET (and BASIC in general) is that BASIC is a relatively weakly-typed language. What that means is that variable types are allowed to be somewhat ambiguous, and data can be passed between two or more variables that are not necessarily compatible. The main problem with THAT issue is that it is easy to truncate our data; if we take a floating point value from one variable and copy it to a single-precision variable, we have lost every number past the tenths place. Big deal? YES!! 3.1 is most certainly not the same as 3.1417 when you are doing area calculations for circular objects...]]>[...]</description>
	                	<pubDate>November 21 2008 16:02:00 EST</pubDate>
	                	<link>http://geeksneversleep.com/page/Visual-Basic</link> 
	            	</item><item> 
	                	<title>An Interesting Use of a C# Foreach Loop</title> 
	                	<description><![CDATA[I&#39;ve seen many different ways of clearing the contents of controls in a Windows Form object, some of which can be quite elaborate. While it can be fun to come up with these convoluted schemes, there is an easier way. Here&#39;s what I do...


I implement a foreach loop, and iterate over the form&#39;s collection of Controls, comparing each control to the Textbox control type, using the is keyword. This keyword, is, performs a type comparison. If the Control is the type I am comparing it to, then I perform a function call, in this case a call to the Control&#39;s ResetText() method.


The beauty of this chunk of code is that it scales with the form itself. If the form has 3 controls or 300, the same code can be applied without modification.


Pretty sweet, huh? Here&#39;s the code (written for C#):



foreach(Control ctrl in this.Controls)

{

&nbsp; &nbsp; if( ctrl is Textbox )
&nbsp; &nbsp; {
&nbsp; &nbsp; &nbsp; &nbsp; ctrl.ResetText();

&nbsp; &nbsp; }
}





Enjoy!]]>[...]</description>
	                	<pubDate>November 04 2008 14:12:00 EST</pubDate>
	                	<link>http://geeksneversleep.com/page/An-Interesting-Use-of-a-Csharp-Foreach-Loop</link> 
	            	</item><item> 
	                	<title>Recommended Reading</title> 
	                	<description><![CDATA[I&#39;ve benefited a lot from studying various textbooks and reference manuals. While it is easy to find code snippets and such via Google, nothing seems to quite stick like reading and rereading a good book. Even books I&#39;ve thought I had already mastered still manage to teach me something on a second or third or fourth read. I find some small bit of text that I somehow managed to skim over previously that sheds light on some arcane problem I may have been struggling with.


Recommended Reading: Desktop Development



C++: The Complete Reference, 4th Edition, 4th Edition, by Herbert Schildt




Recommended Reading: Web Development



Head First HTML with CSS & XHTML, by Elisabeth Freeman and Eric Freeman



PHP 6 and MySQL 5 for Dynamic Websites, 3rd Edition, by Larry Ullman]]>[...]</description>
	                	<pubDate>November 04 2008 11:25:00 EST</pubDate>
	                	<link>http://geeksneversleep.com/page/Recommended-Reading</link> 
	            	</item><item> 
	                	<title>Coding Like Forrest Gump</title> 
	                	<description><![CDATA[It never fails. Every semester, I have to help at least one student who wants to create some convoluted, twisted function for their homework assignment, when it really isn&#39;t necessary. I tend to squint at their screen for a moment, scratch my head, and ask, And what are you trying to do here, again?


It seems to be a two-fold problem. The first (and I know I&#39;ve harped on this before) is just plain a lack of planning. No matter how many times the instructor hints at it, students just don&#39;t seem to like taking a little bit of time to sketch out their programs before they fire up their IDE.


The second problem seems to be related to over-thinking the task at hand. The students seem to want to throw a whole lot of code at a rather simple task, or store some data in a type that really isn&#39;t a good fit for what they need to do.


It&#39;s frustrating at times, but I can eventually convince these young gentlemen and ladies to take a step back from their development environments and watch and listen as I sketch out simple data structures on some scrap paper.


Once we have a good, simple data structure to store data in, the input phase tends to become a lot easier, and this makes every other step that follows easier, too.


So, maybe Forrest should say this if they ever make a sequel: I may be a simple man, but I know what good code is...



:)]]>[...]</description>
	                	<pubDate>October 24 2008 16:09:00 EST</pubDate>
	                	<link>http://geeksneversleep.com/page/Coding-Like-Forrest-Gump</link> 
	            	</item><item> 
	                	<title>Pretty URLs For Everyone!</title> 
	                	<description><![CDATA[Have you ever visited a website, and wondered how the person managing it is able to have their pages display without having the file extension on every page?  I used to. Turns out, it&#39;s not so hard to get what is commonly referred to as pretty URLs.  It&#39;s as simple as adding a few lines of text to a special file most people have on their host servers: the .htaccess file.




Overview


Topics


What is .htaccess?


What does it do?


Code


Explanation




Summary


Comments



What is a .htaccess file?

According to Apache.org, a .htaccess file is a distributed configuration file. They also go on to describe what it does:



... [.htaccess files] provide a way to make configuration changes on a per-directory basis. A file, containing one or more configuration directives, is placed in a particular document directory, and the directives apply to that directory, and all sub-directories thereof.



In a nutshell, it means we can use this file to make configuration changes to our host server&#39;s Apache module, allowing us to set certain file-handling behaviors as we see fit without needing to make permanent changes to the Apache module. It may also be the only way we can modify the Apache module, as is usually the case with sharing hosting.

So, what are WE doing, then?

We are going to do something called a mod_rewrite. What we will do is write some logic out that tells Apache to automagically append a file extension to the file part of the URL containing the page name. This happens in the background, at the server level, so our users are none-the-wiser that we are manipulating the URL. As an added bonus, this also hides the technology we use for our site from our users. This also gives us a small amount of protection from low-level hackers, too.

The Code!

This example shows how simple a mod_rewrite can be. It only takes three to four lines to get pretty URLs. Look the sample over, then keep reading.
 


# Enable Rewrite Engine so that our regex kicks in.
RewriteEngine On

# Don't attempt to add extension to directory.
RewriteCond %{REQUEST_FILENAME} !-d

# Automagically append .php to URL.
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php


The Explanation!

The first thing we do is turn on the Rewrite Engine. This tells Apache we are shaking things up a bit. If we don&#39;t add this line, our rewrites are ignored. Next, we tell Apache to skip anything that would map to a directory, and to only rewrite files that already exist on the server. The last line there is a small bit of regex, or regular expression, that is applied if both of our conditions pass. The upward caret denotes the beginning of the string, while the dollar sign indicates the end of the string. Once the pattern matching finds the end of the string, it will add &#39;.php&#39; to it.


For example, let&#39;s see what happens if the user enters the URL of
 


http://geeksneversleep.com/sample-page



The regex will parse that string and add &#39;.php&#39; to the end. So the URL sent to the server is actually:



http://geeksneversleep.com/sample-page.php



You can use this same idea for any extension you can think of, such as &#39;.htm&#39;, &#39;.html&#39;, &#39;.aspx&#39;, and so on. Just swap out &#39;.php&#39; in the sample above with whatever type you are using.

The nice thing is that everything happens at the server level, meaning the user is unaware anything has been changed. They still see the original URL, unmodified.


And that is it. Pretty cool, huh? :)

The Wrap Up

Using pretty URLs not only improves your site by making your URLs easier to remember, it also tends to improve your SEO, or search-engine optimization. Better SEO equals better search results equals more traffic for you...

Enjoy!]]>[...]</description>
	                	<pubDate>October 13 2008 01:00:00 EST</pubDate>
	                	<link>http://geeksneversleep.com/page/Pretty-URLs-For-Everyone</link> 
	            	</item><item> 
	                	<title>Why Sherlock Holmes Would Have Made A Kick-Ass Programmer</title> 
	                	<description><![CDATA[One of the few quotes I know from the world of Sir Arthur Conan Doyle&#39;s Sherlock Holmes goes something like this: When you are trying to solve what appears to be a mystery, eliminate the obvious first. Whatever is left, no matter how extraordinary, is the answer...


Sometimes, those of us who think we have a good grasp on programming fall prey to over-looking the obvious. We get a bug in our code, and we can't figure it out. We rewrite large sections of code we think are the problem, again and again, cursing profusely when the error persists.


Finally, we break down and seek help from our peers. If we&#39;re lucky, one of those guys might ask the magical question that leads to a memorable fore-head smack, and the problem is solved...


I just had one of these oh-so-enjoyable moments. I&#39;ve been trying to build a new script for this site to update my new page content, and it&#39;s been failure after failure. Finally, I seek help from one of the resident instructors I know (who happens to be fairly good at this web-thing) and asked him for suggestions. One of them? Have you tried echoing the query string to the screen after the post, so you can see what you are sending to the database? he asks. Uh, no. I says.


D&#39;oh.


Oh, look. The primary key field is empty. Hey, that might cause problems, right?


...


Yup.



SMACK!


:p]]>[...]</description>
	                	<pubDate>October 08 2008 20:59:00 EST</pubDate>
	                	<link>http://geeksneversleep.com/page/Why-Sherlock-Holmes-Would-Have-Made-a-Kick-Ass-Programmer</link> 
	            	</item><item> 
	                	<title>Java: Multiplatform Powerhouse</title> 
	                	<description><![CDATA[From Wikipedia:
Java is a programming language originally developed by Sun Microsystems and released in 1995 as a core component of Sun's Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities. Java applications are typically compiled to byte-code which can run on any Java virtual machine (JVM) regardless of computer architecture.




Overview

								Intro


Advantages			
								Drawbacks


Definition




Topics


File structure


Conditional Statements


Classes

								Notes 
[ download ]




Summary


Comments




Java is nearly ubiquitous with the World Wide Web. Because of the write once, run anywhere philosophy Sun has maintained since the beginning, Java is easily ported from one operating system to another with a minimum of fuss, making it an ideal development platform for ensuring maximum compatibility. While there has been a shift of some developers moving towards newer web-centric languages, such as Ruby on Rails (or RoR), Java remains the go-to language for a majority of businesses.


As far as the examples I can show you right now, Java varies very little from C and C++. Java&#39;s class syntax is quite a bit different, as well as the code used in its GUI (graphical user interface) implementation.


Programmer&#39;s Notes


I have put together a short list of notes about the Java language, with an emphasis on the various types available in the core language:


Java Types
Primitive

Integer
					long							int							short							byte


Floating point
					double							float


Character - char
Boolean - bool

Arrays

Must be initialized to be used.
Can be created in two ways:

								Defined, THEN initialized (two steps)
							type variable-name[ ];
variable-name[ ] = new type[size];

OR

type[ ] variable-name;
variable-name[ ] = new type[size];



Defined AND initialized (one step)

type variable-name[ ] = new type[size];

OR

type[ ] variable-name = new type[size];
							


Multi-dimensional array

								two-dimensional:
							type variable-name[ ][ ] = new type[size1][size2];


								three-dimensional:
							type variable-name[ ][ ][ ] = new type[size1][size2][size3];



n-dimensional:

type variable-name[ ][ ]...[ ] = new type[size1][size2]...[size n];



String

An array of characters
Is actually an object
Are immutable


StringBuffer - similar to StringBuilder in C# - allows strings to be modified

Logical operators

Equal to 			 == 
Not equal to 			 != 
Greater than 			 &gt; 
Less than 			 &lt; 
Greater than or equal to 			 &gt;= 
Less than or equal to 			 &lt;= 

Boolean logical operators

AND 			 &amp; 
OR 			 | 
XOR 			 ^ 
OrElse 			 || 
AndAlso 			 &amp;&amp; 
NOT 			 ! 
AND assignment 			 &amp;= 
OR assignment 			 |= 
XOR assignment 			 ^= 
Equal to 			 == 
Not equal to 			 != 
Ternary if-then-else 			 ?: 

Constant variables

Use keyword final.
Must be initialized when declared.

Convention dictates that constants be identified by using UPPERCASE notation:

final type VARIABLE-NAME = value;


Inheritance


Use keyword extends to derive from a parent (base) class.


Use keyword super to access the parent (base) class from a derived (child) class.


Abstract defines a class or method that cannot be instantiated.


Final defines a class that cannot be derived (inherited) from.


Use the keyword package to define a namespace.


Use the keyword import to include an external package (project) into the current project.


Standard Library

Contained within the java package.

Interfaces


Can be thought of as an action plan for your classes; that is, it defines WHAT your class must do, but not HOW it does it.


Any class that uses the interface must implement all aspects of the interface.


Exception: an abstract class can implement only part of the interface.


Any child classes must then implement the remainder of the interface.



Interface methods/functions must be public.

Interfaces cannot have instance variables. Interfaces can have variables, but they are implicitly static and final.


Interfaces can derive from other interfaces, using the extends keyword.


Use keyword implements to add an interface to a class object.




Want a copy of my notes?


If for some odd reason you find this useful, you can download a .doc version here.]]>[...]</description>
	                	<pubDate>October 08 2008 18:46:00 EST</pubDate>
	                	<link>http://geeksneversleep.com/page/Java</link> 
	            	</item><item> 
	                	<title>C# : Creating a Custom Class</title> 
	                	<description><![CDATA[If you are familiar with creating classes in C/C++, I have some good news and some bad news...


Good news: The concept of classes is the same in every OOP language, so you&#39;re at least one step ahead of new programmers.

Bad news: The syntax you used in C/C++ is different enough that you&#39;re probably going to spend a lot of time cursing at the C# compiler...

Similarities

Like I mentioned before, C# uses the same OOP model that you learned in C/C++. You still specify the various accessibility levels of your object&#39;s attributes and actions. You must still provide constructors for your class objects. Also, inheritance and polymorphism are implemented in much the same way as in C/C++.

Differences

The most glaring difference between a C# class and a C/C++ class is, obviously, the syntax. While the basic OOP concepts are the same in C# as in C/C++, the code to implement a class is quite different.


Take a gander at this sample I put together for you:

&bull; SampleClass.cs


class SampleClass
{
public SampleClass( void ) // constructor
{
/* place code here that needs to execute
when an instance of our class is created */
}

public ~SampleClass( void ) // destructor
{
}

// private internal variables and functions go here
private Int32 mySampleValue;

/* public shared variables and external functions
go here */
public Int32 GetSample()
{
return mySampleValue;
}

public void SetSample( Int32 value )
{
mySampleValue = value;
}

}



The low-down...

In C#, classes are implicitly public. While I believe the C# compiler will allow you to make a class private, it ultimately is an exercise in futility to do so, as you will never be able to create an instance of your class if it is private.


One thing I don&#39;t miss about C/C++ when I code in C#: there are no header files. C# classes are self-contained. Also, methods/functions in C# must be contained within a class, so no more global functions. C# does implement static functions, so it is possible to have a shared method/function.]]>[...]</description>
	                	<pubDate>October 03 2008 13:29:00 EST</pubDate>
	                	<link>http://geeksneversleep.com/page/Csharp-Classes</link> 
	            	</item><item> 
	                	<title>C# : .NET&#39;s Native Tongue</title> 
	                	<description><![CDATA[Programmers familiar with C/C++ or Java may feel a sense of dej&#224; v&#250; when first coming into contact with the C# (pronounced C Sharp) language, which, considering C# has its roots in the C++ language, should not be surprising. C# is developed by Microsoft to implement its .NET framework.



Overview

Intro 
Advantages 
Drawbacks 
Definition 


Topics

File structure 
C# keywords 
Conditional Statements 
Classes 


Summary 



Advantages?

C# is a highly-managed language. What this means that the compiler will not allow unsafe operations, unless explicitly forced to do so. This is intended to prevent the unintentional errors in logic and syntax other languages allow inexperienced programmers to code.


One of the unsafe operations C# forbids is implicit conversion between incompatible data types. For instance, you cannot implicitly convert a Double object into a Single or Integer object. Why? Because your data becomes truncated. Single and Integer types are narrower, meaning they have a smaller memory value, than Double types. This could theoretically cause improper execution of code that tests the equivalency of two or more objects.

Cool! Hey, why did you quote compiler? Something I should know?

That&#39;s for one simple reason. C#, like most modern OOP languages, does not actually compile. Rather, it is interpreted into MSLI byte-code when you ask your development environment to build the project code. Then, at runtime, a JIT (Just-In-Time) compiler completes the compilation into machine code. The advantage of using a JIT compiler versus a true compiler is that the executable can be easily ported from system to system, as long as the proper runtime environment is present. For Microsoft languages, the necessary runtime is the .NET Framework.


Drawbacks?

While this does make our code more portable (anything that can run a newer version of Windows can probably run our code), it also means our application takes longer to execute. Of course, the average user will never notice, as this only becomes an issue with systems that require high-speed processing, such as precision mold software or industrial color spectrum analyzers...


C# Keywords


There are certain words that have special meaning the C# compiler and cannot be used in your code for anything else unless you precede them with the @ sign.


The following list is every keyword as of .NET Framework 3.5.





abstract


event


new


struct




as


explicit


null


switch




base


extern


object


this




bool


false


operator


throw




break


finally


out


true




byte


fixed


override


try




case


float


params


typeof




catch


for


private


uint




char


foreach


protected


ulong




checked


goto


public


unchecked




class


if


readonly


unsafe




const


implicit


ref


ushort






continue


in


return


using




decimal


int


sbyte


virtual




default


interface


sealed


volatile




delegate


internal


short


void




do


is


sizeof


while




double


lock


stackalloc


else




long


static


enum


namespace




string




Source: MSDN Visual C# Developer Center]]>[...]</description>
	                	<pubDate>October 03 2008 11:13:00 EST</pubDate>
	                	<link>http://geeksneversleep.com/page/Csharp</link> 
	            	</item><item> 
	                	<title>C/C++ : Creating a Custom Class</title> 
	                	<description><![CDATA[There are two methods for creating a class in a C++ project. The first method is to code your class directly in the project code in which you will be using the class. However, if you take that route, you cannot reuse that code later (say, for an entirely different project) without opening the first project, copying the code, and pasting it into your new project. The second method involves creating a discrete class project, separate from any program code, and then including the class in your program code. I try to always use the second method, for the very simple fact that if I create a class I find useful, I can use it again and again.


So, I will be covering the second method here.  :)

Let&#39;s Get Classy...

As I mentioned previously, a C++ class consists of two parts: a .h file and a .cpp file. I made up a couple of really simple examples, which you can probably see below. The top sample is the .h file, and the bottom sample is its associated .cpp file.

â€¢ SampleClass.h


#pragma once

class SampleClass
{
&nbsp; &nbsp;  public:
&nbsp; &nbsp;  SampleClass( void ); // constructor
&nbsp; &nbsp;  ~SampleClass( void ); // destructor

&nbsp; &nbsp;  private:
&nbsp; &nbsp;  // internal variables and functions go here


&nbsp; &nbsp;  public:
&nbsp; &nbsp;  /* shared variables and external functions

&nbsp; &nbsp;  go here */
};


&bull; SampleClass.cpp


#include "SampleClass.h"

// default constructor

SampleClass::SampleClass( void )
{
&nbsp; &nbsp;  /* place code here that needs to execute
&nbsp; &nbsp;  when an instance of our class is created */

}

// deconstructor - this is called when our class object 

// is no longer being used.

SampleClass::~SampleClass( void )
{
}

[ return type ] SampleClass::[ function name ]( [ parameter type] [ parameter name ] )
{
&nbsp; &nbsp;  /* place code here that needs to execute
&nbsp; &nbsp;  when this function is called */
}


.h Filetype

Within the .h file, you define the outline of your class object; what characteristics (variables) it has, and what actions it can perform (functions). You can (and must) define the datatype of your variables and the return type of your functions within the .h file. You DO NOT (and cannot) initialize, or set default values, for your variables within the .h file. That happens within your .cpp file.


The .h file basically is you telling the compiler here is my class, this is the type of data I am going to use, and this is where you find it.

.cpp Filetype

The .cpp file contains all of the code that is capable of acting on your class data. It is only here, within the .cpp file, that you will find the assignment operator, otherwise known as the  =  sign. This is also where you will implement your relational operators ( =, ).


In order for the compiler to know what the outline of your class is, you must include the .h file you built previously, using the proper notation:



#include SampleClass.h
.


Recall (if you read that part already) that there are two distinct ways of including a class in C++. We use   because our class is not part of the STL. If it were, we would use < > instead.

The Constructor

When you create an instance of your class, the constructor is used to set your member variables (variables local to this class) to a known state, or value. In other words, it initializes those variables. This clears out any data that may have previously existed in the location in memory in which our new variables now reside. We do this to make certain that our program will not be crashed by random invalid data.

The Deconstructor

This basically a self-destruct button for our class object. When the object goes out of scope, it&#39;s deconstructor is called to destroy the object. This frees up any resources the object may have been using (usually memory).

Class-level Functions

Class functions are normally used in one of two ways:



To provide access to our (preferably) private member variables.


To implement class-level logic, such as calculations, that do not need to be (and perhaps shouldn&#39;t be) exposed to the user of our class.


Function Examples

Let us suppose our class, SampleClass, has a couple of member variables declared: char name[25] and int age. Now, if we want to be good OOP programmers (and we do!), we need to enforce encapsulation. That means we should make these variables private, since we don&#39;t want any ol&#39; bit of code to be able to modify these variables unless we say it can. So we have this:

&bull; SampleClass.h


#pragma once

class SampleClass
{
&nbsp; &nbsp; public:
&nbsp; &nbsp;  SampleClass( void ); // constructor
&nbsp; &nbsp;  ~SampleClass( void ); // deconstructor

&nbsp; &nbsp;  private:
&nbsp; &nbsp;  // internal variables and functions go here

&nbsp; &nbsp; char name[25];
&nbsp; &nbsp;  int age;

&nbsp; &nbsp;  public:
&nbsp; &nbsp;  /* shared variables and external functions

&nbsp; &nbsp;  go here */
};



Since our variables are now private, we need a way of accessing and/or modifying them. Suppose for now we just want to be able to view the values of our object&#39;s variables. We can create a function for each variable that will do just that, like so:

&bull; SampleClass.h


#pragma once

class SampleClass
{
&nbsp; &nbsp;  public:
&nbsp; &nbsp;  SampleClass( void ); // constructor
&nbsp; &nbsp;  ~SampleClass( void ); // deconstructor

&nbsp; &nbsp;  private:
&nbsp; &nbsp;  // internal variables and functions go here

&nbsp; &nbsp;  char name[25];
&nbsp; &nbsp;  int age;

&nbsp; &nbsp;  public:
&nbsp; &nbsp;  /* shared variables and external functions

&nbsp; &nbsp;  go here */
&nbsp; &nbsp;  char* GetName( void );
&nbsp; &nbsp;  int GetAge( void );

};


&bull; SampleClass.cpp


#include "SampleClass.h"

// default constructor

SampleClass::SampleClass( void )
{
&nbsp; &nbsp;  /* place code here that needs to execute
&nbsp; &nbsp;  when an instance of our class is created */

}

// deconstructor - this is called when our class object is no longer being used.

SampleClass::~SampleClass( void )
{
}

char* SampleClass::GetName( void )
{
&nbsp; &nbsp; /* place code here that needs to execute
&nbsp; &nbsp;  when this function is called */
&nbsp; &nbsp;  return name;
}

int SampleClass::GetAge( void )
{
&nbsp; &nbsp;  /* place code here that needs to execute
&nbsp; &nbsp;  when this function is called */
&nbsp; &nbsp;  return age;
}



The return type of the function needs to match the data type of the variable whose value we want to return as a result of calling this function.]]>[...]</description>
	                	<pubDate>October 03 2008 12:57:00 EST</pubDate>
	                	<link>http://geeksneversleep.com/page/Cplusplus-Classes</link> 
	            	</item><item> 
	                	<title>C/C++ : Includes</title> 
	                	<description><![CDATA[C++ includes take one of two forms: #include < >  or #include  . The only difference is that the former tells the compiler to look within the STL (Standard Template Library) for the source code, while the latter instructs the compiler to look in the local project 
folder.


Certain header files seem to see a lot of use in low-level programming courses, especially those that focus on creating console-based programs. These include, but are not limited to:


iostream
iomanip
list
map
stdlib
string
math


As you read on, I will try to explain the use of each class, and show ways to implement it in your code.

iostream

From the MSDN Standard C++ Library Reference:



[This class] declares objects that control reading from and writing to the standard streams. This is often the only header you need to include to perform input and output from a C++ program.



Specifically, iostream contains the following functions: cerr, cin, clog, cout, wcerr, wcin, wclog, and wcout. The functions used most often are cin and cout. These are used for console input and output, respectively; in other words, to read in character input from a console window and display character output back out to the console window.

iomanip

This class is used to manipulate the input and output sent and received by the console window.


Iomanip contains the following functions: resetiosflags, setbase, setfill, setiosflags, setprecision and setw. The functions I used most often are setfill, setprecision and setw. These are used for formatting the output sent to the console window. setfill is used to define an automatically-inserted character, setprecision is used to set the number of trailing digits displayed, and setw sets a minimum width to an output string.


Using these three functions together, it is quite easy to format your output to mimic, say, an ATM screen, with the output formatted correctly for currency, without need for excessive code.

list

The easiest way to define the list class is to think of it as an automatic array. A list object is a dynamically re-sized collection of other objects, such as integers, floats, characters, and pointers.

map
The map class is very similar to the list class, with the exception being that a map object&#39;s collection is automatically sorted.

stdlib

This class is mostly used to implement legacy C code. It contains a long list of functions. The functions I have used most often are: atof, atoi, atol, rand, and srand
. The first three, atof, atoi and atol, are used to convert a character string into, in order, a float, integer, or long integer value. rand is used to generate a pseudo-random number. srand is used to seed, or initialize, the random number generator, which helps to increase the randomness of any subsequent calls to the rand function.

string

The string class is easily the most welcomed class to be added the STL, as it saves programmers from having to manually build either their own string class for each program or from having to deal with the complexities of character arrays.


The string class implements it&#39;s own overloaded operators, and gives us access to the function getline, which is extremely useful for when you wish to read in a line of text (from the console window) that contains spaces, a condition that the character inputs have issues dealing with.

math

The math class, according to cplusplus.com, declares a set of functions to compute common mathematical operations and transformations.


These include:
acos, asin, atan, atan2, ceil, cos, cosh, exp,fabs, floor, fmod, frexp, ldexp, log, log10, modf, pow, sin, sinh, sqrt, tan, and tanh.]]>[...]</description>
	                	<pubDate>October 03 2008 10:55:00 EST</pubDate>
	                	<link>http://geeksneversleep.com/page/Cplusplus-Includes</link> 
	            	</item><item> 
	                	<title>C/C++ : Power at Your Fingertips</title> 
	                	<description><![CDATA[C++ is considered by many to be one of the premier object-oriented programming languages. C++ is also one of the few truly compiled languages (with the exception of Microsoft's C++.NET, obviously) still widely used in modern computing. True C++ requires no framework or runtime environment to execute, unlike interpreted languages like Java and the various .NET languages.




Overview


Intro


Advantages


Drawbacks


Definition




Topics


File structure


Keywords


Includes


Conditional Statements


Classes




Summary


Comments




Advantage?


One very important advantage to using a fully-compiled language like C++ is speed of code execution. Because it is compiled directly into machine code, C++ is able to skip the intermediate steps that Java and the various .NET languages must make. This means that C++ code executes a few orders of magnitude faster than an interpreted language, which is important when the code must execute in a high-precision environment, such as, say, a nuclear power plant...


Drawbacks?


One drawback to using C++ is the requirement of a suitable compiler for the target chipset architecture. What that means is that the same executable will not run on both an x86 architecture (Intel Pentium or AMD Athlon) and a RISC architecture (IBM PowerPC or Sun SPARC).


Okay, that&#39;s nice. So, what's with all these weird files?


Take a look at any C/C++ project, and you're likely to see a plethora of files, some with a .cpp file type and some with a .h file type. Look further, and you'll see that, with some exceptions, each .cpp file has a matching .h file. Why is that?, you may ask? Well, the reason is fairly complex, and involves some terminology I'm not entirely up to snuff on, so let's keep it simple. For those just beginning to learn programming, it may help to think of it this way:


&bull; The .h file is very similar to the Table of Contents you&#39;ll find in most books. It tells the compiler where everything is located, and what type of data will be involved.


&bull; The .cpp file contains the actual code that will executed; namely, the functions that will act upon the variables within the program. Also, it is important to note that assignment operators (the equals sign) can only be used within the .cpp file, not the .h file.


C++ Keywords




asm							auto							bool							break

							case						catch					char							class						
							const							const_cast							continue							default												
							delete							do							double							dynamic_cast						
							else							enum							explicit							export						
							extern							false							float							for						
							friend							goto							if							inline						
							int							long							mutable							namespace

							new							operator							private							protected

							public							register							reinterpret_cast							return						
							short							signed							sizeof							static						
							static_cast							struct							switch							template						
							this							throw							true							try

							typedef							typeid							typename							union

							unsigned							using							virtual							void						

volatile
wchar_t
while





Definitions:


A compiler converts the human-readable program code into machine code for the chipset to process.]]>[...]</description>
	                	<pubDate>October 03 2008 10:36:00 EST</pubDate>
	                	<link>http://geeksneversleep.com/page/Cplusplus</link> 
	            	</item><item> 
	                	<title>MySQL: OpenSource Data Storage</title> 
	                	<description><![CDATA[MySQL is what is known as a relational database management system (RDBMS). A RDBMS is a database management system (DBMS) that is based on the relational model. A RDBMS should meet at least these two requirements:



Present the data to the user as relations.


Provide relational operators to manipulate the data in tabular form.



MySQL (pronounced My Es Que Ell) is an OpenSource, cross-platform database system software written in C/C++, and is available under GNU Public License. MySQL is commonly paired with PHP as part of a content management system (CMS), such as Drupal, Wordpress, etc. MySQL uses a modified version of standard SQL syntax.




Overview


Intro


Advantages


Drawbacks


Definition




Topics


File structure




Summary


Comments



Advantages?

One very obvious advantage to using MySQL as a storage engine is that, like most OpenSource software, it is completely free. Being OpenSource also means that a development team can dig into it's codebase and make modifications if necessary, or extend an existing library. The cross-platform nature of MySQL also means that your team is not tied to using a specific operating system or hardware vendor.

Drawbacks?

One big gripe with MySQL is that it has (in the past) not supported such niceties as stored procedures or triggers, features that most other major versions of SQL have supported and that have been shown to increase database performance. Recent press releases by Sun and MySQL AB have indicated that these deficiencies may soon be addressed...

File Structure

Most standard SQL statements will work when using a MySQL database. Some examples follow. NOTE: I tend to uppercase keywords when I am writing SQL statements, but the MySQL engine is case-insensitive.

Create a table:


CREATE TABLE table-name

( 

field-name1 DATATYPE(size), 

field-name2 DATATYPE(size), ... 

field-nameN DATATYPE(size) 

);


Add a record:


INSERT INTO table-name

( field-name1, field-name2, ..., field-nameN ) 
VALUES ( 'value1', 'value2', ..., 'valueN' );


Remove a record:


DELETE FROM table-name

WHERE field-name = 'value';


Update a record:


UPDATE table-name

SET field-name = 'value1'
WHERE field-name = 'value2';


Select a record:


SELECT field-name1, field-name2, ..., field-nameN FROM table-name

WHERE field-name = 'value';


Want more?

I have only covered the basics here. If you want a more thorough run-down on MySQL, Tizag.com has a very good series of tutorials.]]>[...]</description>
	                	<pubDate>October 02 2008 17:59:00 EST</pubDate>
	                	<link>http://geeksneversleep.com/page/MySQL</link> 
	            	</item><item> 
	                	<title>JavaScript</title> 
	                	<description><![CDATA[JavaScript is a widely used tool for web scripting, and was originally developed by the Netscape Communications Corporation under the name LiveScript. One of JavaScript&#39;s most prevalent uses is in AJAX (Asynchronous JavaScript And XML) applications. AJAX is one of the principle technologies behind DHTML, a technology used for dynamically editing a web page after it has been delivered to a user&#39;s browser.




Overview


Intro


Features


Drawbacks


Definition




Notes


Summary


Comments


                  
Features

JavaScript, like it&#39;s similarly named cousin Java, inherits much of it&#39;s syntax from the C programming language. As is the case with most scripting languages, JavaScript is weakly-typed. This means that one variable could be used to hold an integer value, then a string value, and so on, without the casting necessary in strongly-typed languages like C#.
                 
Drawbacks

Perhaps one of the biggest concerns with JavaScript is the frequency with which the applications written in it are exploited. Of course, this is probably more due to programmer error than inherent susceptibility to exploits. Another concern arises if a website depends too much on JavaScript for such things as navigation and/or form validation. Given that JavaScript exploits are so common, many advanced users disable JavaScript in their browsers. My biggest gripe stems from the fact that not all browsers implement the same version of JavaScript, Safari (from Apple, Inc.) being the worst offender.

Notes

To use JavaScript in a web page, it must be embedded in that page or linked in the head of the document. Which method you choose depends on how your script executes. Some examples follow.


&bull; samplepage.html. JavaScript linked in document head.



&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Page Title Goes Here&lt;/title&gt;
&lt;script type=text/javascript src=js/script-one.js&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;/body&gt;
&lt;/html&gt;



&bull; samplepage.html. JavaScript embedded in document.



&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Page Title Goes Here&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;script type=text/javascript&gt;
... 
&lt;/script&gt;

&lt;/body&gt;
&lt;/html&gt;



As you can see, there is a &lt;script&gt; HTML tag we use for adding JavaScript to our page. This tag isn't limited to just JavaScript, however. You may also specify EMCAScript (the official standard on which JavaScript is based) and VBScript. Also, you will notice that &lt;script&gt; tags linked in the head of the document require an extra src attribute, where we specify the URL to where the external script is stored.]]>[...]</description>
	                	<pubDate>October 02 2008 17:14:00 EST</pubDate>
	                	<link>http://geeksneversleep.com/page/JavaScript</link> 
	            	</item><item> 
	                	<title>Drupal | Open Source CMS</title> 
	                	<description><![CDATA[Drupal is an open source content management system written in PHP. Drupal had it&#39;s start as a bulletin board for college students in a single dorm. Drupal has come a long way since those days, but is still ideal for a website that is updated by more than one person.




Overview


Intro


Advantages


Drawbacks


Definition




Summary



Advantages

Anyone who feels limited by the structure of other systems may do well to try Drupal on for size. The code is designed so that any part can be overridden without hacking into the core of the system. This makes upgrades much more painless by keeping all custom code in a single place. There are modules that can be installed to allow for a shopping cart or photo gallery. There are also modules that let you customize the content itself. Views will build lists to 
display the content any way you like, and the Content Construction Kit (CCK) will let you create your own content types. This can be handy if, say, you need to import a spreadsheet containing the details of 8,000 books. The only limits are those set by your hosting plan.

Disadvantages?

The open structure of Drupal is often the thing that turns people away when they first begin to use it. It can be used to build anything, but once you get it uploaded and run the installer there does not seem to be a lot to work with. It helps to have a good idea of where you want your site to go, and it is certain your first Drupal site will not be as efficient as your second or third. Drupal takes a while to understand, but once you get the hang of it you can have a site up and running in no time.

Definitions:

Drupal also ships with some specific terms that must be understood for the fullest enjoyment. Here are a couple you will be confronted with immediately:


Node:

In Drupal, everything is a node. Pages, blog posts, and whatever custom content types you create with CCK are all just different types of nodes
(Source)

Taxonomy:

This is the term Drupal uses to classify content. At the most basic structure it is a list of categories. The taxonomy of your site can be as simple or as complex as you desire. Think of the taxonomy set up to classify all life on Earth. Every plant, animal and bird has a family, genus, species, and perhaps even a variety.
(Source)]]>[...]</description>
	                	<pubDate>October 01 2008 23:16:00 EST</pubDate>
	                	<link>http://geeksneversleep.com/page/Drupal-Open-Source-CMS</link> 
	            	</item><item> 
	                	<title>Content Management System</title> 
	                	<description><![CDATA[Anyone who has hand coded and uploaded a website for very long soon starts to consider automating the uploads in some fashion. For someone who is less comfortable with computers, the automation becomes a necessity. Writing a thoughtful post, or even a quick update while you run out the door, is a complete task into itself and can be made much easier with a few scripts to update menus and display your post in the proper place.


One of the free services such as Blogger or Wordpress.com would seem be a good choice for someone with limited technical skills. There are many advantages to having the big boys do the heavy lifting. Convenience comes at a price, however, and control over content and operation is what is traded away.


Think you want to install your own blog software? Most systems ship with an installer; simply upload to your server, answer a few questions about the database setup, and away you go. The difficult part may be in choosing which software to install. While it is possible to convert an existing site into 
a new system, it may be best to try a few different options and make an informed decision on which is the best fit. Every solution has it's own advantages and drawbacks, and you may be living with your choice for years to come. Like in any good marriage, it is best to say I don't know.


So what are the choices? There are any number of open source and commercial systems available. Here are a few of the more popular and established systems that you may want to check out first.

Wordpress

Wordpress is extremely popular, easy to use, and has a great number of themes and plugins. Wordpress is blog software at heart, but it can be customized to look and act like any sort of website.
Wordpress Project Page &gt;&gt;

b2evolution

b2evolution is derived from the same codebase as Wordpress, but is built from the ground up to support a multi-user installation, making it useful as a community portal or group website.
b2evolution Project Page &gt;&gt;

Movable Type

Movable Type was the first blog software blog package to become widely popular, and there is now an open source version available for download. MT uses a combination of Perl and PHP and builds static pages. All of the code is well separated from the XHTML and CSS, making Movable Type very easy to customize.
Movable Type Project Page &gt;&gt;

Drupal

Drupal is often considered overkill for a one-person blog. Drupal will take more planning and tweaking to accomplish what the others do right out of the box, but it is a valid option, especially if other systems seem too confining.
Drupal Project Page &gt;&gt;

Joomla!

Joomla! is a nice start for those wanting to dip their toes into CMS, and includes a lot of eye candy out of the box. Advanced users may find Joomla! to be a bit too confining...
Joomla! Project Page &gt;&gt;]]>[...]</description>
	                	<pubDate>October 01 2008 22:55:00 EST</pubDate>
	                	<link>http://geeksneversleep.com/page/Content-Management-System</link> 
	            	</item><item> 
	                	<title>PHP Hypertext Preprocessor</title> 
	                	<description><![CDATA[PHP  is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML.. So says PHP.net, and I am willing to go with that. PHP&#39;s real strength seems to be it&#39;s ability to be used for a process called server-side scripting.




Overview


Intro


Advantages


Drawbacks

								
Definitions




Topics


File structure




Summary


Comments




Advantage


One of the major advantages of using PHP is that it allows webmasters to dynamically generate web content on-the-fly, perhaps using pre-coded chunks of HTML code or loading content from a database. Using PHP, we can perform form validation without having to rely on complex CGI scripts. PHP can be used to generate RSS feeds from our existing site content. If you can think of it, you can probably code a PHP script to run it.

Disadvantages?

Well, the biggest drawback to relying on PHP is that you need to have your site hosted on a service that not only has PHP installed (or that is willing to install it for you), but that has the correct version of PHP. Code written for PHP5 might not work on a PHP4 install, and so on...

A Word from Our Sponsors...                  

If you really want to learn the ins-and-outs of web design, I strongly suggest you visit the awesome folks at W3Schools.com. That site has just about everything there is to know about proper web page development. I am merely going to paraphrase some of what I learned there and elsewhere.


Okay!


File Structure


For the most part, PHP documents have the file extension, .php, although you can also use .php4, .php3, or .phtml. You can also save a PHP document as a .html file, but there is no guarantee that the PHP parser will parse your document if you do so.


Inside your PHP document, you must define the beginning and ending scope of the code you want the parser to execute. This scope is defined like so:



Start tag: &lt;?php or &lt;? (short-tag version).


End tag: ?&gt;



PHP has a solid library of usable code behind it. This library gives every budding PHP programmer a good start, and (like all OOP languages) can be extended to fit every unique need that arises.


At this time, the functions that I have used most are the include and the echo functions. The include function is placed in our 
code where we want to insert external documents or scripts. The echo function is used to, well, echo a string out to the current document. The string will be output exactly in the location in which the echo statement occurs within the source document. These two functions alone can be used to save a lot of work on our part, and to provide feedback to our users.


I use the include function to insert the code for my document&#39;s header, footer, and navigation menu. By doing so, I save myself a lot of rewriting, copying, and pasting if I choose to update the image(s) or text in any of those parts of my pages. The echo statement is really useful when I validate my various forms, as I can give the user(s) fairly explicit directions if the form(s) fail to validate.

Do You Want to Know More...?

Check out php.net if you want to get the inside scoop. Also, I wrote up a simple tutorial for building a webpage using HTML and PHP, [ here ].

PHP Keywords




and   	 
or   	 
xor   	 
__FILE__

   	 
exception
__LINE__ 	
array() 	
as

 	
break 	
case
class 	
const

 	
continue 	
declare 	
default
die()

 	
do 	
echo() 	
else 	
elseif


empty() 	
enddeclare 	
endfor 	
endforeach

 	
endif
endswitch 	
endwhile 	
eval()

 	
exit() 	
extends
for 	
foreach

 	
function 	
global 	
if
include()

 	
include_once() 	
isset() 	
list() 	
new


print() 	
require() 	
require_once() 	
return()

 	
static
switch 	
unset() 	
use

 	
var 	
while
__FUNCTION__ 	
__CLASS__

 	
__METHOD__ 	
final 	
php_user_filter
interface


implements 	
instanceof 	
public 	
private


protected 	
abstract
clone 	
try

 	
catch
throw 	
cfunction (PHP 4 only) 	
old_function (PHP 4 only)

 	
this 	
final
__NAMESPACE__ 	
namespace

 	
goto (PHP 6 only) 	
__DIR__




Definitions:

Parser:

In computer technology, a parser is a program, usually part of a compiler, that receives input in the form of sequential source program instructions, interactive online commands, markup tags, or some other defined interface and breaks them up into parts (for example, the nouns (objects), verbs (methods), and their attributes or options) that can then be managed by other programming (for example, other components in a compiler). A parser may also check to see that all input has been provided that is necessary. (whatis.com)]]>[...]</description>
	                	<pubDate>October 01 2008 22:47:00 EST</pubDate>
	                	<link>http://geeksneversleep.com/page/PHP-Hypertext-Preprocessor</link> 
	            	</item><item> 
	                	<title>Cascading Stylesheets</title> 
	                	<description><![CDATA[W3Schools has this to say about CSS:



Cascading Style Sheets (CSS) is a simple mechanism for adding style (e.g. fonts, colors, spacing) to Web documents. Style sheets describe how documents are presented on screens, in print, or perhaps how they are pronounced. By attaching style sheets to structured documents on the Web (e.g. HTML), authors and readers can influence the presentation of documents without sacrificing device-independence or adding new HTML tags.





Overview


Intro


Advantages


Drawbacks


Definition




Topics


File structure




Summary


Comments



Advantage?

Simply put, using CSS means we can put our content and structure in one document, and the style elements in a different, discrete document.


Why is that such a big deal? Well, perhaps this analogy will help: what if painting your house meant you had to tear it apart and rebuild it? Not very fun, or economical, is it? When we embed style elements into a web page, we run into this same problem when we want or need to change the look of the page. Not to mention, maintaining a consistent look across pages
becomes a chore unto itself...

Drawbacks?

I can only think of one major drawback to using CSS: your site becomes dependent on being able to load an external document in order to display correctly. If your site cannot load the style sheet, your page will degrade to however the core HTML is structured. For some sites, that can be, for lack of a better word, painful. Of course, this is only a problem with external style sheets, and frankly, unless your style sheet is stored on a different server for some reason, if your site loads, your style sheet will load.

File Structure

There are two methods to implementing CSS: by embedding in the HTML source document, or by referencing an external style sheet.

Embedded

Of the two ways of embedding style into a web document, the easiest method is to style each element individually, like so:


&lt;tag style=&gt;, where tag is replaced with whatever tag you are styling.


The second method involves adding the &lt;style&gt; tag to the head of your web page, like this:

&bull; samplepage.html


&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
&lt;head&gt;
&lt;title&gt;Page Title Goes Here&lt;/title&gt;
      &lt;style type=text/css&gt;
tag {
// attribute
}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;/body&gt;
&lt;/html&gt;



Simply substitute the element you want to style for tag and add whatever attributes you want to modify, i.e. background-color, font-size, etc.

External

For an external style sheet, we add a &lt;link&gt; element to our &lt;head&gt; element, like so:

&bull; samplepage.html


&lt;!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&gt;
&lt;html xmlns=http://www.w3.org/1999/xhtml &gt;
&lt;head&gt;
&lt;link rel=stylesheet
href=url to stylesheet here 
type=text/css media=all/&gt;
&lt;title&gt;Page Title Goes Here&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;/body&gt;
&lt;/html&gt;



Stylesheets are very simple documents, and look similar to this:

&bull; style.css


// Add copyright notices, etc. to top of page using comments.
// The rest of the style sheet looks just like an embedded 
// stylesheet.

// To style every element of a specific type, add that element
body {
// attribute 
} 

// To style a specific element, add its id 
#header {
// attribute 
} 

// To style more than one element, use a class 
.bodytext{ 
// attribute 
} 



And the elements being styled will look like so: &lt;tag id=header&gt; (ID'd element) and &lt;tag class=bodytext&gt; (class element).

Do You Want to Know More...?

Check out SitePoint.com for a very thorough rundown on CSS.]]>[...]</description>
	                	<pubDate>October 01 2008 22:32:00 EST</pubDate>
	                	<link>http://geeksneversleep.com/page/Cascading-Stylesheets</link> 
	            	</item><item> 
	                	<title>Extensible Hypertext Mark-up Language</title> 
	                	<description><![CDATA[XHTML is a fusion of HTML and XML, or Extensible Mark-up Language. XML documents must follow a strict guideline to be considered valid.


According to W3Schools, XML was designed to describe data and HTML was designed to display data. What this means is that HTML was originally designed to simply display a document in a remotely-accessible way. All of the attributes that crept in as the web evolved are, quite frankly, kludge. XML is designed to give a rigid structure to our page&#39;s content, which can then be externally styled.




Overview


Intro


Advantages


Drawbacks


Definition




Topics


File structure




Summary


Comments




Advantage: XHTML


One of the best reasons to use XHTML over HTML is that it forces (or encourages, depending on the DTD being used) the designer to properly close every element tag, which ensures consistent page rendering across various web browsers.


Another equally important reason to use XHTML is that it allows us to separate our site&#39;s structure from it&#39;s style; XHTML does not support HTML inline styles, but rather specifies a style attribute. More on that later...


Disadvantages?


Um. Well. I honestly cannot think of any drawback to using XHTML over HTML. Sorry!

A Word from Our Sponsors...                  

If you really want to learn the ins-and-outs of web design, I strongly suggest you visit the awesome folks at W3Schools.com. That site has just about everything there is to know about proper web page development. I am merely going to paraphrase some of what I learned there and elsewhere.


Okay! Let's get this party started!


File Structure


XHTML looks a lot like HTML at the surface level, but there are some important differences. Gaze upon this most awesome of examples...


&bull; samplepage.html



&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;

&lt;head&gt;

&lt;title&gt;Page Title Goes Here&lt;/title&gt;

&lt;/head&gt;

&lt;body&gt;


&lt;/body&gt;

&lt;/html&gt;


Break It Down!

So, did you notice the parts that are different? No? Well, then let&#39;s fix that!


The first difference you should notice is that XHTML adds another line of code to the top of the document. This extra line specifies the document type, or DOCTYPE. The DOCTYPE is an externally referenced file used to define such things as what tags are and are not allowed, and how elements may be nested.


The next obvious difference: look at the &lt;html&gt; tag. See all that extra text? That defines which parser should be used to render the document. Since I previously chose a XHTML DTD, I need to also let the browser know that it needs to use a XHTML parser, too.


The rest of the page will look almost exactly like a HTML page. The main difference left between HTML and XHTML has to do with styling, which I will talk about more in my 
CSS page.

Do You Want to Know More...?

Check out the tag list if you want to see all of the available XHTML tags.


Definitions:


DTD:

DTD stands for Document Type Definition. A DTD states what tags and attributes are used to describe content in an SGML, XML or HTML document, where each tag is allowed, and which tags can appear within other tags. 

(Webopedia.com)


DOCTYPE:

The &lt;!DOCTYPE$gt; declaration is the very first thing in your document, before the &lt;html&gt; tag. This tag tells the browser which HTML or XHTML specification the document uses.

(W3Schools.com)


Parser:

In computer technology, a parser is a program, usually part of a compiler, that receives input in the form of sequential source program instructions, interactive online commands, markup tags, or some other defined interface and breaks them up into parts (for example, the nouns (objects), verbs (methods), and their attributes or options) that can then be managed by other programming (for example, other components in a compiler). A parser may also check to see that all input has been provided that is necessary.

(whatis.com)]]>[...]</description>
	                	<pubDate>October 01 2008 22:27:00 EST</pubDate>
	                	<link>http://geeksneversleep.com/page/Extensible-Hypertext-Mark-up-Language</link> 
	            	</item><item> 
	                	<title>Conditional Statements</title> 
	                	<description><![CDATA[Conditional statements, also known as control statements, are used where your program must evaluate whether a logical statement is true or false. These include, but are not limited to:

Click each link to expand and collapse each sample window...
IF-THEN-ELSE

General form: 


IF(CONDITION evaluates to TRUE) THEN

DO SOMETHING

ELSE

DO SOMETHING ELSE




C/C++ / C#.NET / Java


if(x==1)
{

   // do something 

}

else

{

   // do something else

} 





VisualBasic.NET


If foo = bar 
Then

   ' do something 

Else

   ' do something else

End If





WHILE, DO-WHILE, and DO-UNTIL loops

General form: 


WHILE(CONDITION evaluates to TRUE)

DO SOMETHING

LOOP


DO

SOMETHING

WHILE(CONDITION evaluates to TRUE)


DO

SOMETHING

UNTIL(CONDITION evaluates to TRUE)




C/C++ / C#.NET / Java


while(choice != 'x')

{

   // do something 

}


do

{

   // do something 

}while(choice != 'x')


do

{

   // do something 

}while(choice == 'x')




VisualBasic.NET


While repeat = True

' do something

End While


Do While repeat = True

' do something

Loop


Do Until repeat = False

' do something

Loop




FOR and FOREACH loops

General form: 


FOR(ITERATOR; CONDITION; INCREMENTOR)

DO SOMETHING


FOREACH(ELEMENT in COLLECTION)

DO SOMETHING 




C/C++


for(int
i=0; i&lt;0; i++)

{

   // do something

}


for each(Control 
ctrl in this.MainForm.Controls)

{

   // do something

}




C#.NET


int x = 10;

for(
int i=0; i=&lt; x; i++)
{

   // do something

}


foreach 
(Control ctrl 
in this.Controls)

{

   // do something

}




Java		


int x = 10;

for(
int i=0; i=&lt; x; i++)
{

   // do something

}


for 
(Control ctrl : 
this.Controls)

{

   // do something

}




VisualBasic.NET


For Each ctrl 
As Control In Me.MainForm.Controls

   ' do something

Next ctrl




SWITCH or SELECT CASE statements

General form: 


SWITCH (COMPARITOR)

CASE (VALUE1):

    DO SOMETHING

    BREAK

CASE (VALUE2):

    DO SOMETHING

    BREAK

CASE (DEFAULT VALUE):

    DO SOMETHING

    BREAK

END SWITCH




C/C++ / C#.NET / Java


switch(rdb.Name)

{

case button1:

   // do something

   break;

case button2:

   // do something

   break;

default:

    // do something

    break;

}




VisualBasic.NET


Select Case option

Case 0

' do something

Case 1

' do something

Case Else

' do something

End Select]]>[...]</description>
	                	<pubDate>October 01 2008 22:06:00 EST</pubDate>
	                	<link>http://geeksneversleep.com/page/Conditional-Statements</link> 
	            	</item><item> 
	                	<title>GNU &amp; Linux Distros</title> 
	                	<description><![CDATA[Linux



Ubuntu: Linux for human beings&trade;


Ubuntu is a Debian-based Linux OS that uses the GNOME desktop manager. Ubuntu is intended to be easy to use for beginners, but powerful enough for advanced users.





Fedora: infinity | freedom | voice&trade;


Fedora is the consumer version of Red Hat Enterprise Linux OS. Fedora is used to test new features before they are integrated into Enterprise Linux. 
Fedora uses the KDE desktop manager.





openSUSE 11


The openSUSE project is a worldwide community program sponsored by Novell that promotes the use of Linux everywhere.





Gentoo Linux


Gentoo is a free operating system based on either Linux or FreeBSD that can be automatically optimized and customized for just about any application or need.





the slackware project


A no-frills version of Linux for serious geeks. Excellent for use on a personal server.


BSD



PC-BSD


A variation on BSD, a UNIX-like OS built by the University of California-Berkley. Uses the KDE desktop, and is aimed at the casual PC user.





FreeBSD


Closely related to PC-BSD, but supported by the Open Source community. Comes with both the KDE and GNOME desktops.





DragonFlyBSD


DragonFly is an operating system and environment originally based on FreeBSD. DragonFly branched from FreeBSD in 2003 in order to develop a 
radically different approach to concurrency, SMP, and most other kernel subsystems.


NT Clones



ReactOS


ReactOS&reg; is an advanced free open source operating system providing a ground-up implementation of a Microsoft Windows&reg; XP compatible operating system. 
ReactOS aims to achieve complete binary compatibility with both applications and device drivers meant for NT and XP operating systems, by using a similar architecture 
and providing a complete and equivalent public interface.]]>[...]</description>
	                	<pubDate>September 30 2008 12:55:00 EST</pubDate>
	                	<link>http://geeksneversleep.com/page/GNU-Linux-Distros</link> 
	            	</item><item> 
	                	<title>Development Tools</title> 
	                	<description><![CDATA[SourceForge is an excellent site with which to manage your projects, especially if your development team is distributed widely.





Microsoft Visual Studio Express Editions


Say what you will, but Microsoft does occasionally do something nice. If you've used the Professional versions of Visual Studio, but can't afford to buy a personal license, the Express Editions may be the way to go. Featuring a smaller feature set within the same IDE found in the paid versions, you can't go wrong with free...





IntelliJ IDEA: The Most Intelligent Java IDE


For Java developers looking for a good Swing and AWT form designer, I present IntelliJ. It features an IDE that rivals Visual Studio in functionality and customization.





PHP Designer 2007 - Personal 5.0.2


I've used a few different tools for PHP development, but so far PHP Designer, from MPSOFTWARE, has been my hands-down favorite. Pick up the personal version of the 2007 edition for free if you are working on personal projects, or for a relatively small price you can buy a perpetual license for the 2008 editon.





Notepad++


Sometimes, simpler is better. Notepad++ may not look like a lot, but is has syntax-highlighting for darn near every computer language you can think of. It also benefits from an OpenSource license, so not only are you free to use it how you see fit, you can also dig around under the hood if you find something you don't like...





TortoiseCVS: Enjoyable Version Control


Say the words "code versioning" in any programming group meeting, and you'll see more than a few winces. TortoiseCVS can turn those frowns upside down...







Why pay for an expensive office suite when you can get a robust productivity suite for free? I dunno, but people do it anyway. Use OpenOffice.org, silly.




 Active@ ISO Burner (Freeware)


Active@ ISO Burner is a freeware application that will allow you to burn an ISO image file to CD-R, DVD-R, DVD+R, CD-RW, DVD-RW, DL DVD+RW, HD DVD and Blu-ray Disc.]]>[...]</description>
	                	<pubDate>September 30 2008 11:50:00 EST</pubDate>
	                	<link>http://geeksneversleep.com/page/Development-Tools</link> 
	            	</item><item> 
	                	<title>Unified Modeling Language</title> 
	                	<description><![CDATA[Wikipedia defines UML like so:



In the field of software engineering, the Unified Modeling Language (UML) is a standardized specification language for object modeling. UML is a general-purpose modeling language that includes a graphical notation used to create an abstract model of a system, referred to as a UML model.



UML is an excellent tool to assist in the development of any OOP software project, as it gives the developer(s) a good physical representation of the logical flow of data within the project.


UML diagrams can be used to represent three distinct views of a system:



&bull; Functional requirements


Emphasizing the user&#39;s functional requirements, and includes use-case diagrams.


&bull; Static structure


Covering the system&#39;s objects, and the attributes, operations, and relationships among them. Uses include class diagrams and composite structure diagrams.


&bull; Dynamic behavior


Modeling the interaction between the system&#39;s various objects using sequence diagrams, activity diagrams, and state-machine diagrams.


Activity Diagram

More likely than not, if you are a beginning programmer, the type of UML you are most likely to use is the activity diagram. It is used to indicate a step-by-step workflow of your application logic. It can be a top-level overview of your entire project, or can also model specific sequences within the project. Here is a good example (acquired from Wikipedia, of course):





This specific example demonstrates an abstract view of a for loop, but every conditional
statement can be modeled using an activity diagram.

UML Downloads

Click here 
to download a trial of Microsoft Visio 2007. 

Note: Requires Windows XP, or Vista, 256MB of RAM, and a minimum of 1.5 gigabytes of free hard drive space...



Click here
to download a trial of SmartDraw. 

Note: Requires Windows 2000, XP, or Vista, 256MB of RAM, and a minimum of 3 gigabytes of free hard drive space...]]>[...]</description>
	                	<pubDate>September 29 2008 01:26:00 EST</pubDate>
	                	<link>http://geeksneversleep.com/page/Unified-Modeling-Language</link> 
	            	</item><item> 
	                	<title>HTML 4.01 / XHTML 1.0 Reference</title> 
	                	<description><![CDATA[Here you will find every valid, W3C standard tag currently available. I copied this table almost letter-for-letter from w3schools.com. Click on that link if you want an in-depth explanation of each tag...


DTD: indicates in which XHTML 1.0 DTD the tag is allowed. S=Strict, T=Transitional, and F=Frameset



Tag
Description
DTD


&lt;!--...--&gt;
Defines a comment
STF


&lt;!DOCTYPE&gt;
Defines the document type
STF



&lt;a&gt;

Defines an anchor
STF



&lt;abbr&gt;

Defines an abbreviation
STF


&lt;acronym&gt;
Defines an acronym
STF


&lt;address&gt;
Defines an address element
STF


&lt;applet&gt;

Deprecated. Defines an applet

TF


&lt;area&gt;
Defines an area inside an image map
STF


&lt;b&gt;
Defines bold text
STF


&lt;base&gt;
Defines a base URL for all the links in a page
STF


&lt;basefont&gt;

Deprecated. Defines a base font

TF


&lt;bdo&gt;
Defines the direction of text display
STF


&lt;big&gt;
Defines big text
STF


&lt;blockquote&gt;
Defines a long quotation
STF



&lt;body&gt;

Defines the body element
STF



&lt;br&gt;

Inserts a single line break
STF



&lt;button&gt;

Defines a push button
STF



&lt;caption&gt;

Defines a table caption
STF



&lt;center&gt;


Deprecated. Defines centered text

TF



&lt;cite&gt;

Defines a citation
STF



&lt;code&gt;

Defines computer code text
STF



&lt;col&gt;

Defines attributes for table columns 
STF



&lt;colgroup&gt;

Defines groups of table columns
STF



&lt;dd&gt;

Defines a definition description
STF



&lt;del&gt;

Defines deleted text
STF



&lt;dir&gt;


Deprecated. Defines a directory list

TF



&lt;div&gt;

Defines a section in a document
STF



&lt;dfn&gt;

Defines a definition term
STF



&lt;dl&gt;

Defines a definition list
STF



&lt;dt&gt;

Defines a definition term
STF



&lt;em&gt;

Defines emphasized text 
STF



&lt;fieldset&gt;

Defines a fieldset
STF



&lt;font&gt;


Deprecated. Defines text font, size, and color

TF



&lt;form&gt;

Defines a form 
STF



&lt;frame&gt;

 Defines a sub window (a frame)
F



&lt;frameset&gt;

Defines a set of frames
F



&lt;h1&gt; to &lt;h6&gt;

 Defines header 1 to header 6
STF



&lt;head&gt;

Defines information about the document
STF



&lt;hr&gt;

 Defines a horizontal rule
STF



&lt;html&gt;

Defines an html document
STF



&lt;i&gt;

Defines italic text
STF



&lt;iframe&gt;

Defines an inline sub window (frame)
TF



&lt;img&gt;

Defines an image
STF



&lt;input&gt;

Defines an input field
STF



&lt;ins&gt;

Defines inserted text
STF


&lt;isindex&gt;

Deprecated. Defines a single-line
input field

TF



&lt;kbd&gt;

Defines keyboard text
STF



&lt;label&gt;

Defines a label for a form control
STF



&lt;legend&gt;

Defines a title in a fieldset
STF



&lt;li&gt;

Defines a list item
STF



&lt;link&gt;

Defines a resource reference 
STF



&lt;map&gt;

Defines an image map 
STF



&lt;menu&gt;


Deprecated. Defines a menu list

TF



&lt;meta&gt;

Defines meta information
STF



&lt;noframes&gt;

Defines a noframe section
TF



&lt;noscript&gt;

Defines a noscript section
STF



&lt;object&gt;

Defines an embedded object
STF



&lt;ol&gt;

Defines an ordered list
STF



&lt;optgroup&gt;

Defines an option group
STF



&lt;option&gt;

Defines an option in a drop-down list
STF



&lt;p&gt;

Defines a paragraph
STF



&lt;param&gt;

Defines a parameter for an object
STF



&lt;pre&gt;

Defines preformatted text
STF



&lt;q&gt;

Defines a short quotation
STF



&lt;s&gt;


Deprecated. Defines strikethrough text

TF



&lt;samp&gt;

Defines sample computer code
STF



&lt;script&gt;

Defines a script
STF



&lt;select&gt;

Defines a selectable list
STF



&lt;small&gt;

Defines small text
STF



&lt;span&gt;

Defines a section in a document
STF



&lt;strike&gt;


Deprecated. Defines strikethrough text

TF



&lt;strong&gt;

Defines strong text
STF



&lt;style&gt;

Defines a style definition
STF



&lt;sub&gt;

Defines subscripted text
STF



&lt;sup&gt;

Defines superscripted text
STF



&lt;table&gt;

Defines a table
STF



&lt;tbody&gt;

Defines a table body
STF



&lt;td&gt;

Defines a table cell
STF



&lt;textarea&gt;

Defines a text area
STF



&lt;tfoot&gt;

Defines a table footer
STF



&lt;th&gt;

Defines a table header
STF



&lt;thead&gt;

Defines a table header
STF



&lt;title&gt;

Defines the document title
STF



&lt;tr&gt;

Defines a table row
STF



&lt;tt&gt;

Defines teletype text
STF



&lt;u&gt;


Deprecated. Defines underlined text

TF



&lt;ul&gt;

Defines an unordered list
STF



&lt;var&gt;

Defines a variable
STF


&lt;xmp&gt;

Deprecated. Defines preformatted text]]>[...]</description>
	                	<pubDate>September 29 2008 15:20:00 EST</pubDate>
	                	<link>http://geeksneversleep.com/page/html-tags</link> 
	            	</item><item> 
	                	<title>Hypertext Mark-up Language</title> 
	                	<description><![CDATA[The World Wide Web. The Information Super-Highway. The Internet. The Web. Call it what you want. The last may be the most appropriate. This unique phenomenon, this colossal yet invisible web of shared information and creativity has steadily been woven into almost every facet of our lives. Many young people today probably can&#39;t even conceive of a time when a person couldn&#39;t 
instantly connect to the information he or she wanted or contact another person thousands of miles away in a split-second.


And in a real sense, all this is made possible, in no small part, by something as simple as a specially-formatted shared document, utilizing what we call HTML, or HyperText Mark-up Language.




Overview


Intro


Advantages


Drawbacks


Definition




Topics


File structure




Summary



A Word from Our Sponsors...                  

If you really want to learn the ins-and-outs of web design, I strongly suggest you visit the awesome folks at W3Schools.com. That site has just about everything there is to know about proper web page development. I am merely going to paraphrase some of what I learned there and elsewhere.


So, let&#39;s get into the good stuff, shall we?

File Structure

Here is a sample web page I put together for your viewing pleasure. Check it out, then continue 
reading below.

&bull; samplepage.html


&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Page Title Goes Here&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;/body&gt;
&lt;/html&gt;


Break It Down!

So, let&#39;s talk about each part now, aye?


Each word you see surrounded with these brackets, &lt; &gt;, is what is known as an element tag. The element tag, or simply tag, denotes a special area within the document. The assorted tags tell the program responsible for parsing, or interpreting, the document to apply certain attributes to the text contained within that element&#39;s range of influence. This range is determined by specifying the beginning and end tags, like so:


&lt;tag name&gt; Stuff goes here &lt;/tag name&gt;


In this example, the element begins with &lt;tag name&gt; and ends with &lt;/tag name&gt;. Everything in between is affected by any special attributes applied to this element, such as text-alignment, font-size, etc.


If you look at samplepage.html above, you will see that it has four unique tags: &lt;html&gt;, &lt;head&gt; &lt;title&gt;, and &lt;body&gt;. 


The &lt;html&gt; tag is like a wrapper tag; it
surrounds the entire web document. Any text outside of the &lt;html&gt; tag will either be ignored, or displayed without any special formatting applied to it, depending on the browser being used.


Next comes the &lt;head&gt; tag. This part of the web document is not displayed in the user&#39;s web browser. It is used to link the current page to other documents or to specify special rules to apply to the document. It also will normally contain a &lt;title&gt; tag. This instructs the browser to 
display a specific page title in the browser&#39;s title bar. This is useful if the web site has many pages with similar content, so that the user does not get lost in the site.


The last, but in some ways most important tag, is the &lt;body&gt; tag. It is here that all of the viewable text is placed. This is the part of the web document that a user actually sees in his or her browser.


With these four simple tags, it is possible to build a perfectly valid, if completely vanilla, web document. 

Do You Want to Know More...?

Check out the tag list if you want to see all of the available HTML tags.

A More Robust Sample

Okay, now that you have a general idea of what a web page is, let&#39;s make a more real-life example, hmm? We want to create a page similar, to, say... this page! Yeah!


First off, let&#39;s look at how this page is organized. There&#39;s the fancy site graphic up top. We have a nice little menu for navigation (which I happen to embed in the site logo). Then we have this awesome content, followed by the stuff on the bottom, like last updated, copyright, blah blah 
blah...


Since those parts listed above all describe different sections of the page, I section them off in my code. This is easy to do; simply create a &lt;div&gt; element for each section, like so:

&bull; samplepage.html, Part 2


&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Page Title Goes Here&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;!-- header --&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;!-- navigation --&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;!-- content --&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;!-- footer --&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;



Pretty cool, eh? DIV tags are nice, since they can styled in just about any way imaginable, yet do not have much in the way of default attributes, unlike, say, &lt;p&gt; tags (paragraph elements).


So now what?, I hear some of you ask. Well, that&#39;s all up to you! The header element usually contains the image(s) and/or title you use to identify your site. Use the image tag, &lt;img&gt;, to add an image, and you can either type your site title into the &lt;div&gt; tag directly or add a &lt;p&gt; element first, then type your text into that. The navigation section should have link tags, &lt;a&gt;, with links to each page on your site. The content section should be self-explanatory. And the footer section is normally used for such things as copyright dates, links to validators, etc.


Here&#39;s a rather simple example of what I&#39;m talking about:

&bull; samplepage.html, Part 3


&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Page Title Goes Here&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;!-- header --&gt;
&lt;div&gt;
&lt;img alt= src=assets/logo.png &gt;
&lt;p&gt; My Sample Site &lt;/p&gt;
&lt;/div&gt;
&lt;!-- navigation --&gt;
&lt;div&gt;
&lt;a href=index.html&gt; Home &lt;/a&gt;
&lt;/div&gt;
&lt;!-- content --&gt;
&lt;div&gt;
&lt;h1&gt; Welcome &lt;/h1&gt;
&lt;p&gt; This is my sample site. Isn't it nice? :) &lt;/p&gt;
&lt;/div&gt;
&lt;!-- footer --&gt;
&lt;div&gt;
&lt;p&gt; &copy;2008 All rights waived. &lt;/p&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;



And that is about all I will show you, for now. I will put together a better step-by-step tutorial for those who want it...]]>[...]</description>
	                	<pubDate>September 28 2008 00:30:00 EST</pubDate>
	                	<link>http://geeksneversleep.com/page/Hypertext-Mark-up-Language</link> 
	            	</item><item> 
	                	<title>Object-Oriented Programming</title> 
	                	<description><![CDATA[Object-oriented programming centers around the idea that everything can be represented as an object. Each object has characteristics, represented programmatically as variables, and actions it can perform, represented programmatically with subroutines and functions.


While syntax will vary, every object-oriented programming (OOP) language conforms to certain standards. What this means is that if a programmer learns the basic premises of OOP, namely encapsulation, polymorphism, and inheritance, he or she should be able to successfully adapt to any OOP programming language.




Intro


Topics


Encapsulation


Polymorphism


Inheritance




Summary


Comments




The Basics


Since understanding encapsulation, polymorphism, and inheritance are important keys to correctly grasping the idea of OOP, I will take a moment here to explain a little bit about each of these points.


Encapsulation


Encapsulation revolves around one central tenet: only the object in which the variables, subroutines, and functions are contained should have access to those items, unless an outside object is explicitly given access. This is defined by the item&#39;s accessibility level. The syntax varies slightly depending on the language you are using, but every language seems to agree on the two most basic accessibility levels: private and public.


Private elements can only be accessed by the code in which they are defined. Public elements can be accessed by any code into which our original code is embedded. 


There are also intermediate stages of accessibility that exist between private and public: shared,static, friend, protected, and  protected internal being the first to come to mind. I am sure there are other terms in other languages, but they all boil down to have the same meaning.


I know this all sounds a bit vague, but I want to avoid using specific references unless I am discussing a specific language.


Polymorphism


Polymorphism is a fairly simple concept. It means that one object can be adapted to suit new requirements, should the need arise. It always best to create your objects with re-usability in mind.


Polymorphism is achieved programmatically through the use of overrides and overloads. The syntax is slightly different for each language, so I'll cover that in each section. Overrides replace an existing method, function, or subroutine with another of the same name. This occurs most often during inheritance.
Overloads provide additional implementations of one method, function, or subroutine. Overloading occurs most frequently when creating object constructors. Constructors are special functions that are called when we create a new instance of our object, and are used to set our new object&#39;s attributes to a known state. 


Inheritance


Inheritance is the concept that confuses many new programmers. Inheritance centers on the principle of starting with a base object and building on that object to create new objects. Anthropology students should recognize this idea fairly quickly, as it is very similar to the theory of evolution. Each succeeding evolution of the base object adds more functionality or more characteristics to the original object. The new object will have most of the characteristics (depending on the accessibility level I mentioned previously) of the base object, plus it&#39;s own unique characteristics.


Classes


Most OOP languages implement OOP through the use of classes. Wikipedia has a good definition of what a class is: 



In object-oriented programming, a class is a programming language construct that is used as a blueprint to create objects. This blueprint includes attributes and methods that the created objects all share.



I really like their use of the term blueprint, because it is a very accurate analogy for how classes are used. When we create a class file, we are defining what our object is and does, but we do not have a real object to manipulate. When we want an object to manipulate, we construct (create) an instance of our class, which then has all the attributes and abilities our blueprint says it should. If it helps, think of our class file as a stamp press machine. When we create an instance of the class, it is like we are having the machine stamp out a part for us...


Summary


Object-oriented programming is a method used to represent real-word objects electronically in a way that allows a user to apply logic to manipulate those objects.]]>[...]</description>
	                	<pubDate>September 27 2008 00:59:00 EST</pubDate>
	                	<link>http://geeksneversleep.com/page/Object-Oriented-Programming</link> 
	            	</item><item> 
	                	<title>Generic Code</title> 
	                	<description><![CDATA[Generic code, otherwise known as Pseudo-code, is simply writing out the logic of your program in plain text. This can be as basic as:



Start Program

Get Input From User
Perform Calculations
Display Results

End Program



or, for those wanting something a bit more complicated:



Begin Program

&#39; Declare variables to hold user data.
string user_name
integer user_age
                    		
&#39; Get user&#39;s name and age.
Print Please enter your name: , Store to user_name
Print Please enter you age: , Store to user_age

&#39; Echo input back out to screen.
Print Thank you, , user_name, !
Print The age you entered was: , user_age, .
Print 

&#39; Echo message out to user before terminating program.
Print Press any key to end program...

End Program
.


Well, that&#39;s neat, but why would I do that?


Pseudo-code is normally used in conjunction with UML during the planning stage of your program. Note the implied suggestion here: plan before you code! While it is possible to simply sit down and start hacking out code in you favorite editor, it is a bad habit to get into.


In my personal experience, lack of planning always led me to redundant code and/or bad logic. The time I wasted going back and forth between errors could have been dramatically lessened if I had simply spent a little more time planning out what I wanted my program to accomplish.

This seems like a lot of work...

At first, it probably will be. After all, if you knew what you were doing, why would you be in class? Silly...


What I believe you will eventually discover is that the process of diagramming and pseudo-coding becomes second nature. You will be able to put together a mock-up of your program quickly, present it for approval, and be coding in short order. And THAT, my friends, makes potential employers happy... :)]]>[...]</description>
	                	<pubDate>September 26 2008 00:00:00 EST</pubDate>
	                	<link>http://geeksneversleep.com/page/Generic-Code</link> 
	            	</item><item> 
	                	<title>Tutorial One | HTML &gt;&gt; PHP</title> 
	                	<description><![CDATA[Welcome! For those of you stumbling onto this page, this is the first in a series of articles where I walk through creating a simple website for a fictional friend of mine. We will start with the complete HTML source for the index page, and then analyze it to determine which parts can be repeated in our other pages. Then, we will create a dynamically -generated PHP index page from the original HTML source.



Overview 
Step:

Original HTML 
Snipped Sections 
PHP Final Document 


Summary 
Comments 



&bull; index.html

So, let us get this party started, right? Okay! What you see below is the HTML of our friend Louie&#39;s index page. It&#39;s not too fancy. Take a look here, then come back and read the next section.


&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/
xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&nbsp;&nbsp; &lt;link rel="Stylesheet" type="text/css" href="design-by-louie.css"
media="screen" /&gt;
&nbsp;&nbsp; &lt;link rel="shortcut icon" type="image/x-icon" href="favicon.ico"
/&gt;
&nbsp;&nbsp; &lt;title&gt;Design by Louie | Home&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&nbsp;&nbsp; &lt;div id="header"&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &lt;a href="index.html"&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;img alt="" src="images/louie-logo.png"
/&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &lt;/a&gt;
&nbsp;&nbsp; &lt;/div&gt;
&nbsp;&nbsp; &lt;div id="bodytext"&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &lt;div&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;p&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;span class="de1"&gt;DESIGN&lt;/span&gt;&lt;span
class="de2"&gt; | by Louie&trade;&lt;/span&gt;.
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; Creating custom, clean imagery
for everyone. Bold, but understated. Bright, not flashy. Set your

&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; brand apart from a sea of monotonous
look-alikes. Get &lt;span class="de1"&gt;DESIGN&lt;/span&gt;ed.
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;/p&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &lt;/div&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &lt;div id="navigate"&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;ul&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;li&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;a href="stock-images.html"&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;img
alt="" src="images/stock.png" title="Browse Louie&#39;s pre-made imagery." /&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;br
/&gt;Stock Imagery...
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;/a&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;/li&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;li&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;a href="custom-design.html"&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;img
alt="" src="images/custom.png" title="Request a custom design." /&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;br
/&gt;Custom Design...
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;/a&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;/li&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;li&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;a href="about.html"&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;img
alt="" src="images/louie.png" title="Learn more about Louie." /&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;br
/&gt;Louie is...
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;/a&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;/li&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;/ul&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &lt;/div&gt;
&nbsp;&nbsp; &lt;/div&gt;
&nbsp;&nbsp; &lt;div id="footer"&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &amp;copy; 2008. All rights reserved.

&nbsp;&nbsp; &nbsp;&nbsp; &lt;small&gt;&bull;&lt;/small&gt; Last Update: May 5 2008.
&nbsp;&nbsp; &nbsp;&nbsp; &lt;small&gt;&bull;&lt;/small&gt; &lt;a href=""&gt;Valid
XHTML&lt;/a&gt;
&nbsp;&nbsp; &lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;



Not bad, eh? Louie is a minimalist. He likes things simple. As you can see, he has created zones in his code with ID&#39;d &lt;div&gt; tags, to separate the page into sections he can style separately. The header div will contain his site logo, which he has also made a link back to the index page. That is very common, since it gives our visitors a fail-safe way of getting back to the first page. Next, he defined a zone for the page content. Lastly, we see he has created a footer zone, where he can place his copyright information, the date this page was last modified, and a link to the W3C code validator.


Also, those of you with keen eyes may have noticed that there is some extra info
within the &lt;head&gt; tag. I will cover that in later tutorials, or you can go
here if you want to read what I have to say about CSS. Basically, it is a link to an external cascading stylesheet.


Analyze the Code

So, let&#39;s think about this page for a minute. What do we see that we will probably be able to reuse on the other pages? Hmm...


Well, we know that all that nice stuff above the bodytext div tag will be
the same on every page, with the exception of the title. So let&#39;s snip that
and place it in another file.


What else? We definitely know we will be re-using the code from the footer div on down, so snip that into another file...


And I would say that is it. You could argue that we need to make a separate file
for the section surrounded by the navigate div tag. But... this specific
setup will only be used on the index page. As you will see in later tutorials, the other pages will employ a similiar, but smaller, version of that menu.


So what do we have now? Look:


&bull; Snipped sections

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/
xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;

&nbsp;&nbsp; &lt;link rel="Stylesheet" type="text/css" href="design-by-louie.css" media="screen" /&gt;

&nbsp;&nbsp; &lt;link rel="shortcut icon" type="image/x-icon" href="favicon.ico"
/&gt;

&nbsp;&nbsp; &lt;title&gt;Design by Louie | Home&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;

&nbsp;&nbsp; &lt;div id="header"&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &lt;a href="index.html"&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;img alt="" src="images/louie-logo.png" /&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &lt;/a&gt;
&nbsp;&nbsp; &lt;/div&gt;



&nbsp;&nbsp; &lt;div id="bodytext"&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &lt;div&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;p&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;span class="de1"&gt;DESIGN&lt;/span&gt;&lt;span
class="de2"&gt; | by Louie&trade;&lt;/span&gt;.

&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; Creating custom, clean imagery for everyone. Bold, but understated. Bright, not flashy. Set your

&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; brand apart from a sea of monotonous look-alikes. Get &lt;span class="de1"&gt;DESIGN&lt;/span&gt;ed.
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;/p&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &lt;/div&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &lt;div id="navigate"&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;ul&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;li&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;a href="stock-images.html"&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;img alt="" src="images/stock.png" title="Browse Louie&#39;s pre-made imagery." /&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;br /&gt;Stock Imagery...
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;/a&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;/li&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;li&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;a href="custom-design.html"&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;img
alt="" src="images/custom.png" title="Request a custom design." /&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;br /&gt;Custom Design...
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;/a&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;/li&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;li&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;a href="about.html"&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;img alt="" src="images/louie.png" title="Learn more about Louie." /&gt;

&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;br
/&gt;Louie is...
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;/a&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;/li&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;/ul&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &lt;/div&gt;
&nbsp;&nbsp; &lt;/div&gt;



&nbsp;&nbsp; &lt;div id="footer"&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &amp;copy; 2008. All rights reserved.

&nbsp;&nbsp; &nbsp;&nbsp; &lt;small&gt;&bull;&lt;/small&gt; Last Update: May 5 2008.
&nbsp;&nbsp; &nbsp;&nbsp; &lt;small&gt;&bull;&lt;/small&gt; &lt;a href=""&gt;Valid
XHTML&lt;/a&gt;
&nbsp;&nbsp; &lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt; 

And now for the Maaaa-gic!

First, we need to save each of these files. I like to use obvious names. Also, each file is now saved as a .php file, which yields the best results for ensuring our php code is parsed correctly. So, we should now have: header.php, index.php, and footer.php.

And the page title?

We can take care of that issue with a simple PHP trick. First, we add a PHP zone to the top of the index.php page. Add a PHP start tag, like this: &lt;?php, and an end tag, like so: ?&gt;. In between we put this code: $page_title=DESIGN by Louie | Home. To wrap up our site surgery, go back to our header.php file, and where we see the text for the page title (the &lt;title&gt; tag), we replace that text with this: &lt;?php echo($page_title); ?&gt;.

&bull; Snipped Section, with added PHP

&lt;?php
&nbsp;&nbsp; $page_title=DESIGN by Louie | Home;

?&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/
xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&nbsp;&nbsp; &lt;link rel="Stylesheet" type="text/css" href="design-by-louie.css" media="screen" /&gt;
&nbsp;&nbsp; &lt;link rel="shortcut icon" type="image/x-icon" href="favicon.ico"
/&gt;
&nbsp;&nbsp; &lt;title&gt; &lt;?php echo($page_title); ?&gt; &lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&nbsp;&nbsp; &lt;div id="header"&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &lt;a href="index.html"&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &lt;img alt="" src="images/louie-logo.png" /&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &lt;/a&gt;
&nbsp;&nbsp; &lt;/div&gt;



&nbsp;&nbsp; &lt;div id="bodytext"&gt;
&nbsp;&nbsp; &nbsp;&nbsp; &lt;div&gt;
&nbsp;&nbsp; ...

&nbsp;&nbsp; ...
&nbsp;&nbsp; &nbsp;&nbsp; &lt;/div&gt;
&nbsp;&nbsp; &lt;/div&gt;



The last step is really quite simple. Simply add the php include directive to index.php whereever we want insert our new php files. Like so:


&bull;Finished Product: index.php

&lt;?php
&nbsp;&nbsp; $page_title=DESIGN by Louie | Home;

?&gt;

&lt;?php include(&#39