Web Technologies: A Comprehensive Guide to Essential Concepts

// calculator.ts
export module Calculator { export function add(x: number, y: number): number { return x + y;
} export function subtract(x: number, y: number): number {
return x – y; }export function multiply(x: number, y: number): number {
return x * y; } export function divide(x: number, y: number): number {
 if (y === 0) { throw new Error(“Cannot divide by zero”); } return x / y; }}

// main.ts
import { Calculator } from “./calculator”;
console.log(Calculator.add(5, 3)); // Output: 8
console.log(Calculator.subtract(10, 4)); // Output: 6
console.log(Calculator.multiply(2, 6)); // Output: 12
console.log(Calculator.divide(8, 2)); // Output: 4


student by order




   Student Information
   
   


   

Student Information in Ascending Order of Marks:


   


  •        

  •             Name: {{ student.name }}, Marks: {{ student.marks }}
           
       




interface Employee {

  id: number;
  name: string;
  department: string;
  salary: number;
}

const employees: Employee[] = [
  { id: 1, name: ‘John Doe’, department: ‘Engineering’, salary: 60000 },
  { id: 2, name: ‘Alice Smith’, department: ‘Marketing’, salary: 55000 },
  { id: 3, name: ‘Bob Johnson’, department: ‘HR’, salary: 50000 }
];

function displayEmployeeInfo(employee: Employee): void {
  console.log(ID: ${employee.id}, Name: ${employee.name}, Department: ${employee.department}, Salary: ${employee.salary});
}

function displayAllEmployees(employees: Employee[]): void {
  employees.forEach(displayEmployeeInfo);
}

// Display all employees
displayAllEmployees(employees);


XE0psAAAAASUVORK5CYII=


In web analytics, a clickstream (or click path) refers to the sequence of pages a user visits on a website. Clickstream analysis allows webmasters to better understand how their website is being used and where they can make improvements. Applications: -Comparing Traffic Channels: Webmasters can use clickstream analysis to compare different traffic channels. For example, they can analyze whether users from search engines view more pages than users from social media. -Comparing Advertising Strategies: If a website uses paid advertising, clickstream data can help compare the effectiveness of different advertising strategies. -Improving Existing Content: By analyzing clickstreams, webmasters can identify which pieces of content need improvement. -Interlinking Between Existing Content: Clickstream analysis helps optimize the links between different pieces of content on a website. 1.Traffic Analytics – Operates at the server level -Tracks: -How many pages are served to the user. -Page load times. -User actions like hitting the browser’s back or stop button. – Amount of data transmitted before the user moves on. – Helps understand server performance and user experience. 2. Ecommerce Analysis – Gathers information from individual user activity -Paints a full picture of the customer journey over time. -Includes browsing details and conversion data across multiple websites. -Useful for understanding user behavior, preferences, and interactions.


RDF stands for Resource Description Framework. -It’s a model to represent data about physical objects and abstract concepts. -RDF expresses relations between entities using a graph format. RDF uses a simple format called triples to express relationships. Subject: Represents the thing we’re talking about. Predicate: Describes the relationship between the subject and something else. Object: Refers to another thing related to the subject. Features: RDF is a framework for describing resources on the web. RDF provides a model for data and syntax so that independent parties can exchange and use it. Rdf is written in XML.

# Example RDF data describing a book
@prefix ex: http://example.org/> .
ex:Book1 a ex:Book ;
    ex:title “Introduction to RDF” ;
    ex:author “John Doe” ;
    ex:publicationYear 2020 .


The Semantic Web, also known as Web 3.0, extends the World Wide Web. Its goal is to make Internet data machine-readable. To achieve this, it uses technologies like Resource Description Framework (RDF) and Web Ontology Language (OWL). These technologies formally represent metadata. For eg an ontology can describe concepts, relationships between entities, and categories of things. The key idea is that the meaning of data becomes understandable by machines.


Directives are instructions that tell Angular how to manipulate the DOM. There are two types of directives: attribute directives and structural directives. Attribute directives change the appearance or behavior of an element, while structural directives change the layout by adding or removing elements. -To display student information, you might want to use some of the following built-in structural directives: -NgIf: This directive conditionally adds or removes an element from the DOM based on a boolean expression. For example, you can use NgIf to display a message if the student has passed or failed a test. -NgForOf: This directive iterates over a collection and creates a template for each item. For example, you can use NgForOf to display a list of students or a table of student details. -NgSwitch: This directive switches among several views based on a value. For example, you can use NgSwitch to display different sections of student information based on a selected option.


Access specifiers are keywords that control the visibility and accessibility of class members, such as properties and methods. TypeScript supports three access specifiers: public, private, and protected.Public: is the default access specifier for class members. It means they can be accessed from anywhere, inside or outside the class.Private: means that class members can only be accessed from within the same class. They cannot be accessed from outside the class or from subclasses.Protected: means that class members can be accessed from within the same class and from subclasses, but not from outside the class.

class Student {
  public studCode: number; // public property
  private studName: string; // private property
  protected studAge: number; // protected property
  constructor(code: number, name: string, age: number) {
    this.studCode = code;
    this.studName = name;
    this.studAge = age;
  }
  public display(): void { // public method
    console.log(`Student Code: ${this.studCode}`);
    console.log(`Student Name: ${this.studName}`);
    console.log(`Student Age: ${this.studAge}`);
  }
  private getStudName(): string { // private method
    return this.studName;
  }
protected getStudAge(): number { // protected method
    return this.studAge;
  }
}