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

Sort by
Subject
Level

UDP and TCP Socket Programming in C with Winsock: Sender and Receiver Examples

Classified in Computers

Written on in English with a size of 13.97 KB

UDP Sender 1

#include <winsock.h>
#include <stdio.h>

#define msg "This is a UDP message."
int main(int argc, int **argv)
{
WSADATA wsda; // Structure to store info
// returned from WSAStartup
struct hostent *host; // Used to store information
// retrieved about the server
char szMessage[80];
int iMessageLen;
int ret;
char szAddress[64];
int iPort;
SOCKET s; // Our UDP socket handle
SOCKADDR_IN addr; // The host's address

Check Arguments

if(argc != 3 ||
(argc==2 && strcmp((char *) &argv[1][0], "/?")==0))
{
printf("wsudpsnd server port\n");
printf(" server: the server to send the packet to\n");
printf(" port: the port on the remote... Continue reading "UDP and TCP Socket Programming in C with Winsock: Sender and Receiver Examples" »

Top-Down Design and Control Structures in Python

Classified in Computers

Written on in English with a size of 3.35 KB

3/10/16 Notes

Chapter 7/8

Top-Down Design

Takes the most basic aspect of a program and breaks it down into subprograms.

Control Structure

An expression that determines the order in which a program executes.

In Python, this is an if statement.

It can also be a looping statement.

Boolean Expression

A "True or False" program statement.

Composite Data Types

Example:

  • numbers[0] = 1066
  • numbers[1] = 1492
  • numbers[2] = 999
  • numbers[3] = 553
  • numbers[4] = 1892

Example Code:

for i in range(3):
    print(numbers[i])

Arrays

When data is being read into an array, a counter is updated for each operation (e.g., for i in range(5)).

Sequential Search of an Unsorted Array

A sequential search examines each item in turn and compares it to the target item. If it matches, the item is found.... Continue reading "Top-Down Design and Control Structures in Python" »

Data Models, Schemas, and Database Normalization

Classified in Computers

Written on in English with a size of 3.46 KB

Categories of Data Models

  • Entity: Represents a real-world object or concept.
  • Attribute:
    • Represents some property of interest.
    • Further describes an entity.
  • Relationship: Represents an association among two or more entities.
  • Entity-Relationship model
  • Relational data model: Used most frequently in traditional commercial DBMSs.
  • Object data model:
    • New family of higher-level implementation data models.
    • Closer to conceptual data models.
  • Physical data models: Describe how data is stored as files in the computer.
  • Access path: Structure that makes the search for particular database records efficient.
  • Index:
    • Example of an access path.
    • Allows direct access to data using an index term or a keyword.

Schemas, Instances, and Database State

  • Database schema: Description of a
... Continue reading "Data Models, Schemas, and Database Normalization" »

Introduction to Computing and Computer Systems

Classified in Computers

Written on in English with a size of 2.3 KB

Computing

Computing is the automatic processing of information with computers.

Input and Output

Input: Data entered into the computer.
CPU: Processes the information.
Output: The processed information is displayed.

Binary System

Computers use the binary system (0 and 1).
Bit (b): Smallest unit of information (0 or 1).
Byte (B): Group of 8 bits. Example: 1010 0001
Characters are usually expressed with 1 B (8 bits).

Character Encoding

ASCII (American Standard Code for Information Interchange): Represents characters using binary code.
ISO-8859-1: An extension of ASCII, uses 1 byte for characters. Example: A = 0100 0001 (65), = 0111 1110 (126)

Hardware

The physical components of a computer.

Internal Components

  • Motherboard
  • CPU

External Devices (Peripherals)

  • Input:
... Continue reading "Introduction to Computing and Computer Systems" »

Software Testing and Debugging

Classified in Computers

Written on in English with a size of 4.52 KB

SOFTWARE TESTING

Testing can only show the presence of errors, not their absence. The goal of testing is confidence.

  • Validation: Are we building the right product? What does the customer need?
  • Verification: Are we building the product right? Functional/Non-Functional requirements.

SOFTWARE INSPECTION VS. SOFTWARE TESTING

While inspection will go through the code without running the program, testing will run the program and look at the results. Incomplete programs can only be inspected, not tested. Inspections can control aspects of good software (maintainability…), not just the results.

TEST CASE:

  • Requirements
  • Data/Input
  • Actions
  • Expected Results

TEST CASE PRINCIPLES:

  • A test tries to find flaws in a program.
  • A good test case will show a possible defect
... Continue reading "Software Testing and Debugging" »

Reverse Engineering Fundamentals: Process, Steps, and CAD Model Generation

Classified in Computers

Written on in English with a size of 2.76 KB

Forward Engineering Defined

Forward engineering is the traditional process of moving from high-level abstractions and logical designs to the physical implementation of a system.

Understanding Reverse Engineering

Reverse engineering (RE) is the process of duplicating an existing part, sub-assembly, or product without original drawings, documentation, or a computer model.

It is also defined as the process of obtaining a geometric Computer-Aided Design (CAD) model from 3-D points acquired by scanning or digitizing existing parts.

Alternative Name for Reverse Engineering

The process is often referred to as the Physical-to-Digital process.

Key Purposes of Reverse Engineering (RE)

Reverse engineering serves several critical functions, including:

  • The user
... Continue reading "Reverse Engineering Fundamentals: Process, Steps, and CAD Model Generation" »

Java Linked List Implementation: Essential Methods

Classified in Computers

Written on in English with a size of 2.81 KB

Java Linked List Implementation

Inserting Elements at Positions

public void insertPos() {
    if (isEmpty()) {
        throw new EmptyCollectionException("Lista");
    } else {
        LinearNode actual = first;
        LinearNode nuevo = null;
        int posActual = 1;
        while (actual != null) {
            nuevo = new LinearNode(posActual);
            nuevo.next = actual.next;
            actual.next = nuevo;
            actual = nuevo.next;
            nElements++;
            posActual++;
        }
    }
}

Skipping Iterator Implementation

private class SkippingIteratorImpl implements Iterator<T> {
    private Node<T> current;

    public SkippingIteratorImpl() {
        current = first;
        if (first != null) {
... Continue reading "Java Linked List Implementation: Essential Methods" »

Essential Networking Concepts: TCP, UDP, and Congestion

Classified in Computers

Written on in English with a size of 2.5 KB

Differences Between TCP and UDP

  • TCP: Connection-oriented, bytes delivered in order, arbitrary length content, flow control matches sender to receiver, and congestion control matches sender to network.
  • UDP: Connectionless, messages may be lost, limited message size, can send regardless of receiver state, and can send regardless of receiver network.

TCP Connection Management

Explain using figures where and how the 3-way handshaking is used. Explain using figures how TCP releases connections (refer to the other side of this paper).

  • Normal case
  • Simultaneous connect

Computing Adaptive Timeout

Keep smoothed estimates of the RTT and variance in RTT. Update estimates with a moving average. Set timeout to a multiple of estimates to estimate the upper RTT in... Continue reading "Essential Networking Concepts: TCP, UDP, and Congestion" »

Fundamentals of Optimization and Statistical Modeling

Classified in Computers

Written on in English with a size of 3.51 KB

Optimization Problem and LP Relaxation

The objective function for an optimization problem is: Min 3x – 2y, with constraints x ≥ 0, y ≥ 0. x and y must be integers. Suppose that the integer restriction on the variables is removed. If so, this would be a familiar two-variable linear program; however, it would also be an example of an LP relaxation of the integer linear program.

Integers in Linear Programs

Integers cannot be used in linear programs.

  • False

Simple Linear Regression Model

In a simple linear regression model, y = b0 + b1x + eb1, b1 represents the intercept.

Time Series Recurring Pattern

A time series that shows a recurring pattern over one year or less is said to follow a cyclical pattern.

Binary Integer Program Variables

In binary integer... Continue reading "Fundamentals of Optimization and Statistical Modeling" »

Gender Disparities in Mortality Rates and Immune System Function

Classified in Computers

Written on in English with a size of 2.03 KB

EXT2018.OA´WOMEN REALLY´

1.a-P1: A recent study found that women tend to live longer than men. b-P3: The academics also discovered that women have a stronger immune system.

  • a-harsh
  • b-hardship
  • c-underpinnings
  • d-outlive

4.p1: Danish researchers analyzed 19th-century data. p2: Research showed that women outlive men. p3: Males have a higher mortality rate even if...

ORD2018.OB·`Shop hires...`

1.a-P2: But it is important for businesses to understand their customers. b-P4: We thought it was an emotional and exciting experience.

  • a-actually
  • b-aware
  • c-stressful
  • d-understanding

4.p1: At the shop, Fabio performed. p2: When Fabio, the staff. p3: The staff had become...

ORD2017.OB`The victorian...`

1.a-P2: People would gather to observe. b-P3: The tableaus were a frozen... Continue reading "Gender Disparities in Mortality Rates and Immune System Function" »