T
The Ownage
Guest
I have started a guide about these things. Some of these may confuse you, but you will get the hang of it soon.
Note : Some of these guides are not made by me, so I will not take full credit of it.
C++ - The Tutorial Guide:
Preface:
Before we start I have a few tips for programming beginners:
1: Get yourself a friend that knows c# well. Either it be in real life or via msn or irc, etc I have a few friends on irc and msn that have taught me well.
2: Practice the same code. Go over and over every code that you write, put it in a notebook, and do it until you understand what it means and can write it fine.
3: Don't give up. I have never learned a programming language before, and quit on a few others because I didn't know how. It may be hard at first, but stick to it.
4:Take it step by step. Don't skip over things. For example, I started by printing a simple code that prints a number on your screen. I then moved up to a program that prints the values of 2 numbers in addition. I then changed the code to add/divide/multiply/subtract. Now I am currently writing code that asks the user for 2 numbers and an operation. It then calculates. Once I have that setteled. I will move on.
Now for the good stuff .
Section A:
Your first program. Ok, now you should be ready. I hope you have a compiler. Either get ms visual c# or Sharp develop (free) google them. You will find some links .
Now, open a new project and do the following:
Now save and compile. There you have it! your first program. It should print hello world to your screen in a dos box, and close when you press enter.
Now that didn't kill you, did it?
I will post more about this soon enough. Now moving onto Javascript.
The Concept
This first script is meant to introduce you to the very basics of creating and placing a JavaScript on your page. During the deconstruction, you'll be given a few do's and don'ts when writing JavaScript.
The concept of this script is to use JavaScript to place text on a Web page. In this case, the text will be red.
Here's the first script:
The Script
The Script's Effect
Deconstructing the Script
Since this is the first script, it's fairly easy, so allow us to take some time here to discuss JavaScript in general.
What Is Java Script?
First off, it is not Java. It's easy to get confused and think that Java and JavaScript are one in the same. Not so. Java is a programming language developed at Sun Microsystems. JavaScript, on the other hand, was created by the good people at Netscape.
The two are similar in that they are both what are known as Object Orientated Programming (OOP). That means that you build smaller objects that make up the whole. That will make more sense as we go on. The main difference is that Java programming can create fully stand-alone events. A Java "applet" (so-called because it's a small application) may run on a Web page, but is actually a fully contained little program. In addition, Java cannot run as text. It must be "compiled" into what's known as a "machine language" before it can be run.
JavaScript is close to Java in that Netscape sort of pared down Java into an easier set of commands. JavaScript cannot stand alone. It must be running inside of a Web page, and the Web page must be displayed in a browser that understands the JavaScript language, like all Netscape browsers 2.0 and above.
Writing JavaScript
First off, remember that JavaScript is not HTML! I am often asked if one is simply a different version of the other. Nope. However, when writing JavaScript, you follow a lot of rules that are similar to the rules of writing HTML.
First off, the JavaScript goes inside the HTML document. We'll get into placement later. JavaScript is saved as text right along with the HTML document.
The major difference between the two is that HTML is very forgiving in terms of its shape. White space means nothing to HTML. How much space you leave between words or paragraphs doesn't matter. In fact, there's no reason why you couldn't write an HTML document as one long line. It doesn't matter.
The opposite is true in JavaScript. It does have a shape. There are some times when you can break the shape of a script, but not very many. For instance, the second line of the script in this primer looks like this:
document.write
That's its shape and it must remain in that shape. Let's say you paste this into a text editor with small margins. When you paste it, the margins jump the line down so it now looks like this:
document.write
You have altered the form and this script will now throw an error (we'll get into errors and fixing them in the next lesson).
Editing JavaScript
Whether you're editing or writing script, you can not allow margins to get in the way. Always edit your work in a text editor that has no margins. I don't mean margins set to their widest point. I mean NO MARGINS. You should be able to write off of the right side of the text screen for miles. Doing it any other way is going to cause you problems.
Is JavaScript Case Sensitive?
Yes.
Back to the Deconstruction
Let's start at the top. The first line of text looks like this:
That's HTML code to alert the browser that what immediately follows is going to be a JavaScript script. That seems simple enough. All JavaScripts start with this exact command.
But what about that LANGUAGE="JavaScript" deal? Do you really need that? Yes. There are other types of scripts, VBS and LiveScript for example. Using that LANGUAGE sub-command will keep it all straight in the browser's mind.
Since we're only dealing with three lines of text here, allow me to jump right to the end. This:
</SCRIPT>
...ends every JavaScript. No exceptions. Now, put that on a brain cell. That's the last time those two commands will be discussed. Remember, start with <SCRIPT LANGUAGE="javascript"> and end with </SCRIPT>. Moving forward...
Now we hit the meat of the script:
This script is simple enough that you can just about guess what each little bit does, but let's go over it anyway so that we're all speaking with the same common terms.
The script follows this path, the DOCUMENT (the HTML document) is announced. The document will be altered by WRITE-ing something to it. What will be written to the document is inside the parentheses.
Now some terms. The DOCUMENT above is what's known as an "object". The WRITE that follows, separated by a period, is what is known as the object's "method." So, the script is basically saying, take the object (something that already exists) and write something to it.
The text inside of the parentheses is called the method's "instances" or what will be done when the method is acted upon the object. With me so far?
Notice that what is inside of the parentheses is encased in quote marks. In HTML, those quote marks are not required. Here, they are. You must use them.
The text inside the quote marks is simple HTML. You should recognize the text as a FONT command that will turn text red. Notice that the quote marks around the HTML code are single quotes. They have to be. If you use double quotes, then the JavaScript will think it has met the end of the line and you only get part of your text written to the object. And that will throw an error.
More guides coming over their way .
Note : Some of these guides are not made by me, so I will not take full credit of it.
C++ - The Tutorial Guide:
Preface:
Before we start I have a few tips for programming beginners:
1: Get yourself a friend that knows c# well. Either it be in real life or via msn or irc, etc I have a few friends on irc and msn that have taught me well.
2: Practice the same code. Go over and over every code that you write, put it in a notebook, and do it until you understand what it means and can write it fine.
3: Don't give up. I have never learned a programming language before, and quit on a few others because I didn't know how. It may be hard at first, but stick to it.
4:Take it step by step. Don't skip over things. For example, I started by printing a simple code that prints a number on your screen. I then moved up to a program that prints the values of 2 numbers in addition. I then changed the code to add/divide/multiply/subtract. Now I am currently writing code that asks the user for 2 numbers and an operation. It then calculates. Once I have that setteled. I will move on.
Now for the good stuff .
Section A:
Your first program. Ok, now you should be ready. I hope you have a compiler. Either get ms visual c# or Sharp develop (free) google them. You will find some links .
Now, open a new project and do the following:
Code:
using System;
class Hello
{
public class HelloWorld
{
public static void Main()
{
Console.WriteLine("Hello World! ");
Console.ReadLine();
}
}
}
Now save and compile. There you have it! your first program. It should print hello world to your screen in a dos box, and close when you press enter.
Now that didn't kill you, did it?
I will post more about this soon enough. Now moving onto Javascript.
The Concept
This first script is meant to introduce you to the very basics of creating and placing a JavaScript on your page. During the deconstruction, you'll be given a few do's and don'ts when writing JavaScript.
The concept of this script is to use JavaScript to place text on a Web page. In this case, the text will be red.
Here's the first script:
The Script
Code:
<SCRIPT LANGUAGE="javascript">
document.write
("<FONT COLOR='RED'>This Is Red Text</FONT>")
</SCRIPT>
The Script's Effect
This Is Red Text
Deconstructing the Script
Since this is the first script, it's fairly easy, so allow us to take some time here to discuss JavaScript in general.
What Is Java Script?
First off, it is not Java. It's easy to get confused and think that Java and JavaScript are one in the same. Not so. Java is a programming language developed at Sun Microsystems. JavaScript, on the other hand, was created by the good people at Netscape.
The two are similar in that they are both what are known as Object Orientated Programming (OOP). That means that you build smaller objects that make up the whole. That will make more sense as we go on. The main difference is that Java programming can create fully stand-alone events. A Java "applet" (so-called because it's a small application) may run on a Web page, but is actually a fully contained little program. In addition, Java cannot run as text. It must be "compiled" into what's known as a "machine language" before it can be run.
JavaScript is close to Java in that Netscape sort of pared down Java into an easier set of commands. JavaScript cannot stand alone. It must be running inside of a Web page, and the Web page must be displayed in a browser that understands the JavaScript language, like all Netscape browsers 2.0 and above.
Writing JavaScript
First off, remember that JavaScript is not HTML! I am often asked if one is simply a different version of the other. Nope. However, when writing JavaScript, you follow a lot of rules that are similar to the rules of writing HTML.
First off, the JavaScript goes inside the HTML document. We'll get into placement later. JavaScript is saved as text right along with the HTML document.
The major difference between the two is that HTML is very forgiving in terms of its shape. White space means nothing to HTML. How much space you leave between words or paragraphs doesn't matter. In fact, there's no reason why you couldn't write an HTML document as one long line. It doesn't matter.
The opposite is true in JavaScript. It does have a shape. There are some times when you can break the shape of a script, but not very many. For instance, the second line of the script in this primer looks like this:
document.write
Code:
("<FONT COLOR='RED'>This Is Red Text</FONT>")
That's its shape and it must remain in that shape. Let's say you paste this into a text editor with small margins. When you paste it, the margins jump the line down so it now looks like this:
document.write
Code:
("<FONT COLOR='RED'>This Is Red Text</FONT>
")
You have altered the form and this script will now throw an error (we'll get into errors and fixing them in the next lesson).
Editing JavaScript
Whether you're editing or writing script, you can not allow margins to get in the way. Always edit your work in a text editor that has no margins. I don't mean margins set to their widest point. I mean NO MARGINS. You should be able to write off of the right side of the text screen for miles. Doing it any other way is going to cause you problems.
Is JavaScript Case Sensitive?
Yes.
Back to the Deconstruction
Let's start at the top. The first line of text looks like this:
Code:
<SCRIPT LANGUAGE="JavaScript">
That's HTML code to alert the browser that what immediately follows is going to be a JavaScript script. That seems simple enough. All JavaScripts start with this exact command.
But what about that LANGUAGE="JavaScript" deal? Do you really need that? Yes. There are other types of scripts, VBS and LiveScript for example. Using that LANGUAGE sub-command will keep it all straight in the browser's mind.
Since we're only dealing with three lines of text here, allow me to jump right to the end. This:
</SCRIPT>
...ends every JavaScript. No exceptions. Now, put that on a brain cell. That's the last time those two commands will be discussed. Remember, start with <SCRIPT LANGUAGE="javascript"> and end with </SCRIPT>. Moving forward...
Now we hit the meat of the script:
Code:
document.write
("<FONT COLOR='RED'>This Is Red Text</FONT>")
This script is simple enough that you can just about guess what each little bit does, but let's go over it anyway so that we're all speaking with the same common terms.
The script follows this path, the DOCUMENT (the HTML document) is announced. The document will be altered by WRITE-ing something to it. What will be written to the document is inside the parentheses.
Now some terms. The DOCUMENT above is what's known as an "object". The WRITE that follows, separated by a period, is what is known as the object's "method." So, the script is basically saying, take the object (something that already exists) and write something to it.
The text inside of the parentheses is called the method's "instances" or what will be done when the method is acted upon the object. With me so far?
Notice that what is inside of the parentheses is encased in quote marks. In HTML, those quote marks are not required. Here, they are. You must use them.
The text inside the quote marks is simple HTML. You should recognize the text as a FONT command that will turn text red. Notice that the quote marks around the HTML code are single quotes. They have to be. If you use double quotes, then the JavaScript will think it has met the end of the line and you only get part of your text written to the object. And that will throw an error.
More guides coming over their way .