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

"entirely belongs to" shareholding

Computer science359.9 KB

Chapter 1 Introduction to Services

3.1. Service Terminology Service

a service is a software program that makes its functionality available via a technical interface, called a service contract.

Image

Figure 3.1. The symbol used to represent an abstract service.

Service Contract

The symbol used to represent a service contract is displayed in Figure 3.2.

Image

Service Capability

A service contract can be broken down into a set of service capabilities, each of which expresses a function offered by the service to other software programs.

Image

Figure 3.4. A Purchase Order service contract with four service capabilities.

Service Consumer

A service consumer is software program when it accesses and invokes a service—or, when it sends a message to a service capability


Service

...
Continue reading ""entirely belongs to" shareholding" »

Java RMI Discount Calculator: Client-Server Setup

Computer science7.02 KB

Java RMI Buyer Discount Application

This Java application demonstrates the use of Java Remote Method Invocation (RMI) to calculate sales discounts across a distributed client-server architecture.

Remote Interface: IComprador

The remote interface defines the methods available to clients across the network:

import java.net.*;
import java.rmi.*;
import java.rmi.registry.*;
import java.rmi.server.*;

public interface IComprador extends Remote {
    public int getId() throws RemoteException;
    public void setId(int id) throws RemoteException;
    public String getNome() throws RemoteException;
    public void setNome(String nome) throws RemoteException;
    public String getEmail() throws RemoteException;
    public void setEmail(String Email) throws
...
Continue reading "Java RMI Discount Calculator: Client-Server Setup" »

Práctica de Binary Search Tree (BST) en Java

Computer science3.82 KB

Práctica 6: Binary Search Tree

Implementación de diversos métodos recursivos y utilidades para la estructura de datos Binary Search Tree (BST) en Java.

Método findMax()

Busca el elemento de mayor valor en el árbol avanzando recursivamente por la rama derecha:

public T findMax() throws EmptyCollectionException {
    // Inspeccionar con recursividad, bajando por la derecha
    if (!isEmpty()) {
        if (getRightBST().isEmpty()) {
            return getContent();
        } else {
            return getRightBST().findMax();
        }
    } else {
        throw new EmptyCollectionException("No se puede encontrar el máximo de un árbol vacío");
    }
}

Método countEmpty() y Auxiliares

Contabiliza las referencias y subárboles vacíos dentro...

Continue reading "Práctica de Binary Search Tree (BST) en Java" »

RHCSA RH300 Command Reference: Users, ACLs, SELinux, iSCSI, NFS, Samba, Networking and MySQL

Computer science5.29 KB

RH300 Command Reference

for NEWUSER in stannis joffrey renly robb; do useradd -G kings ${NEWUSER}; done
chage -E $(date +%Y-%m-%d -d +90days) sspade #determine password change date
getent passwd ldapuser20
sudo ipa-client-install --domain=server1.example.com --no-ntp --mkhomedir #join IPA server
setfacl -Rm g:sodor:rwX /shares/steamies #add group ACL
setfacl -Rm u:james:r-x /shares/steamies #add user ACL
setfacl -m d:g:sodor:rwx /shares/steamies #add default ACL
setfacl -m d:u:james:r-x /shares/steamies #add default ACL
setfacl -Rb /shares/steamies #delete all ACL recursive
setfacl -x d:g:sodor:rwx /shares/steamies #delete this one ACL
semanage fcontext -l | grep httpd #list SE httpd contents
ls -Z /var/www/ #list extended attributes on existing folder
semanage...

Continue reading "RHCSA RH300 Command Reference: Users, ACLs, SELinux, iSCSI, NFS, Samba, Networking and MySQL" »

Java Inheritance: Circle, Square and Triangle Area Calculation

Computer science1.81 KB

Java Inheritance Example: Geometric Figures

This project demonstrates inheritance, polymorphism, upcasting and downcasting in Java using geometric figures. The abstract class Figura defines the method calcularArea(), which is implemented by the subclasses Circulo, Cuadrado and Triangulo.

Class Figura

  • Abstract class with the protected attribute figura.
  • Constant PI defined as 3.1516.
  • Abstract method calcularArea().

Class Circulo

Calculates the area of a circle using PI * radio^2.

Class Cuadrado

Calculates the area of a square using lado^2.

Class Triangulo

Calculates the area of a triangle using (base * altura) / 2.

Test Programs

TestFigura

Reads the base and height of a triangle, the side of a square and the radius of a circle from the keyboard, then prints...

Continue reading "Java Inheritance: Circle, Square and Triangle Area Calculation" »

Padrão DAO e VO em C#: Implementação Completa de CRUD

Computer science8.76 KB

Abaixo encontra-se a implementação em C# das classes de persistência, modelo e infraestrutura utilizando os padrões DAO (Data Access Object) e VO (Value Object) com ADO.NET.

Implementação do Padrão DAO em C#

A classe ClienteDAO concentra as instruções SQL de inserção, exclusão, alteração, navegação e consulta de registros da tabela de clientes.

Classe ClienteDAO

class ClienteDAO
{
    public static void Inserir(ClienteVO obj)
    {
        string valor = obj.GetNome().Trim();
        string sql = string.Format(
            "INSERT INTO armacao(id_cliente,nome,endereco,telefone,cidade,email)" +
            "VALUES ({0},'{1}','{2}','{3}','{4}','{5}')",
            obj.GetId(),
            obj.GetNome(),
            obj.GetEndereco(
...
Continue reading "Padrão DAO e VO em C#: Implementação Completa de CRUD" »

Java Craps Simulation: Logic and Implementation

Computer science1.9 KB

Java Craps Game Implementation

This document outlines the logic for a dice-based game simulation written in Java.

Game Logic Class

public class Game {

    // Function to determine if the player wins or loses
    public boolean gano_la_apuesta(int a, int b) {
        int val = a + b;

        // Check initial roll conditions
        if (val == 7 || val == 11 || val == 2 || val == 12 || val == 3) {
            if (val == 7 || val == 11) {
                return true;
            }
            if (val == 2 || val == 12 || val == 3) {
                return false;
            }
        }

        // If no initial condition is met, enter the point phase
        int val2;
        int validator = 0;
        do {
            a = new java.util.Random(
...
Continue reading "Java Craps Simulation: Logic and Implementation" »

Software UART on PIC18F4321: Interrupt-Driven Serial Communication in C

Computer science4.63 KB

Software UART on PIC18F4321 with INT0 and Timer Ticks

The following code is a software UART implementation for the PIC18F4321 microcontroller. It uses the xc.h and pic18f4321.h headers and defines the transmit and receive pins, buffer sizes, and masks at the top of the file.

#include <xc.h>
#include <pic18f4321.h>

#define TX_PIN LATBbits.LATB1
#define RX_PIN PORTBbits.RB0

#define RES 2
#define MAX_RX 8
#define MASK_RX 7
#define MAX_TX 8
#define MASK_TX 7

static unsigned char QueueRX[MAX_RX], StartRX = 0, EndRX = 0, HowManyRX = 0;
static unsigned char QueueTX[MAX_TX], StartTX = 0, EndTX = 0, HowManyTX = 0;
static unsigned char rxState = 0, rxTickCnt = 0, rxBitCnt = 0, rxShift = 0;
static unsigned char txState = 0, txTickCnt = 0,
...
Continue reading "Software UART on PIC18F4321: Interrupt-Driven Serial Communication in C" »