1

A+ Notes Part 1

-

Certification Training: A+ Notes Part 1

The 6-step Troubleshooting Process:
1) Identify the problem
2) Establish theory of probably cause
3) Test the theory to determine cause
4) Establish and implement a plan
5) Verify the fix
6) Document everything you do

Bridges
North Bridge: This is located close to the processor. The North Bridge handles communication between RAM, AGP and PCIE slots.

South Bridge: Located further away from the processor than the North Bridge.  The South Bridge handles slower communications such as: PCI, IDE and USB.

Fire classifications
Class A Fire: Orindary combustibles
Class B Fire: Flammable liquids and gasses
Class C Fire: Electrical equipment

Power Supplies
Most are between 120 and 240 volts.
Most are between 200 and 500 watts.
The current form factor standard of a power supply is ATX.

PC Cards
Type    Size      Used for
I           3.3in      Storage
II             5in      NICs, cellular cards
III   10.5mm      HDD

USB / Fireware Transfer rates
USB 1.1        12 Mbps
USB 2.0        480 Mbps
IEEE 1394    400 Mbps
IEEE 1394b    800 Mbps

Memory Pins
SIMM    72
DIMM    168
RIMM    184
SODIMM    144 OR 204

Cable lengths
Serial (RS232)       50 feet
USB                          9 feet
Parallel                   10 or 25 feet
Ethernet                  100-300 meters
ThinNet                   185 meters
ThickNet                  500 meters
Fiber Optic single mode    30 miles
Fiber Optic multi mode    2,000 kilometers

ertification Training: A+ Notes part 1

The 6 step Troubleshooting Process:
1) Identify the problem
2) Establish theory of probably cause
3) Test the theory to determine cause
4) Establish and implement a plan
5) Verify the fix
6) Document everything you do

Bridges
North Bridge
This is located close to the processor. The North Bridge handles communication between RAM, AGP and PCIE slots.

South Bridge
Located further away from the processor than the North Bridge.  The South Bridge handles slower communications such as: PCI, IDE and USB.

Fire classifications
Class A Fire
Orindary combustibles

Class B Fire
Flammable liquids and gasses

Class C Fire
Electrical equipment

Power Supplies
Most are between 120 and 240 volts.
Most are between 200 and 500 watts.
The current form factor standard of a power supply is ATX.

PC Cards
Type    Size    Used for
I    3.3in    Storage
II    5in    NICs, cellular cards
III     10.5mm    HDD

USB / Fireware Transfer rates
USB 1.1        12 Mbps
USB 2.0        480 Mbps
IEEE 1394    400 Mbps
IEEE 1394b    800 Mbps

Memory Pins
SIMM    72
DIMM    168
RIMM    184
SODIMM    144 OR 204

Cable lengths
Serial (RS232)        50 feet
USB            9 feet
Parallel        10 or 25 feet
Ethernet        100-300 meters
ThinNet            185 meters
ThickNet        500 meters
Fiber Optic single mode    30 miles
Fiber Optic multi mode    2,000 kilometers

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)
0

Certification Training: IP Address Classifications

-

Certification Training: IP Address Classifications

Class A
1.0.0.1 to 126.255.255.254
(Supports 16 million hosts)
Class B
128.1.0.1 to 191.255.255.254
(Supports 65,000 hosts)
Class C
192.0.1.1 to 223.255.254.254
(Supports 254 hosts)
Class D
224.0.0.0 to 239.255.255.255
(multicast groups)
(Unlikely to be tested on certification exams)
Class E
240.0.0.0.0 to 254.255.255.254
(strictly used for testing/research)
(Unlikely to be tested on certification exams)

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)
0

Chapter 2 – How to run Perl

-

Chapter 2 – How to run Perl

This quick guide was written towards Windows users.  Some modifications will have to be done for Linux or Mac users but this guide should still cover the basics.

Step 1:
Right click on Dekstop and select New>Text document

Step 2:
Rename the file as test.p;. PL is the Perl file extension.

Step 3:
Double click test.pl and enter the Perl codes as you see below. (start at the top of the document)

Step 4:
Click on your Start menu and click Run.  Type in cmd or command depending what version of Windows you are running.  Click enter.

Step 5:
If you are not on the Desktop, you need to navigate the command line until you’re on the desktop.

Step 6:
To run a perl script, you need to type in perl filename.  In our example, test.pl is our filename so we type in perl test.pl.  Click enter and the script should run.

VN:F [1.9.22_1171]
Rating: 8.0/10 (1 vote cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)
0

Chapter 18 – Introduction to Perl’s DB

-

Perl Tutorials – Chapter 18 – Intro To Perl’s DB

Perl has a number of built-in databases (or databases which can be used via modules) that are freely used to store data. Along with these databases, Perl can also connect to the major databases such as Oracle, MySQL and Excel.

Like everything else in Perl, TIMTYWTDI (There Is More Than One Way To Do It) so if you come from a scripting or programming background and have relational database experience, chances are you’d prefer the power of MySQL or Oracle over the built-in databases already available for you.

Each database comes at a price. The use of MySQL or Oracle can create initial overheard while it loads and connects to the appropriate DBIs to speak with the database. Unless the database is expected to get quite large or the script requires related data or advanced sorting techniques, using a flatfile database such as DB_File might be perform better.

Flatfile databases don’t have the overheard that relational databases do which makes them load faster and require less CPU processing power. These are great if you have only a few sets of data that needs to be saved such as traffic logs, usernames and passwords, dates, etc. There are limitations when it comes to information stored within a flatfile database. SDBM_File allows only a certain number of characters to be stored within a key or value.

If you were scraping web sites for data (let’s say lyrics for example), you’d exceed the character limitations in the database and the data stored would be truncated and thus be inaccurate. The other problem with flatfile databases is the ability (or lacktherof) to do advanced sorting on the data.

Relational databases have larger overhead and are a million fold more powerful than flatfiles while flatfiles process faster and require less code to perform.

In this tutorial we will be taking a brief look at Perl’s built-in database DB_File. These flatfiles are key/value pairs which sounds awfully too similar to the %hash datatype. Because of this, we store the contents of the database into our hash for manipulation or printing.


Calling the DB_File database

DB_File is the module DB_File.pm and is used like the CGI module or strict that you’re familiar with.

Before we can use the database, we need to tell our script to use the database module.

use DB_File;


Connecting to the DB_File database

Unlike relational databases which require usernames and passwords, the only information needed to connect to DB_File is the name of the variable you’re tying to it, the database name and location and the file permissions of the database.

my %db;
my $storage = “counter.db”;

tie %db, “DB_File”, “$storage”, O_CREAT|O_RDWR, 0644,
or die “Cannot open file $storage: $!\n”;

Above, we are declaring %db so we can tie it to the database. The scalar $storage is the database name and location. If there isn’t a file path within the $scalar assignment, it will assume the database is in the same directory as the script that’s running.

Next, we are tieing our variable %db from above TO the database DB_File which is followed by the variable $storage which contains the filename and location of the database. O_CREAT|O_RDWR, 0644, are the file permissions used on the database. Be careful not to give out too many permissions or other people will be able to tamper with your data. 0644 or 0666 is generally as high as you want to go to keep the database relatively secure.

Some, or all, of the parameters can be left out when connecting to DB_File. For example, the following two snippets are identical.

tie %db, “DB_File”, $storage, O_CREAT|O_RDWR, 0666 ;

tie %db, “DB_File”, $storage;

 

Tying variables

When using databases such as DB_File and SDBM_File, variables are tied to the contents of the database. This is to say, when %db is tied to $storage using DB_File, the hash %db contains all the data inside %storage.

Similar to filehandles, data is read from and written to the database using the variable tied variable instead of speaking to it directly. Since the data is stored within our hash variable, it makes data retrieval and manipulation simple.


Using the stored data

The tied variable to the DB_File database is a hash. The hash is no different than any other hash you’ve used within your scripts.

To print out all the contents, a foreach() loop could iterate over all the key/value pairs like so:

foreach my $key (%db)
{
  print “$key => $key{$key}<br>”;
}

Saving the information to the database is identical to the procedure used to add another key/value pair to the original hash. Just create a unique hash key and assign it a value. If the hash key already exists, the previous value will be overwritten with the new information.

$db{“username”} = “password”;

If the database was designed for usernames and passwords, you could check to see whether or not a username (key) exists using an if conditional.

if (exists $db{“username”})
{
  # do this
}


Joining and Splitting

When using flatfile databases associated in key/pair values, we are limited in how much information we can store for each key in order to keep the information grouped together.

The previous example was a username/password combination which would run cleanly. But if you wanted to store more than just one piece of information to the value, joining the data to save and splitting it back into usable variables when you need it is the workaround.

Our scenario: We have an employee database where the key is an employee ID number and the value consists of their name, hourly wage, position and their favorite caffeinated beverage.

%employees = (“100″ => “Fred Flinstone::14.08::scribe::coffee”, “101″ => “Lisa Simpson::23:17::educator::red bull”);

From the hash (assume it’s the database), the value of employee 100 is Fred Flinstone::14.08::scribe::coffee.

All these values are contained within one inseparable string, right? Wrong. When the information is grouped together with a common delimiter the string can be broken up into smaller variables. The most commonly used delimiter is a double colon :: but if the data being stored can contain ::, a different delimiter is required or the data will be broken prematurely.

Take for instance:

$db{“100″} = “Fred Flintstone::14.08::scribe::coffee”;

There are 4 groups of information within the single value which means we’ll create 4 new variables and split() on the common delimiter.

my ($name, $pay, $position, $drink) = split(/::/, $employees{“100″});

The first step is to create meaningful scalar variables which the splitted results will be assigned to. These new variables are assigned (in order they care created!) to the value of the splitted value our hash key 100. Inside split(/ /) is the delimiter in which to separate the data. If two 8s were used as delimiters, it would have looked like

split(/88/,

After the values are extracted into the new variables, they are accessible anywhere throughout the rest of the script.

use DB_File;

my %db;
my $storage = “employees.db”;

tie %db, “DB_File”, $storage;

my %employees = (“100″ => “Fred Flinstone::14.08::scribe::coffee”, “101″ => “Lisa Simpson::23:17::educator::red bull”);

my ($name, $pay, $position, $drink) = split(/::/, $employees{“100″});

print “Their name was $name, their pay was $pay, their position was $position and their favorite drink is $drink”;

Joining information into one storable string is the same idea but is in reverse of the split().

The variable is assigned to the conjoined values of the list of strings or variables at the end of the assignment. Similar to split(), the delimiter to join on is specified before the variables or strings.

my $single_string = join(“::”, $name, $pay, $position, $drink);

print $single_string;

The printout would look something similar to: Superman::1000::superhero::kryptonite. Then to assign the new string back into our database, we’d use the hash assignment.

$employees{“102″} = $single_string;

 

A complete example

#!/usr/bin/perl

use warnings;
use strict;

use CGI qw/:standard/;
use DB_File;

my %db;
my $storage = “employees.db”;

tie %db, “DB_File”, $storage;

my %employees = (“100″ => “Fred Flinstone::14.08::scribe::coffee”, “101″ => “Lisa Simpson::23:17::educator::red bull”);

### example of splitting
my ($name, $pay, $position, $drink) = split(/::/, $employees{“100″});

print “Their name was $name, their pay was $pay, their position was $position and their favorite drink is $drink”;

### example of joining

my $single_string = join(“::”, $name, $pay, $position, $drink);

print $single_string;

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)
1

Chapter 17 – Perl CGI Introduction

-

Chapter 17 – Perl CGI Introcution

Perl’s gateway to cyberspace is CGI (Common Gateway Interface). Perl scripting is for scripting for your own computer, CGI scripting is for web servers and web sites.

The main difference between Perl and CGI (though CGI in essence is just a series of Perl modules) is CGI is generally object oriented. If the thought of using objects frightens you, rest assured you’re not required to use that format.

When you get into using different modules, many modules are object-oriented so you’ll need to look up the documentation before you’ll be able to use their code.

Initial script setup

To make your Perl scripts CGI, you use the CGI module

use CGI qw/:standard/;

The top section of your scripts would look something like

#!/usr/bin/perl

use warnings;
use strict;
use CGI qw/:standard/;

The first thing you need to know when using CGI (remember there are more than one way to do things. There are other ways to use the CGI module or get around it completely by typing out all the HTML for your web site) is the need to print out the HTTP Headers.

This is done by

print header, start_html();

Before you print() anything out to the browser you must print out the headers. It may be easier to put this code near the top of your script if your script allows it. If you attempt to print out information before the headers are set, you’ll get an Internal Server Error (ISE).

Your Perl-ish errors won’t work in CGI, if you have a missing semicolon on line 159 or you didn’t predeclare a variable name under the strict pragma. To turn on CGI warning we use fatalsToBrowser which will show us any and all Perl-ish errors. This will only catch errors that occur after you initialize the warnings which means if you setup warnings on line 7 and the error is on line 5, you’ll get an Internal Server Error (ISE) instead of a real error message.

Because of this, if you choose to use this while creating your CGI script it should be setup near the top of the script. Please note: when writing your script it is encouraged you use the fatalsToBrowser but once the script is live you should remove it. The error message could possibly give away too much server information to potential computer wannabe hackers.

#!/usr/bin/perl

use warnings;
use strict;

use CGI qw/:standard/;
use CGI::Carp ‘fatalsToBrowser’;

print header, start_html();


Printing to browser

Printing to the browser is no different than printing to the command line. You print() your strings using print “”; as you can see below. Any text or variables you decide to print will appear in the user’s browser.

The only difference here is your ability to output your data any way you wish. Since you can now use HTML, you can align your text using tables, make links, change font sizes and colors or even print out JavaScript as well.

print “Hello, CGI World!”;

If you’re not using CGI’s object oriented (OO) interface you’ll need to be careful not to nest unescaped quotes inside of quotes when you are printing out HTML. Take, for instance, assigning a font color. The HTML code would be :

print “<font color=”red”>Hello, CGI World!</font>”;

This would result in incorrect syntax. When printing out HTML there are three ways you could accomplish the same thing.

The first being print qq(). printqq() represents printing a quoted quote string. You nest your string in parenthesis so the quotes from the HTML won’t affect your script.

print qq( <font color=”red”>Hello, CGI World!</font>);

The second way of printing HTML to the screen is escaping the quotes. Using this method will often make your text less readable and harder to maintain so this is the least recommended. The escape character is the / slash. You place this in front of the nested quotes.

print “<font color=/”red/”>Hello, CGI World!</font>”;

The third and final way to print HTML without having to worry about quotes is using herdocs. This method is recommended if you have more than one line of output to print at a time.

A heredoc allows you to print as many lines as you want with only one print statement. You know longer need to use the enclosing quotes or semicolons when you use herdocs which makes this the fasted method to printout mass amounts of HTML or even text output.

You print to a filehandle which you create in caps. In our example we used ENDOFPRINT which could have been ENDOFFILE, EOF, FORM or even CAT. You can name this nearly whatever you want but keep it all A-Z characters for simplicity.

All lines between the print line and the line at the very bottom that contains just the ENDOFPRINT (or whichever filehandle you used) will be printed. Note: the closing filehandle must be on it’s own line with no trailing spaces and at least one full blank line below it.

print <<”ENDOFPRINT”;

<font color=”red”>Hello, CGI World!</font>
<center><h2>We are line #1</J2></center>
<table border=”1″ width=”50″>
<tr>
<td>I am inside a table!</td>
</tr>
</table>

ENDOFPRINT

 

Ending the CGI script

Once all the data is printed to the browser you need to close off the HTML tags. the print header, start_html() from earlier prints out the beginning HTML tag, all the HEAD information and the starting BODY tag.

When you’re done, you need to close off the BODY aznd the HTML tag. Like with everything else in Perl and CGI, there is more than one way to do it (TIMTOWTDI).

You can hard code the closures yourself within a basic print statement.

print “</body></html>”;

Or you could use the CGI function of end_html; neither are suggested over the other, it’s all a principle of coder’s preference.

print end_html;


Uploading the script

In order for CGI to work, the web server you are working on has to have CGI enabled. If they do, you should already have a cgi-bin directory within your main HTML directory. All of the CGI scripts you develop or install need to inside the cgi-bin folder.

Once the script is uploaded, you’ll need to chmod the file (set the file permissions) to 755. If you don’t know how to do this, consult your FTP client’s help menu. 655 isn’t enough permissions to run CGI scripts and 777 is giving away too many rights. Regardless of what the author of the script says, never set the permissions higher than 755.

 

Setting the header information

Many times the CGI script will be a standalone complete script. This means you may have to create more specific header information such as the title, meta content, header type, the CSS files, etc.

print start_html (
-title=>”title of your page goes here”,
-base=>”true”,
-target=>”_blank”,
-meta=>{“keywords” =>”keywords go here”,
“copyright” =>”copyright 1996 King Tut”,
“description”=>”descript info”},
-style=>{“src” =>”/location/of/css.css”}, -BGCOLOR=>”gray”);

Note this isn’t a complete list of the header information you can customize within CGI but this should give you. If you need more information, consult your favorite search engine and search “cgi.pm” tutorials.

The CGI attributes are named after the HTML equivalents so they are pretty self explanatory.

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)