Notes, summaries, assignments, exams, and problems for Computers

Sort by
Subject
Level

Essential IoT Wireless Communication Protocols Explained

Posted by Anonymous and classified in Computers

Written on in English with a size of 4.63 KB

1. MQTT Protocol and Architecture

MQTT is a lightweight messaging protocol designed for M2M IoT communication. It utilizes a publish–subscribe model, eliminating the need for direct device-to-device communication. Key features include low power consumption, low bandwidth usage, scalability, reliability (via QoS 0/1/2), and security (TLS). The architecture consists of a Client (publisher/subscriber device), a Broker (central server for message management, filtering, and routing), and a TCP/IP connection (CONNECT–CONNACK).

2. 6LoWPAN Working and Importance

6LoWPAN stands for IPv6 over low-power wireless personal area networks (IEEE 802.15.4). Its working mechanism involves header compression, packet fragmentation, an adaptation layer, mesh routing,... Continue reading "Essential IoT Wireless Communication Protocols Explained" »

Graph Neural Networks and Distributed Data Pipelines

Posted by Anonymous and classified in Computers

Written on in English with a size of 25.85 KB

Graph Neural Networks (GNN)

GNN Challenges and Representations

Working with graphs introduces unique computational challenges:

  • Graph size is dynamic.
  • Each node can have a variable number of edges.
  • Standard methods used for images and texts are not suitable for graphs.
  • Adjacency matrix representation can be very inefficient.
  • There can be multiple adjacency matrices to represent the same graph.
  • Standard convolution applied to images does not work (though adaptations have been tried).

Potential tasks: Link prediction, node classification, community detection, and ranking.

Representation: Adjacency matrix, edge list, and adjacency list.

Spectral GNN Architectures

Como funciona: Utiliza a Transformada Discreta de Fourier (DFT) sobre a matriz de adjacência... Continue reading "Graph Neural Networks and Distributed Data Pipelines" »

Implementing REINFORCE Policy Gradient for CartPole-v1

Posted by Anonymous and classified in Computers

Written on in English with a size of 3.14 KB

############################### lAB 9 ####################3
import gymnasium as gym
import numpy as np
import tensorflow as tf

# Create the environment
env = gym.Make("CartPole-v1")

# Define a simple neural network model for the policy
model = tf.Keras.Sequential([
    tf.Keras.Layers.Dense(16, activation='relu', input_shape=(env.Observation_space.Shape[0],)),
    tf.Keras.Layers.Dense(env.Action_space.N, activation='softmax')
])

# Define the optimizer
optimizer = tf.Keras.Optimizers.Adam(learning_rate=0.01)

# Function to choose an action based on the current policy
def choose_action(state):
    """
    Chooses an action based on the probabilities output by the policy model.
    Args:
        state (np.Array): The current observation/state from... Continue reading "Implementing REINFORCE Policy Gradient for CartPole-v1" »

Understanding Assembly Language: Instructions and Assemblers

Posted by Anonymous and classified in Computers

Written on in English with a size of 2.8 KB

Understanding Assembly Language

Assembly language is a low-level programming language where instructions are written using mnemonic codes rather than binary machine language. An assembler translates these instructions into executable machine code.

Classification of Assembly Instructions

Assembly language instructions are categorized into three primary types:

  • Imperative Statements (IS): Specify operations for the processor to perform. These generate executable machine code. Examples include: STOP, ADD, SUB, MULT, MOVER, MOVEM, COMP, BC, DIV, READ, and PRINT.
  • Declarative Statements (DL): Used for memory allocation and data definition. DS (Define Storage) reserves memory locations, while DC (Define Constant) stores a constant value in memory.
  • Assembler
... Continue reading "Understanding Assembly Language: Instructions and Assemblers" »

Implementing Logistic Regression and Naive Bayes in Python

Posted by Anonymous and classified in Computers

Written on in English with a size of 1.86 KB

Logistic Regression Implementation

1. Upload and Prepare Dataset

from google.colab import files
uploaded = files.upload()

2. Import Libraries

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import confusion_matrix

3. Load and Split Data

data = pd.read_csv("Social_Network_Ads.csv")
X = data[['Age','EstimatedSalary']]
y = data['Purchased']
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=0)

4. Feature Scaling and Model Training

sc = StandardScaler()
X_train = sc.fit_transform(X_train)
X_test = sc.
... Continue reading "Implementing Logistic Regression and Naive Bayes in Python" »

How the World Wide Web Works: A Technical Breakdown

Classified in Computers

Written on in English with a size of 2.84 KB

How the World Wide Web Works

The World Wide Web is the most widely used part of the internet. When you browse the web, you view multimedia pages containing text, pictures, graphics, sounds, and videos. The web uses hypertext links to allow you to navigate from one place to another.

The web operates on a client/server model: client software (the web browser) runs on your computer, while server software runs on a web host.

To use the web, you need an internet connection and a web browser. You type the URL for the website you wish to visit, and your browser sends a request using the HTTP protocol. This is how the browser and server communicate. When the server finds the requested page, it sends it back to the browser.

How Web Pages Are Organized

The... Continue reading "How the World Wide Web Works: A Technical Breakdown" »

File Systems, Kernels, and High-Performance Networking

Posted by Anonymous and classified in Computers

Written on in English with a size of 25.6 KB

Fast File System (FFS)

Writes

Writes: Writes data to blocks chosen by cylinder groups. Tries to place related blocks near each other and rotationally optimize access. Metadata updates (inodes, directories) are also written in-place within the same group.

Reads

Reads: Very fast because data is grouped by cylinder, minimizing seeks. Sequential reads benefit from rotational optimization and large block sizes (4–8 KB). The first read goes through the inode, then the inode's data block pointers.

Appends

Appends: Allocates the next block near the previous one. Uses rotational delay tables to place the next block just in time for the disk head. Large blocks plus fragments allow efficient small-file appends.

Crash Recovery

Crash Recovery: Uses fsck to walk... Continue reading "File Systems, Kernels, and High-Performance Networking" »

Internet Fundamentals: Protocols, Web Browsers, and Network Architecture

Posted by Anonymous and classified in Computers

Written on in English with a size of 7.49 KB

Internet vs. World Wide Web (WWW)

  • Internet: A global network infrastructure that uses TCP/IP to connect devices worldwide.
  • WWW (World Wide Web): A multimedia service built upon the Internet, utilizing HTML, CSS, web browsers, and hyperlinks.
  • Webpage: A single document accessible via the WWW. | Website: A collection or group of related webpages.

History and Evolution of the Internet

  • 1960s: Development of ARPANET (Advanced Research Projects Agency Network).
  • 1983: Adoption of the TCP/IP protocol suite (developed by Vint Cerf and Bob Kahn).
  • 1989: Invention of the World Wide Web (WWW) by Tim Berners-Lee.
  • 1992: Release of the Mosaic browser (developed at UIUC), popularizing the graphical web.

Understanding the Client-Server Model

  • Client: Initiates a request
... Continue reading "Internet Fundamentals: Protocols, Web Browsers, and Network Architecture" »

Mastering jQuery and Modern Form Validation

Posted by Anonymous and classified in Computers

Written on in English with a size of 7.25 KB

1. Modern Validation APIs (Constraint Validation API)

For advanced tracking and custom error messaging, JavaScript provides the Constraint Validation API. This API gives you deep programmatic control over HTML5 validation states.

Key Properties & Methods

  • element.validity: An object containing boolean properties describing the validity state of the input.
    • validity.valueMissing: True if required but empty.
    • validity.typeMismatch: True if the syntax doesn't match the type (e.g., an invalid email).
    • validity.tooShort: True if it doesn't meet minlength.
    • validity.valid: True if the element passes all validation checks.
  • element.setCustomValidity(string): Sets a custom error message. If you pass an empty string "", the field becomes valid again.
  • element.checkValidity(
... Continue reading "Mastering jQuery and Modern Form Validation" »

Web Application Security: Vulnerabilities and Mitigations

Posted by Anonymous and classified in Computers

Written on in English with a size of 1.73 MB

Web Security Fundamentals

Vte60I22Y4rloTJJkNobQnzfKnvzVllIg5VXseVlb8Oo0lemK0wbVL2Ro4ylzQ96mYBvg7I3FlW9EaUPdsbPXfehlUZYxr6v7kaIgqQgAAEIQAACEIBALQHEci2i6bkhhrpMT82oCQQgAAEIQAACEBgPAcTyeLhORKq5E6z84MJENA2FgAAEIAABCECgJwQQyz1pKIoJAQhAAAIQgAAEINA9AcRy98zJEQIQgAAEIAABCECgJwQQyz1pKIoJAQhAAAIQgAAEINA9AcRy98zJEQIQgAAEIAABCECgJwQQyz1pKIoJAQhAAAIQgAAEINA9AcRy98zJEQIQgAAEIAABCECgJwQQyz1pKIoJAQhAAAIQgAAEINA9AcRy98zJEQIQgAAEIAABCECgJwQQyz1pKIoJAQhAAAIQgAAEINA9AcRy98zJEQIQgAAEIAABCECgJwQQyz1pKIoJAQhAAAIQgAAEINA9AcRy98zJEQIQgAAEIAABCECgJwQQyz1pKIoJAQhAAAIQgAAEINA9AcRy98zJEQIQgAAEIAABCECgJwQQyz1pKIoJAQhAAAIQgAAEINA9AcRy98zJEQIQgAAEIAABCECgJwQQyz1pKIoJAQhAAAIQgAAEINA9AcRy98zJEQIQgAAEIAABCECgJwQQyz1pKIoJAQhAAAIQgAAEINA9AcRy98zJEQIQgAAEIAABCECgJwQQyz1pKIoJAQhAAAIQgAAEINA9AcRy98zJEQIQgAAEIAABCECgJwQQyz1pKIoJAQhAAAIQgAAEINA9AcRy98zJEQIQgAAEIAABCECgJwQQyz1pKIoJAQhAAAIQgAAEINA9AcRy98zJEQIQgAAEIAABCECgJwT+L8xpiAEBloqFAAAAAElFTkSuQmCC NF+gw7WaYNgAAAABJRU5ErkJggg== bpX7OFi9HIwAAAABJRU5ErkJggg== aXgG7JY0aGX+AzUxEfBqKaiqwN+Lqr8dhK3JtUSkuu9jiG7CmeBLI0AibpQApn3VjsogYpJsbULXZBVNqNbpV99GfuLaO+y1OBhQCQmAiCfwnQcZEIpS5hYAQEAJCQAgIgVAEJMiQfSEEhIAQEAJCQAiEhYAEGWHBKoMKASEgBISAEBACEmTIHhACQkAICAEhIATCQkCCjLBglUGFgBAQAkJACAgBCTJkDwgBISAEhIAQEAJhIfANRHwpmb9j0SIAAAAASUVORK5CYII= ntAAAAAElFTkSuQmCC wcCnzcg8p0c5gAAAABJRU5ErkJggg==

Common Cross-Site Scripting (XSS) Types

XSS TypeExample PayloadDescription
Reflected XSS<script>alert(1)</script>Injected payload reflected immediately in server response.
Stored XSS<img src="x" onerror="alert(1)">Payload stored on server (e.g., in database), executed later.
DOM-Based XSSURL: #<script>alert(1)</script>Payload executed via client-side JavaScript manipulation.
Event Handler XSS<a onclick="alert(1)">Click</a>Injects event attributes to run JS on user actions.
Attribute Injection"><script>alert(1)</script>Breaks out of HTML attribute to inject malicious code.
JavaScript URI XSS<a href="javascript:alert(1)">Click</a>Runs JS via link clicks
... Continue reading "Web Application Security: Vulnerabilities and Mitigations" »