September 30, 2012

WHY


Why, Why do
we press harder on a remote control when we know the batteries are
getting weak?

Why
do banks charge a fee due to insufficient funds when they already know
you're broke?

Why
is it that when someone tells you that there are one billion stars in
the universe, you believe them but, if they tell you there is wet
paint, you have to touch it to check?

Why
do they use sterilised needles for lethal
injections?

Why
doesn't Tarzan have a beard?

Why
does Superman stop bullets with his chest, but ducks when you throw a revolver at him?


Whose 
cruel idea was it to put an "s" in the word "lisp"?


Why is it that, no matter what colour bubble bath you use, the bubbles are always white?

Is there ever a day that mattresses are not on sale?

Why do people constantly return to the refrigerator with hopes that
something new to eat will have materialised?

Why is it that no plastic trash bag will open from the first end you
try?

How do those dead bugs get into enclosed light fixtures?


Why is it that whenever you attempt to catch something that's falling off the table you always manage to knock something else over?


If swimming is a good exercise to stay FIT, than why are whales FAT?
 
Why is the place in a stadium where people SIT, called a STAND?
 
Why is that everyone wants to go to HEAVEN but nobody want to DIE?
 
Shall I say that there is racial discrimination even in chess as the WHITE piece is moved FIRST?
 
In our country, we have FREEDOM of SPEECH, then why do we have TELEPHONE BILLS?
 
If money doesn’t grow on TREES, then why do banks have BRANCHES?
 
Why doesn’t GLUE stick to its BOTTEL?
 
Why do you still call it a BUILDING when it is already BUILT?
 
If it’s true that we are here to HELP others, what are others HERE for?
 
If All The Nations in The World Are in Debt, where Did All The Money Go?
 
If The “Black Box” Flight Recorder Is Never Damaged During A Plan Crash, Why Isn’t The Whole Airplane Made Out of that Stuff?
 
Who Copy wrote The Copyright Symbol?



September 29, 2012

Data Structures



Data structures help us to organize the data in the computer, resulting in more efficient programs. An efficient program executes faster and helps minimize the usage of resources like memory, disk. Computers are getting more powerful with the passage of time with the increase in CPU speed, availability of faster network and the maximization of disk space. Therefore people have started solving more and more complex problems. As computer applications are becoming complex, so there is need for more resources. This does not mean that we should buy a new computer to make the application execute faster. Our effort should be to ensure that the solution is achieved with the help of programming, data structures and algorithm. We have to analyze the problem to determine the resource constraints that a solution must meet. Suppose, the data is so huge i.e. in Gigabytes (GBs) while the disc space available with us is just 200 Mega bytes. This problem cannot be solved with programming. Rather, we will have to buy a new disk.

Data Organization

What does organizing the data mean? It means that the data should be arranged in a way that it is easily accessible. The data is inside the computer and we want to see it. We may also perform some calculations on it. Suppose the data contains some numbers and the programmer wants to calculate the average, standard deviation etc. May be we have a list of names and want to search a particular name in it. To solve such problems, data structures and algorithm are used. Sometimes you may realize that the application is too slow and taking more time. There are chances that it may be due to the data structure used, not due to the CPU speed and memory. You may have two data structures and try to decide which one is more suitable for the resolution of the problem.

A solution is said to be efficient if it solves the problem within its resource constraints. What does it mean? In the computer, we have hard disk, memory and other hardware. Secondly we have time. Suppose you have some program that solves the problem but takes two months. It will be of no use. Usually, you don’t have this much time and cannot wait for two months. Suppose the data is too huge to be stored in disk. Here we have also the problem of resources. This means that we have to write programs considering the resources to achieve some solution as soon as possible. There is always cost associated with these resources. We may need a faster and better CPU which can be purchased. Sometimes, we may need to buy memory. As long as data structures and programs are concerned, you have to invest your own time for this.

Importance of Data Structure


Each data structure has costs and benefits. Any data structure used in your program will have some benefits. For this, you have to pay price. That can be computer resources or the time. Also keep in mind that you are solving this problem for some client. If the program is not efficient, the client will not buy it.

In rare cases, a data structure may be better than another one in all situations. It means that you may think that the array is good enough for all the problems. Yet this is not necessary. In different situations, different data structures will be suitable. Sometimes you will realize that two different data structures are suitable for the problem. In such a case, you have to choose the one that is more appropriate. An important skill this course is going to lend to the students is use the data structure according to the situation. You will learn the programming in a way that it will be possible to replace the one data structure with the other one if it does not prove suitable. We will replace the data structure so that the rest of the program is not affected. You will also have to attain this skill as a good programmer.

There are three basic things associated with data structures. A data structure requires:

Ø    Space for each data item it stores
Ø   Time to perform each basic operation
Ø   Programming effort


Understand how to measure the cost of a data structure or program. These techniques also allow you to judge the merits of new data structures that you or others might develop. At times, you may have two suitable data structures for some problem. These can be tried one by one to adjudge which one is better one. 


Selection of a Data Structure

It is necessary to determine the basic operations that must be supported. Quantify the resource constraints for each operation. Suppose you have to insert the data in the computer or database and have to search some data item. Let’s take the example of telephone directory. Suppose there are eight million names in the directory. Now someone asks you about the name of some particular person. You want that this query should be answered as soon as possible. You may add or delete some data. It will be advisable to consider all these operations when you select some data structure.

Finally select the data structure that meets these requirements the maximum. Without, sufficient experience, it will be difficult to determine which one is the best data structure. We can get the help from internet, books or from someone whom you know for already getting the problems solved. We may find a similar example and try to use it. After this course, you will be familiar with the data structures and algorithms that are used to solve the computer problems.

Now you have selected the data structure. Suppose a programmer has inserted some data and wants to insert more data. This data will be inserted in the beginning of the existing data, or in the middle or in the end of the data. Let’s talk about the arrays and suppose you have an array of size hundred. Data may be lying in the first fifty locations of this array. Now you have to insert data in the start of this array. What will you do? You have to move the existing data (fifty locations) to the right so that we get space to insert new data. Other way round, there is no space in the start. Suppose you have to insert the data at 25th location. For this purpose, it is better to move the data from 26th to 50th locations; otherwise we will not have space to insert this new data at 25th location.

Now we have to see whether the data can be deleted or not. Suppose you are asked to delete the data at 27th position. How can we do that? What will we do with the space created at 27th position?

Thirdly, is all the data processed in some well-defined order or random access allowed? Again take the example of arrays. We can get the data from 0th position and traverse the array till its 50th position. Suppose we want to get the data, at first from 50th location and then from 12th. It means that there is no order or sequence. We want to access the data randomly. Random access means that we can’t say what will be the next position to get the data or insert the data.

Comparison of Data Structures


How can you decide which data structure is better than other. Firstly, a programmer can do it by writing two programs using different data structure while solving the same problem. Now execute both data structures. One gives the result before the other. The data structure that gives results first is better than the other one. But sometimes, the data grows too large in the problem. Suppose we want to solve some problem having names and the data of names grows to one million. Now when you run both programs, the second program runs faster. What does it mean? Is the data structure used in program one not correct? This is not true. The size of the data, being manipulated in the program can grow or shrink. You will also see that some data structures are good for small data while the others may suit to huge data. But the problem is how can we determine that the data in future will increase or decrease. We should have some way to take decision in this regard. We will study further in other related articles on how to take such decisions.







September 25, 2012

Bitter Truth


A German Muslim scholar was once asked about terrorism and Islam: He said: Who started the First World War? Muslims? Who started the Second World War? Muslims? Who killed about 20 millions of Aborigines in Australia? Muslims? Who sent the nuclear bombs of Hiroshima and Nagasaki? Muslims? Who killed more than 100 millions of Indians in North America? Muslims? Who killed more than 50 millions of Indians in South America? Muslims? Who took about 180 millions of African people as slaves and 88% of them died and were thrown in Atlantic Ocean? Muslims? No, they weren’t Muslims! First of all, you have to define terrorism properly.  If a non-Muslim does something bad, it is crime. But if a Muslim commits same, he is a terrorist. So remove this double standard.

EIGRP Configuration on Packet Tracer

Configure Enhanced Interior Gateway Routing Protocol on the following topology.

EIGRP topology

2. Also, apply EIGRP on the following topology.

Apply all the IP addresses.
Change the interface states.
Apply Protocol.





September 23, 2012

Networking Devices

Since, we are going to do a series of tutorials on packet tracer. In this manner, we need to have a familiarity of various networking components and devices. We are going to discuss some important devices which are going to be used in networking. 

All networks are made up of basic hardware building blocks to interconnect network nodes, such as Network Interface Cards (NICs), Bridges, Hubs, Switches, and Routers etc. These devices also need cables to connect them. In this tutorial, we are going to discuss these important devices.  

 Network interface cards

A NIC (network interface card) is a piece of computer hardware designed to allow computers to communicate over a computer network. It provides physical access to a networking medium and often provides a low-level addressing system through the use of MAC addresses. It allows users to connect to each other either by using cables or wirelessly.The NIC provides the transfer of data in  megabytes. 


NIC




Every device on a network that needs to transmit and receive data must have a network interface card (NIC) installed. They are sometimes called network adapters, and are usually installed into one of the computer's expansion slots in the same way as a sound or graphics card. The NIC includes a transceiver, (a transmitter and receiver combined). The transceiver allows a network device to transmit and receive data via the transmission medium. Each NIC has a unique 48-bit Media Access Control (MAC) address burned in to its ROM during manufacture. The first 24 bits make up a block code known as the Organisationally Unique Identifier (OUI) that is issued to manufacturers of NICs, and identify the manufacturer. The issue of OUIs to organisations is administered by the Institute of Electrical and Electronics Engineers (IEEE). The last 24 bits constitute a sequential number issued by the manufacturer. The MAC address is sometimes called a hardware address or physical address, and uniquely identifies the network adapter. It is used by many data link layer communications protocols, including Ethernet, the 802.11 wireless protocol and Bluetooth. The use of a 48-bit adress allows for 248(281,474,976,710,656) unique addresses. A MAC address is usually shown in hexadecimal format, with each octet separated by a dash or colon, 

For example: 00-60-55-93-R2-N7


Repeaters

A repeater is an electronic device that receives a signal and retransmits it at a higher power level, or to the other side of an obstruction, so that the signal can cover longer distances without degradation. In most twisted pair ethernet configurations, repeaters are required for cable runs longer than 100 meters away from the computer. As signals travel along a transmission medium there will be a loss of signal strength i.e. attenuation. A repeater is a non-intelligent network device that receives a signal on one of its ports, regenerates the signal, and then retransmits the signal on all of its remaining ports. Repeaters can extend the length of a network (but not the capacity) by connecting two network segments. Repeaters cannot be used to extend a network beyond the limitations of its underlying architecture, or to connect network segments that use different network access methods. They can, however, connect different media types, and may be able to link bridge segments with different data rates. 
Repeater


Repeaters are used to boost signals in coaxial and twisted pair cable and in optical fibre lines. An electrical signal in a cable gets weaker the further it travels, due to energy dissipated in conductor resistance and dielectric losses. Similarly a light signal traveling through an optical fiber suffers attenuation due to scattering and absorption. In long cable runs, repeaters are used to periodically regenerate and strengthen the signal. 


Hubs

A hub contains multiple ports. When a packet arrives at one port, it is copied to all the ports of the hub for transmission. In a hub, a frame is passed along or "broadcast" to every one of its ports. It doesn't matter that the frame is only destined for one port. The hub has no way of distinguishing which port a frame should be sent to. Passing it along to every port ensures that it will reach its intended destination. This places a lot of traffic on the network and can lead to poor network response times. Additionally, a 10/100Mbps hub must share its bandwidth with each and every one of its ports. So when only one PC is broadcasting, it will have access to the maximum available bandwidth. If, however, multiple PCs are broadcasting, then that bandwidth will need to be divided among all of those systems, which will degrade performance.



Network Hub




Bridges


A network bridge connects multiple network segments at the data link layer (layer 2) of the OSI model. Bridges do not copy traffic to all ports, as hubs do, but learn which MAC addresses are reachable through specific ports. Once the bridge associates a port and an address, it will send traffic for that address only to that port. Bridges do send broadcasts to all ports except the one on which the broadcast was received.

Bridges learn the association of ports and addresses by examining the source address of frames that it sees on various ports. Once a frame arrives through a port, its source address is stored and the bridge assumes that MAC address is associated with that port. The first time that a previously unknown destination address is seen, the bridge will forward the frame to all ports other than the one on which the frame arrived.

Network Bridge
Bridges don't know anything about protocols, but just forward data depending on the destination address in the data packet. This address is not the IP address, but the MAC (Media Access Control) address that is unique to each network adapter card. The bridge is basically just to connect two local-area networks (LANs), or two segments of the same LAN that use the same protocol. Bridges can extend the length of a network, but unlike repeaters they can also extend the capacity of a network, since each port on a bridge has its own MAC address. When bridges are powered on in an Ethernet network, they start to learn the network's topology by analysing the source addresses of incoming frames from all attached network segments (a process called backward learning ). Over a period of time, they build up a routing table . 

The bridge monitors all traffic on the segments it connects, and checks the source and destination address of each frame against its routing table. When the bridge first becomes operational, the routing table is blank, but as data is transmitted back and forth, the bridge adds the source MAC address of any incoming frame to the routing table and associates the address with the port on which the frame arrives. In this way, the bridge quickly builds up a complete picture of the network topology. If the bridge does not know the destination segment for an incoming frame, it will forward the frame to all attached segments except the segment on which the frame was transmitted. Bridges reduce the amount of traffic on individual segments by acting as a filter, isolating intra-segment traffic. This can greatly improve response times.

Switches

The switch is a relatively new network device that has replaced both hubs and bridges in LANs. A switch uses an internal address table to route incoming data frames via the port associated with their destination MAC address. Switches can be used to connect together a number of end-user devices such as workstations, or to interconnect multiple network segments. A switch that interconnects end-user devices is often called a workgroup switch. Switches provide dedicated full-duplex links for every possible pairing of ports, effectively giving each attached device its own network segment This significantly reduces the number of intra-segment and inter-segment collisions. Strictly speaking, a switch is not capable of routing traffic based on IP address (layer 3) which is necessary for communicating between network segments or within a large or complex LAN. Some switches are capable of routing based on IP addresses but are still called switches as a marketing term. A switch normally has numerous ports, with the intention being that most or all of the network is connected directly to the switch, or another switch that is in turn connected to a switch.


Network Switch


Routers

Routers are networking devices that forward data packets between networks using headers and forwarding tables to determine the best path to forward the packets. A network environment that consists of several interconnected networks employing different network protocols and architectures requires a sophisticated device to manage the flow of traffic between these diverse networks. Such a device, sometimes referred to as an intermediate system, but more commonly called a router, must be able to determine how to get incoming packets (or datagrams) to the destination network by the most efficient route. Routers gather information about the networks to which they are connected, and can share this information with routers on other networks. The information gathered is stored in the router's internal routing table, and includes both the routing information itself and the current status of various network links. Routers exchange this routing information using special routing protocols. 


A router is connected to at least two networks, commonly two LANs or WANs or a LAN and its ISP's network. Routers are located at gateways, the places where two or more networks connect, and are the critical device that keeps data flowing between networks and keeps the networks connected to the Internet. When data is sent between locations on one network or from one network to a second network the data is always seen and directed to the correct location by the router. The router accomplishes this by using headers and forwarding tables to determine the best path for forwarding the data packets, and they also use protocols such as ICMP to communicate with each other and configure the best route between any two hosts. The Internet itself is a global network connecting millions of computers and smaller networks. There are various routing protocols which are helpful for various different environments and will be discussed later. 











September 21, 2012

ISHQ E RASOOL (SAW) Day

Today , 21st September 2012, we are celebrating the ishq e rasool day and of course, there is a local holiday in Pakistan. Pakistan is the country with the most local holidays in the world. That just official numbers i am talking about. All the strikes that take place and other events as Pakistan is very eventful country, Day in and day out, we either have riots resulting in the shutter down strikes causing loss to economy but who gives a "damn".

Coming back to original discussion about ISHQ E RASOOL (SAW) day, i was watching the news, watching people destroying signals, shops, cars, bikes, billboards, burning cinemas. But the question is, Should this be the reaction ? And who is going to pay for the destruction that happens as a result. The answer is "us, all of us through our tax money".

Hazrat Muhammad (PBUH) said, "Muslim is the one who does not harm another Muslim by all means (through his hands and tongue )". Are they going to stop publishing stuff like that. Same reaction was recorded when some cartoons were published by some danish artist.

This is what they do, they make something insulting, mock our religion and sit in front of the TV to watch us burn ourselves. This photo might give you the little idea of what i am talking about.



Its a shame, How can you protest with violence for somebody who always stood for peace . 


September 17, 2012

RIP assignment




1. Follow it step by step and perform it.

     Basic topology configuration

2. Apply RIP version 1 on the following configuration

     RIP Assignment

3. Apply RIP version 2 on the following configuration.

     RIP V2

C program to Read From a File

#include <stdio.h> #include <stdlib.h> void main() {     FILE *fptr;     char filename[15];     char ch;   ...