0% found this document useful (0 votes)
49 views

Web Technoloy

URL stands for Uniform Resource Locator and is used to identify and locate resources on the internet. A URL consists of several components including the scheme or protocol, domain name, optional port number, path to the resource, optional query parameters, and optional fragment identifier.

Uploaded by

nikitabuva17
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views

Web Technoloy

URL stands for Uniform Resource Locator and is used to identify and locate resources on the internet. A URL consists of several components including the scheme or protocol, domain name, optional port number, path to the resource, optional query parameters, and optional fragment identifier.

Uploaded by

nikitabuva17
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

What is URL?

1. **Scheme/Protocol**: This is the first part of the URL and indicates the protocol or scheme being
used to access the resource. Common protocols include HTTP (Hypertext Transfer Protocol) and HTTPS
(HTTP Secure), which are used for accessing web pages, as well as FTP (File Transfer Protocol) for
transferring files, and mailto for email addresses. For example, in the URL
"https://www.example.com/index.html", the scheme is "https".

2. **Domain Name**: This is the human-readable name that identifies the location of the resource on
the internet. Domain names consist of multiple parts separated by periods (dots). The rightmost part is
the top-level domain (TLD), which indicates the type of organization or country associated with the
domain, such as ".com", ".org", or ".net". The leftmost part is the most specific and typically represents
the specific organization or entity hosting the resource. In our example URL, "www.example.com", the
domain name is "example.com".

3. **Port (Optional)**: The port number is separated from the domain name by a colon (":"). It specifies
a specific endpoint or channel on the server to connect to. Ports are often omitted, in which case the
default port for the specified protocol is used. For example, the default port for HTTP is 80 and for HTTPS
is 443. So, if the URL includes a port, it might look like "http://www.example.com:8080" where ":8080"
specifies the port number.

4. **Path**: The path specifies the specific location or file on the server that you want to access. It's
separated from the domain name (or port, if present) by a forward slash ("/"). In our example URL,
"https://www.example.com/index.html", the path is "/index.html".

5. **Query Parameters (Optional)**: Query parameters are used to send additional information to the
server, typically in the form of key-value pairs separated by "&". They are appended to the end of the
URL after a question mark ("?"). For example, in the URL "https://www.example.com/search?q=URL",
the query parameter is "q=URL", where "q" is the key and "URL" is the value.

6. **Fragment Identifier (Optional)**: The fragment identifier is used to specify a specific section within
the resource being accessed, such as a section of a webpage. It is preceded by a hash symbol ("#") and
appears at the end of the URL. For example, in the URL "https://www.example.com/about#team",
"#team" is the fragment identifier.

Putting it all together, a URL is a structured address used to locate and access resources on the internet,
composed of a scheme, domain name, optional port, path, optional query parameters, and optional
fragment identifier.
Media Tag?

Certainly! Media tags in HTML are used to embed various types of media content into web pages. Let's
discuss each of them:

1. **Audio Tag (`<audio>`)**:

- The `<audio>` tag is used to embed audio content, such as music or sound effects, into a webpage

- It supports various audio formats like MP3, WAV, and OGG.

- Here's a basic example of how to use the `<audio>` tag:

```html

<audio controls>

<source src="audio.mp3" type="audio/mpeg">

Your browser does not support the audio element.

</audio>

2. **Video Tag (`<video>`)**:

- The `<video>` tag is used to embed video content into a webpage.

- It supports various video formats like MP4, WebM, and OGG.

- Here's a basic example of how to use the `<video>` tag:

<video controls width="400" height="300">

<source src="video.mp4" type="video/mp4">

Your browser does not support the video element.

</video>

3. **Form Tag (`<form>`)**:

- The `<form>` tag is used to create interactive forms on web pages for collecting user input.

- It contains various input elements like text fields, checkboxes, radio buttons, dropdown menus, and
buttons.

- Here's an example of a simple form:


<form action="/submit_form" method="post">

<label for="name">Name:</label>

<input type="text" id="name" name="name" required>

<br>

<label for="email">Email:</label>

<input type="email" id="email" name="email" required>

<br>

<input type="submit" value="Submit">

4. **Frames Tag (`<iframe>`)**:

- The `<iframe>` tag is used to embed another HTML document within the current document.

- It's commonly used for embedding external content like maps, videos, or other web pages.

- Here's an example of how to use the `<iframe>` tag:

```html

<iframe src="https://www.example.com" width="600" height="400" frameborder="0"></iframe>

```
Unit 2:

Pattern Matching?

Pattern matching in JavaScript involves using regular expressions (regex) to search for and manipulate
strings based on specific patterns. Regular expressions are patterns used to match character
combinations in strings.

JavaScript provides built-in support for regular expressions through the `RegExp` object and the
`match()`, `test()`, `exec()`, `search()`, `replace()`, and `split()` methods. Here's a brief overview of each:

1. **RegExp Object**: Represents a regular expression pattern. It's typically used to create a regular
expression with the desired pattern.

```javascript

let regex = new RegExp('pattern');

// or

let regex = /pattern/;

```

2. **match() Method**: Returns an array containing all matches of a pattern in a string.

```javascript

let str = 'Hello world';

let matches = str.match(/o/g); // Matches all occurrences of 'o'

console.log(matches); // Output: ['o', 'o']

```

3. **test() Method**: Returns `true` if a pattern is found in a string, otherwise `false`.

```javascript

let str = 'Hello world';

let pattern = /world/;

console.log(pattern.test(str)); // Output: true

4. **exec() Method**: Returns an array containing details about the first match of a pattern in a string.
```javascript

let str = 'Hello world';

let pattern = /world/;

let result = pattern.exec(str);

console.log(result); // Output: ['world', index: 6, input: 'Hello world', groups: undefined]

```

5. **search() Method**: Returns the index of the first occurrence of a pattern in a string, or `-1` if not
found.

```javascript

let str = 'Hello world';

let index = str.search(/world/);

console.log(index); // Output: 6

6. **replace() Method**: Replaces matches of a pattern in a string with a replacement string.

```javascript

let str = 'Hello world';

let newStr = str.replace(/world/, 'planet');

console.log(newStr); // Output: 'Hello planet'

```

7. **split() Method**: Splits a string into an array of substrings based on a pattern.

```javascript

let str = 'apple,banana,orange';

let fruits = str.split(/,/);

console.log(fruits); // Output: ['apple', 'banana', 'orange']


Element Access?

1. **Array Element Access**:

- Arrays in JavaScript are ordered collections of elements, indexed by integers starting from 0.

- You can access elements in an array using square brackets (`[]`) notation, specifying the index of the
element you want to access.

- Example:

```javascript

let array = [1, 2, 3, 4, 5];

console.log(array[0]); // Output: 1

console.log(array[2]); // Output: 3

```

- Negative indices can be used to access elements from the end of the array. `-1` refers to the last
element, `-2` refers to the second to last, and so on.

2. **Object Property Access**:

- Objects in JavaScript are collections of key-value pairs, where keys are strings (or symbols) and values
can be any data type.

- You can access object properties using dot notation (`.`) or square brackets (`[]`), specifying the
property key.

- Dot notation is used when the property key is a valid identifier (e.g., no spaces or special characters).

- Square bracket notation is used when the property key contains spaces, special characters, or is
dynamically determined.

- Example:

```javascript

let person = {

name: 'John',
age: 30,

'favorite color': 'blue'

};

console.log(person.name); // Output: 'John'

console.log(person['age']); // Output: 30

console.log(person['favorite color']); // Output: 'blue'

```

- You can also use variables to dynamically access object properties:

```javascript

let key = 'age';

console.log(person[key]); // Output: 30

Both array element access and object property access are fundamental concepts in JavaScript and are
extensively used in writing code to manipulate data structures and objects. Understanding how to access
elements efficiently is crucial for working with JavaScript data effectively.

Unit No:3

History of php, features , advantages and disadavtages?

PHP, originally an acronym for "Personal Home Page," now stands for "PHP: Hypertext Preprocessor." It's
a server-side scripting language primarily used for web development but can also be used as a general-
purpose programming language. Here's an overview of its history, features, advantages, and
disadvantages:
History of PHP:

- PHP was created by Rasmus Lerdorf in 1994.

- It started as a set of Common Gateway Interface (CGI) binaries written in the C programming language
for managing his personal website.

- Over time, it evolved into a more robust scripting language with additional features and functionalities.

- PHP 3, released in 1998, was the first version to resemble the modern PHP language.

- PHP 4, released in 2000, introduced features like support for object-oriented programming and
enhanced performance.

- PHP 5, released in 2004, brought significant improvements, including better support for object-oriented
programming, the introduction of the Zend Engine 2, and the addition of features like exception handling
and SQLite support.

- PHP 7, released in 2015, was a major milestone with substantial performance improvements, a more
consistent and expressive syntax, and the introduction of features like scalar type declarations and return
type declarations.

- PHP continues to be actively developed, with PHP 8 being the latest major version, released in 2020.

### Features of PHP:

1. **Server-side scripting**: PHP code is executed on the server, generating HTML output that is sent to
the client's browser.

2. **Cross-platform**: PHP runs on various platforms, including Windows, Linux, macOS, and Unix.

3. **Open-source**: PHP is open-source software, freely available for anyone to use, modify, and
distribute.

4. **Extensive library support**: PHP has a vast ecosystem of libraries and frameworks for various
purposes, including web development, database interaction, and more.

5. **Integration with databases**: PHP has built-in support for interacting with databases like MySQL,
PostgreSQL, SQLite, and others.

6. **Simplicity**: PHP is relatively easy to learn and use, especially for beginners in web development.

7. **Flexibility**: PHP can be embedded directly into HTML or used to create standalone scripts.

8. **Large community**: PHP has a large and active community of developers, providing support,
tutorials, and resources.

### Advantages of PHP:


1. **Wide adoption**: PHP is one of the most popular programming languages for web development,
powering millions of websites and web applications.

2. **Rich ecosystem**: PHP has a vast ecosystem of frameworks (e.g., Laravel, Symfony), content
management systems (e.g., WordPress, Drupal), and libraries, making development faster and more
efficient.

3. **Platform independence**: PHP code can run on various operating systems and web servers,
providing flexibility in deployment.

4. **Integration with databases**: PHP provides built-in support for interacting with databases,
simplifying database-driven web development.

5. **Fast prototyping**: PHP's simplicity and flexibility make it suitable for rapid prototyping and
development of web applications.

### Disadvantages of PHP:

1. **Inconsistent standard library**: PHP's standard library can be inconsistent in terms of function
names, parameter orders, and behavior across different versions.

2. **Security concerns**: PHP has had security vulnerabilities in the past, and writing secure PHP code
requires adherence to best practices and regular updates.

3. **Performance**: While PHP has improved performance over the years, it may not be as fast as some
other programming languages like Go or Node.js for certain use cases.

4. **Weak typing**: PHP is dynamically typed, which can lead to unexpected behavior if not carefully
managed.

5. **Shared hosting issues**: PHP applications hosted on shared hosting environments may suffer from
performance and security issues due to the shared nature of the hosting environment.

You might also like