Friday, 19 October 2012

N/W ( Tutorials II )

What Is Network

A network is a group of computers or nodes connected together. They are connected with each other by communication paths.

Types of Networks:

LAN – Local Area Network connects a group of nodes covering a small physical area. LAN’s are most commonly seen in offices, building etc. LAN’s enable higher transfer rate of data, smaller coverage of area and hence less wiring.


WAN – Wide Area Network connects a group of nodes covering a wide area. WAN typically connects and allow communication between regions or national boundaries. The most common example of WAN is internet.



VPN – Virtual Private Network connects or links nodes in some larger area by open connections or virtual circuits in some larger network (e.g., the Internet) instead of by physical wires. It is used for secure communication through the public internet. VPN alone may not support explicit security features, such as authentication or content encryption.



Intranet – It is a set of networks under the control of a single administrative person. It can be considered as an internal network of an organization. If it is large, web servers are used to provide information to the users.



Extranet – It is a network that restricts itself within a single organization. It can be categorized as WAN, MAN etc. however; it cannot have a single LAN. It must have a connection (at least one) with external network.


IP, TCP and UDP In Networking

Explain IP, TCP and UDP

TCP – Transmission control Protocol is used to establish communication between nodes or networks and exchange data packets. It guarantees delivery of data packets in the order they were sent. Hence it is most commonly used in all applications that require guaranteed delivery of data. It can handle both timeouts (if packets were delayed) and retransmission (if packets were lost). The stream of data is transmitted in segments. The segment header is 32 bit. it is a connectionless communication protocol at the third level (network) of the OSI model.

IP – Internet protocol is used for transmission of data over the internet. IP uses IP addresses to identity each machine uniquely. Message is sent using small packets. The packet contains both the sender and receivers address. IP does not guarantee the delivery in the same order as sent. This is because the packets are sent via different routes. It is a connectionless communication protocol at the third level (network) of the OSI model.

UDP – User Data Protocol is a communication protocol. It is normally used as an alternative for TCP/IP. However there are a number of differences between them. UDP does not divide data into packets. Also, UDP does not send data packets in sequence. Hence, the application program must ensure the sequencing. UDP uses port numbers to distinguish user requests. It also has a checksum capability to verify the data

7 Layers Of OSI

Explain the 7 Layers of OSI


Layer 1: Physical layer
It represents all the electrical and physical specifications for devices. 


Layer 2: Data link layer
It provides the functional and procedural means to transfer data between network entities and to detect and possibly correct errors that may occur in the Physical layer.

Layer 3: Network layer
The Network layer provides the functional and procedural means of transferring variable length data sequences from a source to a destination via one or more networks.

Layer 4: Transport layer
It provides transparent transfer of data between end users.

Layer 5: Session layer
It controls the sessions between computers. It connects, manages and terminates the connections between the local and remote application.

Layer 6: Presentation layer
It transforms data to provide a standard interface for the Application layer.

Layer 7: Application layer
It provides a means for the user to access information on the network through an application.  

N/W ( Tutorials I )

What Is LAN

LAN is a computer network that spans a relatively small area. Most LANs are confined to a single building or group of buildings. However, one LAN can be connected to other LANs over any distance via telephone lines and radio waves. A system of LANs connected in this way is called a wide-area network (WAN). Most LANs connect workstations and personal computers. Each node (individual computer) in a LAN has its own CPU with which it executes programs, but it also is able to access data and devices anywhere on the LAN. This means that many users can share expensive devices, such as laser printers, as well as data. Users can also use the LAN to communicate with each other, by sending e-mail or engaging in chat sessions.

Term Protocol

Protocol is a standard way of communicating across a network. A protocol is the "language" of the network. It is a method by which two dissimilar systems can communicate. TCP is a protocol which runs over a network.

FTP (File Transfer Protocol)

FTP is File Transfer Protocol. It used to exchange files on the internet. To enable the data transfer FTP uses TCP/IP, FTP is most commonly used to upload and download files from the internet. FTP can be invoked from the command prompt or some graphical user interface. FTP also allows to update (delete, rename, move, and copy) files at a server. It uses a reserved port no 21.

What is multicasting

Multicasting allows a single message to be sent to a group of recipients. Emailing, teleconferencing, are examples of multicasting. It uses the network infrastructure and standards to send messages.

Functionality Of PING

Ping Is particularly used to check if the system is in network or not. It also gives packet lost information. In windows ping command is written as ping ip_address. The output returns the data packets information. The number of packets sent, received and lost is returned by PING.

MAC Address

A Media Access Control address is a unique identifier that is assigned to the network adapters or NICs by the manufacturers for the purpose of identification and used in the Media Access Control protocol sub layer. It is a 12 digit hexadecimal number. A MAC address usually encodes the registered identification of the manufacturer, if the address is assigned by the manufacturer. It some times also called as Ethernet Hardware Address / physical address/ adapter address.

Spanning-Tree protocols

Spanning Trees are a standard technique implemented in LAN connections. On a mesh topology, a set of spanning tree algorithms were developed for prevention of redundant transmission of data along intermediate hops between a source and a destination host. In the absence of spanning trees, a mesh network is flooded and rendered unusable by messages by circulating within a loop that is infinite, between hosts. An algorithm used in transparent bridges which determines the best path from source to destination to avoid bridge loops.

At the time of STP initialization in a network, its first action is to utilize the Spanning Tree Algorithm for selection of a root bridge and a root port. The root bridge is the network which has lowest-value bridge identifier. All the switches on the network use Bridge Protocol Data Units to broadcast the bridge IDs to the other switches in that network. Soon after selection of the root bridge, determination of the root ports on all other bridges is done.

PHP ( Tutorials V )


Type Of Juggle In PHP

Type Juggling means dealing with a variable type. In PHP a variables type is determined by the context in which it is used. If an integer value is assigned to a variable, it becomes an integer.

E.g. $var3= $var1 + $var2

Here, if $var1 is an integer. $var2 and $var3 will also be treated as integers.  

Difference Between Include And Require

Require () and include () are the same with respect to handling failures. However, require () results in a fatal error and does not allow the processing of the page. i.e. include will allow the script to continue. 

How To Submit Form Without A Submit Button

A form data can be posted or submitted without the button in the following ways:

1. On OnClick event of a label in the form, a JavaScript function can be called to submit the form.

E.g. document.form_name.submit()

2. Using a Hyperlink: On clicking the link, JavaScript function can be called.

E.g <a.href=” javascript:document.MyForm.submit();">

Urlencode And Urldecode

Urlencode can be used to encode a string that can be used in a url. It encodes the same way posted data from web page is encoded. It returns the encoded string.

Syntax: urlencode (string $str )

Urldecode can be used to decode a string. Decodes any %## encoding in the given string (Inserted by urlencode)

Syntax: urldecode (string $str )

Differences Between Require And Include, Include_Once

Include () will include the file specified.

Include_once () will include the file only once even if the code of the file has been included before.

Require () and include () are the same with respect to handling failures. However, require () results in a fatal error and does not allow the processing of the page.







PHP ( TutorialsIV )


How can we increase the execution time of a php script

Default time allowed for the PHP scripts to execute is 30s defined in the php.ini file. The function used is set_time_limit(int seconds). If the value passed is ‘0’, it takes unlimited time. It should be noted that if the default timer is set to 30 sec and 20 sec is specified in set_time_limit(), the script will run for 45 secs.

How to set cookies in PHP 

Cookies are often used to track user information.

Cookies can be set in PHP using the setcookie() function.

Parameters are : name of the cookie, Value of cookie, time for expiry of cookie, path of the cookies location on server, domain, secure (TRUE or FALSE) indication whether the cookie is passed over a secure HTTPS, http only (TRUE) which will make the cookie accessible only through HTTP.

Returns TRUE or FALSE depending on whether the cookie was executed or not.


Functions For IMAP In PHP


IMAP is used for communicate with mail servers. It has a number of functions. Few of them are listed below:

Imap_alerts – Returns all the imap errors occurred

Imap_body – Reads the message body

Imap_check – Reads the current mail box

Imap_clearflag_full – Clears all flags

Imap_close – close and IMAP stream

Imap_delete – Delete message from current mailbox

Imap_delete_mailbox – Deletes a mailbox

Imap_fetchbody – Fetches body of message

Imap_fetchheader – Fetches header of message

Imap_headers – Returns headers for ALL messages

Imap_mail : send a mail

Imap_sort- Sorts imap messages

Different types of errors in PHP


Different types of Errors are:

E_ERROR: A fatal error that causes script termination

E_WARNING: Run-time warning that does not cause script termination


E_PARSE: Compile time parse error.


E_NOTICE: Run time notice caused due to error in code


E_CORE_ERROR: Fatal errors that occur during PHP's initial startup (installation)


E_CORE_WARNING: Warnings that occur during PHP's initial startup 


E_COMPILE_ERROR: Fatal compile-time errors indication problem with script.


E_USER_ERROR: User-generated error message. 


E_USER_WARNING: User-generated warning message. 

E_USER_NOTICE: User-generated notice message. 
 
E_STRICT: Run-time notices.
 
E_RECOVERABLE_ERROR: Catchable fatal error indicating a dangerous error
 
E_ALL: Catches all errors and warnings 

Difference Between $message and $$message In PHP


Explain the difference between $message and $$message.

$message is used to store variable data. $$message can be used to store variable of a variable. Data stored in $message is fixed while data stored in $$message can be changed dynamically.
E.g. $var1 = ‘Variable 1’
$$var1= ‘variable2’
This can be interpreted as $ Variable 1=‘variable2’;
For me to print value of both variables, I will write
$var1 $($var1)

Persistent Cookie

Cookies are used to remember the users. Content of a Persistent cookie remains unchanged even when the browser is closed. ‘Remember me’ generally used for login is the best example for Persistent Cookie.