Information Technology Student Society

Thursday, 8 October 2015

Chapter 2-5



Introduction to Networking
Basic Concept Of Networking

A computer networking  is defined as the interconnection of two or more computers and devices connected together via communication devices and transmission transmission media. For example it may connect computers,printers and scanners. Communication describes a process in which two or more computers, devices transfer data, instructions and information.
Advantages of Computer networks:
·        * Sharing of devices such as printer and scanner
·        * Sharing programs/ software
·         *Sharing data
·         *Sharing information
·         *Sharing single high-speed internet connection
·         *Better communication using internet services such as email, mailing list and  internet relate chat.
s     
       Disadvantages of Computer networks:
*The larger network the more difficult to manage it is to damage  
    
*If the network stop operating system, the it may not be possible to access various resources
  
*Computer viruses:  if any computer system in network gets affected by computer virus, there is a possible threat of the other systems getting affected too.

Types of Computer Network

      Local Area Network(LAN)- is a network that connects computer and devices in a limited geographically area such as home school, computer laboratory, and office

     Metropolitan Area Network(MAN)- is a high speed network that connectlocal area in Metropolitan Area such as city or town. A MAN typically includes one or more LAN but covers a smaller geographically area than WAN.

     Wide Area Network(WAN) - is a network that covers a large geographically area such as country or world. WAN combines many type f media such as telephone lines, cables and radio waves. A WAN can consists of two or more LAN conected together.


Personal Area Network(PAN) - is a computer network organized around an individual person. It generally consisting of a mobile computer network organized around an individual person.

Campus Area Network(CAN)- is made up of an interconnection of LAN with limited area . Network equipments such as switches, routers and the transmission media i.e. optical fiber etc. are almost entirely owned by the computers owner.

    Network Architectures
s    -is the over all design of the computer network that describe how computer network is configured and what strategies are being used. It also known as network model or network design

        Client/Server network + Peer to peer network =  Network architecture

      A network server is a computer designed to process request and deliver data to client.

     A client is a computer that retrieved information form the uses resources provided by the server.
   Intranet - is a private network within an organization that resembles the internet. Intranet is use to provide information to their employees. Typical application include electronic telephones, email, information internal job opening and much more

Extranet - is a private network that connects more than one organizations many organization use the internet technologies to allow suppliers, customers and business partner limited access to their network

Internet - a public network. It is worldwide collection of networks  that links million of business, government agencies, educational institute and individuals.


Physical Topology


-refers to the interconnected structure of a local area network (LAN). The method employed to connect the physical devices on the network with the cables, and the type of cabling used, all constitute the physical topology. This contrasts with logical topology, which describes a network's media signal performance and how it exchanges device data.

-Logical network topology is not always mapped to a specific physical topology. For example, twisted pair Ethernet is logical bus topology that is mapped to a physical star topology plan, while IBM's token ring is a logical ring topology that is physically implemented as a star topology.


Types of Physical Topology
BUS topology - is a network type in where every computer and network device is connected in single cable.
-it transmit data only in one direction
-every device is connected to a single cable.


RING topology- it is called ring topology because it forms a ring as each computer is connected to another computer, with the last one connected to the first.Exactly two neighbor for each device.
-a number of repeaters are used and the transmission is undirectional
-date is transferred in a sequential manner that is bit by bit.

STAR topology - In this type of topology all the computers are connected to a single hub through a cable. This hub is the central node and all others are connected to the central node.
-every node has its own dedicated connection to the hub.
-acts as a repeater for data flow
-can be used with twisted pair, Optical fibre or coaxial cable.


MESH topology- It is a point-to-point connection to the other node or devices. Traffic is carried between two devices or nodes which is connected.
-Partial Mesh : in this topology some of the systems are connected in the same fashion as mesh topology but some devices are only connected to two or three devices.
-Full Mesh- each and every nodes or devices are connected to each other.

Tree topology -It is a root node and all other nodes are connected to it forming a hierarchy. It is also called hierarchical topology. It should at least have three levels to the hierarchy.
-Ideal if workstation are located
-Used in World Wide Web.

HYBRID topology- It is two different types of topology which is a mixture of two or more topologies. For example if in an office in one dept. ring topology is used and in another star topology is used, connecting these topologies will result in Hybrid topology (ring and star topology.







Intro to Programming


Programming helps you understand the computers.
A set of rules that provides a way of telling a computer what operations to perform is called a programming language.

You may already have used software, perhaps for word processing or spread sheets, to solve problems. Perhaps now you are curious to learn how programmers write software.
program is a set of step-by-step instructions that directs the computer to do the tasks you want it to do and produce the results you want.

There are at least three good reasons for learning programming:
Programming helps you understand computers. The computer is only a tool. If you learn how to write simple programs, you will gain more knowledge about how a computer works.
Writing a few simple programs increases your confidence level. Many people find great personal satisfaction in creating a set of instructions that solve a problem.
Learning programming lets you find out quickly whether you like programming and whether you have the analytical turn of mind programmers need. Even if you decide that programming is not for you, understanding the process certainly will increase your appreciation of what programmers and computers can do.

A set of rules that provides a way of telling a computer what operations to perform is called a programming language. There is not, however, just one programming language; there are many. In this chapter you will learn about controlling a computer through the process of programming. You may even discover that you might want to become a programmer. 

The Programming Process:
}Defining the problem
}Planning the solution
}Coding the program
}Testing the program
}Documenting the program

Flow chart- is a pictorial representation of a step-by-step solution to a problem.


It consists of arrows representing the direction the program takes and boxes and other symbols representing actions. It is a map of what your program is going to do and how it is going to do it. The American National Standards Institute (ANSI) has developed a standard set of flowchart symbols. 



Pseudocode-is an English-like nonstandard language that lets you state your solution with more precision than you can in plain English but with less precision than is required when using a formal programming language. Pseudocode permits you to focus on the program logic without having to be concerned just yet about the precise syntax of a particular programming language. However, pseudocode is not executable on the computer. We will illustrate these later in this chapter, when we focus on language examples. 


Symbol  Meaning
==   Equals
!=   Not Equal
<   Less than
<=   Less than or equal to
 >  Greater than
>=   Greater than or equal to

In practice, the computer is presented not with a true/false statement, but with a question having a "Yes" or "No" answer, for example if A = 10, B = 20, K = 5, and SALES = 10000, then:
Condition (Question)   "Answer"
Is A == B?   No
Is B > A?   Yes
Is K <= 25?   Yes
Is SALES >= $5000.00?   Yes 

}Desk-checking - ensure that it is error-free and workable
}Translating - Programs are most commonly translated by a compiler.
compiler translates your entire program at one time


}Debugging - means detecting, locating, and correcting bugs.

Levels of Languages
Machine Language - numbers are what machine language is. 
This lowest level of language, machine language, represents data and program instructions as 1s and Os-binary digits corresponding to the on and off electrical states in the computer.
Assembly Language - assembly languages use mnemonic codes, abbreviations that are easy to remember: A for Add, C for Compare, MP for Multiply, STO for storing information in memory, and so on. 
High-Level Languages
The first widespread use of high-level languages in the early 1960s transformed programming into something quite different from what it had been. Programs were written in an English-like manner, thus making them more convenient to use. As a result, a programmer could accomplish more with less effort, and programs could now direct much more complex tasks. 


Very High-Level Languages
Languages called very high-level languages are often known by their generation number, that is, they are called fourth-generation languages or, more simply, 4GLs. 

Alogarithm
-a procedure or formula for solving a problem.
-a step-by-step procedure for solving a problem.

An algorithm (pronounced AL-go-rith-um) is a procedure or formula for solving a problem. The word derives from the name of the mathematician, Mohammed ibn-Musa al-Khwarizmi, who was part of the royal court in Baghdad and who lived from about 780 to 850. Al-Khwarizmi's work is the likely source for the word algebra as well.

Flowchart?

When we used flowchart?
}To develop understanding of how a process is done.
}To study a process for improvement.
}To communicate to others how a process is done.
}When better communication is needed between people involved with the same process.
}To document a process.


}When planning a project.

This is an example of a flowchart:

Basic Java Programming:
A PROGRAMMING LANGUAGE IS...
A language designed for programming computers
-Consists of a combination of variables, functions, methods, and instructions for controlling actions in a computer system
-Follows a specific syntax for controlling the behavior of a computer or machine
-Thousands of different programming languages have been created, with many more being created every year
-Description of a programming language is usually split into the two components of syntax (form) and semantics (meaning)

 POPULAR PROGRAMMING LANGUAGES
1.Java
2.C
3C++
4.PHP
5.Visual Basic
6.Perl
7.Python
8.C#
9.JavaScript
10.Ruby
11.Delphi
What is Java?
A trademark used for programming languages designed to develop application, especially ones for the Internet, that can operate on different platform.

It is created by: Sun Microsystem.



Examples programs built in Java:


Java Pros and Cons:

Pros:
-Free to use
-Cross platform
-smaller learning curve

Cons:
-Performance in comparison with some other languages
-History of security vulnerability

WHERE JAVA IS BEING USED:
e-Commerce Websites
Computer Desktop Programs
Mobile Applications
Websit and Web games
Tools to use Java:
Code editor- a source editor is a text editor program design specifically for editing source code of computer programs by programmers.

Popular Editors:
-Eclipse
-Netbeans
-Komodo
-Notepad++
-Textmate

Java Virtual Machine-Used for running Java code
Java Development Kit- is a program develop environment for writing java applets and application.

Declaration and use of Variables:

Variables

A variable is a way of naming and storing a value for later use by the program, such as data from a sensor or an intermediate value used in a calculation.

Declaring Variables

Before they are used, all variables have to be declared. Declaring a variable means defining its type, and optionally, setting an initial value (initializing the variable). Variables do not have to be initialized (assigned a value) when they are declared, but it is often useful.
int inputVariable1;
int inputVariable2 = 0;     // both are correct

Programmers should consider the size of the numbers they wish to store in choosing variable types. Variables will roll over when the value stored exceeds the space assigned to store it. See below for an example.

Variable Scope

Another important choice that programmers face is where to declare variables. The specific place that variables are declared influences how various functions in a program will see the variable. This is called variable scope.

Initializing Variables

Variables may be initialized (assigned a starting value) when they are declared or not. It is always good programming practice however to double check that a variable has valid data in it, before it is accessed for some other purpose.
Example:
 int calibrationVal = 17; // declare calibrationVal and set initial value

Variable Rollover

When variables are made to exceed their maximum capacity they "roll over" back to their minimum capacity, note that this happens in both directions.
   int x
   x = -32,768;
   x = x - 1;       // x now contains 32,767 - rolls over in neg. direction
   x = 32,767;
   x = x + 1;       // x now contains -32,768 - rolls over

Using Variables

Once variables have been declared, they are used by setting the variable equal to the value one wishes to store with theassignment operator (single equal sign). The assignment operator tells the program to put whatever is on the right side of the equal sign into the variable on the left side.
inputVariable1 = 7;             // sets the variable named inputVari to 7
inputVariable2 = analogRead(2); // sets the variable named inputVariable2 to the 
                                // (digitized) input voltage read from analog pin #2

Examples

 int lightSensVal;
   char currentLetter;
   unsigned long speedOfLight = 186000UL;
   char errorMessage = {"choose another option"}; // see string 
Once a variable has been set (assigned a value), you can test its value to see if it meets certain conditions, or you can use its value directly. For instance, the following code tests whether the inputVariable2 is less than 100, then sets a delay based on inputVariable2 which is a minimum of 100:
if (inputVariable2 < 100)
{
  inputVariable2 = 100;
}

delay(inputVariable2);
This example shows all three useful operations with variables. It tests the variable ( if (inputVariable2 < 100) ), it sets the variable if it passes the test ( inputVariable2 = 100 ), and it uses the value of the variable as an input parameter to the delay() function ( delay(inputVariable2) )
Style Note: You should give your variables descriptive names, so as to make your code more readable. Variable names like tiltSensor or pushButton help you (and anyone else reading your code) understand what the variable represents. Variable names like var or value, on the other hand, do little to make your code readable.
Some variable type:
Char(Character)- A data type that takes up 1 byte of memory that stores a character value. Character literals are written in single quotes, like this: 'A' (for multiple characters - strings - use double quotes: "ABC").
The char datatype is a signed type, meaning that it encodes numbers from -128 to 127. For an unsigned, one-byte (8 bit) data type, use the byte data type.

Example

  char myChar = 'A';
  char myChar = 65;      // both are equivalent
Byte-A byte stores an 8-bit unsigned number, from 0 to 255.

Example

    byte b = B10010;  // "B" is the binary formatter (B10010 = 18 decimal) 
Int-Integers are your primary data-type for number storage.
Example int ledPin = 13;Syntax int var = val;
  • var - your int variable name
  • val - the value you assign to that variable
Coding Tip
int x; x = -32768; x = x - 1; // x now contains 32,767 - rolls over in neg. direction x = 32767; x = x + 1; // x now contains -32,768 - rolls over
Float-Datatype for floating-point numbers, a number that has a decimal point. Floating-point numbers are often used to approximate analog and continuous values because they have greater resolution than integers. Floating-point numbers can be as large as 3.4028235E+38 and as low as -3.4028235E+38. They are stored as 32 bits (4 bytes) of information.
Examples
float myfloat;

float sensorCalbrate = 1.117;
Syntax
float var = val
  • var - your float variable name
  • val - the value you assign to that variable
  • Example Code
int y;
int x; float z;
y = x / 2; // y now contains 0, ints can't hold fractions
x = 1;
z = (float)x / 2.0; // z now contains .5 (you have to use 2.0, not 2)
int x; x = -32768;
x = 32767;
x = x - 1; // x now contains 32,767 - rolls over in neg. direction
Long-Long variables are extended size variables for number storage, and store 32 bits (4 bytes), from -2,147,483,648 to 2,147,483,647.
x = x + 1; // x now contains -32,768 - rolls over Example
long speedOfLight = 186000L; // see the Integer Constants page for explanation of the 'L'
Syntax
long var = val;
  • var - the long variable name
  • val - the value assigned to the variable
Floats have only 6-7 decimal digits of precision. That means the total number of digits, not the number to the right of the decimal point. Unlike other platforms, where you can get more precision by using a double (e.g. up to 15 digits), on the Arduino, double is the same size as float.
Floating point numbers are not exact, and may yield strange results when compared. For example 6.0 / 3.0 may not equal 2.0. You should instead check that the absolute value of the difference between the numbers is less than some small number.
Floating point math is also much slower than integer math in performing calculations, so should be avoided if, for example, a loop has to run at top speed for a critical timing function. Programmers often go to some lengths to convert floating point calculations to integer math to increase speed.
If doing math with floats, you need to add a decimal point, otherwise it will be treated as an int. See the Floating point constants page for details.
When variables are made to exceed their maximum capacity they "roll over" back to their minimum capacity, note that this happens in both directions. Example for a 16-bit int:
If doing math with integers, at least one of the numbers must be followed by an L, forcing it to be a long. See the Integer Constants page for details.
Double-Double precision floating point number. On the Uno and other ATMEGA based boards, this occupies 4 bytes. That is, the double implementation is exactly the same as the float, with no gain in precision.
Programming with Java Statements.
*Understanding conditional statement
*Understanding loop statement
Understanding Conditional Statements
-Conditional statements used when there is a need of determining the direction of the flow based on condition.
The If conditional statement- The if statement is designed to conditionally execute a statement or conditionally decide between a choice of statements.
The If-then conditional statement-The if- is used when multiple conditions need to flow through a decision-based scenario
The If-then-else conditional statement-The main ddifference is that the code will fall through to the final stand-alone else when the expression fails to return true for any condition.
The Switch conditional statement- It is used to match the value from a switch statement expression against a value associated with a case keyword. Once matched, the enclosed statements associated with the matching case value are executed, unless a break statement is encountered .
Understanding loop statement
-It has many part that include an initialization part, an expression part, and an
iteration
-The initialization does not need to declare a variable as long as the variable is
declared before the statement .So x=0 and x=0 are both acceptable.
-The expression within the for loop must be evaluated to a boolean value.
public class Loops {
 public static void main(String[]args){
System.out.printIn("Let's compact the code using for loop");
int i;
for (i= 0; i<0; i++)
Systym.out.printIn("Hellow!")
System.out.printIn("Now the code looks much better")
}
The while Statement
•This loop evaluates an expression and executes the
loop body only if the expression evaluates to true
There is typically an expression within the body that will affect the result of the expression
The while statement executes its body, while specified condition is true.
public class WhileLoop {
public static void main(String[] args) {
System.out.println("Let's count to 10 using while:");
  int i = 1    
while (i <= 10) { System.out.println(i);
i++   }
Intro to Developing Network

History of Internet
In 1957, computers only work on one task at a time. It is the most ineffective processing of the data.There is an indirect connection between the programmer and the computer which encountered bugs.
A remote connection was installed so that enable for the programmer work directly.
 It allows to share the power of single computer to multiple users.
DARPA- Defence Advance Research Project Agency
-it uses to secure the leading technology of the US.
-information was manually transferred by the human.
-a plan was developed to eliminate the manual processing
-replaced by ARPANET
ARPANET - Advance Research Project Agency Networking
-replaced for DARPA.
HTML Basics
How the Html works?
http is text-based request-response protocol
HTML or Hyper Text Mark Language
-
> A notation for describing
-documents structure (semantic markup)
-formatting (presentation)
> It is looks like A Microsoft Word document
HTML files must have an .htm or .html file extension.
-HTML can be created with the text editor such as..
*Notepad
*Notepad++
-or HTML editor like..
*Microsoft FrontPage
*Macromedia dreamweaver
AN HTML STRUCTURE>>>>
Html comprised of "element" and "tags"
>Begins with <html> and ends with </html>
>when writing html, must define namespace
Ex. <html> xmlns="http://www.facebook.com/xhtml">

First HTML Page
<!DOCTYPE HTML>
<html>
<head>
<title>My First html page</title>
 
</head>
<body>
 
<p>This is some text..</p>
 
</body>
<html>
Tags!
<!DOCTYPE HTML>
<html>
<head>
opening--<title>My First html page</title>---closing
 
</head>
<body>
 
<p>This is some text..</p>
 
</body>
<html>
<!DOCTYPE HTML>
--------------------------------------------
<html> HEADER
<head>
<title>My First html page</title>
 
</head>
------------------------------------------
<body>
 
<p>This is some text..
<!DOCTYPE HTML>
<html>
<head>
<title>My First html page</title>
 
</head>
 -------------------------------------------
<body>
   
<p>This is some text..</p>
 
</body> Body
----------------------------------------------
<html>
 
</body>
<html>
Headings and Paragraph examples:

The CSS Styles

































No comments:

Post a Comment