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

Sort by
Subject
Level

Mastering C# List: A Comprehensive Reference

Classified in Computers

Written on in English with a size of 54.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" »

VB.NET Code Examples for Arrays and Timer Controls

Classified in Computers

Written on in English with a size of 2.92 KB

Weight Calculation and Session Management in VB.NET

This example demonstrates how to handle weight data using arrays and manage application sessions with timers.

Public Class Form1
    Dim PESOPERSONA(1) As Integer
    Dim PESOTOTAL As Integer

    Private Sub Form1_Load(...)
        Me.Text = "CÁLCULO DE PESO"
        Label1.Text = "RESULTADO"
        Label2.Text = "" & vbCrLf
        PESOPERSONA(0) = 105
        PESOPERSONA(1) = 55

        For i = 0 To 7
            If PESOPERSONA(i) < 10 Or PESOPERSONA(i) > 100 Then
                Label2.Text = Label2.Text & "EL DATO DE PESO " & i & " no es válido por no estar entre 10 y 100 " & vbCrLf
            Else
                PESOTOTAL = PESOTOTAL + PESOPERSONA(i)
... Continue reading "VB.NET Code Examples for Arrays and Timer Controls" »

Processes, Threads, and RAID Levels in Operating Systems

Classified in Computers

Written on in English with a size of 234.98 KB

What is a Process?

A process is a program in execution, encompassing the current values of the program counter, registers, and variables. It's an active entity with a limited lifespan, created at execution start and terminated upon completion. Processes utilize various resources like memory, disk, and printers as needed.

Process vs. Program

Process

Program

A program in execution.

A set of instructions.

Active/dynamic entity.

Passive/static entity.

Limited lifespan.

Longer lifespan (stored on disk).

Uses various resources (memory, disk, etc.).

Stored on disk, doesn't use other resources.

Has a memory address space.

Requires disk space for instructions.

Multiprogramming and the Process Model

Multiprogramming involves rapidly switching the CPU between multiple... Continue reading "Processes, Threads, and RAID Levels in Operating Systems" »

C++ Standard Library Data Structures and Algorithms

Classified in Computers

Written on in English with a size of 146.78 KB

C-Style Arrays

In stack: int a[3] = {0, 1, 2};

In heap: int* b = new int[3];

Sorting

std::sort(myvector.begin(), myvector.end());

Example 2: std::sort(myvector.begin(), myvector.end(), myCompFunction);

mylist.sort() or mylist.sort(compare_nocase);

bool compare_nocase(const std::string& first, const std::string& second) { return first < second; }

Templated Classes

Include template <typename T> above the header.

Each function has a template declaration:

template <typename T>
class_name<T>::getmax () {
  // ...
}

typedef list_iterator iterator;

Strings

str.substr(3, 5) (starts at position 3, length 5)

str1.compare(str2) != 0

str.length()

Lists

iterator insert(iterator position, const value_type& val); (returns pair)

Maps

std::map&

... Continue reading "C++ Standard Library Data Structures and Algorithms" »

Telephone Means and Equipment: Features and Services

Classified in Computers

Written on in English with a size of 9.05 KB

Telephone Means and Equipment

Fixed individual devices (copper networks have been replaced by optical fiber networks)

Private branch exchanges (PBX): it connects calls between two destinations or ends

Function: call transfers among extensions, caller ID…

Types: IP PBXs call centers, they manage just phone calls contact centres, they not only manage phone calls but emails, SMS, online messages, faxes, etc.

Mobile devices: PDA, Smartphone

Services: Internet, e-mail, videoconference, digital camera, audio an Video quality player, an agenda, GPS, own, Operating system

Additional services offered by the telephone equipment

Common features

A.Fixed telephony: -Notice of charge(aviso de cargo) you receive info on the cost of a call Call forwarding(desvio

... Continue reading "Telephone Means and Equipment: Features and Services" »

Manual de Comandos Iptables y Configuración de ACL

Classified in Computers

Written on in English with a size of 3.05 KB

Comandos Esenciales de Iptables

  • Listar reglas: iptables -t nat -L --line-numbers
  • Política por defecto: iptables -t filter -P OUTPUT DROP
  • Permitir HTTP e ICMP: iptables -A OUTPUT -o eth0 -p tcp --dport 80 -j ACCEPT
  • Permitir Correo (25, 110): iptables -A INPUT -s 0.0.0.0/0 -p tcp --dport 25 -j ACCEPT
  • Bloquear PING de IP específica: iptables -A INPUT -o eth0 -s 192.168.28.200 -p icmp -j DROP
  • Redirección de puertos (80 a 8080): iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080
  • DNAT (Redirección a IP): iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j DNAT --to 192.168.10.12:80
  • Backup de reglas: iptables-save > mi_tabla y iptables-restore < mi_tabla
  • Borrar reglas: iptables -t nat -F y iptables -D INPUT
... Continue reading "Manual de Comandos Iptables y Configuración de ACL" »

Essential Computer Science: Binary, OS Kernel, Von Neumann, Assembly

Classified in Computers

Written on in English with a size of 53.68 KB

Binary Operations and Number Systems

s8wZJYEAlCkAAAAASUVORK5CYII=

Bitwise Shift Operations

Left Shift

The left shift operator (<<) shifts bits to the left, filling the vacated positions on the right with zeros. This is equivalent to multiplying the number by powers of two.

Right Shift

The right shift operator (>>) shifts bits to the right. There are two types:

  • Logical Right Shift: Fills the vacated positions on the left with zeros.
  • Arithmetic Right Shift: Fills the vacated positions on the left with the most significant bit (sign bit) of the original number, preserving the sign for signed integers.

Decimal to Binary Conversion

To convert a decimal number to binary, repeatedly divide the decimal number by 2. Record the remainder (which will be either 0 or 1) from right... Continue reading "Essential Computer Science: Binary, OS Kernel, Von Neumann, Assembly" »

Project Hemisphere: AT&T Surveillance and Database Systems

Classified in Computers

Written on in English with a size of 2.76 KB

Project Hemisphere

Project Hemisphere is a partnership between AT&T and the US Government. The Justice Department has described it as an essential tool.

Hemisphere is a secretive program run by AT&T that searches trillions of call records and analyzes cellular data to determine where a target is located, with whom they speak, and potentially why.

No warrant is required to make use of Hemisphere. AT&T has the ability to extract information because it retains so much of it. The company owns more than three-quarters of U.S. landline switches and the second-largest share of the nation’s wireless infrastructure and cellphone towers.

Database Fundamentals

A database is a collection of related data that can be stored in a central location... Continue reading "Project Hemisphere: AT&T Surveillance and Database Systems" »

Framing and Bit Stuffing in Computer Networks

Classified in Computers

Written on in English with a size of 764 bytes

Framing bit stuffing:

Framing in Computer Network. Data link layer is responsible for something called Bit Stuffing in Computer Network. It is the division of stream of bits from network layer into manageable units (called frames). Frames could be of fixed size or variable size. Bit stuffing is the insertion of non-information bits into data.

framing: A frame is a digital data transmission unit in computer networking and telecommunication.

Bit Stuffing: Bit stuffing is the process of inserting non-information bits into data to break up bit patterns to affect the transmission of the network.

Byte Stuffing: It is a process that transforms a sequence of data bytes that may contain illegal or reserved values.

Memory Management: Algorithms and Techniques

Classified in Computers

Written on in English with a size of 4.4 KB

Memory Management Problems and Solutions

Deadlock Scenario

A system has four processes and five allocable resources. The current allocation and maximum needs are as follows:

What is the smallest value of x for which this is a safe state?

The needs matrix is as follows:

  • 0 1 0 0 1
  • 0 2 1 0 0
  • 1 0 3 0 0
  • 0 0 1 1 1

If x is 0, we have a deadlock immediately. If x is 1, process D can run to completion. When D is finished, the available vector is 1 1 2 2 1. Now, A has ‘10211’ and ‘11221’ is available which together satisfies maximum need. So, A is finished and now ‘2 1 4 3 2’ is available, which can satisfy C. Once C is done, the available resources are 3 2 4 4 2, which can help B finish. So, x =1 will do.

Memory Compaction

A swapping system eliminates... Continue reading "Memory Management: Algorithms and Techniques" »