Gmail, one of the most popular email services in the world, supports millions of users, delivering robust performance, high availability, and strong security...
Introduction. Have you ever wondered how to build a scalable system like the one you use most for interview practice? Leetcode has become a cornerstone for s...
Google Docs is a powerful, web-based word processing application that allows multiple users to create, edit, and collaborate on documents in real time. Desig...
Introduction:. In today's mobile-first world, having a website that performs seamlessly on mobile devices is no longer optional—it's imperative. Mobile optim...
Basic Introduction. Nodejs is a JavaScript runtime build over Chrome's V8 JavaScript engine. Nodejs is generally used a backend tool to cater to client apis.
Create the Lazy-Loaded Component. In the application, add a new component using the Angular CLI command, as shown below.
def listsum(a,b): print("Sum: ",(a+b)) listsum(10,20)
import random def d20roller: def main(): main()
# Course: CS261 - Data Structures # Description: Data structure for assignments # Be sure to go through this entire file to see what operations # are available to the StaticArray. Also, see the __main__ block # at the bottom for some tips on how to use the StaticArray. class StaticArrayException(Exception): """ Custom exception for Static Array class. Any changes to this class are forbidden. """ pass class StaticArray: """ Implementation of Static Array Data Structure. Implemented methods: get(), set(), length() Any changes to this class are forbidden. Even if you make changes to your StaticArray file and upload to Gradescope along with your assignment, it will have no effect. Gradescope uses its own StaticArray file (a replica of this one) and any extra submission of a StaticArray file is ignored. """ def __init__(self, size: int = 10) -> None: """ Create array of given size. Initialize all elements with values of None. If requested size is not a positive number, raise StaticArray Exception. """ if size < 1: raise StaticArrayException('Array size must be a positive integer') # The underscore denotes this as a private variable and # private variables should not be accessed directly. # Use the length() method to get the size of a StaticArray. self._size = size # Remember, this is a built-in list and is used here # because Python doesn't have a fixed-size array type. # Don't initialize variables like this in your assignments! self._data = [None] * size def __iter__(self) -> None: """ Disable iterator capability for StaticArray class. This means loops and aggregate functions like those shown below won't work: arr = StaticArray() for value in arr: # will not work min(arr) # will not work max(arr) # will not work sort(arr) # will not work """ return None def __str__(self) -> str: """Override string method to provide more readable output.""" return f"STAT_ARR Size: {self._size} {self._data}" def get(self, index: int): """ Return value from given index position. Invalid index raises StaticArrayException. """ if index < 0 or index >= self.length(): raise StaticArrayException('Index out of bounds') return self._data[index] def set(self, index: int, value) -> None: """ Store value at given index in the array. Invalid index raises StaticArrayException. """ if index < 0 or index >= self.length(): raise StaticArrayException('Index out of bounds') self._data[index] = value def __getitem__(self, index: int): """Enable bracketed indexing.""" return self.get(index) def __setitem__(self, index: int, value: object) -> None: """Enable bracketed indexing.""" self.set(index, value) def length(self) -> int: """Return length of the array (number of elements).""" return self._size if __name__ == "__main__": # Using the Static Array # # Can use either the get/set methods or [] (bracketed indexing) # # Both are public methods; using the [] calls the corresponding get/set # # Create a new StaticArray object - is the default size arr = StaticArray() # These two statements are equivalent arr.set(0, 'hello') arr[0] = 'hello' # These two statements are equivalent print(arr.get(0)) print(arr[0]) # Print the number of elements stored in the array print(arr.length()) # Create a new StaticArray object to store 5 elements arr = StaticArray(5) # Set the value of each element equal to its index multiplied by 10 for index in range(arr.length()): arr[index] = index * 10 # Print the values of all elements in reverse order for index in range(arr.length() - 1, -1, -1): print(arr[index]) # Special consideration below # # Don't do this! This creates a built-in Python list and if you use # one you'll lose points. forbidden_list = [None] * 10 print(type(arr)) print(type(forbidden_list))
def listsum(a,b): print("Sum: ",(a+b)) listsum(10,20)
public class LoopExample { // Save as "LoopExample.java" public static void main(String[] args) { // Loop to print numbers from 1 to 10 for (int i = 1; i <= 10; i++) { System.out.print(i + " "); // Print each number followed by a space } // Print the student's name and course number after the loop System.out.println(); // Moves to the next line after the loop System.out.println("Taylor Patrick, IS 122 Programming Logic"); } }
CREATE TABLE Area ( id SERIAL PRIMARY KEY, code VARCHAR(10), name VARCHAR(100), description TEXT ); CREATE TABLE Role ( id SERIAL PRIMARY KEY, name VARCHAR(30), description TEXT ); CREATE TABLE Shift ( id SERIAL PRIMARY KEY, code VARCHAR(10), name VARCHAR(50), starts TIME, ends TIME ); CREATE TABLE Plant ( id SERIAL PRIMARY KEY, code VARCHAR(10) UNIQUE NOT NULL, name VARCHAR(100) NOT NULL, country VARCHAR(30) NOT NULL, city VARCHAR(50) NOT NULL, address VARCHAR(250), foundation DATE, status BOOLEAN DEFAULT TRUE, cover UUID, DG VARCHAR(50), photo UUID ); CREATE TABLE Customer ( id SERIAL PRIMARY KEY, name VARCHAR(50) NOT NULL, plant_id INTEGER NOT NULL, starts DATE NOT NULL, ends DATE, nationality VARCHAR(50), photo UUID, CONSTRAINT fk_customer_plant FOREIGN KEY (plant_id) REFERENCES Plant(id) ); CREATE TABLE Project ( id SERIAL PRIMARY KEY, name VARCHAR(20) NOT NULL, customer_id INTEGER NOT NULL, starts DATE NOT NULL, ends DATE, dev BOOLEAN DEFAULT FALSE, origin VARCHAR(50), photo UUID, CONSTRAINT fk_project_customer FOREIGN KEY (customer_id) REFERENCES Customer(id) ); CREATE TABLE Family ( id SERIAL PRIMARY KEY, name VARCHAR(50), workcenter VARCHAR(20), project_id INTEGER, starts DATE, ends DATE, photo UUID, CONSTRAINT fk_family_project FOREIGN KEY (project_id) REFERENCES Project(id) ); CREATE TABLE Employee ( id SERIAL PRIMARY KEY, matricule INTEGER, firstname VARCHAR(50), lastname VARCHAR(50), gender BOOLEAN DEFAULT FALSE, join_date DATE, plant_id INTEGER, role_id INTEGER, CONSTRAINT FOREIGN KEY (plant_id) REFERENCES Plant(id), CONSTRAINT FOREIGN KEY (role_id) REFERENCES Role(id) ); CREATE TABLE User ( -- Core Identifiers id SERIAL PRIMARY KEY, matricule INTEGER, firstname VARCHAR(50), lastname VARCHAR(50), phone VARCHAR(30) CHECK (phone ~ '^\+?[0-9]{8,15}$'), email VARCHAR(200) CHECK (email ~* '^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$'), join_date DATE, reports_to INTEGER REFERENCES User(id), -- Authentication password_hash TEXT, is_active BOOLEAN DEFAULT TRUE, is_verified BOOLEAN DEFAULT FALSE, is_blocked BOOLEAN DEFAULT FALSE, blocked_until TIMESTAMPTZ, security_code TEXT, -- Security Infos created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), last_auth TIMESTAMPTZ, pwd__changed_at TIMESTAMPTZ, failed_attempts INTEGER DEFAULT 0, refresh_token TEXT, refresh_token_expires_at TIMESTAMPTZ, pwd_reset_token TEXT, pwd_reset_expires TIMESTAMPTZ, -- Session Infos device VARCHAR(20), browser VARCHAR(50), geo_location VARCHAR(50), ip_address VARCHAR(50), -- Additional Details avatar UUID, lang VARCHAR(5) DEFAULT 'EN' CHECK(lang IN ('EN', 'FR', 'AR', 'ES')), dept_id INTEGER, team_id INTEGER, role_id INTEGER, -- Constraints CONSTRAINT fk_user_dept FOREIGN KEY (dept_id) REFERENCES Department(id), CONSTRAINT fk_user_team FOREIGN KEY (team_id) REFERENCES Team(id), CONSTRAINT fk_user_role FOREIGN KEY (role_id) REFERENCES Role(id), CONSTRAINT max_failed_attempts CHECK (failed_attempts <= 3) ); CREATE TABLE Department ( id SERIAL PRIMARY KEY, code VARCHAR(10), title VARCHAR(50), description TEXT, manager_id INTEGER, team_manager_id INTEGER, photo UUID ); CREATE TABLE Team ( id SERIAL PRIMARY KEY, name VARCHAR(50), description TEXT, coordinator_id INTEGER REFERENCES User(id), supervisor_id INTEGER REFERENCES User(id) ); CREATE TABLE Connector ( id SERIAL PRIMARY KEY, ref BIGINT, code VARCHAR(10), name VARCHAR(20), description TEXT, P1 UUID, P2 UUID ); CREATE TABLE Catalogue ( id SERIAL PRIMARY KEY, code VARCHAR(10), category VARCHAR(100), description TEXT, reworkable INTEGER, detectable INTEGER ); CREATE TABLE Action ( id SERIAL PRIMARY KEY, title VARCHAR(100), category BOOLEAN, content TEXT, score FLOAT CHECK(score >= 0 AND score <= 10), attachment_key UUID, has_attachment BOOLEAN, created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), defect_id INTEGER REFERENCES Catalogue(id) ); CREATE INDEX idx_actions_attachtment ON Action(attachment_key); CREATE TABLE Root_Cause ( id SERIAL PRIMARY KEY, title VARCHAR(100), content TEXT, score FLOAT CHECK(score >= 0 AND score <= 10), attachment_key UUID, has_attachment BOOLEAN, created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), defect_id INTEGER REFERENCES Catalogue(id) ); CREATE TABLE Process ( id SERIAL PRIMARY KEY, code VARCHAR(10), name VARCHAR(50), description TEXT, photo UUID, category VARCHAR(50) ); CREATE TABLE Production_Team ( id SERIAL PRIMARY KEY, title VARCHAR(200), LL1 INTEGER, LL2 INTEGER DEFAULT NULL, descirption TEXT ); CREATE TABLE Line_Type ( id SERIAL PRIMARY KEY, name VARCHAR(50), descirption TEXT ); CREATE TABLE Production ( id SERIAL PRIMARY KEY, family_id INTEGER, shift_id INTEGER, target INTEGER, quantity INTEGER, datetime TIMESTAMP, directs INTEGER, indirects INTEGER, absence_directs INTEGER, absence_indirects INTEGER, support INTEGER, uptime FLOAT, downtime FLOAT, CT FLOAT ); CREATE TABLE Claim ( id SERIAL PRIMARY KEY, ); CREATE TABLE Claim_Category ( id SERIAL PRIMARY KEY ); CREATE TABLE Claim_Action ( id SERIAL PRIMARY KEY, title VARCHAR(100), family_id INTEGER REFERENCES Family(id), description TEXT, appearance_date DATE, D8 UUID, PPT UUID, OK UUID, NOK UUID, attachment UUID, actions_id );