Notes, summaries, assignments, exams, and problems for Computer science

Digital and Analog Signals: Input and Output Channels

Computer science2.58 KB

Digital Awareness

When you want to receive digital information from the outside: The business card input channels are available, usually in groups of 8 bits, to which binary information is assigned by a program. These can be assigned to an internal variable state of a byte by a reading instruction that may have a port. There can be one or more bytes of input, assigning each an address.

Analog Outputs

To send analog control signals to the outside, the tallies have one or more channels of output through their respective A/D converters. A 1V analog converter generates a constant proportional to the numerical value of the digital data that it has on its input lines. Internally, they have a 5V memory. Different voltage ranges can be obtained using...

Continue reading "Digital and Analog Signals: Input and Output Channels" »

Mastering MySQL User Management and Privilege Control

Computer science2.75 KB

Users and Privileges

The root user is the administrator and possesses all privileges in MySQL. It is not recommended to grant all users full server access; maintaining data and structural integrity requires restricting specific tasks to authorized users only.

Users and privileges are intimately related. You can create users without immediately assigning privileges. MySQL allows you to define distinct users and assign specific permissions at various levels.

Privilege Levels

  • Global: Applies to all databases on a server. This is the highest and most general level of privilege.
  • Database: Applies to individual databases and, by extension, all contents within them.
  • Table: Applies to individual tables and all columns within those tables.
  • Column: Applies
...
Continue reading "Mastering MySQL User Management and Privilege Control" »

Oracle Tablespaces, Segments, and Data Blocks Explained

Computer science2.39 KB

Oracle Tablespaces and Data Storage

System tablespaces and the required sysaux tablespace are created when the database is created and must be online.

The System tablespace is used for core functionality, for example, the data dictionary tables.

The auxiliary Sysaux tablespace is used for additional database components, such as the Enterprise Manager repository.

A tablespace accounts for one or more data files.

Data files belong to one tablespace.

User process: It begins when the user database server requests a connection to Oracle.

Process server: Connects to the Oracle instance and starts when a user establishes a session.

Background processes: Start the Oracle instance.

Oracle is a server management system database that provides an open, comprehensive,...

Continue reading "Oracle Tablespaces, Segments, and Data Blocks Explained" »

Prolog Predicates & Game AI Algorithms

Computer science3.47 KB

funcition min-max(pos,out-eval,out-best_move,in-whomoves,in-max_level){max=-?;min=?;best_move=0;if(level==0){evaluation=eval_(pos);best_move=0; return;}else{foi(i=0;i<num_succ(i);++i){succi=succesor(i);if(whomoves=='max'){min-max(succi,evaluation,best_move,'min', max_level-1);if(evaluation>max){max=evaluation; best_move=i;}}else{min-max(succi,evaluation,best_move,'max', max_level-1);}if(evaluation<min){min=evaluation;best_move=i;}}}}

funcition ??(pos,level,quien_juega,*eval,mejor_move,?,?){if(terminal(pos)||(level==0){*eval=eval(pos);return;}n_succ= num_succ(pos);for(i=0;i<n_succ;++i{if(quien_juega=='max'){succi=succesor(pos,i);??(succi,level-1,'min',evali, mejor_movi,?,?);if(evali>?){?=evali;*eval=?; *mejor_move=i;}if(?>?)...

Continue reading "Prolog Predicates & Game AI Algorithms" »

Mastering Topic Modeling, Anomaly Detection, and PageRank

Computer science12.48 KB

Topic Modeling: LSI vs LDA

Latent Semantic Indexing (LSI)

Use LSI for semantic similarity, retrieval, short/sparse documents, and synonymy problems. It uses Singular Value Decomposition (SVD) to find latent concept axes from term-document co-occurrence. Concepts are mathematical directions, not clean probability-based topics. It is better when the goal is to “find similar documents.”

Latent Dirichlet Allocation (LDA)

Use LDA for discovering hidden themes and topic percentages. In this model, each document is a mixture of topics, and each topic is a distribution over words. It is better when the goal is to determine “what themes exist in this corpus?”

Key Distinction

  • LSI finds latent concept dimensions.
  • LDA explicitly models probabilistic topics.
...
Continue reading "Mastering Topic Modeling, Anomaly Detection, and PageRank" »

Mastering C++ Operator Overloading: A Practical Tutorial

Computer science5.41 KB

In C++, Operator Overloading is a compile-time polymorphism feature that allows you to grant custom meanings to existing C++ operators (like +, -, *, ==, etc.) when they are applied to user-defined data types (objects).

It does not let you create new operators (you cannot invent a ** operator), nor does it change the precedence or associativity of existing ones. It simply makes your custom objects behave intuitively, like built-in data types.

1. Syntax of Operator Overloading

To overload an operator, you define a special member function using the operator keyword followed by the symbol you want to overload.

ReturnType operator Symbol (Arguments) {
    // Custom logic here
}

2. Overloading Unary Operators

A unary operator operates on a single operand....

Continue reading "Mastering C++ Operator Overloading: A Practical Tutorial" »

Modern Cryptography and Data Security Fundamentals

Computer science11.63 KB

Lecture 1: Introduction and Security Concepts

The CIA Triad

  • Confidentiality: Limits access to authorized users. A breach results in unauthorized disclosure.
  • Integrity: Prevents unauthorized modification. A breach results in an altered document.
  • Availability: Ensures timely access. A breach results in a Denial of Service (DoS) attack.

Additional Security Objectives

  • Authenticity: Verifies that the data or sender is real and trustworthy.
  • Accountability: Ensures actions are traceable to specific entities.
  • Non-repudiation: Ensures a party cannot deny their actions, often achieved via digital signatures.

Kerckhoffs's Principle

Security should rely only on the secrecy of the key, not the secrecy of the algorithm. The system remains secure even if the attacker...

Continue reading "Modern Cryptography and Data Security Fundamentals" »

Essential Shell Scripting Examples for Linux Automation

Computer science3.37 KB

1. Armstrong Number Checker

Write a shell script to check whether a given number is an Armstrong number.

echo "Enter a number"
read c
x=$c
sum=0
while [ $x -gt 0 ]
do
r=$(( $x % 10 ))
n=$(( $r * $r * $r ))
sum=$(( $sum + $n ))
x=$(( $x / 10 ))
done
if [ $sum -eq $c ]
then
echo "This is an Armstrong number"
else
echo "This is not an Armstrong number"
fi

2. Calculate Area of a Circle

Write a shell script to find the area of a circle.

echo "Enter radius"
read r
echo "Area is"
echo "3.14 * $r * $r" | bc

3. Average of Command Line Arguments

Write a shell script to find the average of numbers entered as command line arguments.

sum=0
for i in $*
do
sum=$((sum + i))
done
echo "Summation of $# numbers is: $sum"
N=$#
avg=$(echo "$sum / $N" | bc -l)
echo "Average = $avg"
...
Continue reading "Essential Shell Scripting Examples for Linux Automation" »

Computer Architecture: Functional Units and Memory Systems

Computer science659.68 KB

Functional Units of a Computer

A computer system is logically divided into several functional units that work together to perform data processing. These units accept input, process the data, store information, and produce output.

Main Functional Units

1. Input Unit

  • Accepts raw data and instructions from the user and enters them into the computer.
  • Converts the input data into machine-readable form (binary) for processing.

Examples: Keyboard, Mouse, Scanner, Microphone.

2. Output Unit

  • Displays the processed results to the user.
  • Converts the machine results into human-readable form.

Examples: Monitor, Printer, Speakers.

3. Memory Unit

  • Stores data, instructions, and intermediate results required for processing.
  • Supplies data to the CPU whenever needed.

Types

...
Continue reading "Computer Architecture: Functional Units and Memory Systems" »

C Programming: Numerical Algorithms and Control Flow

Computer science18.07 KB

Unit 3: Core C Programming Concepts

Extracting Digits of a Number

Extracting digits of a number is a fundamental programming task used in various computational problems, such as reversing a number, checking for palindromes, or performing digit-based calculations. There are two main approaches: right-to-left extraction and left-to-right extraction.

Right-to-Left Extraction

In right-to-left extraction, the modulus operator (%) is used to obtain the last digit of the number, while integer division (/) removes the last digit after processing. For example, for the number 1234:

  • 1234 % 10 gives 4.
  • 1234 / 10 gives 123.

This process is repeated until the number becomes zero, allowing each digit to be handled individually.

Left-to-Right Extraction

Left-to-right...

Continue reading "C Programming: Numerical Algorithms and Control Flow" »