Notes, summaries, assignments, exams, and exercises for Computer science for Other courses

Network Setup Walkthrough: ISP, HQ and BR Routers with GRE Tunnel and OSPF

Computer science7.7 KB

Network Setup Walkthrough

ISP

1. Isp_br-rtr – 172.16.2.1/28, Isp_hr-rtr – 172.16.1.1/28, rename the device (поменять имя).

2. Edit /etc/sysctl.conf with nano, uncomment the # line, run sysctl -p, then reboot.

HQ-RTR

1. Isp_hr-rtr – 172.16.1.2/28, gateway 172.16.1.1, DNS 1.1.1.1

2. hq-rtr_hq-cli (VLAN 200) – ens38.200, parent ens38, VLAN ID 200, address 192.168.100.65/28

3. VLAN 999 – ens39.999, parent ens39, VLAN ID 999, address 192.168.100.81/29

4. VLAN 100 – ens37.100, parent ens37, VLAN ID 100, address 192.168.100.1/26, rename the connection (поменять имя)

5. Edit /etc/sysctl.conf with mcedit, uncomment the # line, run sysctl -p, then reboot.

BR-RTR

1. isp_br-rtr – 172.16.2.2/28, gateway 172.16.2.1, DNS 1.1.1.1

2....

Continue reading "Network Setup Walkthrough: ISP, HQ and BR Routers with GRE Tunnel and OSPF" »

Firebase Authentication in JavaScript: Google, GitHub, Twitter and Email Login

Computer science4.95 KB

Firebase Authentication Implementation

The following onDeviceReady function handles user authentication, including social login with Google, GitHub and Twitter, email and password registration, email login, session monitoring and sign-out.

function onDeviceReady() {
  // Function for the login button
  // Launch Google sign-in
  if (document.querySelector('#button-login-google')) {
    document.querySelector('#button-login-google').addEventListener('click', function() {
      const provider = new GoogleAuthProvider(auth);
      signInWithRedirect(auth, provider);
    });
  }
  if (document.querySelector('#button-login-github')) {
    document.querySelector('#button-login-github').addEventListener('click', function() {
      const provider = new
...
Continue reading "Firebase Authentication in JavaScript: Google, GitHub, Twitter and Email Login" »

Java Socket Client-Server and SQLite Database Integration

Computer science5.14 KB

Client Class

public class Cliente {
    private Socket cliente;
    private DataInputStream entrada;
    private DataOutputStream salida;

    public String sendMSN(String msn)
    {
        String dirIP = "127.0.0.1";
        String mensaje = "";
        String mensaje2 = "";
        try
        {
            cliente = new Socket(dirIP, 2000);
            salida = new DataOutputStream(cliente.getOutputStream());
            salida.writeUTF(msn);

            entrada = new DataInputStream(cliente.getInputStream());
            mensaje = entrada.readUTF();
            System.out.println(mensaje);
            //inicioSesion is = new inicioSesion();
            //st = entrada.readUTF();
            mensaje2 = entrada.readUTF();
            cliente.
...
Continue reading "Java Socket Client-Server and SQLite Database Integration" »

Java JDBC DAO Code Review: Fixing Bakker, Sterke Dranken & Boeken Classes

Computer science6.84 KB

Java JDBC DAO and Swing Code: Corrected Version

Below is the corrected code for the BakkerDAO, BaseDAO, sterke dranken, boeken and Nachtwinkel classes. The main issues addressed are a missing prepareStatement assignment, incorrect use of ps before initialization, and a few spelling and capitalization inconsistencies.

1. BakkerDAO

public class BakkerDAO extends BaseDAO {
PreparedStatement ps = null;

public boolean verwijderBakker(Bakker b) {
String sql = "DELETE FROM bakker WHERE id = ?";
try {
Connection c = getCon();
if (c == null || c.isClosed()) {
throw new IllegalStateException("Connection closed or failed");
}
ps = c.prepareStatement(sql);
ps.setInt(1, b.getID());
int result = ps.executeUpdate();
if (result > 0) {
return true;
} else {
return false;
}...

Continue reading "Java JDBC DAO Code Review: Fixing Bakker, Sterke Dranken & Boeken Classes" »

Java Figuras Geométricas: Clases Círculo, Cuadrado y Triángulo

Computer science5.61 KB

Figuras

public class Circulo extends Figura {
private float radio;
public Circulo(String nombre, float coordenadax, float coordenaday, float radio) {
super(nombre, coordenadax, coordenaday);
this.radio = radio;
}

public float getRadio() {
return radio;
}

public void setRadio(float radio) {
this.radio = radio;
}

@Override
public float CalculaArea() {
return (float) (radio * radio * Math.PI);
}
}

public class Cuadrado extends Figura {
private float lado;
public Cuadrado(String nombre, float coordenadax, float coordenaday, float lado) {
super(nombre, coordenadax, coordenaday);
this.lado = lado;
}

public float getLado() {
return lado;
}

public void setLado(float lado) {
this.lado = lado;
}

@Override
public float CalculaArea() {
return lado * lado;
}
}

Clase abstracta Figura

public

...
Continue reading "Java Figuras Geométricas: Clases Círculo, Cuadrado y Triángulo" »

K-Lite Codec Tweak Tool Log File: System and Filter Details

Computer science4.53 KB

K-Lite Codec Tweak Tool | Log File | Generated at 2009-07-28 17:58:37



System Information



KLCP: 462 full
OS: Microsoft Windows XP Service Pack 3 (5.01.2600)
DirectX: 9.0c
CPU name: AMD Athlon(tm) 64 Processor 2800+
CPU speed: 1799MHz
Memory: 1152MB
Screen size: 1024x768 (32 bits)
Video card: VIA/S3G UniChrome Pro IGP, 32MB
Audio card: Realtek AC97 Audio


DirectShow Filters



Description: Haali Media Splitter
File name: c:\archivos de programa\k-lite codec pack\filters\haali\splitter.ax
CLSID: {55DA30FC-F16B-49FC-BAA5-AE59FC65F82D}
Merit: 00800001 = MERIT_PREFERRED + 1

Description: Haali Media Splitter (AR)
File name: c:\archivos de programa\k-lite codec pack\filters\haali\splitter.ax
CLSID: {564FD788-86C9-4444-971E-CC4A243DA150}
Merit: 00400000 = MERIT_UNLIKELY

Description:

...
Continue reading "K-Lite Codec Tweak Tool Log File: System and Filter Details" »

8085 Microprocessor Architecture and Instructions

Computer science3.83 KB

Subroutines and Control Instructions

A subroutine is a group of instructions written to perform a specific task. It can be called from different parts of a program using the CALL instruction, and after execution, it returns to the main program using the RET instruction.

Example:

CALL 2500H ; Call subroutine at address 2500H

2500H: INR A ; Increment accumulator

RET ; Return to main program

  • CALL 2500H transfers control to address 2500H.
  • The instructions at 2500H are executed.
  • RET returns control to the instruction immediately after CALL.

Unconditional Jump (JMP)

Example: JMP 3000H (Assembly Language)

  • The CPU immediately jumps to memory address 3000H.
  • Execution continues from 3000H.
  • No flag (Zero, Carry, Sign, etc.) is checked.

Interrupts and Control Signals

RST

...
Continue reading "8085 Microprocessor Architecture and Instructions" »

8085 Microprocessor Addressing Modes and Registers Explained

Computer science2.84 KB

Addressing Modes in 8085 Microprocessor

Addressing modes refer to the ways in which an instruction specifies the location of its data (operand). The 8085 microprocessor supports several addressing modes to access data efficiently based on program needs. Understanding these modes is essential for instruction execution and memory handling in assembly programming.

1. Immediate Addressing Mode

In this mode, the actual data (operand) is provided directly within the instruction itself. The processor does not need to fetch data from memory. It is fast and commonly used for initialization.

  • Example: MVI A, 25H ; Load 25H directly into register A

2. Register Addressing Mode

The operand is stored in a CPU register. The instruction specifies the register where...

Continue reading "8085 Microprocessor Addressing Modes and Registers Explained" »

Работа со стрингови во C++: броење самогласки, палиндроми и зборови

Computer science2.8 KB

Работа со стрингови во C++

1. Броење самогласки во збор

int main(){
char tekst[50];
int brojac = 0;
cout << "Vnesi tekst: ";
cin.getline(tekst,50);
for(int i=0; i<strlen(tekst); i++){
char c = tolower(tekst[i]);
if(c=='a' || c=='e' || c=='i' || c=='o' || c=='u')
brojac++;
}
cout << "Samoglaski: " << brojac;
}


2. Промена на сите мали букви во големи

int main(){
char tekst[50];
cout << "Vnesi tekst: ";
cin.getline(tekst,50);
for(int i=0; i<strlen(tekst); i++)
tekst[i] = toupper(tekst[i]);
cout << "Vo golemi bukvi: " << tekst;
}

3. Преброј колку пати се појавува дадена буква

int main(){
char tekst[50], bukva;
int brojac =

...
Continue reading "Работа со стрингови во C++: броење самогласки, палиндроми и зборови" »

8051 Microcontroller Architecture and Flip-Flop Types

Computer science288.82 KB

SR Flip-Flop (Set-Reset Flip-Flop)

The SR flip-flop is one of the simplest sequential circuits and serves as a fundamental building block for more complex flip-flops. It is a 1-bit memory device with two inputs: Set (S) and Reset (R). It has two outputs, Q and its complement Q̅ (Q with overline).

Logic Diagram and Working

An SR flip-flop can be constructed using two cross-coupled NAND gates (or NOR gates). Below is the working principle for the NAND-gate implementation:

  1. Set Condition (S = 0, R = 1):

    • When S = 0, the output of the top NAND gate (Q) is forced to 1 (since NAND is the inverse of AND).

    • This Q = 1 is fed into the bottom NAND gate with R = 1; the bottom gate's inputs become 1 and 1, so its output (Q̅) becomes 0.

    • The circuit is now in the

...
Continue reading "8051 Microcontroller Architecture and Flip-Flop Types" »