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

Sort by
Subject
Level

Client-Side Web Application Development Examples

Classified in Computers

Written on in English with a size of 8.49 KB

Client-Side Web Application Logic

Course Registration Script

This script handles the client-side logic for a course registration form. It fetches available courses, populates a selection dropdown, and processes form submissions to register new entries via an API.

DOM Element Selection and Initialization

The script begins by selecting necessary DOM elements for interaction and notification display.

const init = async function () {
  const selectEl = document.querySelector("select");
  const formEl = document.querySelector("form");
  const notifEl = document.querySelector(".success-notif");
  const errNotifEl = document.querySelector(".fail-notif");

Notification Dismissal Logic

Functionality to close success and error notification boxes is implemented

... Continue reading "Client-Side Web Application Development Examples" »

C++ Code Examples: Essential Algorithms & Programs

Classified in Computers

Written on in English with a size of 5.54 KB

C++ Code Examples: Essential Algorithms & Programs

Here are some fundamental C++ code examples covering various algorithms and programming concepts:

Factorial Calculation

#include <iostream>
using namespace std;

long factorial(int x) {
 int i, f = 1;
 for (i = 1; i <= x; i++) {
 f = f * i;
 }
 return f;
}

int main() {
 int n;
 cout << "Enter the number: ";
 cin >> n;
 if (n < 0) {
 cout << "Factorial is not defined for negative numbers";
 } else {
 cout << "Factorial = " << factorial(n);
 }
 return 0;
}

String Length Finder

#include <iostream>
using namespace std;

int main() {
 int length = 0, i;
 char s[20];
 cout << "Enter the string: ";
 cin.getline(s, 20);
 for (i = 0; s[i] != '\0'
... Continue reading "C++ Code Examples: Essential Algorithms & Programs" »

Database Fundamentals: Normalization, Storage, and SQL Queries

Classified in Computers

Written on in English with a size of 4.08 KB

This document summarizes key concepts and solutions from previous database exam questions.


Relational Schema with Functional Dependencies

  • Schema: R(A, B, C, D, E, F)
  • Dependencies: C → F, E → A, EC → D, A → B
  1. Candidate Keys: CE
  2. Prime Attributes: C, E
  3. Second Normal Form (2NF):
    • No, because of partial dependencies:
      • C → F (partial dependency)
      • E → A, B (partial dependency)

EMP_DEPT Table Analysis

  1. Functional Dependencies:
    • Ssn → Ename, Bdate, Address, Dnumber, Dname, Dmgr_ssn
    • Dnumber → Dname, Dmgr_ssn
    • Dmgr_ssn → Dnumber, Dname
    • Dname → Dnumber, Dmgr_ssn
  2. First Normal Form (1NF):
    • Split names into first_name and last_name.
  3. Second Normal Form (2NF):
    • Already in 2NF because there are no partial dependencies.

EMP_PROJ Table Normalization

  1. Functional Dependencies:
... Continue reading "Database Fundamentals: Normalization, Storage, and SQL Queries" »

React Hooks & Redux: Essential Concepts for Developers

Posted by Anonymous and classified in Computers

Written on in English with a size of 10.31 KB

React Hooks and Essential Libraries

useState Hook

Purpose

Purpose: Adds state to functional components.

Import

import { useState } from 'react';

Syntax

const [state, setState] = useState(initialValue);

Update Methods

  • setState(newValue);
  • setState(prevState => ...); (for updates based on previous state)

Example

import React, { useState } from 'react';

function Counter() {
  const [count, setCount] = useState(0);

  return (
    <div>
      <p>Count: {count}</p>
      <button onClick={() => setCount(count + 1)}>Increment</button>
    </div>
  );
}

useEffect Hook

Purpose

Purpose: Performs side effects such as data fetching, subscriptions, or direct DOM manipulations.

Import

import { useEffect } from 'react';

Syntax

useEffect(
... Continue reading "React Hooks & Redux: Essential Concepts for Developers" »

Find the Largest Number and Calculate Factorial in C++

Classified in Computers

Written on in English with a size of 2.11 KB

Input three numbers and find the largest. Enter a number and display the day name of the week.
#include
#include
using namespace std;
using namespace std;
int main() {
int num1, num2, num3;
int day;
cout << "Enter three numbers: ";
cout << "Enter a number (From 1 to 7): ";
cin >> num1 >> num2 >> num3;
cin >> day;
if (num1 > num2 && num1 > num3) {
cout << "Largest number is " << num1;
} else if (num2 > num3) {
cout << "Largest number is " << num2;
} else {
cout << "Largest number is " << num3;
}
switch (day) {
case 1: cout << "Sunday"; break;
case 2: cout << "Monday"; break;
... Continue reading "Find the Largest Number and Calculate Factorial in C++" »

Practical Machine Learning Labs in TensorFlow and PyTorch

Posted by Anonymous and classified in Computers

Written on in English with a size of 14.76 KB

Lab 1: Basic TensorFlow Computation Graph

This example demonstrates how to define and execute a simple computation graph in TensorFlow using the @tf.function decorator, which converts a Python function into a high-performance TensorFlow graph.

import tensorflow as tf

# Define a simple computation graph
@tf.function  # Converts Python function into a TensorFlow graph
def my_graph(x, y):
  return x * y + 5  # Simple equation: (x * y) + 5

# Create TensorFlow constants (nodes)
x = tf.constant(3.0)
y = tf.constant(4.0)

# Run the computation graph
result = my_graph(x, y)

# Print the result
# Convert tensor to a NumPy array to see the value
print(f"Result of (x * y) + 5: {result.numpy()}")

Lab 2: Simple Linear Regression with Keras

Here, we build,... Continue reading "Practical Machine Learning Labs in TensorFlow and PyTorch" »

Python Django Project Setup and Database Integration

Classified in Computers

Written on in English with a size of 4.14 KB

Python Django Project Setup

Follow these steps to initialize and configure your Python Django environment.

Initial Environment Navigation

  • Step 1: Open the Command Prompt and use cd.. to navigate back.
  • Step 2: Use cd.. again to reach the desired root.
  • Step 3: Navigate to your Python directory: cd Raj_Python.
  • Step 4: Enter your project folder: cd mscit_dproject.

Creating the Project and Application

  • Step 5: Create the project: django-admin startproject [Project Name].
  • Step 6: Navigate into the project folder: cd [Project Name].
  • Step 7: Create a new application: python manage.py startapp [App Name].
  • Step 8: Open the project in VS Code and configure settings.py.

Configuring settings.py

In settings.py, import the OS module and define your template directory:

import

... Continue reading "Python Django Project Setup and Database Integration" »

Bootstrap Components: Navigation Tabs, Tables, and Forms

Classified in Computers

Written on in English with a size of 2.78 KB

Corrected Exam

<!DOCTYPE html>

Images and Table with Nav Tabs

Lorem ipsum dolor sit amet consectetur adipisicing elit. Ducimus deserunt natus est et, incidunt id quasi ex veniam tenetur quibusdam optio dolor rem dicta officia voluptate nemo rerum quod amet.

Data Table

#NameAgeCountry
1Alice25USA
2Bob30UK
3Charlie28Canada

Alert Notification

Hello! This is an alert that can be closed by clicking on the "X" button.

<!DOCTYPE html>

Document

Form Section

Text Input
Select Option Choose... Option 1 Option 2 Option 3 Option 4
Accept Terms

Send

Grid

Lorem ipsum, dolor sit amet consectetur adipisicing elit. Assumenda autem culpa dolorum dolorem voluptatum quisquam ipsam quia quae libero rerum aut pariatur saepe quaerat doloribus... Continue reading "Bootstrap Components: Navigation Tabs, Tables, and Forms" »

180 Essential Excel Shortcuts for Windows

Posted by Anonymous and classified in Computers

Written on in English with a size of 220.94 KB

Cheat Sheets N More

180 Essential Excel Shortcuts for PC

Master Anything Faster · Cheat Sheets N More

Microsoft Windows Edition

200 Shortcuts

Part 1: Absolute Basics

Moving Around

  • Move one cell in any direction: Arrow Keys
  • Confirm entry and move down: Enter
  • Confirm entry and move up: Shift + Enter
  • Move one cell to the right: Tab
  • Move one cell to the left: Shift + Tab
  • Move down one screen: Pg Dn
  • Move up one screen: Pg Up
  • Move one screen to the right: Alt + Pg Dn
  • Move one screen to the left: Alt + Pg Up
  • Move to first column in row: Home

Important Places

  • Go to cell A1: Ctrl + Home
  • Go to last used cell: Ctrl + End
  • Jump to edge of data region: Ctrl + Arrow
  • Select to edge of data region: Ctrl + Shift + Arrow
  • Open Go To dialog: F5
  • Open Go To (alternate): Ctrl + G

Selecting Cells

  • Extend selection
... Continue reading "180 Essential Excel Shortcuts for Windows" »

Java Producer-Consumer Pattern Implementation

Classified in Computers

Written on in English with a size of 2.28 KB

Java Producer-Consumer Implementation

class ObjCompartido {
    private int longArray;
    private ArrayList<Object> array = new ArrayList<>();

    public ObjCompartido(int longArray) {
        this.longArray = longArray;
    }

    public synchronized void producir(Object xxx) {
        while (this.array.size() == longArray) {
            try {
                System.out.println("ESPERANDO");
                wait();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        this.array.add(xxx);
        System.out.println("AÑADIDO");
        notifyAll();
    }

    public synchronized void consumir(Object xxx) {
        while (this.array.isEmpty()) {
            try {
... Continue reading "Java Producer-Consumer Pattern Implementation" »