Notes, summaries, assignments, exams, and exercises for Computer science for Vocational training

Understanding DHCP: Configuration, Protocols, and Advantages

Computer science3.16 KB

DHCP: Dynamic Host Configuration Protocol

DHCP (Dynamic Host Configuration Protocol) is a service created by the IETF in 1993 that operates at the network level. It provides a rapid mechanism for network configuration. UDP is the protocol used by clients to automatically obtain IP addresses.

Configuration Options

  • IP Address
  • Subnet Mask
  • Default Gateway
  • DNS Server
  • Domain Name
  • DNS Suffix Name
  • Node Type (Windows)
  • Renewal Time
  • Reconnection Time

WINS (Windows Internet Name Service) is a Microsoft service that resolves NetBIOS names to IP addresses. MAC addresses are a sequence of 6 groups of hexadecimal digits that uniquely identify a network interface. The first 3 digits control the manufacturer.

Lease: When an IP address is assigned to a client, the lease indicates...

Continue reading "Understanding DHCP: Configuration, Protocols, and Advantages" »

Mastering C# List: A Comprehensive Reference

Computer science54.79 KB

Understanding the C# List<T>

  • The List<T> is a collection of strongly typed objects that can be accessed by index and includes methods for sorting, searching, and modifying the list.
  • It is the generic version of the ArrayList, found within the System.Collections.Generic namespace.
  • The List<T> performs faster and is less error-prone than the ArrayList.
  • Because it is a generic collection, you must specify a type parameter for the data it stores.

Creating a List and Adding Elements

List<int> primeNumbers = new List<int>();
primeNumbers.Add(1); // Adding elements using Add() method
primeNumbers.Add(3);
primeNumbers.Add(5);
primeNumbers.Add(7);

Using Collection Initializer Syntax

var bigCities = new List<string>()
{
...
Continue reading "Mastering C# List: A Comprehensive Reference" »

Socket.io Emitting Patterns and Best Practices

Computer science2.3 KB

Socket.io Emitting Patterns

io.on('connect', onConnect);

function onConnect(socket) {
  // Sending to the client
  socket.emit('hello', 'can you hear me?', 1, 2, 'abc');

  // Sending to all clients except sender
  socket.broadcast.emit('broadcast', 'hello friends!');

  // Sending to all clients in 'game' room except sender
  socket.to('game').emit('nice game', "let's play a game");

  // Sending to all clients in 'game1' and/or 'game2' room, except sender
  socket.to('game1').to('game2').emit('nice game', "let's play a game (too)");

  // Sending to all clients in 'game' room, including sender
  io.in('game').emit('big-announcement', 'the game will start soon');

  // Sending to all clients in namespace 'myNamespace', including sender
  io.
...
Continue reading "Socket.io Emitting Patterns and Best Practices" »

Essential Tech Terms Defined

Computer science4.8 KB

  • Accuracy

    Tells us how correct a GPS measurement is.
  • Array

    A group of disk drives that are connected and used as a single unit.
  • Assembler

    A program that translates low-level programming language into machine code.
  • Attachment

    A file sent as part of an email.
  • Avatar

    An image in a computer game that represents a person.
  • Barcode

    An arrangement of lines and spaces that represent data.
  • Bit

    The smallest unit of computer data.
  • Bitrate

    A measurement of the amount of data that is processed.
  • Broadband

    A system that allows computers to transfer large amounts of information.
  • Calibration

    The act of adjusting printers and scanners to display colors correctly.
  • Capacity

    The amount of space an MP3 player has to store files.
  • Catalog

    An inventory of books in a library.
  • Cell phone

    A wireless
...
Continue reading "Essential Tech Terms Defined" »

C++ Program for 2D Transformations in Graphics

Computer science2.87 KB

C++ Program for 2D Transformations

Write your text here! #include<iostream>

#include<graphics.h>
using namespace std;

int main()
{
    int gd = DETECT,gm,ch;
    initgraph(&gd,&gm,NULL);
    cleardevice();
    long int x1 = 30,y1 = 30,x2 = 70,y2 = 70;
    int y = 2,x = 2;

    do
    {
        cout<<"\n2-D TRANSFORMATIONS";
        cout<<"\n1.Translation";
        cout<<"\n2.Rotation";
        cout<<"\n3.Scaling";
        cout<<"\n4.Exit";
        cout<<"\nEnter your choice ";
        cin>>ch;

        switch(ch)
        {
            case 1:
                long int tx,ty;
                cout<<"\nEnter x1 coordinate ";
                cin>>x1;
                cout<
...
Continue reading "C++ Program for 2D Transformations in Graphics" »

Java JDBC MySQL Connection and Car Table Management

Computer science2.75 KB

Java JDBC Connection and Cars Table in MySQL

public static Connection conexionBD(String BDNombre) throws SQLException {
Connection con = null;
try {
System.out.println("Connecting...");
String controlador = "com.mysql.jdbc.Driver";
Class.forName(controlador).newInstance();
con = DriverManager.getConnection("jdbc:mysql://localhost:3306/bdtest", "usuario", "contraseña");
System.out.println("Connection succeeded!");
} catch (Exception e) {
e.printStackTrace();
}
return con;
}
public static void createCOCHES(Connection con, String BDNombre) throws SQLException {
String createString = "create table if not exists " + BDNombre + ".coches " +
"(matricula varchar(8) not null," +
...
Continue reading "Java JDBC MySQL Connection and Car Table Management" »

Software Testing and Maintenance Essentials

Computer science3.5 KB

Software Validation and Verification Fundamentals

Objectives of Validation and Verification

  • Detect and correct defects as soon as possible.
  • Reduce risks of budget and timetable deviations.
  • Improve software quality and reliability.
  • Improve development process management visibility.
  • Quickly assess proposed changes.

Philosophy of Software Testing

Recommendations by G.J. Myers:

  • Each test case should define the expected output.
  • Programmers must avoid testing their own programs.
  • Thoroughly inspect test results to identify possible symptoms of defects.
  • Test case generation should include valid, invalid, and unexpected inputs.
  • Prove that the software performs as intended and avoids unintended actions.
  • Test plans should always assume the presence of defects to avoid
...
Continue reading "Software Testing and Maintenance Essentials" »

PHP Session Management and MySQL Database Interaction

Computer science2.31 KB

Starting a Session and Destroying Variables (inicio.php)

session_start();
unset($_SESSION["host"]);

Creating a Session and Attempting a Connection (marco.php)

session_start();
$conn = @mysql_connect($host, $user, $password) or die("Incorrect user or password");
@mysql_select_db($db, $conn) or die("Cannot open the DB");

Assigning Connection Parameters to Session Variables

$_SESSION["host"] = $host;
$_SESSION['User'] = $user;

Starting a Session, Connecting to the Database, and Sending an Insertion Query (altas.php)

<?
 session_start();
 $conn = mysql_connect($host, $user, $password) or die("Incorrect user or password");
 mysql_select_db($db, $conn) or die("Not selected");
 $query = "insert into departments values ($dep, '$nom', '$crazy')";
 $result
...
Continue reading "PHP Session Management and MySQL Database Interaction" »

MySQL Database Management: Users, Permissions, Tables

Computer science3.76 KB

Users

  • Creation

From the Partner's Computer

  • Create user `Professor` @ '192.168.5.25' identified by 'Professor';

Local Access

  • Administrative user `Create` @ 'localhost' identified by 'Administrative';

Access from Any Computer

  • Create user `` @ '%' student identified by 'student';
  • Deletion

  • DROP
  • Permissions

To Grant Permissions

  • GRANT SELECT ON clase.cuidadores TO 'student'@'localhost';
SELECT * FROM carers;
  • GRANT SELECT (name, currency) ON clase.cuidadores TO 'student'@'localhost';
SELECT name FROM currency carers;
  • GRANT INSERT, SELECT, UPDATE ON IES.Curso TO 'Administrative'@'localhost';
  • GRANT INSERT (IdCurso, DNI), SELECT (IdCurso, DNI), UPDATE (IdCurso, ID) ON IES.Matrícula TO 'Administrative'@'localhost';

With Update

  • GRANT SELECT (name, currency), UPDATE (currency)
...
Continue reading "MySQL Database Management: Users, Permissions, Tables" »

Evolution of Operating Systems: Generations & Concepts

Computer science2.71 KB

Historical Operating Systems: A Timeline

This document provides a brief history of operating systems, covering their evolution across different generations.

1st Generation (1945-1955)

Characterized by vacuum valves and machine language. These systems were large, consumed high energy, were very slow, and performed simple mathematical calculations.

2nd Generation (1955-1965)

Transitioned to transistors and batch processing. Systems became smaller and consumed less power.

3rd Generation (1965-1980)

Integrated circuits were introduced, making systems cheaper and enabling multiple processors to run concurrently.

4th Generation (1980-Present)

Marked by the advent of personal computers.

Memory Management

The memory manager is a crucial part of the OS. It is...

Continue reading "Evolution of Operating Systems: Generations & Concepts" »