student notes / est. for the classroom

HTML, CSS, JavaScript, Python, data science, computer networks — written the way you'd explain it to a classmate, not a compiler.

Top Job & Internship Portals

Handpicked portals for fresher jobs, tech roles, and listings in Hyderabad

GFG

GeeksforGeeks

Tech & Software Roles

Visit →
INT

Internshala

Fresher Jobs & Internships

Visit →
GOOG

Google Careers

Global Google Openings

Visit →
APN

Apna Jobs

Local Jobs in Hyderabad

Visit →
INS

Instahyre

Tech Roles in Hyderabad

Visit →
NAUK

Naukri.com

Fresher Jobs in Hyderabad

Visit →
📢 Updated daily

Internship & Job Alerts

01

Latest notes

November 11, 2022

IWP theory - Web Programming Theory

Introduction to Internet and WWW

Computers and their structures are tough to approach, and it is made even extra tough while you want to recognize phrases associated with the difficulty this is already utilized in regular English, Network, and the net will appear to be absolutely wonderful from one some other, however, they may seem like identical.

A network is a group of two or more computer systems (Multiple gadgets, additionally called hosts), which are related through a couple of channels for the motive of sending and receiving data (records/media) in a shared environment. The community also can consist of serval gadgets/mediums that resource communique among or extra machines; those gadgets are called Network devices and consist of routers, switches, hubs, and bridges, amongst others.




Internet is a group of computer systems connected from all around the world. The Internet protocol suite is a framework defined through the Internet standards. Methods are divided right into a layered set of protocols on this architecture. The Internet gives a huge variety of statistics and communique offerings, which includes forums, databases, email, and hypertext. It is made of the neighborhood to global personal, public networks connected through plenty of digital, wireless, and networking technologies.

The Internet is a worldwide interconnected network of hundreds of thousands of computers of various types that belong to multiple networks.

Working of the internet: The internet is a global computer network that connects various devices and sends a lot of information and media. It uses an Internet Protocol (IP) and Transport Control Protocol (TCP)-based packet routing network. TCP and IP work together to ensure that data transmission across the internet is consistent and reliable, regardless of the device or location. Data is delivered across the internet in the form of messages and packets. A message is a piece of data delivered over the internet, but before it is sent, it is broken down into smaller pieces known as packets.

IP is a set of rules that control how data is transmitted from one computer to another via the internet. The IP system receives further instructions on how the data should be transferred using a numerical address (IP Address). The TCP is used with IP to ensure that data is transferred in a secure and reliable manner. This ensures that no packets are lost, that packets are reassembled in the correct order, and that there is no delay that degrades data quality.

History of Internet 

Talking about the history of internet, the ARPANET (Advanced Research Projects Agency Network, later renamed the internet) established a successful link between the University of California Los Angeles and the Stanford Research Institute on October 29, 1969. Libraries automate and network catalogs outside of ARPANET in the late 1960s.

TCP/IP (Transmission Control Protocol and Internet Protocol) is established in the 1970s, allowing internet technology to mature. The development of these protocols aided in the standardization of how data was sent and received via the internet. NSFNET (National Science Foundation Network), the 56 Kbps backbone of the internet, was financed by the National Science Foundation in 1986. Because government monies were being used to administer and maintain it, there were commercial restrictions in place at the time.

In the year 1991, a user-friendly internet interface was developed. Delphi was the first national commercial online service to offer internet connectivity in July 1992. Later in May 1995, All restrictions on commercial usage of the internet are lifted. As a result, the internet has been able to diversify and grow swiftly. Wi-Fi was first introduced in 1997. The year is 1998, and Windows 98 is released. Smartphone use is widespread in 2007. The 4G network is launched in 2009. The internet is used by 3 billion people nowadays. By 2030, there are expected to be 7.5 billion internet users and 500 billion devices linked to the internet.

Uses of the Internet:

·         E-mail: E-mail is an electronic message sent across a network from one computer user to one or more recipients. It refers to the internet services in which messages are sent from and received by servers. 

·         Web Chat: Web chat is an application that allows you to send and receive messages in real-time with others. By using Internet chat software, the user can log on to specific websites and talk with a variety of other users online. Chat software is interactive software that allows users to enter comments in one window and receive responses from others who are using the same software in another window.

·         World Wide Web: The World Wide Web is the Internet’s most popular information exchange service. It provides users with access to a large number of documents that are linked together using hypertext or hyperlinks.

·         E-commerce: E-commerce refers to electronic business transactions made over the Internet. It encompasses a wide range of product and service-related online business activities.

·         Internet telephony: The technique that converts analog speech impulses into digital signals and routes them through packet-switched networks of the internet is known as internet telephony.

·         Video conferencing: The term “video conferencing” refers to the use of voice and images to communicate amongst users.

Web Client 

The client (or user) side of the Internet. The Web browser on the user’s computer or mobile device is referred to as a Web client. It could also apply to browser extensions and helper software that improve the browser’s ability to support specific site services.

Web browser

A web browser is a software program software that searches for, retrieves, and presentations material which includes Web pages, photos, videos, and different files. The browser sends a request to the Webserver, which then transmits the statistics returned to the browser, which presentations the findings at the laptop. Example – Mozilla Firefox, Microsoft Edge, Google Chrome, Safari etc.

Webpage

An internet web page (additionally called a web page) is a report that may be regarded in an internet browser at the World Wide Web. HTML (HyperText Markup Language) and CSS (Cascading Style Sheet) are used to generate the primary shape of an internet web page. An internet web page is generally a segment of an internet site that carries statistics in plenty of formats, which includes textual content inside the shape of paragraphs, lists, tables, and so on.

The home web page is the beginning or first web page of an internet site. It gives trendy statistics and connections to all the internet pages which are associated. Every internet web page has its personal deal with. This may be visible withinside the deal with the bar. As a result, if we need to get admission to a selected internet web page, the deal needs to be placed inside the browser’s deal with bar.

Website

An internet site, in trendy, is a group of statistics approximately statistics prepared into many internet pages. An internet site is probably made for a sure motive, subject matter, or to provide a service. An internet site (abbreviated as “website” or “site”) is a group of online pages connected collectively through links and saved on an internet server. By clicking on links, a tourist can pass from one web page to the next. An internet site’s pages also are connected below one area call and proportion a not unusual place subject matter and template.

Search Engine

Search engines are websites that search on the internet on behalf of users and show a listing of results. More than actually written may be discovered on seek engines. You can be capable of looking for different online content material which includes photographs, video content material, books, and news, in addition to gadgets and offerings, relying on the seek engine you are the use of.

To make use of the Internet, you do not always want to recognize the deal with an internet site. It is crucial to recognize the way to do a look for statistics. Using a seek engine is one of the only methods to seek. A seek engine can help you in finding what you are looking for. You also can appearance up net maps and instructions to help you to plot your adventure from one factor to some other. Example: Google, Bing, DuckDuckGo, yahoo, etc.

Web 1.0: The Beginning of the Internet

Web 1.0, which emerged with the invention of the Internet, featured static web pages that could only be viewed. These early websites were essentially digital brochures, with limited interactivity and no ability for users to contribute content. This era saw the rise of early browsers such as Mosaic and Netscape Navigator, which made it easier for users to access the Web.

Web 2.0: The Era of Social Media and User-Generated Content

Web 2.0, which emerged during the “Internet Boom” era of the late 1990s and early 2000s, introduced more dynamic web pages and websites, and allowed for user-generated content. This era saw the rise of social media platforms such as Facebook, Twitter, and YouTube, as well as the introduction of blogs, wikis, and other forms of user-generated content.

Web 3.0: The Future of the Internet

Web 3.0, which is still in development, promises to bring a more personalized and intuitive experience for users. It is expected to be more intelligent and able to understand the context and intent of the user’s actions. This will be achieved through the integration of Artificial Intelligence (AI) and Machine Learning (ML) technologies.

Many experts in the tech industry claimed that Web 3.0 is the next evolution of the internet that is focused on decentralization, intelligence, and security. It aims to create a more personalized, intuitive, and inclusive experience for users by leveraging new technologies such as blockchain and artificial intelligence. The goal of Web 3.0 is to make the internet more democratic, open-source, and secure.

Differentiation between Network and Internet

The number one distinction between a network and the internet is that a network is made of computer systems that are bodily related and may be used as a personal laptop at the same time as additionally sharing records. The Internet, on the alternative hand, might be an era that connects those small and massive networks and creates a brand new in-intensity community.

Advantages of the Internet:

·         It is the best source of a wide range of information. There is no better place to conduct research than the internet.

·         Online gaming, talking, browsing, music, movies, dramas, and TV series are quickly becoming the most popular ways to pass the time.

·         Because there are hundreds of thousands of newsgroups and services that keep you updated with every tick of the clock, the Internet is a source of the most recent news.

·         Because of virtual shops where you may buy anything you want and need without leaving your house, internet shopping is becoming increasingly popular. Recently, virtual shops have been making a lot of money.

·         With the emergence of online businesses, virtual stores, and credit card usage, purchasing goods without going to the store has never been easier.

Disadvantages of the Internet:

·         Spending too much time on the internet is hazardous for the young generation’s physical and mental health.

·         Children who use the internet develop an addiction, which is quite dangerous.

·         It is now quite easy to decipher someone’s chat or email messages thanks to the hacking community.

·         With the emergence of online stores, people prefer to order online rather than going to local stores which results in less social interactions among people.

 

 

 

 

HTML tags, attributes and elements

HTML Tags

HTML Elements

HTML Attributes

HTML tags are used to hold the HTML element.

HTML element holds the content.

HTML attributes are used to describe the characteristic of an HTML element in detail.

HTML tag starts with < and ends with >

Whatever written within a HTML tag are HTML elements.

HTML attributes are found only in the starting tag.

HTML tags are almost like keywords where every single tag has unique meaning.

HTML elements specifies the general content.

HTML attributes specify various additional properties to the existing HTML element.

What are Tags and Attributes?

Tags and attributes are the basis of HTML.

They work together but perform different functions – it is worth investing 2 minutes in differentiating the two.

What Are HTML Tags?

Tags are used to mark up the start of an HTML element and they are usually enclosed in angle brackets. An example of a tag is: <h1>.

Most tags must be opened <h1> and closed </h1> in order to function.

What are HTML Attributes?

Attributes contain additional pieces of information. Attributes take the form of an opening tag and additional info is placed inside.

·         An example of an attribute is:

<img src="mydog.jpg" alt="A photo of my dog.">

In this instance, the image source (src) and the alt text (alt) are attributes of the <img> tag.

Golden Rules To Remember

·         The vast majority of tags must be opened (<tag>) and closed (</tag>) with the element information such as a title or text resting between the tags.

·         When using multiple tags, the tags must be closed in the order in which they were opened. For example:

           Example: <strong><em>This is really important!</em></strong>

 

CSS selectors and properties

 

CSS Selectors

CSS selectors are used to "find" (or select) the HTML elements you want to style.

We can divide CSS selectors into five categories:

This page will explain the most basic CSS selectors.


The CSS element Selector

The element selector selects HTML elements based on the element name.

Example

Here, all <p> elements on the page will be center-aligned, with a red text color: 

p {
  text-align
: center;
  color
: red;
}

Try it Yourself »


The CSS id Selector

The id selector uses the id attribute of an HTML element to select a specific element.

The id of an element is unique within a page, so the id selector is used to select one unique element!

To select an element with a specific id, write a hash (#) character, followed by the id of the element.

Example

The CSS rule below will be applied to the HTML element with id="para1": 

#para1 {
  text-align
: center;
  color
: red;
}

Try it Yourself »

Note: An id name cannot start with a number!



The CSS class Selector

The class selector selects HTML elements with a specific class attribute.

To select elements with a specific class, write a period (.) character, followed by the class name.

Example

In this example all HTML elements with class="center" will be red and center-aligned: 

.center {
  text-align
: center;
  color
: red;
}

Try it Yourself »

You can also specify that only specific HTML elements should be affected by a class.

Example

In this example only <p> elements with class="center" will be red and center-aligned: 

p.center {
  text-align
: center;
  color
: red;
}

Try it Yourself »

HTML elements can also refer to more than one class.

Example

In this example the <p> element will be styled according to class="center" and to class="large": 

<p class="center large">This paragraph refers to two classes.</p>

Try it Yourself »

Note: A class name cannot start with a number!


The CSS Universal Selector

The universal selector (*) selects all HTML elements on the page.

Example

The CSS rule below will affect every HTML element on the page: 

* {
  text-align
: center;
  color
: blue;
}

Try it Yourself »


The CSS Grouping Selector

The grouping selector selects all the HTML elements with the same style definitions.

Look at the following CSS code (the h1, h2, and p elements have the same style definitions):

h1 {
  text-align
: center;
  color
: red;
}

h2 
{
  text-align
: center;
  color
: red;
}

p 
{
  text-align
: center;
  color
: red;
}

It will be better to group the selectors, to minimize the code.

To group selectors, separate each selector with a comma.

Example

In this example we have grouped the selectors from the code above: 

h1, h2, p {
  text-align
: center;
  color
: red;
}

Try it Yourself »

 

 

Javascript Datatypes and variables

 

JavaScript has 8 Datatypes

1. String
2. Number
3. Bigint
4. Boolean
5. Undefined
6. Null
7. Symbol
8. Object

The Object Datatype

The object data type can contain:

1. An object
2. An array
3. A date

Examples

// Numbers:
let length = 16;
let weight = 7.5;

// Strings:
let color = "Yellow";
let lastName = "Johnson";

// Booleans
let x = true;
let y = false;

// Object:
const person = {firstName:"John", lastName:"Doe"};

// Array object:
const cars = ["Saab", "Volvo", "BMW"];

// Date object:
const date = new Date("2022-03-25");

Note

A JavaScript variable can hold any type of data.

The Concept of Data Types

In programming, data types is an important concept.

To be able to operate on variables, it is important to know something about the type.

Without data types, a computer cannot safely solve this:

let x = 16 + "Volvo";

Does it make any sense to add "Volvo" to sixteen? Will it produce an error or will it produce a result?

JavaScript will treat the example above as:

let x = "16" + "Volvo";

Note

When adding a number and a string, JavaScript will treat the number as a string.

Example

let x = 16 + "Volvo";

Try it Yourself »

Example

let x = "Volvo" + 16;

Try it Yourself »

JavaScript evaluates expressions from left to right. Different sequences can produce different results:

JavaScript:

let x = 16 + 4 + "Volvo";

Result:

20Volvo

Try it Yourself »

JavaScript:

let x = "Volvo" + 16 + 4;

Result:

Volvo164

Try it Yourself »

In the first example, JavaScript treats 16 and 4 as numbers, until it reaches "Volvo".

In the second example, since the first operand is a string, all operands are treated as strings.



JavaScript Types are Dynamic

JavaScript has dynamic types. This means that the same variable can be used to hold different data types:

Example

let x;       // Now x is undefined
x = 5;       // Now x is a Number
x = "John";  // Now x is a String

Try it Yourself »


JavaScript Strings

A string (or a text string) is a series of characters like "John Doe".

Strings are written with quotes. You can use single or double quotes:

Example

// Using double quotes:
let carName1 = "Volvo XC60";

// Using single quotes:
let carName2 = 'Volvo XC60';

Try it Yourself »

You can use quotes inside a string, as long as they don't match the quotes surrounding the string:

Example

// Single quote inside double quotes:
let answer1 = "It's alright";

// Single quotes inside double quotes:
let answer2 = "He is called 'Johnny'";

// Double quotes inside single quotes:
let answer3 = 'He is called "Johnny"';

Try it Yourself »

You will learn more about strings later in this tutorial.


JavaScript Numbers

All JavaScript numbers are stored as decimal numbers (floating point).

Numbers can be written with, or without decimals:

Example

// With decimals:
let x1 = 34.00;

// Without decimals:
let x2 = 34;

Try it Yourself »


Exponential Notation

Extra large or extra small numbers can be written with scientific (exponential) notation:

Example

let y = 123e5;    // 12300000
let z = 123e-5;   // 0.00123

Try it Yourself »


Note

Most programming languages have many number types:

Whole numbers (integers):
byte (8-bit), short (16-bit), int (32-bit), long (64-bit)

Real numbers (floating-point):
float (32-bit), double (64-bit).

Javascript numbers are always one type:
double (64-bit floating point).

You will learn more about numbers later in this tutorial.


JavaScript BigInt

All JavaScript numbers are stored in a a 64-bit floating-point format.

JavaScript BigInt is a new datatype (ES2020) that can be used to store integer values that are too big to be represented by a normal JavaScript Number.

Example

let x = BigInt("123456789012345678901234567890");

Try it Yourself »

You will learn more about BigInt later in this tutorial.


JavaScript Booleans

Booleans can only have two values: true or false.

Example

let x = 5;
let y = 5;
let z = 6;
(x == y)       
// Returns true
(x == z)       // Returns false

Try it Yourself »

Booleans are often used in conditional testing.

You will learn more about booleans later in this tutorial.


JavaScript Arrays

JavaScript arrays are written with square brackets.

Array items are separated by commas.

The following code declares (creates) an array called cars, containing three items (car names):

Example

const cars = ["Saab", "Volvo", "BMW"];

Try it Yourself »

Array indexes are zero-based, which means the first item is [0], second is [1], and so on.

You will learn more about arrays later in this tutorial.


JavaScript Objects

JavaScript objects are written with curly braces {}.

Object properties are written as name:value pairs, separated by commas.

Example

const person = {firstName:"John", lastName:"Doe", age:50, eyeColor:"blue"};

Try it Yourself »

The object (person) in the example above has 4 properties: firstName, lastName, age, and eyeColor.

You will learn more about objects later in this tutorial.


The typeof Operator

You can use the JavaScript typeof operator to find the type of a JavaScript variable.

The typeof operator returns the type of a variable or an expression:

Example

typeof ""             // Returns "string"
typeof "John"         // Returns "string"
typeof "John Doe"     // Returns "string"

Try it Yourself »

Example

typeof 0              // Returns "number"
typeof 314            // Returns "number"
typeof 3.14           // Returns "number"
typeof (3)            // Returns "number"
typeof (3 + 4)        // Returns "number"

Try it Yourself »

You will learn more about typeof later in this tutorial.


Undefined

In JavaScript, a variable without a value, has the value undefined. The type is also undefined.

Example

let car;    // Value is undefined, type is undefined

Try it Yourself »

Any variable can be emptied, by setting the value to undefined. The type will also be undefined.

Example

car = undefined;    // Value is undefined, type is undefined

Try it Yourself »


Empty Values

An empty value has nothing to do with undefined.

An empty string has both a legal value and a type.

Example

let car = "";    // The value is "", the typeof is "string"

 

 

Json Communication

 

Creating a simple AJAX GET request

Before we can use Ajax, we need to get jQuery in your application. For this article, we will use the Ajax jQuery script available online as in the code below. For the purpose of this article, we will be considering a JSON file where we will be sending an ajax() request and retrieve data from the file.

Let’s consider that the JSON file named “data.json” is inside a folder named data which is in the root directory or in other words the folder where our html file currently is and has the data as shown below.

Note: Remember that you need to be on localhost or some deployed path for ajax requests to work otherwise it will give you a CORS (Cross-Origin Resource Sharing) error.

The data.json file:

[
    {
        "Name":"Aman Prakash Jha",
        "Occupation": "Student"
    },
    {
        "Name":"Sharan Swaroop",
        "Occupation":"SDE-1"
    },
    {
        "Name":"Chiraag Kakar",
        "Occupation":"Sr. Software Engineer"
    }
]

Example:

·         HTML

<!DOCTYPE html>

<html>

 

<head>

 

    <!--Loading the script so that we can use Ajax-->

    <script src=

"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">

    </script>

</head>

 

<body>

    <h2>Welcome To GFG</h2>

 

     

<p>

        Default code has been

        loaded into the Editor.

    </p>

 

 

    <button id="getData">GET</button>

     

    <script>

        $("#getData").click(function (event) {

            event.preventDefault();

            $.ajax({

                url: "data/data.json",

                type: "GET",

                dataType: "json",

                success: function (data) {

                     

                    // This here will print the

                    // retrieved json on the console.

                    console.log(data);

                },

                error: function () {

                    console.log("Something went wrong");

                },

            });

        });

    </script>

</body>

 

</html>

Output:

[
    {
        "Name":"Aman Prakash Jha",
        "Occupation": "Student"
    },
    {
        "Name":"Sharan Swaroop",
        "Occupation":"SDE-1"
    },
    {
        "Name":"Chiraag Kakar",
        "Occupation":"Sr. Software Engineer"
    }
]

 

 

 

DOM – Document object Model

 

dom.gif

 

The following example changes the content (the innerHTML) of the <p> element with id="demo":

Example

<html>
<body>

<p id="demo"></p>

<script>
document.getElementById("demo").innerHTML = "Hello World!";
</script>


</body>
</html>

Try it Yourself »

In the example above, getElementById is a method, while innerHTML is a property.


The getElementById Method

The most common way to access an HTML element is to use the id of the element.

In the example above the getElementById method used id="demo" to find the element.


The innerHTML Property

The easiest way to get the content of an element is by using the innerHTML property.

The innerHTML property is useful for getting or replacing the content of HTML elements.

The innerHTML property can be used to get or change any HTML element, including <html> and <body>.

 

 

PHP variables and Datatypes

 

PHP Data Types

Variables can store data of different types, and different data types can do different things.

PHP supports the following data types:

  • String
  • Integer
  • Float (floating point numbers - also called double)
  • Boolean
  • Array
  • Object
  • NULL
  • Resource

PHP String

A string is a sequence of characters, like "Hello world!".

A string can be any text inside quotes. You can use single or double quotes:

ExampleGet your own PHP Server

<?php
$x = "Hello world!"
;
$y = 'Hello world!'
;

echo $x;
echo "<br>";
echo $y;
?>

Try it Yourself »


PHP Integer

An integer data type is a non-decimal number between -2,147,483,648 and 2,147,483,647.

Rules for integers:

  • An integer must have at least one digit
  • An integer must not have a decimal point
  • An integer can be either positive or negative
  • Integers can be specified in: decimal (base 10), hexadecimal (base 16), octal (base 8), or binary (base 2) notation

In the following example $x is an integer. The PHP var_dump() function returns the data type and value:

Example

<?php
$x = 5985
;
var_dump($x);
?>

Try it Yourself »



PHP Float

A float (floating point number) is a number with a decimal point or a number in exponential form.

In the following example $x is a float. The PHP var_dump() function returns the data type and value:

Example

<?php
$x = 10.365
;
var_dump($x);
?>

Try it Yourself »


PHP Boolean

A Boolean represents two possible states: TRUE or FALSE.

$x = true;
$y = false;

Booleans are often used in conditional testing. You will learn more about conditional testing in a later chapter of this tutorial.


PHP Array

An array stores multiple values in one single variable.

In the following example $cars is an array. The PHP var_dump() function returns the data type and value:

Example

<?php
$cars = array
("Volvo","BMW","Toyota");
var_dump($cars);
?>

Try it Yourself »

You will learn a lot more about arrays in later chapters of this tutorial.


PHP Object

Classes and objects are the two main aspects of object-oriented programming.

A class is a template for objects, and an object is an instance of a class.

When the individual objects are created, they inherit all the properties and behaviors from the class, but each object will have different values for the properties.

Let's assume we have a class named Car. A Car can have properties like model, color, etc. We can define variables like $model, $color, and so on, to hold the values of these properties.

When the individual objects (Volvo, BMW, Toyota, etc.) are created, they inherit all the properties and behaviors from the class, but each object will have different values for the properties.

If you create a __construct() function, PHP will automatically call this function when you create an object from a class.

Example

<?php
class Car {
  public
 $color;
  public
 $model;
  public
 function __construct($color, $model) {
    $this->color = $color;
    $this->model = $model;
  }
  public
 function message() {
    return
 "My car is a " . $this->color . " " . $this->model . "!";
  }
}

$myCar = new
 Car("black", "Volvo");
echo $myCar -> message();
echo "<br>";
$myCar = new
 Car("red", "Toyota");
echo $myCar -> message();
?>

Try it Yourself »


PHP NULL Value

Null is a special data type which can have only one value: NULL.

A variable of data type NULL is a variable that has no value assigned to it.

Tip: If a variable is created without a value, it is automatically assigned a value of NULL.

Variables can also be emptied by setting the value to NULL:

Example

<?php
$x = "Hello world!"
;
$x = null;
var_dump($x);
?>

 

PHP functions

 

PHP Built-in Functions

PHP has over 1000 built-in functions that can be called directly, from within a script, to perform a specific task.

Please check out our PHP reference for a complete overview of the PHP built-in functions.


PHP User Defined Functions

Besides the built-in PHP functions, it is possible to create your own functions.

  • A function is a block of statements that can be used repeatedly in a program.
  • A function will not execute automatically when a page loads.
  • A function will be executed by a call to the function.

Create a User Defined Function in PHP

A user-defined function declaration starts with the word function:

Syntax

function functionName() {
  code to be executed;
}

Note: A function name must start with a letter or an underscore. Function names are NOT case-sensitive.

Tip: Give the function a name that reflects what the function does!

In the example below, we create a function named "writeMsg()". The opening curly brace ( { ) indicates the beginning of the function code, and the closing curly brace ( } ) indicates the end of the function. The function outputs "Hello world!". To call the function, just write its name followed by brackets ():

ExampleGet your own PHP Server

<?php
function writeMsg() {
  echo
 "Hello world!";
}

writeMsg(); // call the function
?>

Try it Yourself »



PHP Function Arguments

Information can be passed to functions through arguments. An argument is just like a variable.

Arguments are specified after the function name, inside the parentheses. You can add as many arguments as you want, just separate them with a comma.

The following example has a function with one argument ($fname). When the familyName() function is called, we also pass along a name (e.g. Jani), and the name is used inside the function, which outputs several different first names, but an equal last name:

Example

<?php
function familyName($fname) {
  echo
 "$fname Refsnes.<br>";
}

familyName("Jani"
);
familyName("Hege"
);
familyName("Stale"
);
familyName("Kai Jim"
);
familyName("Borge"
);
?>

Try it Yourself »

The following example has a function with two arguments ($fname and $year):

Example

<?php
function familyName($fname, $year) {
  echo
 "$fname Refsnes. Born in $year <br>";
}

familyName("Hege"
, "1975");
familyName("Stale"
, "1978");
familyName("Kai Jim"
, "1983");
?>

Try it Yourself »


PHP is a Loosely Typed Language

In the example above, notice that we did not have to tell PHP which data type the variable is.

PHP automatically associates a data type to the variable, depending on its value. Since the data types are not set in a strict sense, you can do things like adding a string to an integer without causing an error.

In PHP 7, type declarations were added. This gives us an option to specify the expected data type when declaring a function, and by adding the strict declaration, it will throw a "Fatal Error" if the data type mismatches.

In the following example we try to send both a number and a string to the function without using strict:

Example

<?php
function addNumbers(int $a, int $b) {
  return
 $a + $b;
}
echo addNumbers(5, "5 days");
// since strict is NOT enabled "5 days" is changed to int(5), and it will return 10
?>

Try it Yourself »

To specify strict we need to set declare(strict_types=1);. This must be on the very first line of the PHP file.

In the following example we try to send both a number and a string to the function, but here we have added the strict declaration:

Example

<?php declare(strict_types=1); // strict requirement

function addNumbers(int $a, int $b) {
  return
 $a + $b;
}
echo addNumbers(5, "5 days");
// since strict is enabled and "5 days" is not an integer, an error will be thrown
?>

Try it Yourself »

The strict declaration forces things to be used in the intended way.


PHP Default Argument Value

The following example shows how to use a default parameter. If we call the function setHeight() without arguments it takes the default value as argument:

Example

<?php declare(strict_types=1); // strict requirement
function
 setHeight(int $minheight = 50) {
  echo
 "The height is : $minheight <br>";
}

setHeight(350
);
setHeight(); // will use the default value of 50
setHeight(135
);
setHeight(80
);
?>

Try it Yourself »


PHP Functions - Returning values

To let a function return a value, use the return statement:

Example

<?php declare(strict_types=1); // strict requirement
function
 sum(int $x, int $y) {
  $z = $x + $y;
  return
 $z;
}

echo "5 + 10 = " . sum(5, 10) . "<br>";
echo "7 + 13 = " . sum(7, 13) . "<br>";
echo "2 + 4 = " . sum(2, 4);
?>

Try it Yourself »


PHP Return Type Declarations

PHP 7 also supports Type Declarations for the return statement. Like with the type declaration for function arguments, by enabling the strict requirement, it will throw a "Fatal Error" on a type mismatch.

To declare a type for the function return, add a colon ( : ) and the type right before the opening curly ( { )bracket when declaring the function.

In the following example we specify the return type for the function:

Example

<?php declare(strict_types=1); // strict requirement
function
 addNumbers(float $a, float $b) : float {
  return
 $a + $b;
}
echo addNumbers(1.2, 5.2);
?>

Try it Yourself »

You can specify a different return type, than the argument types, but make sure the return is the correct type:

Example

<?php declare(strict_types=1); // strict requirement
function
 addNumbers(float $a, float $b) : int {
  return
 (int)($a + $b);
}
echo addNumbers(1.2, 5.2);
?>

Try it Yourself »


Passing Arguments by Reference

In PHP, arguments are usually passed by value, which means that a copy of the value is used in the function and the variable that was passed into the function cannot be changed.

When a function argument is passed by reference, changes to the argument also change the variable that was passed in. To turn a function argument into a reference, the & operator is used:

Example

Use a pass-by-reference argument to update a variable:

<?php
function add_five(&$value) {
  $value += 5
;
}

$num = 2
;
add_five($num);
echo $num;
?>

Try it Yourself »

 

Node.js

 

var http = require('http');

http.createServer(function
 (req, res) {
  res.writeHead(200
, {'Content-Type': 'text/plain'});
  res.end('Hello World!'
);
}).listen(8080
);

Run example »

 

Event driven programming

Event-Driven Programming in Node.js: Node.js makes extensive use of events which is one of the reasons behind its speed when compared to other similar technologies. Once we start a Node.js server, it initializes the variables and functions and then listens for the occurrence of an event.

Event-driven programming is used to synchronize the occurrence of multiple events and to make the program as simple as possible. The basic components of an Event-Driven Program are:

·         A callback function ( called an event handler) is called when an event is triggered.

·         An event loop that listens for event triggers and calls the corresponding event handler for that event.


A function that listens for the triggering of an event is said to be an ‘Observer’. It gets triggered when an event occurs. Node.js provides a range of events that are already in-built. These ‘events’ can be accessed via the ‘events’ module and the EventEmitter class. Most of the in-built modules of Node.js inherit from the EventEmitter class

EventEmitter: The EventEmitter is a Node module that allows objects to communicate with one another. The core of Node’s asynchronous event-driven architecture is EventEmitter. Many of Node’s built-in modules inherit from EventEmitter.

The idea is simple – emitter objects send out named events, which trigger listeners that have already been registered. Hence, an emitter object has two key characteristics:

·         Emitting name events: The signal that something has happened is called emitting an event. A status change in the emitting object is often the cause of this condition.

·         Registering and unregistering listener functions: It refers to the binding and unbinding of the callback functions with their corresponding events.

Event-Driven Programming Principles:

·         A suite of functions for handling the events. These can be either blocking or non-blocking, depending on the implementation.

·         Binding registered functions to events.

·         When a registered event is received, an event loop polls for new events and calls the matching event handler(s).

Implementation:  Filename: app.js

·         Javascript

// Import the 'events' module

const events = require('events');

  

// Instantiate an EventEmitter object

const eventEmitter = new events.EventEmitter();

  

// Handler associated with the event

const connectHandler = function connected() {

    console.log('Connection established.');

  

    // Trigger the corresponding event

    eventEmitter.emit('data_received');

}

  

// Binds the event with handler

eventEmitter.on('connection', connectHandler);

  

// Binds the data received

eventEmitter.on(

    'data_received', function () {

        console.log('Data Transfer Successful.');

    });

  

// Trigger the connection event

eventEmitter.emit('connection');

  

console.log("Finish");

The above code snippet binds the handler named ‘connectHandler’ with the event ‘connection’’. The callback function is triggered when the event is emitted.

Run the app.js file using the following command:

node app.js

Output:  

Connection established.

Data Transfer Successful.

Finish

Advantages of Event-Driven Programming:

·         Flexibility: It is easier to alter sections of code as and when required.

·         Suitability for graphical interfaces: It allows the user to select tools (like radio buttons etc.) directly from the toolbar

·         Programming simplicity: It supports predictive coding, which improves the programmer’s coding experience.

·         Easy to find natural dividing lines: Natural dividing lines for unit testing infrastructure are easy to come by.

·         A good way to model systems: Useful method for modeling systems that must be asynchronous and reactive.

·         Allows for more interactive programs: It enables more interactive programming. Event-driven programming is used in almost all recent GUI apps.

·         Using hardware interrupts: It can be accomplished via hardware interrupts, lowering the computer’s power consumption.

·         Allows sensors and other hardware: It makes it simple for sensors and other hardware to communicate with software.

Disadvantages of Event-Driven Programming:

·         Complex: Simple programs become unnecessarily complex.

·         Less logical and obvious: The flow of the program is usually less logical and more obvious

·         Difficult to find error: Debugging an event-driven program is difficult

·         Confusing: Too many forms in a program might be confusing and/or frustrating for the programmer.

·         Tight coupling: The event schema will be tightly coupled with the consumers of the schema.

·         Blocking: Complex blocking of operations.

Relation between Event-Driven Programming and Object-Oriented Programming: We can combine Object-oriented Programming (OOP) and Event-driven programming (EDP) and use them together in the same code snippet.

 

 

DBMS Architecture

  • The DBMS design depends upon its architecture. The basic client/server architecture is used to deal with a large number of PCs, web servers, database servers and other components that are connected with networks.
  • The client/server architecture consists of many PCs and a workstation which are connected via the network.
  • DBMS architecture depends upon how users are connected to the database to get their request done.

Types of DBMS Architecture

 







Database architecture can be seen as a single tier or multi-tier. But logically, database architecture is of two types like: 2-tier architecture and 3-tier architecture.

1-Tier Architecture

  • In this architecture, the database is directly available to the user. It means the user can directly sit on the DBMS and uses it.
  • Any changes done here will directly be done on the database itself. It doesn't provide a handy tool for end users.
  • The 1-Tier architecture is used for development of the local application, where programmers can directly communicate with the database for the quick response.

 

2-Tier Architecture

  • The 2-Tier architecture is same as basic client-server. In the two-tier architecture, applications on the client end can directly communicate with the database at the server side. For this interaction, API's like: ODBC, JDBC are used.
  • The user interfaces and application programs are run on the client-side.
  • The server side is responsible to provide the functionalities like: query processing and transaction management.
  • To communicate with the DBMS, client-side application establishes a connection with the server side.

 

3-Tier Architecture

  • The 3-Tier architecture contains another layer between the client and server. In this architecture, client can't directly communicate with the server.
  • The application on the client-end interacts with an application server which further communicates with the database system.
  • End user has no idea about the existence of the database beyond the application server. The database also has no idea about any other user beyond the application.
  • The 3-Tier architecture is used in case of large web application.

 

What is the structure of a relational database model?

E. F. Codd, then a young programmer at IBM, invented the relational database in 1970. In his paper, "A Relational Model of Data for Large Shared Data Banks," Codd proposed shifting from storing data in hierarchical or navigational structures to organizing data in tables containing rows and columns.

Each table, sometimes called a relation, in a relational database contains one or more data categories in columns or attributes. Each row, also called a record or tuple, contains a unique instance of data -- or key -- for the categories defined by the columns. Each table has a unique primary key that identifies the information in a table. The relationship between tables can be set via the use of foreign keys -- a field in a table that links to the primary key of another table.

How does a relational database work?

The data tables used in a relational database store information about related objects. Each row holds a record with a unique identifier -- known as a key -- and each column contains the attributes of the data. Each record assigns a value to each feature, making relationships between data points easy to identify.

The standard user and application program interface (API) of a relational database is the Structured Query Language. SQL code statements are used both for interactive queries for information from a relational database and for gathering data for reports. Defined data integrity rules must be followed to ensure the relational database is accurate and accessible.

What is the structure of a relational database model?

E. F. Codd, then a young programmer at IBM, invented the relational database in 1970. In his paper, "A Relational Model of Data for Large Shared Data Banks," Codd proposed shifting from storing data in hierarchical or navigational structures to organizing data in tables containing rows and columns.

Each table, sometimes called a relation, in a relational database contains one or more data categories in columns or attributes. Each row, also called a record or tuple, contains a unique instance of data -- or key -- for the categories defined by the columns. Each table has a unique primary key that identifies the information in a table. The relationship between tables can be set via the use of foreign keys -- a field in a table that links to the primary key of another table.

For example, a typical business order entry database would include a table that describes a customer with columns for name, address, phone number and so forth. Another table would describe an order, including information like the product, customer, date and sales price.

A user can get a database report showing the data they need. For example, a branch office manager might want a report on all customers that bought products after a certain date. A financial services manager in the same company could, from the same tables, obtain a report on accounts that need to be paid.

When creating a relational database, users define the domain of possible values in a data column and constraints that may apply to that data value. For example, a domain of possible customers could allow up to 10 possible customer names, but it is limited in one table to allowing only three of these customer names to be specifiable.

Two constraints relate to data integrity and the primary and foreign keys:

  • Entity integrity ensures that the primary key in a table is unique and the value is not set to null.
  • Referential integrity requires that every value in a foreign key column will be found in the primary key of the table from which it originated.

In addition, relational databases possess physical data independence. This refers to a system's capacity to make changes to the inner schema without altering the external schemas or application programs. Inner schema alterations may include the following:

  • the use of new storage devices;
  • modifying indexes;
  • changing from a specific access method to a different one;
  • using different data structures; and
  • using various storage structures or file organizations.

Logical data independence is a system's ability to manage the conceptual schema without altering the external schema or application programs. Conceptual schema alterations may include the addition or deletion of new relationships, entities or attributes without altering existing external schemas or rewriting application programs.

What are the types of databases?

There are several database categories, from basic flat files that aren't relational to NoSQL and newer graph databases that are considered even more relational than standard relational databases. Some database types include the following:

Flat file database. These databases consist of a single table of data that has no interrelation -- typically text files. This type of file enables users to specify data attributes, such as columns and data types.

NoSQL database. This type of database is an alternative that's especially useful for large, distributed data sets. NoSQL databases support a variety of data models, including key-value, document, columnar and graph formats.

Graph database. Expanding beyond traditional column- and row-based relational data models; this NoSQL database uses nodes and edges that represent connections between data relationships and can discover new relationships between the data. Graph databases are more sophisticated than relational databases. They are used for fraud detection or web recommendation engines.

Object relational database (ORD). An ORD is composed of both a relational database management system (RDBMS) and an object-oriented database management system (OODBMS). It contains characteristics of both the RDBMS and OODBMS models. A traditional database is used to store the data. It is then accessed and manipulated using queries written in a query language, such as SQL. Therefore, the basic approach of an ORD is based on a relational database.

However, an ORD can also be considered object storage, particularly for software written in the object-oriented programming language, thus pulling on object-oriented characteristics. In this situation, APIs are used in the storage and retrieval of data.


What are the advantages of relational databases?

The key advantages of relational databases include the following:

  • Categorizing data. Database administrators can easily categorize and store data in a relational database that can then be queried and filtered to extract information for reports. Relational databases are also easy to extend and aren't reliant on physical organization. After the original database creation, a new data category can be added without having to modify the existing applications.
  • Accuracy. Data is stored just once, eliminating data deduplication in storage procedures.
  • Ease of use. Complex queries are easy for users to carry out with SQL, the main query language used with relational databases.
  • Collaboration. Multiple users can access the same database.
  • Security. Direct access to data in tables within an RDBMS can be limited to specific users.

What are the disadvantages of relational databases?

The disadvantages of relational databases include the following:

  • Structure. Relational databases require a lot of structure and a certain level of planning because columns must be defined and data needs to fit correctly into somewhat rigid categories. The structure is good in some situations, but it creates issues related to the other drawbacks, such as maintenance and lack of flexibility and scalability.
  • Maintenance issues. Developers and other personnel responsible for the database must spend time managing and optimizing the database as data gets added to it.
  • Inflexibility. Relational databases are not ideal for handling large quantities of unstructured data. Data that is largely qualitative, not easily defined or dynamic is not optimal for relational databases, because as the data changes or evolves, the schema must evolve with it, which takes time.
  • Lack of scalability. Relational databases do not horizontally scale well across physical storage structures with multiple servers. It is difficult to handle relational databases across multiple servers because as a data set gets larger and more distributed, the structure is disrupted, and the use of multiple servers has effects on performance -- such as application response times -- and availability.

Examples of relational databases

Standard relational databases enable users to manage predefined data relationships across multiple databases. Popular examples of standard relational databases include Microsoft SQL Server, Oracle Database, MySQL and IBM DB2.

Cloud-based relational databases, or database as a service, are also widely used because they enable companies to outsource database maintenance, patching and infrastructure support requirements. Cloud relational databases include Amazon Relational Database Service, Google Cloud SQL, IBM DB2 on Cloud, SQL Azure and Oracle Cloud.

What are the differences between relational databases, non-relational databases and NoSQL?

The most important difference between relational database systems and non-relational database systems is that relational databases are normalized. That is, they store data in a tabular form, arranged in a table with rows and columns. A non-relational database stores data as files.

Other differences include the following:

  • Use of primary keys. Relational database tables each have a primary key identifier. In a non-relational database, data is normally stored in hierarchical or navigational form, without the use of primary keys.
  • Data values relationships. Since data in a relational database is stored in tables, the relationship between these data values is stored as well. Since a non-relational database stores data as files, there is no relationship between the data values.
  • Integrity constraints. In a relational database, the integrity constraints are any constraint that ensures database integrity. They are defined for the purpose of atomicity, consistency, isolation and durability, or ACID. Non-relational databases do not use integrity constraints.
  • Structured vs. unstructured data. Relational databases work well for structured data that conforms to a predefined data model and doesn't change much. Non-relational databases are better for unstructured data, which doesn't conform to a predefined data model and can't be stored in an RDBMS. Examples of unstructured data include text, emails, photos, videos and web pages.

SQL | DDL, DQL, DML, DCL and TCL Commands


Looking for one place where you can find all the SQL commands or SQL sublanguage commands like DDL, DQL, DML, DCL, and TCL, then bookmark this article. In this write-up, you will explore all the Structured Query Language (SQL) commands with accurate syntax.

But before heading to the command section, let’s have a brief introduction to SQL.

Short Overview on SQL

Structured Query Language (SQL), as we all know, is the database language by the use of which we can perform certain operations on the existing database, and also we can use this language to create a database. SQL uses certain commands like CREATE, DROP, INSERT, etc. to carry out the required tasks. 

SQL commands are like instructions to a table. It is used to interact with the database with some operations. It is also used to perform specific tasks, functions, and queries of data. SQL can perform various tasks like creating a table, adding data to tables, dropping the table, modifying the table, set permission for users.

These SQL commands are mainly categorized into five categories: 

  1. DDL – Data Definition Language
  2. DQL – Data Query Language
  3. DML – Data Manipulation Language
  4. DCL – Data Control Language
  5. TCL – Transaction Control Language

Now, we will see all of these in detail.

DDL (Data Definition Language)

DDL or Data Definition Language actually consists of the SQL commands that can be used to define the database schema. It simply deals with descriptions of the database schema and is used to create and modify the structure of database objects in the database. DDL is a set of SQL commands used to create, modify, and delete database structures but not data. These commands are normally not used by a general user, who should be accessing the database via an application.

List of DDL commands: 

  • CREATE: This command is used to create the database or its objects (like table, index, function, views, store procedure, and triggers).
  • DROP: This command is used to delete objects from the database.
  • ALTER: This is used to alter the structure of the database.
  • TRUNCATE: This is used to remove all records from a table, including all spaces allocated for the records are removed.
  • COMMENT: This is used to add comments to the data dictionary.
  • RENAME: This is used to rename an object existing in the database.

DQL (Data Query Language)

DQL statements are used for performing queries on the data within schema objects. The purpose of the DQL Command is to get some schema relation based on the query passed to it. We can define DQL as follows it is a component of SQL statement that allows getting data from the database and imposing order upon it. It includes the SELECT statement. This command allows getting the data out of the database to perform operations with it. When a SELECT is fired against a table or tables the result is compiled into a further temporary table, which is displayed or perhaps received by the program i.e. a front-end.

List of DQL: 

  • SELECT: It is used to retrieve data from the database.

DML(Data Manipulation Language)

The SQL commands that deal with the manipulation of data present in the database belong to DML or Data Manipulation Language and this includes most of the SQL statements. It is the component of the SQL statement that controls access to data and to the database. Basically, DCL statements are grouped with DML statements.

List of DML commands: 

  • INSERT: It is used to insert data into a table.
  • UPDATE: It is used to update existing data within a table.
  • DELETE: It is used to delete records from a database table.
  • LOCK: Table control concurrency.
  • CALL: Call a PL/SQL or JAVA subprogram.
  • EXPLAIN PLAN: It describes the access path to data.

DCL (Data Control Language)

DCL includes commands such as GRANT and REVOKE which mainly deal with the rights, permissions, and other controls of the database system. 

List of  DCL commands: 

GRANT: This command gives users access privileges to the database.

Syntax:

GRANT SELECT, UPDATE ON MY_TABLE TO SOME_USER, ANOTHER_USER;  

REVOKE: This command withdraws the user’s access privileges given by using the GRANT command.

Syntax:

REVOKE SELECT, UPDATE ON MY_TABLE FROM USER1, USER2;  

TCL (Transaction Control Language)

Transactions group a set of tasks into a single execution unit. Each transaction begins with a specific task and ends when all the tasks in the group are successfully completed. If any of the tasks fail, the transaction fails. Therefore, a transaction has only two results: success or failure. You can explore more about transactions here. Hence, the following TCL commands are used to control the execution of a transaction: 

BEGIN: Opens a Transaction.

COMMIT: Commits a Transaction.

Syntax:

COMMIT;  

ROLLBACK: Rollbacks a transaction in case of any error occurs.

Syntax:

ROLLBACK;  

SAVEPOINT: Sets a save point within a transaction.

Syntax:

SAVEPOINT SAVEPOINT_NAME;  

HTTPS

HTTPS is an abbreviation of Hypertext Transfer Protocol Secure. It is a secure extension or version of HTTP. This protocol is mainly used for providing security to the data sent between a website and the web browser. It is widely used on the internet and used for secure communications. This protocol uses the 443 port number for communicating the data.

This protocol is also called HTTP over SSL because the HTTPS communication protocols are encrypted using the SSL (Secure Socket Layer).

By default, it is supported by various web browsers.

Those websites which need login credentials should use the HTTPS protocol for sending the data.

It allows users to create a secured encrypted connection and helps them to protect their information from being stolen.

Difference between HTTP and HTTPS

HTTPHTTPS
1. It is an abbreviation of Hypertext Transfer Protocol1. It is an abbreviation of Hypertext Transfer Protocol Secure.
2. This protocol operates at the application layer.2. This protocol operates at the transport layer.
3. The data which is transferred in HTTP is plain text.3. The data which is transferred in HTTPS is encrypted, i.e., ciphertext.
4. By default, this protocol operates on port number 80.4. By default, this protocol operates on port number 443.
5. The URL (Uniform Resource Locator) of HTTP start with http://5. The URL (Uniform Resource Locator) of HTTPS start with https://
6. This protocol does not need any certificate.6. But, this protocol requires an SSL (Secure Socket Layer) certificate.
7. Encryption technique is absent in HTTP.7. Encryption technique is available or present in HTTPS.
8. The speed of HTTP is fast as compared to HTTPS.8. The speed of HTTPS is slow as compared to HTTP.
9. It is un-secure.9. It is highly secure.
10. Examples of HTTP websites are Educational Sites, Internet Forums, etc.10. Examples of HTTPS websites are shopping websites, banking websites, etc.

Advantages of HTTPS

Following are the advantages or benefits of a Hypertext Transfer Protocol Secure (HTTPS):

  • The main advantage of HTTPS is that it provides high security to users.
  • Data and information are protected. So, it ensures data protection.
  • SSL technology in HTTPS protects the data from third-party or hackers. And this technology builds trust for the users who are using it.
  • It helps users by performing banking transactions.

Disadvantages of HTTPS

Following are the disadvantages or limitations of a Hypertext Transfer Protocol Secure (HTTPS):

  • The big disadvantage of HTTPS is that users need to purchase the SSL certificate.
  • The speed of accessing the website is slow because there are various complexities in communication.
  • Users need to update all their internal links.

Difference between Secure Socket Layer (SSL) and Transport Layer Security (TLS)


SSL stands for Secure Socket Layer while TLS stands for Transport Layer Security. Both Secure Socket Layer and Transport Layer Security are the protocols used to provide security between web browsers and web servers. The main difference between Secure Socket Layer and Transport Layer Security is that, in SSL (Secure Socket Layer), the Message digest is used to create a master secret and It provides the basic security services which are Authentication and confidentiality. while In TLS (Transport Layer Security), a Pseudo-random function is used to create a master secret. 



There are some differences between SSL and TLS which are given below:

SSLTLS
SSL stands for Secure Socket Layer.TLS stands for Transport Layer Security.
SSL (Secure Socket Layer) supports the Fortezza algorithm.TLS (Transport Layer Security) does not support the Fortezza algorithm.
SSL (Secure Socket Layer) is the 3.0 version.TLS (Transport Layer Security) is the 1.0 version.
In SSL( Secure Socket Layer), the Message digest is used to create a master secret.In TLS(Transport Layer Security), a Pseudo-random function is used to create a master secret.
In SSL( Secure Socket Layer), the Message Authentication Code protocol is used.In TLS(Transport Layer Security), Hashed Message Authentication Code protocol is used.
SSL (Secure Socket Layer) is more complex than TLS(Transport Layer Security).TLS (Transport Layer Security) is simple.
SSL (Secure Socket Layer) is less secured as compared to TLS(Transport Layer Security).TLS (Transport Layer Security) provides high security.
SSL is less reliable and slower.TLS is highly reliable and upgraded. It provides less latency.
SSL has been depreciated.TLS is still widely used.
SSL uses port to set up explicit connection.TLS uses protocol to set up implicit connection.
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner.


<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
  <meta name="description" content="Free Web tutorials">
  <meta name="keywords" content="HTML, CSS, JavaScript">
  <meta name="author" content="John Doe">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
* {
  box-sizing: border-box;
}

.left {
  background-color: #2196F3;
  padding: 20px;
  float: left;
  width: 20%; /* The width is 20%, by default */
}

.main {
  background-color: #f1f1f1;
  padding: 20px;
  float: left;
  width: 60%; /* The width is 60%, by default */
}

.right {
  background-color: #04AA6D;
  padding: 20px;
  float: left;
  width: 20%; /* The width is 20%, by default */
}

/* Use a media query to add a break point at 800px: */
@media screen and (max-width: 800px) {
  .left, .main, .right {
    width: 100%; /* The width is 100%, when the viewport is 800px or smaller */
  }
}
</style>
</head>
<body>

<h2>Media Queries</h2>
<p>Resize the browser window.</p>

<p>Make sure you reach the breakpoint at 800px when resizing this frame.</p>

<div class="left">
  <p>Left Menu</p>
</div>

<div class="main">
  <p>Main Content</p>
</div>

<div class="right">
  <p>Right Content</p>
</div>

</body>
</html>


The <meta> tag defines metadata about an HTML document. Metadata is data (information) about data.

<meta> tags always go inside the <head> element, and are typically used to specify character set, page description, keywords, author of the document, and viewport settings.

Metadata will not be displayed on the page, but is machine parsable.

Metadata is used by browsers (how to display content or reload page), search engines (keywords), and other web services.

The viewport is the user's visible area of a web page. It varies with the device - it will be smaller on a mobile phone than on a computer screen.

You should include the following <meta> element in all your web pages:

<meta name="viewport" content="width=device-width, initial-scale=1.0">

This gives the browser instructions on how to control the page's dimensions and scaling.

The width=device-width part sets the width of the page to follow the screen-width of the device (which will vary depending on the device).

The initial-scale=1.0 part sets the initial zoom level when the page is first loaded by the browser.



 

4 comments:

02

Capstone resource hub

Codingacharya

Capstone Learning Resources, Notes & Project Hub

TCS NQT Questions
Read Notes
Machine Learning – ACE Theory
Read Notes
Machine Learning PPT
Read Notes
MachienLearning LAB
Read Notes
CSPT LAB programs
Read Notes
Time table and CSPT syllabus
Read Notes
Appreciations
Read Notes
ISTE life memberships
Read Notes
Artificial Intelligence & Analytics
Read Notes
Fullstack Web Dev
Read Notes
MERN Web Dev
Read Notes
Course Structure
Read Notes
Cloud Computing
Read Notes
90 Days ML Challenge
Read Notes
Advanced Analytics & Viz
Read Notes
Advanced Machine Learning
Read Notes
React JS
Read Notes
ML Chaitanya
Read Notes
Important Links
Read Notes
CSS Effects
Read Notes
RESUME
Read Notes
Bootstrap CSS
Read Notes
MongoDB
Read Notes
OWN Python Package
Read Notes
HTML Course
Read Notes
HTML Projects
Read Notes
GitHub Projects
Read Notes
Angular JS
Read Notes
Journals
Read Notes
NLP Notes
Read Notes
Videos
Read Notes
Data Analytics & Viz
Read Notes
Cloud Computing (Archive)
Read Notes
Open CV
Read Notes
jQuery
Read Notes
React JS (Archive)
Read Notes
Node JS
Read Notes
DAV Theory
Read Notes
DAV Lab
Read Notes
Big Data Notes
Read Notes
R-Programming
Read Notes
HADOOP Lab
Read Notes
GATE DA
Read Notes
JAVA Lab
Read Notes
Computer Networks
Read Notes
03

Live projects & profiles