• Hi all. We have had reports of member's signatures being edited to include malicious content. You can rest assured this wasn't done by staff and we can find no indication that the forums themselves have been compromised.

    However, remember to keep your passwords secure. If you use similar logins on multiple sites, people and even bots may be able to access your account.

    We always recommend using unique passwords and enable two-factor authentication if possible. Make sure you are secure.
  • Be sure to join the discussion on our discord at: Discord.gg/serebii
  • If you're still waiting for the e-mail, be sure to check your junk/spam e-mail folders

C++, .NET, MySQL, Perl, Python etc. Help

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 :p .

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 ;) .
 

ricocheting

Noob Trainer
Admin
wow. not to be harsh, but i'm debating whether i'm more impressed with your cut & paste skills, the C# / C++ mixup, the MySQL-Perl-Python part, or the fact that you didn't credit any of the sources you ripped your post from.

thanks for trying though, something like this would be a good idea
 
T

The Mighty Darkspoon

Guest
In my experience, it's a lot easier to just work it out yourself. If ya wanna get to know this sorta stuff, pick a time when you're free for a long period and find a tutorial or book, and get experimenting. It's a lot easier to work through yourself than to let others 'get you started'. Nice idea, though.
 
T

The Mighty Darkspoon

Guest
Yeah but you can get much better results with C# or C++ (my personal pick). Whatever works best for you, I guess :)
 

ricocheting

Noob Trainer
Admin
Alyssa Picariello said:
visual basic .net is much easier language than C# in my option. ^_^

much easiser to understand. =p

visual basic will kill your programming skills and give you very bad habits if you are ever planning on moving on to other languages. in-and-of-itself it's an ok language and is fairly easy to learn. however, I personally loath VB more than any other "popular" language i've ever used (/me ignores the people who know what lisp is by putting in "popular")

C# on the other hand is very well organized and very often, if not most of the time, I can guess if I don't know exactly what I need and it will work because the language itself follows very logical syntax/properties/methods.

as to what's more powerful, all your .NET languages are pretty much exactly the same and the code itself is even interchangeable. however, anything made in .NET when compiled, the word "bloatware" comes to mind...
 
K

Kroko

Guest
Please do not revive old threads. But! Ownage how are you using custom avatars?! You may only do that when... You're a moderator or a administrator!
 

Virtual Headache

*~*~*~*~*~*~*~*~*
Nitrus said:
Please do not revive old threads. But! Ownage how are you using custom avatars?! You may only do that when... You're a moderator or a administrator!

it might have been an old thread but it's a sticky one, so I think it's allowed

I remember him being a Mod.
so after being dismodded, he didn't change his avatar so it's till a custom one

not for being so much off topic I have to say that I'm currently learning delphi at school.
I don't get better, because my teacher doesn't know so much about it. she is looking up nearly everthing in the help section of delphi.

I think teaching it myself will get my further^^
 

Ferret

Randomness on Toast
ricocheting said:
visual basic will kill your programming skills and give you very bad habits if you are ever planning on moving on to other languages. in-and-of-itself it's an ok language and is fairly easy to learn. however, I personally loath VB more than any other "popular" language i've ever used (/me ignores the people who know what lisp is by putting in "popular")
Aaaaaaaaaaaaaaaaaaaaaah! Someone who finally agrees with me!
I completely hate BASIC languages. They're worthless wastes of time, and teach awful skills.
They were attempting to teach V B in my IT course, and at one point I had to stand up and shout, "This language and bloody joke!" Not because I'm bad at it, because compared to everyone else I'm a damn professional, but because the whole thing is a disgusting lump of unstable ugly crap.

C# on the other hand is very well organized and very often, if not most of the time, I can guess if I don't know exactly what I need and it will work because the language itself follows very logical syntax/properties/methods.
Curly-bracket languages are where it's at. C, Perl, PHP, Java etc.
They do as they're told, they're elegant and very easy to work with.

as to what's more powerful, all your .NET languages are pretty much exactly the same and the code itself is even interchangeable. however, anything made in .NET when compiled, the word "bloatware" comes to mind...
Truth. The whole idea of .NET is nice and all, but when it comes down to it, the implementation is a bit shoddy.
 

chaos on the internet

AAAAAAAAAAAAAAAAAAAA
I have no clue why this is a sticky, especially when whats his face is giving C# code when the header says "C++."

They aren't nearly the same thing.
 
Ferret said:
I completely hate BASIC languages. They're worthless wastes of time, and teach awful skills.

I think it's not all that bad : P when come to teaching, because some people find it hard to focus on the language and the logic at the same time. The BASIC languages is quite useful to simplify the language for the meantime, like some people only know the structure of a program but hardly knows how the program works... especially in C++ when it comes to the ATI/graphics.

I would find it awful to teach (but I'm not doing teaching on that anyway, so I don't really bother :D) if I'm teaching people C++ straight away when they don't know the way it works.

I guess later on, it is abit pointless, but as a way of leading to programming, I think it gives a good idea for people about programming. ^_^
 
W

Wood00d

Guest
I am kind of a beginner. Here is a program I wrote on X code(for mac) to get teh volume of a cone. What is a parse error?
#include <iostream>
using namespace std;

int main () {
float pi,r,h,v,lo;
lo=(pi*pow(r,2)*h);
v=lo/3;
pi=3.14;
// insert code here...
cout << "Enter the height\n";
cin >> (h);
cout << "enter teh radius\n";
cin >> (r)
cout <<lo=(pi*pow(r,2)*h);
cout <<(v=lo/3);
cout <<(v);
return 0;
}
 
Last edited by a moderator:
Wood00d said:
I am kind of a beginner. Here is a program I wrote on X code(for mac) to get teh volume of a cone. What is a parse error?
#include <iostream>
using namespace std;

int main () {
float pi,r,h,v,lo;
lo=(pi*pow(r,2)*h);
v=lo/3;
pi=3.14;
// insert code here...
cout << "Enter the height\n";
cin >> (h);
cout << "enter teh radius\n";
cin >> (r)
cout <<lo=(pi*pow(r,2)*h);
cout <<(v=lo/3);
cout <<(v);
return 0;
}

I think Parse error is the same as Syntax error, see that line you've highlighted in red?

I haven't used X Code before, but I think the error is you've missed out an extra set of brackets.

i.e. it should be cout << (lo=(pi*pow(r,2)*h));, or if you've planned to display it, wouldn't it be with the inverted commas instead?

but if you're planning to display the outcome of that formula, why don't you just type in cout << (lo); instead? That would be better.


Another thing is that I'm not sure if you require the brackets, I haven't used it before, so don't know. Anyway, Try it ^_^

[EDIT]

Wait a second, isn't X Code just the Mac version of C++?

If that's the case, it should be:

cout << "Enter the height\n";
cin >> h;
cout << "enter teh radius\n";
cin >> r;
cout << "lo=(pi*pow(r,2)*h)"; (or cout << lo) (Look below!)
cout << "v=lo/3"; (or cout << v; if you want to display the number)
cout << v;
 
Last edited:
W

Wood00d

Guest
Thanks it works. hey, I have a fun program for you. You give objects to an emoticon and he interacts with them. It displays teh boolean expression too!

#include <iostream>
using namespace std;

int main () {
string a;
bool repeat;

// insert code here...
repeat = true;
cout << "@_@\n";
while(repeat){
cout << " i=ice cream\n n=nothing\n b=burrito\n t=terminate\n f=give a buudy\n s=souffle\n d=toy\n v=video game\n r=rocket\n";

cout << "what will you do?\n";
cin >> a;
if(a == "i" || a == "I")
{
cout << "<o ^O^\n";
cout << "<c ^_^\n";
cout << "< ^O^\n";
cout << "^_^\n";
}
else if(a == "n" || a == "N")
cout << "v-v\n";
else if(a == "b" || a == "B")
{
cout << "[ ] ^_^\n";
cout << " [[ ^O^\n";
cout << " [[ ^_^\n";
cout << " ^O^\n";
cout << "^_^\n";
cout << "*_*\n";
cout << "X_X\n";
cout << "You killed it you idiot.\n";
repeat = false;
}
else if(a == "t" || a == "T")
{
cout << "vov do you really want to go? Okay...\n";
repeat = false;
}
else if(a == "f" || a == "f")
{
cout << "hope he enjoys teh company...\n";
cout << "Awwww. It's a baby!\n";
cout << "@_@ ^_^\n";
cout << "^_^ +-|_|^o^ 'yay truck!'\n";
cout << "+x_x-|_| o_O\n";
cout << "->o'(harp music)' vov'too bad.'\n";
}
else if(a == "s")
{
cout << " [} ^o^\n";
cout << " [- -} @_@'?'\n";
cout << " [ ___ o_O\n";
}
else if(a == "S")
{
cout << "[} ^O^\n";
cout << "[ ^_^\n";
cout << "^o^ 'yummy!'\n";
}
else if(a == "d")
{
cout << ">->o OoO\n";
cout << ">->o>^)\n";
cout << ">->-^)\n";
cout << ">-> ^_^\n";
}
else if(a == "D")
{
cout << " >->o __[_I^I]\n";
cout << " >-> -o-[_I^I]\n";
cout << "^Io||Io^ ^_^\n";
}
else if(a == "v" || a == "V")
{
cout << " |_ >^\n";
cout << " |_ >*'!'\n";
cout << " |_ =/\n";
cout << "CRASH!!!!";
cout << " |_|--- ^_^\n";
}
else if(a== "r" || a== "R")
{
cout << "O >=> o\n";
cout << "o_O O|_|O\n";
cout << "o_O O|o|O'ruler'\n";
cout << "o_O O|o|O'okay, you're done with your term. Now you must die.'\n";
cout << "O <=<<<< o\n";
cout << "v_v\n";
}
else
cout << "o_O'what?'\n";

}
return 0;
}
 
Cool! ^_^

Keep it up! ^_^
 
W

Wood00d

Guest
objects?

IGP: Net Wanderer said:
Cool! ^_^

Keep it up! ^_^

Thanx. I'm working on a monster database, but I kneed to know how to include objects.
Can anyone help? @_@
 

chaos on the internet

AAAAAAAAAAAAAAAAAAAA
It's okay, but here is a suggestion:

a is always one character in length, so change it's type to "char" and encase what you are comparing it to with single quotes.

If you have any questions, i'll show up here occasionally. 6 years of C++ never hurt anyone..
 
Cool, 6 years of C++! ^_^

Oh yeah, I was wondering if you know how to get the 3D graphics working with DirectX in C++ or maybe know information on it? : P I'm troubling with that, only using OpenGL with a bit of help : P

Thanks in Advance ^_^
 
Top