Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
3 views40 pages

Internet Application Programming II

This document outlines a course on Internet Programming, detailing its purpose, learning outcomes, and key concepts related to the internet, programming, and web services. It covers essential topics such as internet protocols, client-side programming, web authoring tools, and the roles of programmers in IT. Additionally, it provides definitions and explanations of various programming languages, web applications, and the structure of HTML.

Uploaded by

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

Internet Application Programming II

This document outlines a course on Internet Programming, detailing its purpose, learning outcomes, and key concepts related to the internet, programming, and web services. It covers essential topics such as internet protocols, client-side programming, web authoring tools, and the roles of programmers in IT. Additionally, it provides definitions and explanations of various programming languages, web applications, and the structure of HTML.

Uploaded by

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

STARFORD INTERNATIONAL UNIVERSITY

COLLAGE OF COMPUTER SCIENCE AND INFORMATION TECHNOLOGY

MAIN CAMPUS, HAI REFERENDUM, JUBA, SOUTH SUDAN

PREPARED BY
MR. OLWENY FELIX K.O
CONTACT:
TEL: 0925600460
EMAIL: [email protected]
COURSE PURPOSE
The purpose of this course is to explain Internet Programming concepts and related
Programming and scripting languages.

LEARNING OUTCOMES
At the end of the course, the learner will be able to:
i. Describe basic Internet Protocols.
ii. Explain JAVA and HTML tools for Internet programming.
iii. Describe scripting languages.
iv. Explain dynamic HTML and XML programming.
v. Explain Server Side Programming tools.

Definition of terms:

a. Internet:

The term "internet" refers to a global network of interconnected computers and other devices that
communicate with each other using standardized protocols. It enables information and data to be
shared globally among millions of users.

Components of the Internet:

Network Infrastructure:

This includes physical components such as cables, routers, switches, and servers, as well as
wireless signals that enable communication between devices.

Protocols:

These are rules and standards that govern how data is transmitted and received across the
internet. Examples include TCP/IP (Transmission Control Protocol/Internet Protocol), HTTP
(Hypertext Transfer Protocol), and DNS (Domain Name System).

Web Services and Applications:

Websites, email services, social media platforms, online games, and other applications that
operate over the internet are built on top of its infrastructure and protocols.
Key Features of internet

Global Reach: The internet spans the entire globe, connecting devices and users across
continents and countries.

Decentralized: It is a decentralized network, meaning there is no single point of control. Instead,


multiple networks and service providers work together through peering agreements.

Scalability: The internet is designed to handle large volumes of data and users simultaneously,
allowing for its widespread use and growth

Accessibility: Access to the internet can be achieved through various means, including wired
connections (like fiber optic cables and DSL) and wireless technologies (such as WiFi and
mobile networks).

How Internet Works?

• Ethernet, IP, HTTP, TCP, and UDP comprise the basic infrastructure of the Internet.
• There are only five simple steps involved in the Working Principle of Internet.
• Along with 3G/4G/5G, the DSL and Dialup are other important Connecting Modes.
• There are mainly three protocols involved in the Internet Working Method e.g. TCP,
HTTP, and FTP.
• Switches and Routers, the Physical Infrastructure are the main pillars of the Internet.

Firstly, you’ll be required to connect your system or PC with any router or modem to establish a
connection. This connection is the base of the internet connection.
When you open the browser and start typing something like “www.google.com”, your system
will push a query command to your ISP (Internet Service Provider) that is connected with other
servers that store and process data.

Now, the web browser will start indexing the URL that you’ve entered and will fetch the details
in numeric format (in their language to identify the address (unique) that you’re trying to reach.

Next, now your browser will start sending the HTTP request where you’re trying to reach and
send a copy of the website on the user’s system. Note: The server will send data in the form of
small packets (from the website to the browser)

Once all the data (of small packets) is received at the user’s end (PC/Laptop), the browser will
start arranging all those small packets and later will form a collective file (here, the browser will
gather all the small packets and rearrange them just like a puzzle) and then you’ll be able to see
the contents of that website

Note: The action happens so quickly that we don’t even notice what’s going behind. Only, when
the connection is poor, you do face difficulty in reaching or loading any website or its content.

b. Application

An application, often shortened to "app," refers to a software program designed to perform


specific tasks or provide specific functionality for the user or another application. Applications
can range from simple utilities to complex systems used in various domains like business,
entertainment, education, and more.

Web Applications:

Ecommerce: Online stores like Amazon, eBay, and Shopify where users can buy and sell goods
and services.

Social Networks: Platforms such as Facebook, Twitter, and LinkedIn accessed through web
browsers.

Web based Email: Services like Gmail, Outlook, and Yahoo Mail for managing email online.
Cloud Applications: Tools such as Google Drive, Dropbox, and Microsoft OneDrive for file
storage and collaboration

Customer Relationship Management (CRM): Software like Salesforce, HubSpot, and Zoho
CRM used to manage customer interactions and data.

Enterprise Resource Planning (ERP): Systems such as SAP, Oracle ERP, and Microsoft
Dynamics that integrate core business processes.

What is programming?

Programming is an act of writing code to produce a useful application. Programming can be seen
also as follows:

1. Writing Code: Programmers write code in various programming languages such as Python,
Java, C++, JavaScript, and many others. Each language has its syntax, rules, and capabilities
suited for different types of applications and tasks.

2. Problem Solving: Programming involves breaking down complex problems into smaller,
manageable parts and devising algorithms (step-by-step procedures) to solve them. It requires
analytical thinking and creativity to find efficient solutions.

3. Software Development: Programming is essential for developing software applications,


including desktop applications, mobile apps, web applications, and enterprise systems.
Programmers design, build, test, and maintain software to meet specific user requirements.

4. Automation and Scripting: Beyond software development, programming is used for


automation tasks and scripting. IT professionals write scripts to automate repetitive tasks,
configure systems, manage networks, and analyze data.

5. Integration: Programming facilitates integration between different software systems and


services. APIs (Application Programming Interfaces) allow programs to interact with each other,
exchange data, and provide seamless user experiences.
6. Data Manipulation: Programmers use programming languages to manipulate and analyze
data. This includes tasks such as data cleaning, transformation, aggregation, and visualization,
which are crucial for decision-making and business intelligence.

Roles of a programmer in IT:

Software Development: Designs and develops software applications, ensuring they meet
functional requirements and performance standards.

Systems Analysis: Analyzes and designs IT systems, including software and hardware solutions,
to optimize business processes and meet organizational goals.

Data Science/Analysis: Uses programming skills to analyze large datasets, derive insights, build
predictive models, and visualize data to support decision-making.

Network Administrator: Writes scripts to automate network management tasks, monitor


network performance, and ensure security and reliability.

IT Consultant: Advises businesses on technology solutions, including custom software


development, based on their needs and objectives.

WEB SERVICES

Web services are software systems designed to support interoperable machinetomachine


interaction over a network, typically the internet. They allow different applications to
communicate and exchange data regardless of their underlying technologies or platforms. Key
aspects of web services include:

1. Service Oriented Architecture (SOA): Web services are based on the concept of SOA,
where software components (services) are designed to provide specific functionality and can be
accessed and reused by other applications.

2. Interoperability: Web services use standard protocols and formats (like XML, JSON) that
facilitate communication and data exchange between heterogeneous systems. This
interoperability is crucial for integrating different applications and services.
3. Internet Protocols: Internet protocols are rules and standards that govern how data is
transmitted, routed, and received over networks, including the internet. They define procedures
and formats for communication between devices and ensure that data packets are correctly
addressed and delivered. Some essential internet protocols include:

1. TCP/IP (Transmission Control Protocol/Internet Protocol): The foundational protocol


suite of the internet. TCP manages the assembling of a message or file into smaller packets that
are transmitted over the internet and received by a TCP layer that reassembles the packets back
into the original message.

2. HTTP (Hypertext Transfer Protocol): The protocol used for transferring hypertext requests
and information on the World Wide Web. It defines how messages are formatted and
transmitted, and how web servers and browsers should respond to various commands.

3. HTTPS (HTTP Secure): An extension of HTTP that adds encryption using SSL/TLS
protocols to secure data transmission over the internet, commonly used for secure
communication (e.g., online banking, ecommerce).

4. DNS (Domain Name System): Converts domain names (like example.com) into IP addresses
(like 192.0.2.1) to facilitate routing and communication between devices on the internet. It
translates human readable domain names into IP addresses that computers use to identify each
other on the network.

5. SMTP (Simple Mail Transfer Protocol): A protocol used for sending and receiving email
messages over the internet. It defines how email clients and servers communicate and transfer
email messages.

6. FTP (File Transfer Protocol): A protocol used for transferring files between a client and
server on a computer network. It defines methods for file access, file transfer, and file
management.
WEB AUTHORING TOOLS

Web authoring tools are software applications designed to facilitate the creation and management
of websites and web pages without extensive coding knowledge. These tools typically provide a
user-friendly interface and often incorporate templates, draganddrop functionality, and
WYSIWYG (What You See Is What You Get) editors to simplify the web development process.
Here’s an overview along with examples of popular web authoring tools:

1. Content Management Systems (CMS):

Content Management Systems are comprehensive platforms that allow users to create, manage,
and publish digital content on the web. They often include built-in web authoring capabilities
and are particularly suited for websites requiring frequent updates and content additions.

WordPress: One of the most popular CMS platforms, Word Press offers a wide range of themes
and plugins to customize websites. It's known for its flexibility, scalability, and user-friendly
interface.

Joomla: Another robust CMS that provides extensive customization options and is suitable for
building complex websites. Joomla is favored for its strong community support and developer
friendly features.

Drupal: Known for its flexibility and scalability, Drupal is a powerful CMS suitable for large
scale websites and applications. It offers advanced customization and integration capabilities.

2. Website Builders:

Website builders are online platforms that allow users to create websites using predesigned
templates and draganddrop tools. They are ideal for users who want to quickly create a basic
website without technical expertise.

Wix: Wix is a popular website builder known for its ease of use and extensive collection of
templates. It offers a draganddrop editor, allowing users to customize layouts, add elements, and
manage content effortlessly.
Squarespace: Squarespace offers professionally designed templates that are visually appealing
and responsive. It provides intuitive tools for customization, blogging, ecommerce, and more.

Weebly: Weebly is known for its userfriendly interface and simple draganddrop editor. It offers
various themes and features like ecommerce integration, blogging, and SEO tools.

3. Code Editors with Web Authoring Capabilities:

While these tools require more familiarity with HTML, CSS, and sometimes JavaScript, they
provide more control and flexibility over the website’s design and functionality.

Adobe Dreamweaver: A powerful code editor and web authoring tool that supports both
WYSIWYG editing and direct code editing. It integrates well with other Adobe products and
offers extensive features for web development.

Visual Studio Code (VS Code): A lightweight, opensource code editor that supports various
programming languages. It offers extensions and plugins for HTML, CSS, JavaScript, and other
web technologies, enhancing productivity and customization.

4. Online Platforms and Prototyping Tools:

Figma: While primarily a design tool, Figma allows designers to create interactive prototypes of
web pages and interfaces. It supports collaboration and realtime editing, making it useful for
design and user experience testing.

Adobe XD: Another design and prototyping tool that allows designers to create interactive
prototypes for websites and mobile apps. It integrates well with other Adobe products and
supports animations and transitions.

Considerations for Choosing Web Authoring Tools:

Ease of Use: Choose a tool that matches your skill level and offers an intuitive interface for your
needs.

Features and Flexibility: Consider the customization options, templates, plugins, and
integrations available to achieve your desired website functionality.
Scalability: Ensure the tool can grow with your website’s needs, especially if you anticipate
expanding features or managing larger amounts of content.

Each web authoring tool offers unique features and capabilities suited to different types of users
and projects. The choice depends on your specific requirements, technical proficiency, and
preferences for design and functionality.

CLIENT SIDE PROGRAMMING

Client side programming refers to the execution of scripts, applications, or code directly within
the user's browser or client device rather than on a remote server. This methodology allows for
dynamic and interactive web experiences by manipulating the content displayed in the user's
browser window without requiring constant communication with the server. Here’s an overview
of client side programming methodology:

Key Concepts and Methodologies:

1. Languages and Technologies:

HTML (Hypertext Markup Language): Provides the structure and content of web pages.

CSS (Cascading Style Sheets): Controls the presentation and layout of HTML elements.

JavaScript: The primary client side scripting language used to add interactivity, manipulate the
DOM (Document Object Model), handle events, and communicate asynchronously with servers
(AJAX).

2. Execution Environment:

Client side scripts are executed by the user's browser (such as Chrome, Firefox, Safari) or client
device (such as mobile apps built with frameworks like React Native).

Scripts are typically embedded directly within HTML documents or linked externally via script
tags.

3. Interactivity and User Experience:


Client side programming enhances user experience by enabling dynamic content updates and
immediate responses to user interactions (like clicks, inputs, scrolls).

It allows for form validation, animation effects, real-time updates (like chat applications), and
client side data storage (using technologies like local Storage or Indexed DB).

4. Frameworks and Libraries:

JavaScript Frameworks: Such as React.js, Angular, and Vue.js provide structured


environments for building complex client side applications with reusable components and state
management.

Libraries: Like jQuery simplify DOM manipulation and AJAX requests, making development
faster and more efficient.

5. Security Considerations:

Client side scripts can expose vulnerabilities if not properly secured. Common concerns include
cross site scripting (XSS) attacks and exposure of sensitive data.

Best practices include input validation, secure storage of sensitive information, and careful
handling of user generated content.

6. Performance Optimization:

Efficient client side programming improves website performance by reducing server load and
minimizing network latency.

Techniques include minimizing HTTP requests, optimizing code and assets (like images and
scripts), and utilizing browser caching.

HTML

Hyper Text Markup Language (HTML) is the standard markup language used to create and
structure content on web pages. It provides a set of elements or tags that define the structure and
layout of a web document, specifying how the content should be displayed in a web browser.
HTML is a foundational technology of the World Wide Web and is essential for creating static
and dynamic web pages. Here are the key aspects of HTML:

Basic Structure:

HTML documents are text files with a .html extension and consist of elements enclosed in tags.
The structure typically includes:

<!DOCTYPE html>

<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>This is a Heading</h1>

<p>This is a paragraph.</p>
</body>
</html>

<!DOCTYPE html>: Declares the document type and version of HTML (HTML5 in this case).

<html>: Root element that wraps all content on the web page.

<head>: Contains metadata about the document, such as title, character set, stylesheets, and
scripts.

<title>: Sets the title of the web page, displayed in the browser's title bar or tab.

<body>: Contains the main content of the web page, including headings, paragraphs, images,
links, forms, and other elements.

Key Concepts of HTML:

1. Elements and Tags:


Tags: Enclosed in angle brackets (<>), define the beginning (<tag>) and end (</tag>) of an
element.

Attributes: Provide additional information about an element, specified within the start tag (<tag
attribute="value">).

2. Document Object Model (DOM):

HTML documents are represented as a tree structure called the DOM.

Each element in the DOM can be accessed, manipulated, and styled using JavaScript and CSS.

3. Common HTML Elements:

<h1> to <h6>: Headings of varying levels (1 being the highest).

<p>: Paragraphs of text.

<a>: Anchor tags for creating hyperlinks (<a href="url">Link text</a>).

<img>: Inserts images (<img src="image.jpg" alt="Description">).

<div>: Division or container for grouping content.

<span>: Inline container for styling text or grouping inline elements.

4. Semantic HTML:

Uses elements that convey meaning beyond presentation, improving accessibility and SEO.

Examples include <header>, <nav>, <article>, <section>, <footer>, etc.

5. Forms and Input Elements:

<form>: Defines a form for user input (<form action="/submitform" method="post"> ...
</form>).

<input>: Creates form controls like text fields, checkboxes, radio buttons, etc.

<button>: Creates clickable buttons (<button type="submit">Submit</button>).


DYNAMIC HTML

Dynamic HTML (DHTML) refers to a combination of technologies used to create dynamic and
interactive web pages by manipulating the HTML, CSS, and JavaScript in real-time within a web
browser. It enables developers to enhance user experience by allowing web pages to respond to
user actions without requiring page reloads. Here’s an overview of Dynamic HTML and its key
components:

Components of Dynamic HTML:

1. HTML (Hypertext Markup Language):

Provides the structure and content of web pages. Elements are used to define the layout,
headings, paragraphs, images, links, forms, and other content displayed on the web page.

2. CSS (Cascading Style Sheets):

Controls the presentation and styling of HTML elements. CSS is used to define colors, fonts,
layouts, spacing, and other visual aspects of the web page.

3. JavaScript:

The primary scripting language used in DHTML to add interactivity and dynamic behavior to
web pages. JavaScript can manipulate HTML elements, respond to user actions (like clicks and
inputs), change CSS styles, handle events, and interact with web APIs and serverside scripts.

Key Features and Techniques of DHTML:

1. DOM Manipulation (Document Object Model):

DHTML allows JavaScript to dynamically access and manipulate the structure, content, and
style of HTML elements.

Developers can add, remove, modify, or reorder elements within the DOM based on user
interactions or application logic.

2. Event Handling:
JavaScript can attach event listeners to HTML elements to respond to user actions (e.g., clicks,
mouse movements, keyboard input).

Events trigger JavaScript functions that can update content, modify styles, or initiate
serverside requests asynchronously (using AJAX).

3. CSS Manipulation:

DHTML enables dynamic changes to CSS styles based on user interactions or application
state.

JavaScript can modify CSS properties of elements to create animations, transitions, or


responsive layouts without reloading the entire page.

4. Asynchronous Requests (AJAX Asynchronous JavaScript and XML):

AJAX allows web pages to request and receive data from a server asynchronously without
refreshing the entire page.

It enables dynamic updates of content (like news feeds, live scores) and enhances user
experience by reducing latency and improving responsiveness.

EXTENDED MARKUP LANGUAGE (XML)

Extended Markup Language (XML) is a widely used markup language designed to store and
transport data in a format that is both human readable and machine-readable. It provides a
flexible and standardized way to structure and describe data across different systems, platforms,
and programming languages. XML is not tied to any specific application or domain, making it
versatile for a wide range of uses. Here’s an overview of XML and its key characteristics:

Features of XML:

1. Markup Language:

XML uses tags to define and describe the structure and meaning of data.

Tags are enclosed in angle brackets (< >) and can be nested to represent hierarchical
relationships.
2. Human Readable and Machine Understandable:

XML documents are plain text files that are easy for humans to read and write.

At the same time, XML follows strict syntax rules that make it machine-readable and easily
parsed by software applications.

3. Data Description:

XML is used to describe data and its structure, rather than just formatting content for display
(as in HTML).

It allows users to define custom tags and attributes that correspond to specific data elements
and their relationships.

4. Platform and Language Independence:

XML is platform independent and can be used across different operating systems and
hardware environments.

It is also language independent, meaning it can be processed by various programming


languages and software tools.

5. Extensibility:

XML allows users to define their own tags and document structures based on specific
requirements.

This extensibility makes XML suitable for defining data formats, configuration files,
communication protocols, and more.

6. Validation and Schema:

XML documents can be validated against a schema (typically defined in XML Schema or
DTD Document Type Definition).

Schema defines the structure, data types, constraints, and validation rules for XML documents,
ensuring data integrity and consistency.
Example of XML Syntax:

xml
<?xml version="1.0" encoding="UTF8"?>
<library>

<book>
<title>XML Fundamentals</title>
<author>John Doe</author>
<year>2020</year>
</book>
<book>

<title>Advanced XML Techniques</title>


<author>Jane Smith</author>
<year>2022</year>
</book>
</library>

<?xml version="1.0" encoding="UTF8"?>: Declaration specifying the XML version and


character encoding.

<library>: Root element enclosing all other elements.

<book>: Child elements representing individual books, each containing <title>, <author>, and
<year> elements.

Common Uses of XML:

Data Exchange: XML is used for exchanging structured data between different systems and
applications, facilitating interoperability.

Configuration Files: Many software applications use XML for configuration settings due to its
readability and extensibility.
Web Services: XML is commonly used as a data format for exchanging information between
web services and clients (e.g., SOAP messages).

Document Formats: XML is used in document formats like XHTML, OpenDocument (ODF),
and Office Open XML (OOXML) for storing and structuring content.

Advantages of XML:

Flexibility: Supports complex data structures and hierarchical relationships.

Interoperability: Enables data exchange between disparate systems and platforms.

Standardization: Widely adopted and supported across industries and technologies.

Challenges:

Overhead: XML can be verbose compared to other data formats like JSON.

Complexity: Defining and managing XML schemas and namespaces can be complex.

Performance: Parsing and processing large XML documents can require significant
computational resources.

SERVER SIDE PROGRAMMING

Server-side programming refers to the process of writing code that runs on a web server rather
than on the client's browser or device. It involves handling requests from clients (such as web
browsers), processing data, interacting with databases, and generating dynamic web pages or
responses that are sent back to the client. Server-side programming is crucial for creating
interactive and dynamic web applications that require server-side processing and data
manipulation. Here’s an overview of server side programming and its key aspects:

Key Components and Concepts of server-side programming:

1. Server-Side Languages:

PHP: A widely used server side scripting language known for its simplicity and integration
with web servers like Apache.
Python: Popular for web development with frameworks like Django and Flask, offering
versatility and readability.

Ruby: Often used with the Ruby on Rails framework, known for rapid development and
convention over configuration.

Java: Known for its scalability and performance, commonly used with frameworks like Spring
and Java EE.

Node.js (JavaScript): Allows JavaScript to run on the server-side using event driven,
nonblocking I/O model, suitable for real-time applications.

ASP.NET (C#): Microsoft's framework for building web applications using C#, providing
robustness and integration with Microsoft technologies.

2. Execution Environment:

Server-side code executes on the web server in response to client requests.

The server processes the request, executes the server-side code, interacts with databases or
other services, and generates an appropriate response.

3. Handling Requests and Responses:

Server-side scripts handle incoming requests from clients (e.g., web browsers, mobile apps).

They process form submissions, user inputs, and other interactions, validating data, and
performing necessary computations or business logic.

4. Database Interaction:

Server-side programming involves querying databases (such as MySQL, PostgreSQL,


MongoDB) to retrieve, store, and manipulate data.

Data retrieved from databases can be dynamically incorporated into web pages or APIs
generated by the server.

5. Session Management and State Maintenance:


Server-side programming manages user sessions and maintains application state across
multiple requests.

Sessions enable personalized user experiences, authentication, and authorization.

6. Generating Dynamic Content:

Server-side scripts generate HTML, CSS, JavaScript, and other content dynamically based on
user input, application logic, and database queries.

They assemble templates or views, integrate data, and send the resulting content to the client
for display.

7. Security Considerations:

Server-side programming addresses security concerns such as input validation, sanitization,


authentication, and protection against common vulnerabilities (e.g., SQL injection, cross-site
scripting).

Access control and data encryption are implemented to secure sensitive information.

Advantages of Server-Side Programming:

Security: Sensitive operations and data handling can be managed securely on the server.

Scalability: Server resources can be scaled to handle increasing traffic and workload.

Complex Logic: Enables implementation of complex business logic and workflows.

Database Integration: Facilitates efficient interaction with databases and other backend
services.

Challenges:

Performance: Server side processing can impact response times, especially with complex logic
or heavy database interactions.
Maintenance: Requires regular updates, monitoring, and optimization to ensure reliability and
performance.

Learning Curve: Some server side languages and frameworks may have a steeper learning
curve compared to client side technologies.

6. HTML5 Features:

Introduced new elements and attributes to improve semantics and functionality.

Supports multimedia elements (<audio>, <video>), canvas for graphics, local storage,
geolocation, and more.

JAVASCRIPT

JavaScript is a versatile and widely used programming language primarily known for its role in
web development. It is a key component of creating dynamic and interactive content on websites,
enhancing user experience by enabling functionalities such as animations, form validation, and
asynchronous data retrieval. Here's an overview of JavaScript and its key characteristics:

Key Features of JavaScript:

1. Client Side Scripting:

JavaScript runs on the client side (in the user's web browser), allowing it to interact with the
Document Object Model (DOM) and manipulate elements on web pages dynamically.

It enables developers to respond to user actions (like clicks, inputs, scrolls) and modify content
without reloading the entire web page.

2. Cross Platform Compatibility:

JavaScript is supported by all modern web browsers, including Chrome, Firefox, Safari, Edge,
and others. It provides a consistent development environment across different platforms and
devices.

3. Versatility and Application:


Beyond web development, JavaScript is used in various environments and frameworks:

Node.js: Allows JavaScript to be used for server side programming, enabling full stack
development.

React, Angular, Vue.js: Popular frontend frameworks for building single page applications
(SPAs) and user interfaces.

Electron: Enables building desktop applications using web technologies with JavaScript.

Mobile App Development: Frameworks like React Native and Ionic allow JavaScript
developers to build cross platform mobile apps.

4. Dynamic Typing and Weak Typing:

JavaScript is dynamically typed, meaning variables do not require explicit declaration of data
types.

It supports weak typing, where variables can change data types as needed during execution.

5. Asynchronous Programming:

JavaScript supports asynchronous programming through callbacks, promises, and async/await


syntax.

This allows handling of operations that do not block the execution of other code, such as
fetching data from servers (AJAX calls) or performing animations.

6. Functional and Object-oriented Paradigms:

JavaScript supports both functional and object-oriented programming (OOP) paradigms.

Functions are first-class citizens, allowing them to be passed as arguments, returned from
other functions, or assigned to variables.

Example of JavaScript Syntax:


javascript

// Define a function to greet the user

function greetUser(name) {

return 'Hello, ' + name + '!';

// Call the function and output the result

var userName = 'John';

console.log(greetUser(userName)); // Output: Hello, John!

Advantages of JavaScript:

• Enhanced User Experience: Enables interactive elements and dynamic content on web
pages.
• Extensive Ecosystem: Rich ecosystem of libraries, frameworks, and tools for rapid
development.
• Cross Platform Compatibility: Runs on multiple platforms and integrates well with
various technologies.
• Community Support: Large and active developer community contributing to opensource
projects and sharing resources.
COMMON GATEWAY INTERFACE

Common Gateway Interface (CGI) scripting is a standard protocol for interfacing external
applications for example, whatapp, Instagram etc with web servers to generate dynamic web
content or perform other server side tasks. It allows web servers to communicate with executable
programs or scripts running on the server to process requests and generate responses
dynamically. Here’s an overview of CGI scripting and its key aspects:

Key Concepts of CGI Scripting:

1. Purpose and Functionality:

CGI enables web servers (like Apache, Nginx) to execute programs or scripts in response to
client requests via the web browser.

It facilitates dynamic content generation, form processing, database interaction, file


manipulation, and more.

2. Components:

Client (Browser): Sends HTTP requests to the web server.

Web Server: Receives requests and forwards them to CGI programs/scripts.

CGI Program/Script: Executable file or script written in languages like Perl, Python, C, or
shell scripts. It processes the request, generates dynamic content, and sends a response back to
the server.

Server Side Environment: Where the CGI program/script executes, often with access to server
side resources like databases or file systems.

3. Execution Workflow:

When a client requests a CGI script (e.g., submitting a form), the web server identifies the CGI
script based on the URL configuration.

The server spawns a new process or thread to execute the CGI script, passing HTTP request
parameters (like form data) as input.
The CGI script processes the input, performs necessary computations or database queries, and
generates HTML or other content for the HTTP response.

The server sends the generated content back to the client’s browser for display.

4. CGI Environment Variables:

CGI programs/scripts can access environment variables provided by the web server, which
contain information about the request (e.g., HTTP headers, client IP address, and server
configuration).

These variables help the CGI script determine how to process the request and tailor the
response accordingly.

5. Output Handling:

CGI scripts typically output HTML or other content directly to the server's output stream.

The server sends this output back to the client as part of the HTTP response, which renders the
dynamic content in the user’s browser.

Example of CGI Scripting (Using Perl):

perl

#!/usr/bin/perl

use strict;

use warnings;

# Send HTTP headers

print "Contenttype: text/html\n\n";

# Get current date and time

my $current_datetime = localtime();
# Generate HTML output

print "<html>\n";

print "<head><title>CGI Example</title></head>\n";

print "<body>\n";

print "<h1>Current Date and Time</h1>\n";

print "<p>$current_datetime</p>\n";

print "</body>\n";

print "</html>\n";

ACTIVE SERVER PAGE

Active Server Pages (ASP) is a server side scripting environment and framework developed by
Microsoft for dynamically generating web pages. It allows developers to create dynamic,
interactive, and data driven web applications by embedding server side scripts directly into
HTML pages. ASP was first released in December 1996 as part of the Windows NT 4.0 Option
Pack and has since evolved into ASP.NET. Here’s an overview of Active Server Pages and its
key features:

Key Features of Active Server Pages (ASP):

1. Server Side Scripting:

ASP enables developers to embed server side scripts (typically written in VBScript or JScript,
a variant of JavaScript) directly within HTML pages.

Scripts are enclosed in <% %> delimiters, allowing for dynamic content generation and
interaction with server side resources.

2. Integration with COM Components:

ASP allows integration with Component Object Model (COM) components, enabling
developers to reuse existing libraries and components.
This promotes code reusability and enhances functionality by leveraging COM objects for
tasks like database access, file operations, and business logic.

3. Database Connectivity:

ASP supports easy integration with databases using ADO (ActiveX Data Objects) for data
access.

Developers can connect to various databases (such as Microsoft SQL Server, MySQL, Oracle)
to retrieve and manipulate data dynamically.

4. Session and State Management:

ASP provides built in session management capabilities to maintain state across multiple
requests from the same user.

Session variables allow storing user specific data throughout a user's visit to the web
application.

5. Component Based Architecture:

ASP follows a component based architecture where functionality can be encapsulated in


reusable components.

Developers can create custom ASP components or use third-party components to extend
application capabilities.

6. Error Handling and Debugging:

ASP supports error handling and debugging mechanisms to identify and troubleshoot issues in
server side scripts.

Developers can log errors, handle exceptions, and debug scripts using tools like Microsoft
Visual Studio or debugging tools provided by the server environment.

7. Security Features:
ASP includes security features for managing authentication and authorization, protecting
sensitive information, and preventing common vulnerabilities such as SQL injection and cross
site scripting (XSS).

Example of ASP Script:

asp

<%

' VBScript code embedded in ASP

Dim currentDateTime

currentDateTime = Now()

Response.Write "<html>"

Response.Write "<head><title>ASP Example</title></head>"

Response.Write "<body>"

Response.Write "<h1>Current Date and Time</h1>"

Response.Write "<p>" & currentDateTime & "</p>"

Response.Write "</body>"

Response.Write "</html>"

%>

SOCKETS

Server sockets, also known simply as sockets, are fundamental network communication
endpoints used for establishing and managing connections between a server application and
multiple client applications. They enable bidirectional communication over a network, allowing
data to be transmitted and received between applications running on different devices or
computers. Here's a detailed explanation of server sockets:

Sockets Defined

A socket is a software concept for a connection. Sockets enable applications to connect to a


Transmission Control Protocol/Internet Protocol (TCP/IP) network.

An application running on a host creates a socket or doorway to connect with an application on


another host. Messages pass through this socket or doorway.

Sockets enable virtual TCP or UDP communication channels between hosts.

When an application starts on a host, a port number is assigned to a process or a function running
in it. When that application wants to communicate with another host, (go to a website for
example) a socket is created.

This example shows three applications requiring three TCP communication channels: Two
channels for each of the two web browsers acting as HTTP clients, and one for the email
application acting as an SMTP client.
Sockets are physically implemented as transmit (TX) & receive (RX) memory buffers.

When an application wants to transmit a message, a process writes to the socket’s transmit
buffer. This same process periodically checks the socket’s receive buffer for messages being sent
by the host on the other end of the virtual connection.

The Transport layer delivers messages to the application by writing them to the socket’s receive
buffer. The Transport layer also periodically polls the socket’s transmit buffer to determine if
there are messages to send.

Example: Established Socket

A socket is created by an application running in a host. The application assigns a transport


protocol (TCP or UDP) and source and destination addresses to the socket. It identifies sockets
by assigning numbers to them.
Note the web server has two sockets opened: one for each web page it is serving. These sockets
are differentiated by the destination port numbers. This graphic shows a virtual TCP connection
between a client and server. Note the socket numbers are not the same on both sides of the
channel. Hosts create, close and number their own sockets.

Example: Use Sockets to Create a TCP Connection

The following steps describe a TCP connection process using sockets.

1. Server Creates Socket and Listens


2. Client Creates a Socket and Connects
3. Transport Layer Delivers Message to Server
4. Server Creates Socket & Process
5. Transport Layer Delivers Message to Client
6. Sockets Closed

Server Creates Socket and Listens

A web server creates a socket dedicated to listening for client requests. After the socket exists,
the server goes into “listening” mode and waits for a client's request. It periodically checks for
messages received in this socket.

This type of socket is referred to as a connectionless socket. A connectionless socket is used to


establish a TCP connection with the HTTP server. There is no destination IP
address or port number defined for this type of socket. Client Creates a Socket and Connects
When a client wants to download a web page it creates a socket and then sends the web age
ownload request to the socket.

Transport Layer Delivers Message to Server

The client’s Transport layer periodically checks its transmit buffers to determine if a message
needs to be sent. When a message is found it is forwarded to the destination address.

Server Creates Socket and Process

When the server receives the client’s request, it creates a new dedicated socket and process. It
then creates a message for the client and sends it to the socket.

Note this socket uses the client’s destination IP address and port number. This virtual TCP
connection is now referred to as “established”.

The message sent by the server is the HTML file for the requested webpage.
Transport Layer Delivers Message to Client

The server’s Transport layer periodically checks its transmit buffers to determine if a message
needs to be sent.

When a message is found it is forwarded to the destination address.


Sockets Closed

After the client receives the web page it requested, it sends an acknowledge to the server and
then closes its socket.

The server receives the client’s acknowledge then closes its socket.

Server Socket vs. Client Socket:

Server Socket: A server socket waits for incoming client connections. It listens on a specific
port for client requests and handles these requests as they arrive.

Client Socket: A client socket initiates a connection to the server socket by specifying the
server's IP address and port number.

TCP/IP and UDP:

TCP (Transmission Control Protocol): Provides reliable, connection oriented communication


between applications. It ensures data integrity and ordered delivery.

UDP (User Datagram Protocol): Provides connectionless, unreliable communication. It is


faster but does not guarantee delivery or order.

Socket Programming:
Socket programming involves using socket APIs provided by the operating system or
programming languages (e.g., Python's socket module, Java's java.net.Socket class) to create,
configure, and manage sockets.

Server sockets typically use the bind, listen, and accept methods to set up and manage
incoming client connections.

Lifecycle of Server Sockets:

Binding: The server socket binds to a specific IP address and port number using the bind
method, indicating where clients can connect.

Listening: The socket enters a listening state (listen method), waiting for incoming connection
requests from clients.

Accepting Connections: When a client requests a connection, the server socket accepts the
connection (accept method), creating a new socket dedicated to that client for communication.

Handling Requests: The server socket and client socket communicate by sending and
receiving data through their respective input and output streams.

Concurrency and Multithreading:

Server sockets often employ multithreading or asynchronous programming techniques to


handle multiple client connections concurrently.

Each accepted client connection typically runs in its own thread or process to ensure that the
server can handle multiple clients simultaneously.

7. Scalability and Performance:

Well-designed server socket applications can scale to support thousands of simultaneous


connections, making them suitable for applications requiring high throughput and low latency.

Example (Python):
python

import socket

# Create a TCP/IP socket

server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

# Bind the socket to the address and port

server_address = ('localhost', 8080)

server_socket.bind(server_address)

# Listen for incoming connections (max 5 pending connections)

server_socket.listen(5)

# Wait for a connection, accept it, and handle the client

while True:

print('Waiting for a connection...')

client_socket, client_address = server_socket.accept()

try: print(f'Connection from {client_address}')

# Receive data from the client

data = client_socket.recv(1024)

if data:
print(f'Received: {data.decode()}')

# Send back a response

message = 'Hello, client!'

client_socket.sendall(message.encode())

finally:

# Clean up the connection

client_socket.close()

CASCADING STYLE SHEETS (CSS)

Cascading Style Sheets (CSS) is a style sheet language used to describe the presentation (i.e., the
look and formatting) of a document written in markup languages like HTML and XML. CSS
separates the content of a web page from its visual design, allowing developers to control layout,
colors, fonts, and other aspects of presentation across multiple web pages or a whole website.
Here’s a detailed overview of CSS and its key components:

Key Concepts of Cascading Style Sheets (CSS):

1. Selectors and Declarations:

Selectors: CSS selectors target HTML elements based on their type, class, ID, attributes, or
relationship with other elements.

css

/* Example of a selector targeting all <p> elements */

p{

color: blue;

fontsize: 16px;
}

/* Example of a selector targeting elements with class="button" */

.button {

backgroundcolor: #ff9900;

border: 1px solid #e67e22;

Declarations: CSS declarations define the style properties applied to selected elements, such as
color, font, margin, padding, etc.

2. Cascading and Specificity:

Cascading: Multiple style sheets can be applied to the same document, with rules from
different sources (e.g., external CSS files, internal <style> tags, inline styles) cascading and
combining to determine the final styles.

Specificity: Determines which style rules are applied when multiple rules could apply to the
same element. Specificity is calculated based on selector types (ID selectors have higher
specificity than class selectors, etc.).

3. Box Model:

Content: The actual content (text, images) of the HTML element.

Padding: Space between the content and the element’s border.

Border: A border surrounding the padding (optional).

Margin: Space between the element’s border and adjacent elements.

4. Layout and Positioning:

CSS can control the layout and positioning of elements on a web page using properties like
display, position, float, flexbox, and grid.
Flex box and Grid Layout provide powerful tools for creating complex layouts with a
responsive design.

5. Responsive Design:

CSS supports responsive design principles, allowing developers to create layouts that adapt to
different screen sizes and orientations using media queries (@media).

6. Animations and Transitions:

CSS can animate elements and create transitions between states using properties like
animation, transition, transform, and key frames.

7. Preprocessors and Postprocessors:

CSS preprocessors like Sass and Less extend CSS with features like variables, mixins, and
nested rules, improving maintainability and efficiency.

Postprocessors like Autoprefixer automatically add vendor prefixes to CSS rules for better
cross browser compatibility.

Example of CSS:

css

/* Style for all <h1> elements */

h1 {

color: #333;

fontsize: 24px;

marginbottom: 10px;

/* Style for elements with class="button" */


.button {

backgroundcolor: #007bff;

color: white;

padding: 10px 20px;

border: none;

borderradius: 4px;

cursor: pointer;

/* Responsive design using media queries */

@media (maxwidth: 768px) {

.button {

fontsize: 16px;

Prepare your computer for practices.

You might also like