Skip to content

Instantly share code, notes, and snippets.

#include <iostream>
#include <unordered_map>
using namespace std;
int main(){
unordered_map<int, int> h;
for(long i=0;; i++)
{
try{
h[i]=i;
@khalefa-phd
khalefa-phd / main.cpp
Last active April 16, 2021 00:03
test
#include <string.h>
#include <algorithm>
#include <cstring>
#include <iostream>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
@khalefa-phd
khalefa-phd / a.sql
Created April 7, 2021 20:25
Triggers Mysql
CREATE TABLE Students
(sid CHAR(20),
name CHAR(20) NOT NULL,
login CHAR(10),
age INTEGER,
gpa REAL Default 0,
Constraint pk Primary Key (sid),
Constraint u1 Unique (login),
Constraint gpaMax check (gpa <= 4.0) );
#include <iostream>
#include <unordered_map>
#include <string>
#include <algorithm>
using namespace std;
static unordered_map<string, int> lookup;
// Function to find the length of the longest common subsequence of
PG_FUNCTION_INFO_V1(addTen);
Datum addTen(PG_FUNCTION_ARGS) {
int32 i;
FuncCallContext *funcctx;
int call_cntr;
int max_calls;
// Code executed only on first call of the function
if (SRF_IS_FIRSTCALL()) {
MemoryContext oldcontext;
@khalefa-phd
khalefa-phd / Readme.md
Created March 29, 2021 18:02
Testing udf

test udf functions

@khalefa-phd
khalefa-phd / q6.sql
Last active February 22, 2021 22:08
Problem no 6
-- correct but not for mysql
SELECT s.sid,s.lname, s.fname
FROM course c, student s, enrolled e
where c.cid=e.cid and e.sid=s.sid and c.`name`='network'
Intersect (
SELECT s.sid,s.lname, s.fname
FROM course c, student s, enrolled e
where c.cid=e.cid and e.sid=s.sid and c.`name`='database');
-- version 1
/*
* Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
#include <stdio.h>
#include <unistd.h>
int main() {
pid_t ChildID;
ChildID = fork(); // check for Fork
if (ChildID >= 0) // fork sucess
{
if (ChildID == 0) // Code Of Child which the value will be 0 in
// case of Child code
{
@khalefa-phd
khalefa-phd / Server.java
Created February 10, 2020 18:20
Socket IP example 1
import java.io.IOException;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Date;
public class Server {
public static void main(String[] args) throws IOException {
//Wait on port
try (ServerSocket listener = new ServerSocket(1090)) {