Pages

Thursday 4 August 2022

Different Types of CSS

There are three ways of adding CSS style rules to HTML elements:       
1. Inline — using the style attribute in HTML element
2. Internal — inside the style element under head section
3. External — using an external CSS file with .css extension

Therefore, CSS allows style rules to be specified in three different ways. CSS styles can be added inside a single HTML element, inside the “style” element under HTML head section, or in an external CSS file. Even multiple external style sheets can be referenced inside a single HTML document.

All the styles will “cascade” into a new “virtual” style , where number one has the highest priority, followed by number 2 and number 3.

So, an inline style (inside an HTML element) has the highest priority, which means that it will override internal style (which is declared inside the “head” section), or in an external style sheet.
 
CSS Syntax
The CSS syntax is made up of three parts: a selector, a property and a value:
selector {  property : value }
The selector is normally the HTML element/tag we wish to define, the property is the attribute we wish to change, and each property can take a value. The property and value are separated by a colon, and surrounded by curly braces:

body { background-color : lightblue }

If the value is multiple words, put quotes around the value:

p { font-family : “sans serif” }
If we wish to specify more than one property, we must separate each property with a semicolon. The example below shows how to define a center aligned paragraph, with a red text color:

p { text-align : center; color : red }
To make the style definitions more readable, we can describe one property on each line, like this:

p {  
    text-align : center;  
    color : red;  
    font-family : arial 
}
 
Grouping
We can group selectors; separating each selector with a comma. In the example below we have grouped all the header elements. All header elements will be displayed in green text color:
h1, h2, h3, h4, h5, h6 { color : green }
 
How to Insert a Style Sheet
When a browser reads a style sheet, it will format the web page according to it. There are three ways of inserting a style sheet: 
1) Inline,  
2) Internal (or embedded), and 
3) External. We will demonstrate each of them one-by-one with coding examples.
 
[1] Inline CSS

An inline style loses many of the advantages of style sheets by mixing content with presentation. Use this method sparingly, such as when a style is to be applied to a single occurrence of an element.
To use inline styles we use the style attribute in the relevant tag. The style attribute can contain any CSS property. The example shows how to change the color and the left margin of a paragraph:
<p style="color: red; margin-left: 20px">
This is a paragraph
</p>
The complete code is given below. It also changes the background color and adds one more paragraph.
<html>
<body style="background-color: lightblue">
<p style="color: red; margin-left: 20px">
This is a paragraph
</p
<br>
<p style="color: green">This is another paragraph</p>
</body>
</html>

Example:
<html>
<body style="background-color:green">
<h1 style="color:white;text-align:center">
THIS IS THE DEMO FOR INLINE STYLE SHEETS
</hl>
</body>
</html>

Output:


[2] Internal CSS
The internal style sheet should be used when a single document has a unique style. We define internal styles in the head section by using the “style” tag under HTML head section, like this:

<html>
<head>
<style type="text/css">
   h3 { color: blue }
   p { color: red; margin-left: 20px }
   body { background-color: lightblue }
</style>
</head>
<body>
<h3>This is a heading</h3>
<hr>
<p>This is a paragraph</p>
</body>
</html>

Example:
<html>
<head>
<style>
body {background-color:yellow}
h1{color:black}
</style>
</head>
<body>
<h1>THIS IS THE DEMO FOR 
INTERNAL CASCADING STYLE
SHEETS</h1>
</body>
</html>

Output:
[3] External CSS
An external style sheet is ideal when the style is applied to many web pages. With an external style sheet, we can change the look of an entire Web site by changing one file. Each page must link to the style sheet using the “link” tag. The “link” tag goes inside the head section:

<head>
<link rel="stylesheet" type="text/css" href="external.css"/>
</head>
 

The browser will read the style definitions from the file external.css, and format the document according to it. An external style sheet can be written in any text editor. The file should not contain any HTML tags. Our style sheet should be saved with a .css extension.

The example style sheet named external.css file is shown below:

body { background-image: url(“bgdesert.jpg”) }

h3 { color: blue; font-family: verdana; font-size: 300% }

p { color: red; font-family: courier; font-size: 150%; }

The complete code is given below:

<html>
<head>
<link rel="stylesheet" type="text/css" href="external.css"/>
</head>
<body>
<h3><b>This is a heading</b></h3>
<hr>
<p><b>This is a paragraph</b></p>
</body>
</html>

Example:
Prg1:ext.css
body {background-color:blue}
h1{color:white;text-align:center}

Prg 2:external.html
<html>
<head>
<link rel="stylesheet" href="ext.css">
</head>
<body>
<h1>THIS IS SAMPLE DEMO FOR 
EXTERNAL CASCADING STYLE
SHEETS</h1>
</body>
</html>

Output:

Monday 1 August 2022

Difference between DHTML vs HTML

Difference between HTML and DHTML

HTML

DHTML

HTML is a Hypertext Markup language.

DHTML is a Dynamic Hypertext markup language.

HTML stand for static page.

DHTML stands for Dynamic.

HTML does not have a server-side code..

DHTML have server-side code.

Plain page without any scripts and style as called as HTML.

Page with HTML,CSS and scripts called as DHTML.

Client-side technologies slow in HTML.

Client-side technologies fast in HTML.

Processing from the browser not required in HTML.

Processing from browser required in DHTML.

HTML files are stored with .htm or .html extensions.

DHTML file are stored with .dhtml extension.


 //Program to illustrate HTML vs DHTML

<html>
<head>
<title>JavaScript Animation</title>
<script type="text/javascript">
var imgObj = null;
 function init(){
imgObj = document.getElementById('myImage');
imgObj.style.position= 'relative';
imgObj.style.left = '0px';
}
function moveRight(){
imgObj.style.left = parseInt(imgObj.style.left) + 10 + 'px';
}
window.onload =init;
</script>
</head>
<body>
<form>
<img id="myImage" src="shiva3.png"height="400" width="600" />
<p>Click button below to move he image to right</p>
<input type="button" value="Click Me" onclick="moveRight();" />
</form>
</body>
</html> 

Saturday 5 December 2020

Subnet Mask

Problem:
Your router has the following IP address on Ethernet0: 172.16.2.1/23. Which of the following can be valid host IDs on the LAN interface attached to the router?
1) 172.16.1.100
2) 172.16.1.198
3) 172.16.2.255
4) 172.16.3.0
A. 1 only
B. 2 and 3 only
C. 3 and 4 only
D. None of the above
Answer : C

Explanation:
172 Binary number  =10101100
16 Binary number    =00010000
2 Binary number      =00000010
1 Binary number      =00000001

Given IP172.16.2.1=10101100.00010000.00000010.00000001
Subnet mask /23   =11111111.11111111.11111110.00000000
AND Operation
Network Address  =10101100.00010000.00000010.00000000

Network Address     =172.16.2.0      (NID=1 HID=0)
Broad cast Address =172.16.3.255  (NID=1 HID=1)

Valid First Host Id = 172.16.2.1    (Add +1 to Network Address)
Valid Last Host Id = 172.16.3.254 (subtract  -1 to Broad cast Address)


Problem
Which two statements describe the IP address 10.16.3.65/23?
1)The subnet address is 10.16.3.0     255.255.254.0.
2)The lowest host address in the subnet is 10.16.2.1   255.255.254.0.
3)The last valid host address in the subnet is 10.16.2.254 255.255.254.0.
4)The broadcast address of the subnet is 10.16.3.255  255.255.254.0.
A. 1 and 3
B. 2 and 4
C. 1, 2 and 4
D. 2, 3 and 4
Answer:B

Explanation:
10 Binary number     =00001010
16 Binary number     =00010000
3  Binary number      =00000011
65 Binary number     =01000001

Given IP 10.16.3.65 =00001010.00010000.00000011.01000001
Subnet mask /23     =11111111.11111111.11111110.00000000
AND Operation          --------------------------------------- **********
Network Address    =00001010.00010000.00000010.00000000

Network Address     =10.16.2.0      (-NID=1 *HID=0)
Broad cast Address =10.16.3.255  (-NID=1 *HID=1)

Valid First Host Id = 10.16.2.1    (Add +1 to Network Address)
Valid Last Host Id = 10.16.3.254 (subtract  -1 to Broad cast Address)

Problem
Which subnet does host 172.27.25.187/23 belong to?
Answer: subnet Network Address is   =172.27.24.0 
Explanation:
172 Binary number   =10101100
27 Binary number     =00011011
25 Binary number     =00011001
187 Binary number   =10111011

Given IP172.27.25.187=10101100.00011011.00011001.10111011
Subnet mask /23          =11111111.11111111.11111110.00000000
AND Operation                --------------------------------------**********
Network Address         =10101100.00011011.00011000.00000000

Network Address     =172.27.24.0      (-NID=1 *HID=0)
Broad cast Address =172.27.25.255  (-NID=1 *HID=1)

Valid First Host Id      = 172.27.24.1    (Add +1 to Network Address)
Valid Last Host Id =172.27.25.254 (subtract  -1 to Broad cast Address)

Problem:
How many subnets and hosts per subnet can you get from the network 172.28.0.0 255.255.254.0?
Explanation:
172 Binary number   =10101100
28 Binary number     =00011100
0 Binary number       =00000000
0 Binary number       =00000000
255 Binary number   =11111111
254 Binary number   =11111110

Given IP
172.28.0.0       
10101100.00011100.00000000.00000000
Subnet mask
255.255.254.0
11111111.11111111.11111110.00000000
---------------------------------------**********
AND Operation
Network Address
10101100.00011100.00000000.00000000

To find the subnets we need to observe the number of 1's placed in 3 rd octet because there is a change observed in the given subnet mask i.e  2 power 7 = 128 subnets

To find the hosts per subnet we need to observe the number of 0's placed from 3 rd octet to 4th octet i.e  2 power 9 = 512 -2 =510 Host 

Problem:
How many subnets and hosts per subnet can you get from the network 172.21.0.0/28?
Explanation:
172 Binary number   =10101100
21 Binary number     =00010101
0 Binary number       =00000000
0 Binary number       =00000000
255 Binary number   =11111111


Given IP
172.21.0.0       
10101100.00010101.00000000.00000000
Subnet mask /28
11111111.11111111.11111111.11110000
------------------------------------------------ ****
AND Operation
Network Address
10101100.00010101.00000000.00000000

To find the subnets we need to observe the number of 1's placed in 3 rd & 4th octet because there is a change observed in the given subnet mask i.e  2 power 12 = 4096 subnets

To find the hosts per subnet we need to observe the number of 0's placed from 4th octet i.e  2 power 4 = 16 -2 =14 Host
 
You are designing a subnet mask for the 172.29.0.0 network. You want 60 subnets with up to 600 hosts on each subnet. What subnet mask should you use?

Thursday 3 December 2020

Introduction to Networking

 



IP sharing: Your ISP assigns you one IP address. If you have a desktop, a laptop, a media box on your TV, and an iPad, that one IP address clearly isn’t going to cut it. A router manages those multiple connections and ensures that the right packets of information go to the right places. Without this function, there would be no way for a person on the desktop and a person on the laptop to both browse the web as there would be no distinguishing between which computer was requesting what.

Network Address Translation (NAT): Related to the IP sharing function, NAT modifies the headers in packets of information coming into and out of your network so that they get routed to the proper device. Think of NAT like a very helpful receptionist inside your router that knows exactly where every incoming/outgoing package should go and stamps the department on them accordingly.

Dynamic Host Configuration: Without DHCP you would have to manually configure and add all the hosts to your network. This means every time a new computer entered the network you would have to manually assign it an address on the network. DHCP does that for you automatically so that when you plug your XBOX into your router, your friend gets on your wireless network, or you add a new computer, an address is assigned with no human interaction required.

Firewall: Routers act as basic firewalls in a variety of ways including automatically rejecting incoming data that is not part of an ongoing exchange between a computer within your network and the outside world. If you request a music stream from Pandora, for example, your router says, “We’re expecting you, come on in” and that stream of data is directed to the device that made the request. On the other hand, if a sudden burst of port probing comes in from an unknown address your router acts as a bouncer and rejects the requests, effectively cloaking your computers. Even for a user with a single computer a simple $50 router is worth it for the firewall functionality alone.

Sunday 29 November 2020

Introduction to IP Addressing

IPV4

X.X.X.X                       32 Bits

X=8 Bits


MAC

X.X.X.X.X.X               48 Bits

X=8 Bits


IPV6

X.X.X.X.X.X.X.X        128Bits

X=16 Bits


  

IP address is an address having information about how to reach a specific host, especially outside the LAN. An IP address is a 32 bit unique address having an address space of 232

Generally, there are two notations in which IP address is written, dotted decimal notation and hexadecimal notation.

Dotted Decimal Notation:


Hexadecimal Notation:


Classful Addressing
                            The 32 bit IP address is divided into five sub-classes. These are:
Class A
Class B
Class C
Class D
Class E
Each of these classes has a valid range of IP addresses. Classes D and E are reserved for multicast and experimental purposes respectively. The order of bits in the first octet determine the classes of IP address.

IPv4 address is divided into two parts:
Network ID
Host ID
The class of IP address is used to determine the bits used for network ID and host ID and the number of total networks and hosts possible in that particular class. Each ISP (Internet Service Provider) or network administrator assigns IP address to each device that is connected to its network.

Note: IP addresses are globally managed by Internet Assigned Numbers Authority(IANA) and Regional Internet Registries(RIR).

Note: While finding the total number of host IP addresses, 2 IP addresses are not counted and are therefore, decreased from the total count because the first IP address of any network is the network number and whereas the last IP address is reserved for broadcast IP.

Class A
IP address belonging to class A are assigned to the networks that contain a large number of hosts.

The network ID is 8 bits long.
The host ID is 24 bits long.

The higher order bit of the first octet in class A is always set to 0. The remaining 7 bits in first octet are used to determine network ID. The 24 bits of host ID are used to determine the host in any network. The default subnet mask for class A is 255.x.x.x. Therefore, class A has a total of:

2^7-2= 126 network ID(Here 2 address is subracted because 0.0.0.0 and 127.x.y.z are special address. )
2^24 – 2 = 16,777,214 host ID
IP addresses belonging to class A ranges from 1.x.x.x – 126.x.x.x

Class B:
IP address belonging to class B are assigned to the networks that ranges from medium-sized to large-sized networks.

The network ID is 16 bits long.
The host ID is 16 bits long.
The higher order bits of the first octet of IP addresses of class B are always set to 10. The remaining 14 bits are used to determine network ID. The 16 bits of host ID is used to determine the host in any network. The default sub-net mask for class B is 255.255.x.x. Class B has a total of:

2^14 = 16384 network address
2^16 – 2 = 65534 host address
IP addresses belonging to class B ranges from 128.0.x.x – 191.255.x.x.

Class C:
IP address belonging to class C are assigned to small-sized networks.

The network ID is 24 bits long.
The host ID is 8 bits long.
The higher order bits of the first octet of IP addresses of class C are always set to 110. The remaining 21 bits are used to determine network ID. The 8 bits of host ID is used to determine the host in any network. The default sub-net mask for class C is 255.255.255.x. Class C has a total of:

2^21 = 2097152 network address
2^8 – 2 = 254 host address
IP addresses belonging to class C ranges from 192.0.0.x – 223.255.255.x.

Class D:
IP address belonging to class D are reserved for multi-casting. The higher order bits of the first octet of IP addresses belonging to class D are always set to 1110. The remaining bits are for the address that interested hosts recognize.

Class D does not posses any sub-net mask. IP addresses belonging to class D ranges from 224.0.0.0 – 239.255.255.255.

Class E:
IP addresses belonging to class E are reserved for experimental and research purposes. IP addresses of class E ranges from 240.0.0.0 – 255.255.255.254. This class doesn’t have any sub-net mask. The higher order bits of first octet of class E are always set to 1111.

Range of special IP addresses:

169.254.0.0 – 169.254.0.16 : Link local addresses
127.0.0.0 – 127.0.0.8 : Loop-back addresses
0.0.0.0 – 0.0.0.8 : used to communicate within the current network.


Problem :
consider the following subnet mask
255.255.254.0
1)Find the number of hosts per subnet 
2)Number of subnet if subnet mask belongs to class A
3)Number of subnet if subnet mask belongs to class B
4)Number of subnet if subnet mask belongs to class C
5)Number of subnet if total 10bits are used for global network ID


Problem:


Problem:
Answer:C


Problem:




Thursday 26 November 2020

E-mail (Electronic mail)

           


 


Short for electronic mail, e-mail or email is information stored on a computer that is exchanged between two users over telecommunications. The first e-mail was sent by Ray Tomlinson in 1971

Email is a service which allows us to send the message in electronic mode over the internet. It offers an efficient, inexpensive and real time mean of distributing information among people.

E-Mail Address

Each user of email is assigned a unique name for his email account. This name is known as E-mail address. Different users can send and receive messages according to the e-mail address.

E-mail is generally of the form username@domainname. For example, webmaster@tutorialspoint.com is an e-mail address where webmaster is username and tutorialspoint.com is domain name.

The username and the domain name are separated by @ (at) symbol.

E-mail addresses are not case sensitive.

Spaces are not allowed in e-mail address.


The following rules make an e-mail address valid:

The username cannot be longer than 64 characters long, and the domain name cannot be longer than 254 characters.

There should be only one @ sign in an e-mail address.

The space and special characters: ( ) , : ; < > \ [ ] are allowed. Occasionally, a space, backslash, and quotation mark work but must be preceded with a forward slash. Although valid, some e-mail providers do not allow these characters.

The username and e-mail addresses as a whole cannot begin or end with a period.

The e-mail must not have two or more consecutive periods.

E-mail Header
The first five lines of an E-mail message is called E-mail header. The header part comprises of following fields:

From
Date
To
Subject
CC
BCC

From
The From field indicates the sender’s address i.e. who sent the e-mail.

Date
The Date field indicates the date when the e-mail was sent.

To
The To field indicates the recipient’s address i.e. to whom the e-mail is sent.

Subject
The Subject field indicates the purpose of e-mail. It should be precise and to the point.

CC
CC stands for Carbon copy. It includes those recipient addresses whom we want to keep informed but not exactly the intended recipient.

BCC
BCC stands for Black Carbon Copy. It is used when we do not want one or more of the recipients to know that someone else was copied on the message.

Greeting
Greeting is the opening of the actual message. Eg. Hi Sir or Hi Guys etc.

Text
It represents the actual content of the message.

Signature
This is the final part of an e-mail message. It includes Name of Sender, Address, and Contact Number.

Wednesday 25 November 2020

How Does The Internet Works

 


To understand the Internet, it helps to look at it as a system with two main components. 
The first of those components is hardware. That includes everything from the cables that carry terabits of information every second to the computer sitting in front of you.
Other types of hardware that support the Internet include routers, servers, cell phone towers, satellites, radios, smartphones and other devices. All these devices together create the network of networks. 

Machines that store the information we seek on the Internet are servers. Other elements are nodes which serve as a connecting point along a route of traffic. And then there are the transmission lines which can be physical, as in the case of cables and fiber optics, or they can be wireless signals from satellites, cell phone or 4G towers, or radios.

All of this hardware wouldn't create a network without the second component of the Internet: the protocols. Protocols are sets of rules that machines follow to complete tasks. Without a common set of protocols that all machines connected to the Internet must follow, communication between devices couldn't happen. The various machines would be unable to understand one another or even send information in a meaningful way. The protocols provide both the method and a common language for machines to use to transmit data.

You've probably heard of several protocols on the Internet. For example, hypertext transfer protocol is what we use to view Web sites through a browser -- that's what the http at the front of any Web address stands for. If you've ever used an FTP server, you relied on the file transfer protocol. Protocols like these and dozens more create the framework within which all devices must operate to be part of the Internet.

Two of the most important protocols are the transmission control protocol (TCP) and the Internet protocol (IP). We often group the two together -- in most discussions about Internet protocols you'll see them listed as TCP/IP.

What do these protocols do? At their most basic level, these protocols establish the rules for how information passes through the Internet. Without these rules, you would need direct connections to other computers to access the information they hold. You'd also need both your computer and the target computer to understand a common language.

You've probably heard of IP addresses. These addresses follow the Internet protocol. Each device connected to the Internet has an IP address. This is how one machine can find another through the massive network.

The version of IP most of us use today is IPv4, which is based on a 32-bit address system. There's one big problem with this system: We're running out of addresses. That's why the Internet Engineering Task Force (IETF) decided back in 1991 that it was necessary to develop a new version of IP to create enough addresses to meet demand. The result was IPv6, a 128-bit address system. That's enough addresses to accommodate the rising demand for Internet access.

When you want to send a message or retrieve information from another computer, the TCP/IP protocols are what make the transmission possible. Your request goes out over the network, hitting domain name servers (DNS) along the way to find the target server. The DNS points the request in the right direction. Once the target server receives the request, it can send a response back to your computer. The data might travel a completely different path to get back to you. This flexible approach to data transfer is part of what makes the Internet such a powerful tool.

How data travels across the Internet
First you open your Web browser and connect to our Web site when you  do this, your computer sends an electronic request over your internet connection to your Internet Service Provider (ISP).The ISP routes the request to a server further up the chain on the Internet. Eventually the request will hit a Domain Name Server (DNS).

This server will look for a match for the domain name you've typed in (such as www.howstuffworks.com). If it finds a match, it will direct your request to the proper server's IP address. If it doesn't find a match, it will send the request further up the chain to a server that has more information.

The request will eventually come to our Web server. Our server will respond by sending the requested file in a series of packets. Packets are parts of a file that range between 1,000 and 1,500 bytes. Packets have headers and footers that tell computers what's in the packet and how the information fits with other packets to create an entire file. Each packet travels back up the network and down to your computer. Packets don't necessarily all take the same path -- they'll generally travel the path of least resistance.

That's an important feature. Because packets can travel multiple paths to get to their destination, it's possible for information to route around congested areas on the Internet. In fact, as long as some connections remain, entire sections of the Internet could go down and information could still travel from one section to another -- though it might take longer than normal.

When the packets get to you, your device arranges them according to the rules of the protocols. It's kind of like putting together a jigsaw puzzle. The end result is that you see this article.

This holds true for other kinds of files as well. When you send an e-mail, it gets broken into packets before zooming across the Internet. Phone calls over the Internet also convert conversations into packets using the voice over Internet protocol (VoIP). We can thank network pioneers like Vinton Cerf and Robert Kahn for these protocols -- their early work helped build a system that's both scalable and robust.




Different Types of CSS

There are three ways of adding CSS style rules to HTML elements:        1. Inline — using the style attribute in HTML element 2. Internal — ...