Parallel Programming Examples: OpenMP and MPI Code Snippets
1. OpenMP Parallel Loop Scheduling
#include <stdio.h>
#include <omp.h>
int main() {
int n = 16, thread;
printf("\nEnter the number of tasks: ");
scanf("%d", &n);
printf("\nEnter the number of threads: ");
scanf("%d", &thread);
omp_set_num_threads(thread);
printf("\n--------------------------------------\n");
#pragma omp parallel for schedule(static, 2)
for (int i = 0; i < n; i++) {
printf("Thread %d executes iteration %d\n", omp_ Read More
Essential Database Management Systems Concepts
1. Data, Databases, and DBMS
Data refers to raw facts and figures which by themselves have no meaning (e.g., numbers, names, marks, dates). When processed and organized, it becomes meaningful information.
A database is an organized collection of related data stored in a structured manner for easy access, management, and updates (e.g., a student database).
A Database Management System (DBMS) is software that allows users to create, store, retrieve, update, and manage databases efficiently (e.g., MySQL,
Read MoreFlutter Implementation: Cart and Room Management
Flutter Shopping Cart Implementation
This example demonstrates how to create a simple Shopping Cart interface in Flutter using TextEditingController and StatefulWidget to manage item inputs and calculate totals.
import 'package:flutter/material.dart';
void main() { runApp(MyApp()); }
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(home: CartScreen());
}
}
class Item {
String name;
int qty;
double price;
Item(this.name, this. Read More
Mastering SQL Server Fundamentals and Azure Database Services
SQL Fundamentals & Azure IaaS
1. Database Fundamentals
RDBMS vs. NoSQL:
- RDBMS: Organized store of data, minimizes redundancy, reduces inconsistency. Stores data in tables (rows/columns).
- DBMS Types:
- Open Source: MySQL, MariaDB, PostgreSQL.
- Proprietary: Oracle, Microsoft SQL Server, IBM DB2.
SQL Server Editions:
- Express: Free, limited size/performance.
- Developer: Free/low-price, full features, dev use only.
- Standard/Enterprise: Production use, terabytes of data.
Data Types:
- Numeric: int, bigint, decimal,
Essential Python Programming Exercises and Solutions
Program 7: Prime Number Checker
n = int(input("Enter number: "))
if n <= 1:
print("Neither prime nor composite")
else:
for i in range(2, n):
if n % i == 0:
print("Not prime, it is a composite number")
break
else:
print("Is a prime number and not a composite")Program 8: Geometry Area Calculator
def rect(l, b):
print("Area of rectangle:", l * b)
def square(s):
print("Area of square:", s * s)
def triangle(b, h):
print("Area of triangle: Read More
Database Management Systems: Core Concepts and Principles
Database Management System (DBMS)
A software package or system designed to facilitate the creation and maintenance of a computerized database.
Data Storage in Databases
Data is stored in tables consisting of rows and columns.
Table Relationships and Keys
Tables relate to one another using keys:
- Primary Key (PK): Uniquely identifies a row in a table.
- Foreign Key (FK): Links one table to another.
Records and Constraints
A record (or row) is a single entry containing data for each column in the table. A constraint
Read More