IFT 203 Lecture Note
IFT 203 Lecture Note
IFT 203
2. *TCP/IP (1983)*: The Internet Protocol (IP) and Transmission Control Protocol (TCP)
were adopted as the standard protocols.
3. *World Wide Web (1991)*: Tim Berners-Lee invented the web, making it easy for users
to access and share information.
4. *Servers*: Computers that store and provide access to data (e.g., websites, email).
1. *Data Transmission*: Data is broken into packets and transmitted over the network.
Internet Services
Internet Protocols
4. *DNS (Domain Name System)*: Protocol for resolving domain names to IP addresses.
Internet Security
1. *Firewalls*: Network security systems that control incoming and outgoing traffic.
Internet Applications
1. *Web Browsers*: Software for accessing and viewing web pages (e.g., Google Chrome,
Mozilla Firefox).
2. *Email Clients*: Software for sending and receiving email (e.g., Microsoft Outlook,
Mozilla Thunderbird).
3. *Social Media*: Online platforms for social networking (e.g., Facebook, Twitter).
The World Wide Web (WWW) is a system of interlinked hypertext documents that can be
accessed via the Internet.
1. _1989_: Tim Berners-Lee invented the World Wide Web while working at CERN.
2. _1990_: Berners-Lee wrote the first web browser and web server.
2. _HTML (Hypertext Markup Language)_: Markup language for creating web pages.
4. _XML (Extensible Markup Language)_: Markup language for creating custom data
formats.
1. _HTTPS (Hypertext Transfer Protocol Secure)_: Secure protocol for transferring web
pages.
3. _Firewalls_: Network security systems that control incoming and outgoing traffic.
2. _Responsive Web Design_: Designing web pages that adapt to different screen sizes.
Front-end Development
1. *Definition*: Front-end development is the process of building the user interface and
user experience of a website or web application.
2. *Front-end Technologies*: HTML, CSS, JavaScript, and frameworks like React, Angular,
and Vue.js.
3. *Responsive Web Design*: Designing web pages that adapt to different screen sizes
and devices.
Back-end Development
2. *Back-end Technologies*: Programming languages like Java, Python, Ruby, and PHP,
and frameworks like Spring, Django, and Ruby on Rails.
Full-stack Development
1. *Definition*: Full-stack development is the process of building both the front-end and
back-end of a website or web application.
3. *Testing and Debugging*: Testing and debugging code thoroughly to ensure quality and
reliability.
1. *Progressive Web Apps (PWAs)*: Building web applications that provide a native app-
like experience.
2. *Artificial Intelligence (AI) and Machine Learning (ML)*: Using AI and ML to improve web
application functionality and user experience.
3. *Internet of Things (IoT)*: Building web applications that interact with physical devices
and sensors.
World Wide Web (WWW) as interactive applications, content publishing, and social
services:
Interactive Applications
1. *Web 2.0*: The second generation of the World Wide Web, characterized by interactive
and dynamic web applications.
2. *AJAX (Asynchronous JavaScript and XML)*: A technique for creating interactive web
applications by sending and receiving data asynchronously.
Content Publishing
1. *Blogging*: The act of creating and publishing content on a blog, a type of online
journal or diary.
3. *Digital Publishing*: The process of publishing digital content, such as e-books, online
articles, and multimedia content.
4. *RSS (Really Simple Syndication)*: A format for publishing and subscribing to web
content, such as news feeds and podcasts.
Social Services
1. *Social Networking*: The act of creating and maintaining relationships with others on
social networking platforms, such as Facebook and Twitter.
2. *Online Communities*: Groups of people who interact with each other online, often
around a shared interest or goal.
3. *Collaboration Tools*: Software applications that allow multiple users to work together
on a project or task, such as Google Docs and Trello.
4. *Social Media*: Online platforms that allow users to create and share content, such
as videos, photos, and text updates.
Key Features
2. *Interactivity*: The ability of users to interact with web applications and with each
other.
3. *Dynamic Content*: Content that is updated dynamically, rather than being static.
4. *Social Interaction*: The ability of users to interact with each other on social
networking platforms and online communities.
Benefits
1. *Increased Interactivity*: The web allows for increased interactivity between users and
between users and web applications.
4. *New Business Opportunities*: The web enables new business opportunities and
revenue streams.
Challenges
1. *Security*: The web is vulnerable to security threats, such as hacking and malware.
2. *Privacy*: The web raises concerns about user privacy and data protection.
3. *Information Overload*: The web can be overwhelming, with too much information
available.
4. *Digital Divide*: The web can exacerbate existing social and economic inequalities.
1. _Definition_: HTTP is a protocol used for transferring data over the web.
2. _How it works_: HTTP uses a request-response model, where a client (e.g., web
browser) sends a request to a server, and the server responds with the requested data.
4. _HTTP Status Codes_: 200 (OK), 404 (Not Found), 500 (Internal Server Error), etc.
2. _How it works_: HTTPS uses SSL/TLS (Secure Sockets Layer/Transport Layer Security)
to encrypt data transmitted between the client and server.
4. _HTTPS Certificates_: Obtained from trusted Certificate Authorities (CAs) to verify the
identity of the server.
1. _Data Transfer_: HTTP is used for transferring data between the client and server, while
HTTPS is used for secure data transfer.
2. _Authentication_: HTTPS is used for authenticating the identity of the server and
ensuring the integrity of data transmitted.
4. _Trust_: HTTPS helps establish trust between the client and server, ensuring that data
is transmitted securely and reliably.
1. _Use HTTPS for sensitive data_: Use HTTPS for transmitting sensitive data, such as
passwords, credit card numbers, and personal identifiable information.
2. _Use HTTP for public data_: Use HTTP for transmitting public data that does not require
encryption or authentication.
4. _Monitor and update HTTPS certificates_: Regularly monitor and update HTTPS
certificates to ensure that they remain valid and trusted.
2. _Insecure protocols_: Avoid using insecure protocols, such as SSLv2 and SSLv3, which
are vulnerable to attacks.
3. _Expired certificates_: Ensure that HTTPS certificates are up-to-date and not expired,
as this can create security vulnerabilities.
The roles and operations of the web browser and the web server:
Web Browser
1. *Requesting Web Pages*: Sends HTTP requests to the web server to retrieve web
pages.
2. *Rendering Web Pages*: Displays the received web pages on the user's device.
4. *Providing User Interaction*: Allows users to interact with web pages through input
devices, such as keyboards and mice.
1. *Sending HTTP Requests*: Sends HTTP requests to the web server, including the
requested URL, headers, and data.
2. *Receiving HTTP Responses*: Receives HTTP responses from the web server, including
the requested web page, headers, and data.
3. *Parsing and Rendering*: Parses the received web page and renders it on the user's
device.
4. *Executing Client-Side Scripts*: Executes client-side scripts, such as JavaScript, to
provide dynamic functionality.
Web Server
1. *Hosting Web Pages*: Hosts web pages and makes them available to clients.
2. *Receiving HTTP Requests*: Receives HTTP requests from clients and processes them.
3. *Sending HTTP Responses*: Sends HTTP responses to clients, including the requested
web page, headers, and data.
1. *Receiving HTTP Requests*: Receives HTTP requests from clients, including the
requested URL, headers, and data.
3. *Sending HTTP Responses*: Sends HTTP responses to clients, including the requested
web page, headers, and data.
1. *HTTP Request-Response Cycle*: The web browser sends an HTTP request to the web
server, which processes the request and sends an HTTP response back to the web
browser.
2. *TCP/IP Protocol*: The web browser and web server communicate using the TCP/IP
protocol, which provides reliable, connection-oriented communication.
3. *HTTP Methods*: The web browser uses HTTP methods, such as GET, POST, PUT, and
DELETE, to interact with the web server.
4. *HTTP Status Codes*: The web server uses HTTP status codes, such as 200, 404, and
500, to indicate the outcome of the HTTP request.
1. _Definition_: A web form is an interactive element on a web page that allows users to
input data and interact with a web application.
2. _Purpose_: Web forms enable users to provide input to a web application, which can
then process the data and respond accordingly.
1. _Simple Forms_: Basic forms that collect user input and submit it to the server for
processing.
2. _Complex Forms_: Forms that collect multiple types of data, such as text, images, and
files, and may involve validation and error handling.
3. _Dynamic Forms_: Forms that change their structure or behavior based on user input
or other factors.
Form Elements
Form Validation
3. _Validation Rules_: Rules that define the criteria for valid user input.
Form Submission
2. _POST Method_: Submits form data as a separate entity in the request body.
3. _Form Action_: Specifies the URL that processes the form data.
Security Considerations
1. _Cross-Site Scripting (XSS)_: Attack that injects malicious code into a web page.
2. _Cross-Site Request Forgery (CSRF)_: Attack that tricks users into performing
unintended actions.
Best Practices
1. _Use HTML5 Form Validation_: Use HTML5 form validation attributes to provide basic
validation.
2. _Use JavaScript for Client-Side Validation_: Use JavaScript to provide additional client-
side validation.
3. _Use Server-Side Validation_: Use server-side validation to ensure data integrity and
security.
4. _Use CSRF Tokens_: Use CSRF tokens to prevent cross-site request forgery attacks.
1. _Definition_: A style sheet is a file that contains styles and layouts for a document or a
collection of documents.
2. _Purpose_: Style sheets separate the presentation of a document from its structure,
making it easier to maintain and update the document.
2. _Internal Style Sheets_: Embedded directly into an HTML document using the
`<style>` element.
3. _Inline Style Sheets_: Applied directly to an HTML element using the `style` attribute.
1. _Element Selectors_: Select elements based on their tag name (e.g., `h1`, `p`,
`img`).
2. _Class Selectors_: Select elements based on their class attribute (e.g., `.header`,
`.footer`).
CSS Properties
2. _Padding Area_: The area between the content area and the border.
2. _Use Meaningful Class Names_: Use descriptive class names to make it easier to
understand the purpose of a style.
3. _Avoid Inline Styles_: Avoid using inline styles to maintain separation of concerns.
4. _Test and Validate_: Test and validate style sheets to ensure they work correctly across
different browsers and devices.
The examples of inline style sheets, internal style sheets, and external style sheets:
- *Definition*: An inline style sheet is a style sheet that is applied directly to an HTML
element using the `style` attribute.
- *Disadvantages*: Can make HTML code cluttered and difficult to read; styles are not
reusable.
- *Definition*: An internal style sheet is a style sheet that is embedded directly into an
HTML document using the `<style>` element.
- *Example*:
```
<head>
<style>
h1 {
color: red;
}
p{
font-size: 18px;
</style>
</head>
<body>
<h1>This is a heading.</h1>
</body>
```
- *Advantages*: Easy to use for small to medium-sized projects; styles are applied to the
entire document.
- *Disadvantages*: Styles are not reusable across multiple documents; can make HTML
code cluttered.
- *Definition*: An external style sheet is a style sheet that is stored in a separate file with
a `.css` extension.
```
h1 {
color: red;
p{
font-size: 18px;
```
HTML file:
```
<head>
</head>
<body>
<h1>This is a heading.</h1>
</body>
```
- *Disadvantages*: Requires creating and linking a separate file; can be more complex to
set up.
Element Selectors
```
p{
color: blue;
```
```
h1, h2, h3, h4, h5, h6 {
```
Class Selectors
```
.header {
background-color: #f2f2f2;
padding: 20px;
```
```
p.intro {
font-size: 18px;
font-weight: bold;
```
ID Selectors
```
#logo {
width: 100px;
height: 50px;
margin: 10px;
}
```
Attribute Selectors
```
[hreflang] {
font-style: italic;
```
- Select all input elements with the attribute "type" equal to "email":
```
input[type="email"] {
width: 200px;
height: 30px;
padding: 10px;
```
Pseudo-Class Selectors
```
a:hover {
color: red;
```
```
p:active {
background-color: yellow;
```
Pseudo-Element Selectors
```
p::first-letter {
font-size: 24px;
font-weight: bold;
```
```
p::first-line {
font-style: italic;
```
Text Editors
Debugging Tools
Testing Frameworks
Front-end Frameworks
Full-stack Frameworks
What is HTTP?
HTTP Request
3. *Headers*: Key-value pairs that provide additional information about the request.
HTTP Response
1. *Status Code*: A three-digit code indicating the outcome of the request (e.g., 200 OK,
404 Not Found).
2. *Headers*: Key-value pairs that provide additional information about the response.
HTTP Methods
HTTP Connections
HTTPS
HTTPS (Hypertext Transfer Protocol Secure) is an extension of HTTP that adds encryption
and authentication to the protocol. It uses TLS (Transport Layer Security) or SSL (Secure
Sockets Layer) to secure the connection.
Best Practices
Here are some best practices for using HTTP in web applications development:
2. *Use meaningful HTTP methods*: Use the correct HTTP method for the action being
performed.
3. *Handle errors correctly*: Return the correct HTTP status code for errors.
2. _Purpose_: HTML is used for structuring and presenting content on the web.
3. _Features_: HTML has a set of predefined tags and attributes that are used for
formatting and structuring content.
4. _Syntax_: HTML syntax is flexible and forgiving, allowing for mistakes and
inconsistencies.
1. _Definition_: XHTML is a markup language that combines the features of HTML and
XML.
2. _Purpose_: XHTML is used for creating web pages that require stricter syntax and
formatting rules.
3. _Features_: XHTML has the same set of tags and attributes as HTML, but with stricter
syntax rules.
4. _Syntax_: XHTML syntax is more rigid and requires proper nesting and closing of tags.
1. _Definition_: XML is a markup language used for storing and transporting data.
2. _Purpose_: XML is used for creating custom markup languages and data formats.
3. _Features_: XML allows users to define their own tags and attributes, making it highly
customizable.
4. _Syntax_: XML syntax requires proper nesting and closing of tags, as well as the use of
a document type definition (DTD) or schema.
5. _Version_: The latest version of XML is XML 1.1.
Key differences
1. _Purpose_: HTML is used for web pages, XHTML is used for web pages with stricter
syntax rules, and XML is used for storing and transporting data.
2. _Syntax_: HTML has flexible syntax, XHTML has stricter syntax, and XML requires
proper nesting and closing of tags.
3. _Customizability_: XML is highly customizable, allowing users to define their own tags
and attributes.
4. _Validation_: XHTML and XML require validation against a DTD or schema, while HTML
does not.
Comparison table
| Purpose | Web pages | Web pages with stricter syntax | Storing and transporting data |
How to use CSS and XSLT for formatting and transforming web content:
What is CSS?
CSS is a styling language used to control the layout and appearance of web pages.
2. *Link to HTML*: Link the CSS file to an HTML document using the `<link>` tag.
3. *Apply styles*: Use CSS selectors to target HTML elements and apply styles.
*CSS Example*
```
/* styles.css */
body {
background-color: #f2f2f2;
h1 {
color: #00698f;
```
```
<head>
</head>
<body>
<h1>Hello World!</h1>
</body>
```
1. *Create an XSLT file*: Write XSLT rules in a separate file with a `.xsl` extension.
2. *Transform XML*: Use an XSLT processor to transform an XML document into another
format (e.g., HTML).
3. *Apply styles*: Use XSLT templates to apply styles to the transformed document.
*XSLT Example*
```
<xsl:template match="/">
<html>
<body>
<h1><xsl:value-of select="title"/></h1>
<p><xsl:value-of select="paragraph"/></p>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
```
```
<root>
<title>Hello World!</title>
<paragraph>This is a paragraph of text.</paragraph>
</root>
```
To transform the XML document using XSLT, you can use an XSLT processor like
`xsltproc`:
```
bash
```
This will generate an HTML document (`output.html`) based on the XSLT transformation.
Types of Graphics
1. _Raster Graphics_: Made up of pixels, examples include JPEG, PNG, and GIF.
2. _Vector Graphics_: Made up of lines and curves, examples include SVG and EPS.
Uses of Graphics
2. _PNG (Portable Network Graphics)_: Suitable for images with transparent backgrounds
and simple graphics.
3. _GIF (Graphics Interchange Format)_: Suitable for simple graphics and animations.
4. _SVG (Scalable Vector Graphics)_: Suitable for vector graphics and animations.
1. _Engagement_: Multimedia content can engage users and enhance their experience.
2. _Use Alternative Text_: Use alternative text for graphics and multimedia content to
improve accessibility.
3. _Use Captions and Transcripts_: Use captions and transcripts for multimedia content
to improve accessibility.
4. _Test for Compatibility_: Test graphics and multimedia content for compatibility with
different browsers and devices.
Adding Audio
```
<audio controls>
</audio>
```
```
audio.play();
```
Adding Video
</video>
```
```
video.play();
```
Adding Images
```
```
```
img.src = 'image.jpg';
document.body.appendChild(img);
```
Adding Animations
*CSS Animations*
```
.element {
@keyframes spin {
0% {
transform: rotate(0deg);
100% {
transform: rotate(360deg);
```
*JavaScript Animations*
```
element.style.transform = 'rotate(360deg)';
```
```
```
ctx.fillStyle = 'red';
```
Note: These examples are just a starting point, and you will likely need to add more code
and styling to create a fully functional multimedia web application.
[13/01, 07:02] Meta AI: Here are some additional code and style examples to help create
a fully functional multimedia web application:
```
```
.grid-container {
display: grid;
grid-gap: 10px;
.grid-item {
background-color: #f2f2f2;
padding: 20px;
```
* **CSS Flexbox Layout**:
```
.flex-container {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
.flex-item {
background-color: #f2f2f2;
padding: 20px;
margin: 10px;
```
- *Responsive Design*:
```
```
/* Desktop layout */
.container {
max-width: 1200px;
margin: 0 auto;
/* Tablet layout */
.container {
max-width: 900px;
margin: 0 auto;
/* Mobile layout */
.container {
max-width: 600px;
margin: 0 auto;
```
## Multimedia Elements
* **Video Player**:
```
</video>
<style>
#video-player {
width: 100%;
height: 100vh;
object-fit: cover;
}
</style>
```
- *Audio Player*:
```
```
</audio>
<style>
#audio-player {
width: 100%;
height: 50px;
</style>
```
* **Image Gallery**:
```
<div class="image-gallery">
</div>
<style>
.image-gallery {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
.image-gallery img {
width: 30%;
height: 200px;
object-fit: cover;
margin: 10px;
</style>
```
Interactive Elements
- *Canvas Animation*:
```
```
<script>
let x = 0;
let y = 0;
let speedX = 2;
let speedY = 2;
function animate() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = 'red';
```x += speedX;
y += speedY;
speedX = -speedX;
speedY = -speedY;
requestAnimationFrame(animate);
```
animate();
</script>
```
* **SVG Graphics**:
```
<script>
circle.setAttribute('cx', '100');
circle.setAttribute('cy', '100');
circle.setAttribute('r', '50');
circle.setAttribute('fill', 'blue');
svg.appendChild(circle);
</script>
```
Accessibility Features
```
```
```
```
.high-contrast-mode {
background-color: #000;
color: #fff;
}
/* Add a toggle button for high contrast mode */
<script>
highContrast
```
Client-side programming refers to the execution of code on the client's web browser
rather than on the server. This approach allows for dynamic web pages, interactive user
interfaces, and faster response times.
*1. JavaScript*
*2. TypeScript*
*3. Dart*
*4. VBScript*
- *Features*: Similar syntax to Visual Basic, support for COM components, and dynamic
typing.
- *Uses*: Client-side scripting for Internet Explorer, server-side scripting with ASP
Classic.
1. *Separate Concerns*: Keep HTML, CSS, and JavaScript code separate and organized.
2. *Use Modular Code*: Break down large codebases into smaller, reusable modules.
3. *Optimize Performance*: Minimize HTTP requests, use caching, and optimize
JavaScript execution.
4. *Ensure Security*: Validate user input, use secure protocols (HTTPS), and follow best
practices for secure coding.
5. *Test Thoroughly*: Write unit tests, integration tests, and conduct manual testing to
ensure code quality.
The positive and negative impacts of the World Wide Web on people's lives:
Positive Impacts
1. *Global Connectivity*: The web has made it possible for people to connect with each
other from all over the world, regardless of geographical distance.
3. *E-commerce and Online Shopping*: The web has enabled online shopping, making it
possible for people to purchase goods and services from anywhere in the world.
4. *Remote Work and Education*: The web has enabled remote work and education,
allowing people to work and learn from anywhere, at any time.
5. *Social Media and Community Building*: The web has enabled social media and
community building, allowing people to connect with others who share similar interests
and passions.
6. *Improved Healthcare*: The web has enabled telemedicine, online health resources,
and access to medical information, improving healthcare outcomes for many people.
Negative Impacts
4. *Privacy Concerns*: The web can compromise personal privacy, as companies and
governments collect and use personal data without consent.
5. *Social Isolation*: The web can facilitate social isolation, as people substitute online
interactions for in-person connections.
6. *Job Displacement*: The web can displace jobs, as automation and artificial
intelligence replace human workers.
7. *Environmental Impact*: The web can have a negative environmental impact, as data
centers and online infrastructure consume energy and contribute to greenhouse gas
emissions.
Overall, the World Wide Web has had a profound impact on people's lives, bringing many
benefits and opportunities, but also creating new challenges and negative
consequences.