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

Prolog vs CLIPS: Comparison of Syntax, Rules and Search Strategies

Computer scienceUpdated on 197.63 KB

Prolog vs. CLIPS: A Detailed Comparison

This document provides a comparison between Prolog and CLIPS, two popular languages used in artificial intelligence and expert systems development. We will explore their syntax, features, and applications through examples.

Facts and Rules

Prolog:

Facts:


father(tom, john).  % tom is father of john
mother(susan, john). % susan is mother of john
father(george, tom). % george is father of tom

Rules:


parent(X, Y) :- father(X, Y), mother(X, Y).
grandparent(X, Z) :- parent(X, Y), parent(Y, Z).
grandfather(X, Z) :- father(X, Y), parent(Y, Z).
grandmother(X, Z) :- mother(X, Y), parent(Y, Z).

CLIPS:

Facts:


(deffacts families
  (father tom john) ; tom is father of john
  (mother susan john) ; susan is mother of
...
Continue reading "Prolog vs CLIPS: Comparison of Syntax, Rules and Search Strategies" »

Extracting Structured Institution Data with LangChain and Cohere

Computer scienceUpdated on 3.45 KB

Automated Data Extraction Using LangChain and Cohere

This script demonstrates how to leverage LangChain, Cohere, and the Wikipedia API to extract structured information about institutions. By using Pydantic, we ensure the extracted data follows a strict schema for better reliability.

Required Libraries and Data Models

First, we import the necessary modules and define our data structure using a Pydantic model to store institution details such as the founder, founding year, and employee count.

from langchain_community.llms import Cohere
from langchain.prompts import PromptTemplate
from langchain_core.runnables import RunnableLambda
from pydantic import BaseModel
import wikipediaapi

class InstitutionDetails(BaseModel):
    founder: str
    founded:
...
Continue reading "Extracting Structured Institution Data with LangChain and Cohere" »

MS-DOS CONFIG.SYS File: Configuration and Device Drivers

Computer scienceUpdated on 23.04 KB

Understanding MS-DOS CONFIG.SYS Configuration

The CONFIG.SYS file is crucial for configuring various system components, including MS-DOS, hardware, and applications, ensuring they function as intended.

System configuration information is primarily stored in the CONFIG.SYS file.

What is CONFIG.SYS?

It is a text file that contains special commands that configure computer components such as hardware (memory, keyboard, mouse, printer) for use by MS-DOS and applications.

It is the first file that runs when you start MS-DOS.

Location of CONFIG.SYS

It is usually located in the root directory, C:\.

CONFIG.SYS Runtime

MS-DOS executes this file each time you start your computer. However, if needed, you can instruct the system to skip it.

Why Modify CONFIG.SYS?

...
Continue reading "MS-DOS CONFIG.SYS File: Configuration and Device Drivers" »

IoT Wireless Protocols Explained: MQTT, LoRa, ZigBee, Wi-Fi, BLE, NFC and RFID

Computer scienceUpdated on 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 "IoT Wireless Protocols Explained: MQTT, LoRa, ZigBee, Wi-Fi, BLE, NFC and RFID" »

Understanding Computer Architecture: System Bus, Address Bus, Data Bus, and Control Bus

Computer science38.71 KB

System Bus (Data, Address, and Control Bus)

This network of wires or electronic pathways is called the 'Bus'. A system bus is a single computer bus that connects the major components of a computer system.

It combines the functions of:

  • Data Bus: Carries information.
  • Address Bus: Determines where information should be sent.
  • Control Bus: Determines the operation to be performed.

This technique was developed to reduce costs and improve modularity.

Z

Figure: System Bus

Address Bus

The address bus is a group of wires or lines used to transfer the addresses of memory or I/O devices.

  • It is unidirectional.
  • The width of the address bus determines the maximum addressing capacity, representing the largest address within memory that the bus can handle.
  • Addresses are
...
Continue reading "Understanding Computer Architecture: System Bus, Address Bus, Data Bus, and Control Bus" »

dsdfs

Computer science7.22 KB

Kako si lep danes 

What is Lorem Ipsum?

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

What is Lorem Ipsum?

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard...

Continue reading "dsdfs" »

SQL Aggregate Functions: COUNT, SUM, MIN, MAX, AVG

Computer science12.36 KB

Aggregations

Consider the case of sports tournaments like cricket. Players' performances are analyzed based on their batting average, the maximum number of sixes hit, the lowest score in a tournament, etc.

In such scenarios, we perform aggregations to combine multiple values into a single value, i.e., individual scores into an average score.

Let's learn more about aggregations to perform insightful analysis using the following database.

Database: The database consists of a player_match_details table that stores information about players' details in a match, such as name, match, score, year, and the number of fours and sixes scored.

Schema

12345678
player_match_details (name VARCHAR(250),match VARCHAR(10),score INTEGER,fours INTEGER,sixes INTEGER,year
...
Continue reading "SQL Aggregate Functions: COUNT, SUM, MIN, MAX, AVG" »

Operating System Concepts: Process, Memory, and Disk Management

Computer science64.1 KB

Primary Functions of an Operating System

An operating system (OS) is system software that acts as an interface between the user and the computer hardware. Its primary functions are:

  • Process Management: Creation, scheduling, and termination of processes.
  • Memory Management: Allocation and deallocation of memory.
  • File Management: Organization, storage, and retrieval of files.
  • Device/I-O Management: Controls peripheral devices.
  • Security & Protection: Prevents unauthorized access.

What Is a Batch Processing System?

  • A batch operating system groups similar jobs (with the same requirements) together and executes them as a single batch without user interaction.
  • A resident monitor reads jobs sequentially from input and submits them to the CPU.
  • Advantage: Less
...
Continue reading "Operating System Concepts: Process, Memory, and Disk Management" »

Assembly Language Instructions and MS-DOS Functions

Computer science3.39 KB

Data Transfer Instruction:

LEA

Gets source effective address and stores it in the target. Source segment address is stored in DS. Example: LEA DX, OPERANDO1

Control Transfer Instructions

Loops

Operation (IP decrement) + Conditional jump on operation result.

Example:

MOV CX, 4
Bucle:
  INC BX
  ADD BX, CX
  LOOP Bucle

Compare Instruction:

CMP

Compares source and target operands and properly modifies the flag register. It internally works by subtracting the target from the source operand. Operands are equal if the result is zero. Source is greater than target if the result is negative. Target is greater than source otherwise. Example: CMP AX, DX; Compares AX and DX.

Interrupt Instructions:

INT

INT jumps to a specified interrupt address. i8086 interrupt addresses...

Continue reading "Assembly Language Instructions and MS-DOS Functions" »

Routing Protocols: RIP, OSPF, BGP, CSMA/CD, CSMA/CA

Computer science4.41 KB

Intra-AS Routing

RIP – Based on Distance-Vector (D-V), fewer messages, converges slower, smaller size.

OSPF – Based on Link-State (L-S), converges faster, more messages, larger networks.

Distance-Vector is distributed, and each router only knows the costs to its neighbors and their distance vectors.

Link state is global and requires that each router knows the network topology and link costs to all nodes.

OSPF: Used internally inside a network, an intra-network/domain protocol used in an AS.

BGP: An internetwork protocol used between two different ASs, used at the edge of your network to connect your network to the internet.

RIP: An intra-network protocol used in an AS, used for small networks (maximum number of hops is 16).

EBGP: Runs between two...

Continue reading "Routing Protocols: RIP, OSPF, BGP, CSMA/CD, CSMA/CA" »