Sunday, April 6, 2014

Network Topology

  • Compute network:-
Goals:-
1.Resource sharing .
2.Provide High Reliability
3.Distribution of workload
4.Saving Money
5.Expandability
6.Powerful communication Medium.
7.Protecting Information.
8.Preserving Information.

Applications:-
1) Business Applications
2) Home Applications

Network architecture describes how a computer network is configured and what strategies are employed .
Configurations include star, bus, ring, mesh and hierarchical. Strategies include terminal, peer-to-peer and  client-sever.

  • Network Hardware :-
Broadcasting :-
1.Addressing a packet to all destinations.
2.Received by every machine on network.
3.Multicasting

Point to point:-
1.Network connections between  individual pairs.
2.Packet may visit one more intermediate machines
3.Uni-casting.

A network can be arranged or configured in several different ways.This arrangement is called the network's topology.

Network topologies:-  Physical topologies -

MESH topology:-
1.Interconnected topology.
2.Point to point link.
3.n(n-1)/2 links for n devices.
4.Direct communication
5.Highest degree of fault tolerance


Advantages:
1.Traffic problems eliminated .
2.Robust
3.Fault identification and fault isolation easy.
4.Privacy.
5.Highest  reliability and security.

Disadvantages:
1Amount of cabling
2.Number of I/O ports.
3.Reconnection is difficult.
4.Installation of new devices is difficult.
5.Expensive.



STAR topology:-
1.Point to point link.
2.Hub central controller.
3.Communication through controller.
4.Controller exchange data.



Advantages :
1.Requires only one link and one I/O port
2.Less expensive.
3.Easy to install.
4.Robust.
5.Fault identification and isolation easy.

Disadvantages:
Performance depends on hub.
Therefore if hub fails.
So,Network stops
Since speed depends on hub connections.

In a star network,a number of small computers or peripheral devices are linked to a central unit.This central unit may be a host computer or a file server.
All communications pass through this central unit 
Control is maintained by polling. That is ,each connecting device is asked (polled) whether it has a message to send .Each device is then in turn allowed to send its message.
One particular advantage of the star form of network is that it can be used to provide a time-sharing system. That is , several users can share resources (time) on a central computer.
The star is a common arrangement for linking several microcomputers to a mainframe that allows access to an organization's database.

BUS Topology:-

1.Linked by single cable i.e. multi point topology.
2.Devices have Drop lines and taps.
3.Used in LAN.


Advantages:-
1.Easy t install.
2.Cabling requires less compare to mesh and star.

Disadvantages:
1.Limited number of devices support .
2.Difficult to identify and isolate fault.
3.Degradation in quality of signal.
4.Bus cable fault ,stops all transmission.

In bus network each device in the network handles its own communications control.There is no host computer.
All communications travel along a common connecting cable called a bus.
As the information passes along the bus,it is examined by each device to see if the information is intended for it.
The bus network is typically used when only a few microcomputers are to be linked together.This arrangement is common for sharing data stored on different microcomputers.
The bus network is not as efficient as the star network for sharing common resources.
However , a bus network is less expensive and is in very common use.

RING topology:-

1.Connected to two devices .
2.Point to point link dedicated .
3.Signal travels in one direction.
4.Device relay ,if not intended.



Advantages:
1.Easy to install or reconfigure.
2.Fault isolation is easy.
3.Token

Disadvantages:-
1.Ring break ,network disable.
2.Number of devices connected and ring length.
3.Unidirectional ,data transfer is slow.

In ring network, each device is connected to two other devices , forming a ring .
There is no central file or computer.Messages are passed around the ring until they reach the correct destination.
With microcomputers, the ring arrangement is the least frequently used of the other networks .
However ,it often is used to link mainframes ,especially over wide geographical areas. These mainframes tend to operate fairly autonomously.
They perform most or all of their  own processing and only occasionally share data and programs with other mainframes.



HYBRID topology:-

1.Combination of topologies,not basic topology.
2.Two different basic topologies connection.
3.WAN have it.


Computer network - OSI and TCP/IP

Comparison between OSI and TCP/IP :-

OSI TCP/IP
1. Open Systems Interconnection 1. Transfer Control Protocol / Internet protocaol
2.Number of layers are seven (7). 2.Number of layers are four (4).
3.Connection oriented and connectionless
in network and only connection oriented in transport.
3.Only connectionless in Internet and both in Transport.
4. Distinction
1.Services
2.Interfaces
3.Protocols
4.Does not distinction between them.
5.Model first developed.
Therefore, Not biased toward one protocol general model.
5.Protocol first developed
Therefore, does not fit any other protocol stack.
6.No thought was given to inter-networking 6.Main goal to handle inter-networking.
7.Model useful,Protocols not popular. 7.Model not widely accepted ,Protocols universally used.
8.S and P layers empty.
D and N layers overfull.
Many function addressing ,flow control and error control reappear.
8.No distinguish nor mention P and D layer even have functionalities.

Computer network - Service

 Service :-
Service
_______________________|___________________
|                                                                                 |
                   Connection Oriented                                                       Connectionless
                   _______|_________                            ___________________|__________
                   |                              |                         |                              |                        |
Reliable connection       Unreliable connection      Unreliable        Acknowledgement      Request-
oriented service                                                    data-gram            data-gram                   reply
      ______|__________
      |                               |
Message stream         Byte stream


Difference between Connection oriented and Connectionless

          Connection-oriented                                                    Connectionless
1. It is similar to telephone system.                     1. This is modeled after the postal system.

2. Packets received are in same order as sent.    2. Messages arrive out of order.

3.Each service can be characterized by quality    3.Not all applications require reliable service
   of service-reliable or unreliable.                           and not all require connection oriented
                                                                              communication.
4.It has services:                                                 4.It has services: -
   i) Reliable message stream.                                  i) Unreliable data-gram
   ii) Reliable byte stream                                         ii)  Acknowledged data-gram
   iii) Unreliable connection.                                     iii) Request -reply

5. It has example:-                                               5.It has example
   i) Sequence of pages                                            i) Electronic junk mail.
   ii) Remote login.                                                   ii) Registered mail.
   iii) Digitized voice                                                 iii) Database query.



Services primitive :-
1) Set of primitives (operations)
2)Available to user process to access service.
3)depend on service.


Service primitive for implementing a simple connection oriented service:
     Primitive                                                           Meaning
1) LISTEN                -      Block waiting for an incoming connection.
2) CONNECT          -      Establish a connection with a waiting peer
3) RECEIVE             -      Block waiting for an incoming message
4) SEND                   -      Send a message to the peer.
5) DISCONNECT    -      Terminate a connection.

Saturday, April 5, 2014

Program in C++ for play-game TIC TAC TOE

#include <iostream.h>
#include <conio.h>

char square[10] = {'0','1','2','3','4','5','6','7','8','9'};
int testwinner();
void playchart();

int main()
{
    int player = 1,i,choice;
    char mark;
    clrscr();
    do
    {
        playchart();
        player=(player%2)?1:2;
        cout << "Player " << player << ", enter a number ==>  \a ";
        cin >> choice;
        mark=(player == 1) ? 'X' : 'O';
        if (choice == 1 && square[1] == '1')
            square[1] = mark;
        else if (choice == 2 && square[2] == '2')
            square[2] = mark;
        else if (choice == 3 && square[3] == '3')
            square[3] = mark;
        else if (choice == 4 && square[4] == '4')
            square[4] = mark;
        else if (choice == 5 && square[5] == '5')
            square[5] = mark;
        else if (choice == 6 && square[6] == '6')
            square[6] = mark;
        else if (choice == 7 && square[7] == '7')
            square[7] = mark;
        else if (choice == 8 && square[8] == '8')
            square[8] = mark;
        else if (choice == 9 && square[9] == '9')
            square[9] = mark;
        else
        {
            cout<<"Invalid move ";
            player--;
            getch();
        }
        i=testwinner();
        player++;
    }while(i==-1);
    playchart();
    if(i==1)
        cout<<"==>\aPlayer "<<--player<<" win ";
    else
        cout<<"==>\aGame draw";
    getch();
    return 0;
}

int testwinner()
{
    if (square[1] == square[2] && square[2] == square[3])
        return 1;
    else if (square[4] == square[5] && square[5] == square[6])
        return 1;
    else if (square[7] == square[8] && square[8] == square[9])
        return 1;
    else if (square[1] == square[4] && square[4] == square[7])
        return 1;
    else if (square[2] == square[5] && square[5] == square[8])
        return 1;
    else if (square[3] == square[6] && square[6] == square[9])
        return 1;
    else if (square[1] == square[5] && square[5] == square[9])
        return 1;
    else if (square[3] == square[5] && square[5] == square[7])
        return 1;
    else if (square[1] != '1' && square[2] != '2' && square[3] != '3' &&
             square[4] != '4' && square[5] != '5' && square[6] != '6' &&
            square[7] != '7' && square[8] != '8' && square[9] != '9')
        return 0;
    else
        return -1;
}

void playchart()
{
    clrscr();
    cout << "\n\n\tTic Tac Toe\n\n";
    cout << "Player 1 (X)  -  Player 2 (O)" << endl << endl;
    cout << endl;
    cout << "     |     |     " << endl;
    cout << "  " << square[1] << "  |  " << square[2] << "  |  " << square[3] << endl;
    cout << "_____|_____|_____" << endl;
    cout << "     |     |     " << endl;
    cout << "  " << square[4] << "  |  " << square[5] << "  |  " << square[6] << endl;
    cout << "_____|_____|_____" << endl;
    cout << "     |     |     " << endl;
    cout << "  " << square[7] << "  |  " << square[8] << "  |  " << square[9] << endl;
    cout << "     |     |     " << endl << endl;
}


Click here for more programs on C++

Program in C to sort all words of text in alphabatical order.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include<conio.h>
void sort_string(char*);
 int main()
{
   char string[100];
   clrscr();
   printf("Enter some text\n");
   gets(string);

   sort_string(string);
   printf("%s\n", string);
   getch();
   return 0;

}

void sort_string(char *s)
{
   int c, d = 0, length;
   char *pointer, *result, ch;

   length = strlen(s);

   result = (char*)malloc(length+1);

   pointer = s;

   for(ch='a';ch<='z';ch++ )
   {
      for(c=0;c<length;c++ )
      {
         if(*pointer == ch )
         {
            *(result+d) = *pointer;
            d++;
         }
         pointer++;
      }
      pointer = s;
   }
   *(result+d) = '\0';
   strcpy(s, result);
   free(result);
}
Click here for more programs on C++

Friday, April 4, 2014

Software testing -White box testing,Black box testing, Grey box testing

Software testing  :
Software testing is the process to uncover requirement, design and coding errors in the program.

Three most prevalent and commonly used software testing techniques for detecting errors, they are:
1)White box testing,
2)Black box testing and
3)Grey box testing.

1) White Box Testing Technique:
It is the detailed investigation of internal logic and structure of the code. In white box testing it is necessary
for a tester to have full knowledge of source code.

White box testing techniques are:-
i) Control Flow Testing: It is a structural testing strategy that uses the program control flow as a model
control flow and favours more but simpler paths over fewer but complicated path.
ii) Branch Testing: Branch testing has the objective to test every option (true or false) on every control
statement which also includes compound decision.
iii) Basis Path Testing: Basis path testing allows the test case designer to produce a logical complexity
measure of procedural design and then uses this measure as an approach for outlining a basic set of
execution paths.
iv) Data Flow Testing: In this type of testing the control flow graph is annoted with the information about how
the program variables are define and used.
v) Loop Testing: It exclusively focuses on the validity of loop construct.

Advantages:-
a)Side effects are beneficial.
b)It reveals error in hidden code by removing extra lines of code.

Disadvantages:-
a)It is very expensive.
b)Some of the codes omitted in the code could be missed out.





2) Black Box Testing Technique:
It is a technique of testing without having any knowledge of the internal working of the application. It only
examines the fundamental aspects of the system and has no or little relevance with the internal logical structure of the system.

Black box testing techniques are
i) Equivalence Partitioning: It can reduce the number of test cases, as it divides the input data of a software
unit into partition of data from which test cases can be derived.
ii) Boundary Value Analysis: It focuses more on testing at boundaries, or where the extreme boundary values
are chosen. It includes minimum, maximum, just inside/outside boundaries, error values and typical values.
iii) Fuzzing: Fuzz testing is used for finding implementation bugs, using malformed/semi-malformed data
injection in an automated or semi-automated session.
iv) Cause-Effect Graph: It is a testing technique, in which testing begins by creating a graph and establishing
the relation between the effect and its causes. Identity, negation, logic OR
and logic AND are the four basic symbols which expresses the interdependency between cause and effect.
v) Orthogonal Array Testing: OAT can be applied to problems in which the input domain is relatively small,
but too large to accommodate exhaustive testing.
vi) All Pair Testing: In all pair testing technique, test cases are designs to execute all possible discrete
combinations of each pair of input parameters. Its main objective is to have a set of test cases that covers all
the pairs.
vii) State Transition Testing: This type of testing is useful for testing state machine and also for navigation of
graphical user interface.

Advantages:-
a)Efficient for large code segment.
b)Programmer and tester are independent of each other.

Disadvantages:-
a)Inefficient testing.
b)Without clear specification test cases are difficult to design.





3) Grey Box Testing Technique:
 White box + Black box = Grey box, it is a technique to test the application with limited knowledge of the
internal working of an application and also has the knowledge of fundamental aspects of the system
The other name of grey box testing is translucent testing.

Grey box testing techniques are :
i) Orthogonal Array Testing: This type of testing use as subset of all possible combinations.
ii) Matrix Testing: In matrix testing the status report of the project is stated.
iii) Regression Testing: If new changes are made in software, regression testing implies running of test cases.
iv) Pattern Testing: Pattern testing verifies the good application for its architecture and design.

Advantages:-
a)The test is done from the user’s point of view rather than designer’s point of view.
b)Grey box testing provides combined benefits of white box and black box testing techniques

Disadvantages:-
a)Many program paths remain untested.
b)Test coverage is limited as the access to source code is not available.

Thursday, April 3, 2014

PCM - Pulse Code Modulation


PCM :- Pulse Code Modulation
It is the digitization process in which analog signal is represented in digital or discrete form .
It use ordinary analog signal which is digitized at the end office with the help of codec (coder decoder) codec produces 7 or 8 bit numbers .

Codec is inverse of modem -True
It code the digital to analog.
CO  DEC -COder (Analog to Digital) DECoder  (Digital to analog)

PCM is based Nyquest theorem:-
               There are various system for digital transmission:-
1.T1 carrier system (handle 24 voice channel)
2.Encoding system

There are three methods of PCM:
1.Differential pulse code modulation ( DPCM)
2.Delta Modulation
3.Predictive encoding

1.DPCM :-
Definition :It does not transmit actual sample .It transmit difference between current and previous value .Errors can ignored for voice or speech.

2.Delta modulation :
It is special care of DPCM it uses only one bit per sample .Each sample differs from its predecessor by either +1 or -1 .This is called as a sampling interval .
Granular noise :- The schema which is used for slow changing signal which gives distortion called as granular noise.

3.Predictive encoding : this preemptive to DPCM .Some sampling values are used to protect the next value,for this transmitter and receiver must uses same prediction algorithm.


Data  communication
   characteristics :
1. Delivery     :  Correct destination
2. Accuracy  :  Correct data
3. Timeliness  :  Fast enough
4. Jitter          :  Uneven  delay


Data  representation
1Ttext        :  email
2.Numbers :  Direct  conversion
3. Images   :  pixels
4.Audio      : continous
5. Video     :  movie

Data  flow :
1.Simplex
2.Half Duplex
3.Full Duplex

From Side Hustle to Main Income: 7 Proven Ways to Make Money Online in 2025

  From Side Hustle to Main Income: 7 Proven Ways to Make Money Online in 2025 Introduction: The New Era of Earning – Why 2025 is Your Year t...