Snippets Collections
FCFS:
#include<stdio.h>

// Process structure
struct process {
    int pid;      // Process ID
    int burst;    // Burst time
    int waiting;  // Waiting time
    int turnaround;// Turnaround time
};

// Function to calculate waiting and turnaround times for each process
void calculateTimes(struct process proc[], int n) {
    int total_waiting = 0, total_turnaround = 0;
   
    // Waiting time for first process is 0
    proc[0].waiting = 0;
    // Turnaround time for first process is its burst time
    proc[0].turnaround = proc[0].burst;

    // Calculate waiting and turnaround times for each process
    for (int i = 1; i < n; i++) {
        // Waiting time of current process = Turnaround time of previous process
        proc[i].waiting = proc[i - 1].waiting + proc[i - 1].burst;
        // Turnaround time of current process = Waiting time of current process + Burst time of current process
        proc[i].turnaround = proc[i].waiting + proc[i].burst;
    }
}

// Function to display the process details
void displayProcesses(struct process proc[], int n) {
    printf("Process ID\tBurst Time\tWaiting Time\tTurnaround Time\n");

    for (int i = 0; i < n; i++) {
        printf("%d\t\t%d\t\t%d\t\t%d\n", proc[i].pid, proc[i].burst, proc[i].waiting, proc[i].turnaround);
    }
}

// Function to calculate average waiting and turnaround times
void calculateAverages(struct process proc[], int n, float *avg_waiting, float *avg_turnaround) {
    int total_waiting = 0, total_turnaround = 0;

    for (int i = 0; i < n; i++) {
        total_waiting += proc[i].waiting;
        total_turnaround += proc[i].turnaround;
    }

    *avg_waiting = (float)total_waiting / n;
    *avg_turnaround = (float)total_turnaround / n;
}

int main() {
    int n; // Number of processes
    printf("Enter the number of processes: ");
    scanf("%d", &n);

    struct process proc[n]; // Array of processes

    // Input process details
    printf("Enter the burst time for each process:\n");
    for (int i = 0; i < n; i++) {
        proc[i].pid = i + 1;
        printf("Process %d: ", i + 1);
        scanf("%d", &proc[i].burst);
    }

    // Calculate waiting and turnaround times
    calculateTimes(proc, n);

    // Display the process details
    displayProcesses(proc, n);

    // Calculate and display average waiting and turnaround times
    float avg_waiting, avg_turnaround;
    calculateAverages(proc, n, &avg_waiting, &avg_turnaround);
    printf("\nAverage Waiting Time: %.2f\n", avg_waiting);
    printf("Average Turnaround Time: %.2f\n", avg_turnaround);

    return 0;
}


SJF:

#include <stdio.h>

struct Process {
    int process_id;
    int arrival_time;
    int burst_time;
};

void sjf_scheduling(struct Process processes[], int n) {
    int completion_time[n];
    int waiting_time[n];
    int turnaround_time[n];

    // Sort processes based on arrival time
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            if (processes[i].arrival_time > processes[j].arrival_time) {
                // Swap processes
                struct Process temp = processes[i];
                processes[i] = processes[j];
                processes[j] = temp;
            }
        }
    }

    int current_time = 0;

    for (int i = 0; i < n; i++) {
        // Read process details from the keyboard
        printf("Enter details for process %d:\n", i + 1);
        printf("Process ID: ");
        scanf("%d", &processes[i].process_id);
        printf("Arrival Time: ");
        scanf("%d", &processes[i].arrival_time);
        printf("Burst Time: ");
        scanf("%d", &processes[i].burst_time);

        // If the process hasn't arrived yet, wait
        if (current_time < processes[i].arrival_time) {
            current_time = processes[i].arrival_time;
        }

        // Update completion time
        completion_time[i] = current_time + processes[i].burst_time;

        // Update waiting time
        waiting_time[i] = current_time - processes[i].arrival_time;

        // Update turnaround time
        turnaround_time[i] = waiting_time[i] + processes[i].burst_time;

        // Move to the next process
        current_time += processes[i].burst_time;
    }

    // Display results
    printf("\nProcess\tCompletion Time\tWaiting Time\tTurnaround Time\n");
    for (int i = 0; i < n; i++) {
        printf("%d\t\t%d\t\t%d\t\t%d\n", processes[i].process_id, completion_time[i], waiting_time[i], turnaround_time[i]);
    }

    // Calculate and display averages
    int total_waiting_time = 0;
    int total_turnaround_time = 0;
    for (int i = 0; i < n; i++) {
        total_waiting_time += waiting_time[i];
        total_turnaround_time += turnaround_time[i];
    }

    float avg_waiting_time = (float)total_waiting_time / n;
    float avg_turnaround_time = (float)total_turnaround_time / n;

    printf("\nAverage Waiting Time: %.2f\n", avg_waiting_time);
    printf("Average Turnaround Time: %.2f\n", avg_turnaround_time);
}

int main() {
    int n;

    printf("Enter the number of processes: ");
    scanf("%d", &n);

    struct Process processes[n];

    sjf_scheduling(processes, n);

    return 0;
}


Round Robin:
#include<stdio.h>  
    #include<stdlib.h>  
     
    void main()  
    {  
        // initlialize the variable name  
        int i, NOP, sum=0,count=0, y, quant, wt=0, tat=0, at[10], bt[10], temp[10];  
        float avg_wt, avg_tat;  
        printf(" Total number of process in the system: ");  
        scanf("%d", &NOP);  
        y = NOP; // Assign the number of process to variable y  
     
    // Use for loop to enter the details of the process like Arrival time and the Burst Time  
    for(i=0; i<NOP; i++)  
    {  
    printf("\n Enter the Arrival and Burst time of the Process[%d]\n", i+1);  
    printf(" Arrival time is: \t");  // Accept arrival time  
    scanf("%d", &at[i]);  
    printf(" \nBurst time is: \t"); // Accept the Burst time  
    scanf("%d", &bt[i]);  
    temp[i] = bt[i]; // store the burst time in temp array  
    }  
    // Accept the Time qunat  
    printf("Enter the Time Quantum for the process: \t");  
    scanf("%d", &quant);  
    // Display the process No, burst time, Turn Around Time and the waiting time  
    printf("\n Process No \t\t Burst Time \t\t TAT \t\t Waiting Time ");  
    for(sum=0, i = 0; y!=0; )  
    {  
    if(temp[i] <= quant && temp[i] > 0) // define the conditions  
    {  
        sum = sum + temp[i];  
        temp[i] = 0;  
        count=1;  
        }    
        else if(temp[i] > 0)  
        {  
            temp[i] = temp[i] - quant;  
            sum = sum + quant;    
        }  
        if(temp[i]==0 && count==1)  
        {  
            y--; //decrement the process no.  
            printf("\nProcess No[%d] \t\t %d\t\t\t\t %d\t\t\t %d", i+1, bt[i], sum-at[i], sum-at[i]-bt[i]);  
            wt = wt+sum-at[i]-bt[i];  
            tat = tat+sum-at[i];  
            count =0;    
        }  
        if(i==NOP-1)  
        {  
            i=0;  
        }  
        else if(at[i+1]<=sum)  
        {  
            i++;  
        }  
        else  
        {  
            i=0;  
        }  
    }  
    // represents the average waiting time and Turn Around time  
    avg_wt = wt * 1.0/NOP;  
    avg_tat = tat * 1.0/NOP;  
    printf("\n Average Turn Around Time: \t%f", avg_wt);  
    printf("\n Average Waiting Time: \t%f"
code:
#include<stdio.h>  
    #include<stdlib.h>  
     
    void main()  {  
        int i, NOP, sum=0,count=0, y, quant, wt=0, tat=0, at[10], bt[10], temp[10];  
        float avg_wt, avg_tat;  
        printf(" Total number of process in the system: ");  
        scanf("%d", &NOP);  
        y = NOP; 
    for(i=0; i<NOP; i++){  
    printf("\n Enter the Arrival and Burst time of the Process[%d]\n", i+1);  
    printf(" Arrival time is: \t");   
    scanf("%d", &at[i]);  
    printf(" \nBurst time is: \t"); 
    scanf("%d", &bt[i]);  
    temp[i] = bt[i]; 
    }  
    printf("Enter the Time Quantum for the process: \t");  
    scanf("%d", &quant);  
    printf("\n Process No \t\t Burst Time \t\t TAT \t\t Waiting Time ");  
    for(sum=0, i = 0; y!=0; )  
    {  
    if(temp[i] <= quant && temp[i] > 0){  
        sum = sum + temp[i];  
        temp[i] = 0;  
        count=1;  
        }    
        else if(temp[i] > 0){  
            temp[i] = temp[i] - quant;  
            sum = sum + quant;    
        }  
        if(temp[i]==0 && count==1){  
            y--;  
            printf("\nProcess No[%d] \t\t %d\t\t\t\t %d\t\t\t %d", i+1, bt[i], sum-at[i], sum-at[i]-bt[i]);  
            wt = wt+sum-at[i]-bt[i];  
            tat = tat+sum-at[i];  
            count =0;    
        }  
        if(i==NOP-1)  
        {i=0;}  
        else if(at[i+1]<=sum){  
            i++;  
        }  
        else { i=0; }  
    }  

    avg_wt = wt * 1.0/NOP;  
    avg_tat = tat * 1.0/NOP;  
    printf("\n Average Turn Around Time: \t%f", avg_tat);  
    printf("\n Average Waiting Time: \t%f",avg_wt);
    }
    
output:
Total number of process in the system: 4
 Enter the Arrival and Burst time of the Process[1]
 Arrival time is: 	2
Burst time is: 	6
 Enter the Arrival and Burst time of the Process[2]
 Arrival time is: 	4
Burst time is: 	7
 Enter the Arrival and Burst time of the Process[3]
 Arrival time is: 	4
Burst time is: 	8
 Enter the Arrival and Burst time of the Process[4]
 Arrival time is: 	8
Burst time is: 	2
Enter the Time Quantum for the process: 	3
 Process No 		 Burst Time 		 TAT 		 Waiting Time 
Process No[1] 		 6				 4			 -2
Process No[4] 		 2				 6			 4
Process No[2] 		 7				 17			 10
Process No[3] 		 8				 19			 11
 Average Turn Around Time: 	11.500000
 Average Waiting Time: 	5.750000
#include<stdio.h>
#include<unistd.h>
#include<sys/types.h>
#include<string.h>
#include<stdlib.h>
int main(){
   int fd[2],x;
   pid_t pid;
   char string[]="welcome";
   char b[80];
   pipe(fd);
   pid=fork();
   if(pid==0){
   close(fd[0]);
   write(fd[1],string,(strlen(string)+1));
   exit(0);
   }
   else{
     close(fd[1]);
     x=read(fd[0],b,sizeof(b));
     printf("received string:%s",b);
     }
     return 0;
     }
#include<stdio.h>

int main() {
  /* array will store at most 5 process with 3 resoures if your process or
  resources is greater than 5 and 3 then increase the size of array */
  int p, c, count = 0, i, j, alc[5][3], max[5][3], need[5][3], safe[5], available[3], done[5], terminate = 0;
  printf("Enter the number of process and resources");
  scanf("%d %d", & p, & c);
  // p is process and c is diffrent resources
  printf("enter allocation of resource of all process %dx%d matrix", p, c);
  for (i = 0; i < p; i++) {
    for (j = 0; j < c; j++) {
      scanf("%d", & alc[i][j]);
    }
  }
  printf("enter the max resource process required %dx%d matrix", p, c);
  for (i = 0; i < p; i++) {
    for (j = 0; j < c; j++) {
      scanf("%d", & max[i][j]);
    }
  }
  printf("enter the  available resource");
  for (i = 0; i < c; i++)
    scanf("%d", & available[i]);

  printf("\n need resources matrix are\n");
  for (i = 0; i < p; i++) {
    for (j = 0; j < c; j++) {
      need[i][j] = max[i][j] - alc[i][j];
      printf("%d\t", need[i][j]);
    }
    printf("\n");
  }
  /* once process execute variable done will stop them for again execution */
  for (i = 0; i < p; i++) {
    done[i] = 0;
  }
  while (count < p) {
    for (i = 0; i < p; i++) {
      if (done[i] == 0) {
        for (j = 0; j < c; j++) {
          if (need[i][j] > available[j])
            break;
        }
        //when need matrix is not greater then available matrix then if j==c will true
        if (j == c) {
          safe[count] = i;
          done[i] = 1;
          /* now process get execute release the resources and add them in available resources */
          for (j = 0; j < c; j++) {
            available[j] += alc[i][j];
          }
          count++;
          terminate = 0;
        } else {
          terminate++;
        }
      }
    }
    if (terminate == (p - 1)) {
      printf("safe sequence does not exist");
      break;
    }

  }
  if (terminate != (p - 1)) {
    printf("\n available resource after completion\n");
    for (i = 0; i < c; i++) {
      printf("%d\t", available[i]);
    }
    printf("\n safe sequence are\n");
    for (i = 0; i < p; i++) {
      printf("p%d\t", safe[i]);
    }
  }

  return 0;
}
#include <stdio.h>
 
struct Process {
    int process_id;
    int arrival_time;
    int burst_time;
};
 
void sjf_scheduling(struct Process processes[], int n) {
    int completion_time[n];
    int waiting_time[n];
    int turnaround_time[n];

    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            if (processes[i].arrival_time > processes[j].arrival_time) {
                struct Process temp = processes[i];
                processes[i] = processes[j];
                processes[j] = temp;
            }
        }
    }
 
    int current_time = 0;
    for (int i = 0; i < n; i++) {
        printf("Enter details for process %d:\n", i + 1);
        printf("Process ID: ");
        scanf("%d", &processes[i].process_id);
        printf("Arrival Time: ");
        scanf("%d", &processes[i].arrival_time);
        printf("Burst Time: ");
        scanf("%d", &processes[i].burst_time);
        if (current_time < processes[i].arrival_time) {
            current_time = processes[i].arrival_time;
        }
        completion_time[i] = current_time + processes[i].burst_time;
        waiting_time[i] = current_time - processes[i].arrival_time;
        turnaround_time[i] = waiting_time[i] + processes[i].burst_time;
        current_time += processes[i].burst_time;
    }
    printf("\nProcess\tCompletion Time\tWaiting Time\tTurnaround Time\n");
    for (int i = 0; i < n; i++) {
        printf("%d\t\t%d\t\t%d\t\t%d\n", processes[i].process_id, completion_time[i], waiting_time[i], turnaround_time[i]);
    }

    int total_waiting_time = 0;
    int total_turnaround_time = 0;
    for (int i = 0; i < n; i++) {
        total_waiting_time += waiting_time[i];
        total_turnaround_time += turnaround_time[i];
    }
    float avg_waiting_time = (float)total_waiting_time / n;
    float avg_turnaround_time = (float)total_turnaround_time / n;
    printf("\nAverage Waiting Time: %.2f\n", avg_waiting_time);
    printf("Average Turnaround Time: %.2f\n", avg_turnaround_time);
}
 
int main() {
    int n;
    printf("Enter the number of processes: ");
    scanf("%d", &n);
    struct Process processes[n];
    sjf_scheduling(processes, n);
    return 0;
}
 Enter the number of processes: 5
Enter details for process 1:
Process ID: 1
Arrival Time: 2
Burst Time: 2
Enter details for process 2:
Process ID: 2
Arrival Time: 4
Burst Time: 3
Enter details for process 3:
Process ID: 3
Arrival Time: 6
Burst Time: 4
Enter details for process 4:
Process ID: 4
Arrival Time: 8
Burst Time: 5
Enter details for process 5:
Process ID: 5
Arrival Time: 10
Burst Time: 6

Process	Completion Time	Waiting Time	Turnaround Time
1		4		0		2
2		7		0		3
3		11		1		5
4		16		3		8
5		22		6		12

Average Waiting Time: 2.00
Average Turnaround Time: 6.00

 
#include<stdio.h>
 
struct process {
    int pid;      
    int burst;   
    int waiting;  
    int turnaround;
};
 
void calculateTimes(struct process proc[], int n) {
    int total_waiting = 0, total_turnaround = 0;
   
    proc[0].waiting = 0;
    
    proc[0].turnaround = proc[0].burst;
 
    for (int i = 1; i < n; i++) {
        proc[i].waiting = proc[i - 1].waiting + proc[i - 1].burst;
        proc[i].turnaround = proc[i].waiting + proc[i].burst;
    }
}
 
void displayProcesses(struct process proc[], int n) {
    printf("Process ID\tBurst Time\tWaiting Time\tTurnaround Time\n");
    for (int i = 0; i < n; i++) {
        printf("%d\t\t%d\t\t%d\t\t%d\n", proc[i].pid, proc[i].burst, proc[i].waiting, proc[i].turnaround);
    }
}
 
void calculateAverages(struct process proc[], int n, float *avg_waiting, float *avg_turnaround) {
    int total_waiting = 0, total_turnaround = 0;
    for (int i = 0; i < n; i++) {
        total_waiting += proc[i].waiting;
        total_turnaround += proc[i].turnaround;
    }
    *avg_waiting = (float)total_waiting / n;
    *avg_turnaround = (float)total_turnaround / n;
}
 
int main() {
    int n; 
    printf("Enter the number of processes: ");
    scanf("%d", &n);
    struct process proc[n]; 
    printf("Enter the burst time for each process:\n");
    for (int i = 0; i < n; i++) {
        proc[i].pid = i + 1;
        printf("Process %d: ", i + 1);
        scanf("%d", &proc[i].burst);
    }
    calculateTimes(proc, n);
    displayProcesses(proc, n);
    float avg_waiting, avg_turnaround;
    calculateAverages(proc, n, &avg_waiting, &avg_turnaround);
    printf("\nAverage Waiting Time: %.2f\n", avg_waiting);
    printf("Average Turnaround Time: %.2f\n", avg_turnaround);
 
    return 0;
}




Output:

Enter the number of processes: 4
Enter the burst time for each process:
Process 1: 1
Process 2: 2
Process 3: 3
Process 4: 4
Process ID	Burst Time	Waiting Time	Turnaround Time
1		1		0		1
2		2		1		3
3		3		3		6
4		4		6		10

Average Waiting Time: 2.50
Average Turnaround Time: 5.00

 
        /**
         * Check if assignment has been updated on elastic-search
         */
        $elasticResponse = $this->getElasticDocumentById(FormInstanceIndex::getCurrentAliasName(), $instance_id);
        $actualFormAssignment = $elasticResponse['form_assignments'][0] ?? [];
        $this->assertNotEmpty($actualFormAssignment);
        $this->assertSame($instance_id, $actualFormAssignment['instance_id']);
        $this->assertSame($assignment['role_id'], $actualFormAssignment['role_id']);
        $this->assertSame($assignment['message'], $actualFormAssignment['message']);

        l($actualFormAssignment, mode:0);
import xarray as xr
import pandas as pd
import xwrf
from pyproj import Transformer, CRS
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import proplot as pplt
import numpy as np
from scipy.stats import pearsonr  
import xskillscore as xs
from sklearn.metrics import mean_squared_error
import math
from datetime import datetime
import proplot as pplt

from dask.distributed import Client, LocalCluster
cluster = LocalCluster()
client = Client(cluster)

import warnings
warnings.filterwarnings("ignore")

client
from datetime import datetime, timedelta

wrfData=xr.open_dataset('/blue/dhingmire/ROMS_Input/ERA5/1992/d2/wrfout_d02_1993-01-02_00:00:00')
fig,axes = pplt.subplots(nrows=6,ncols=4,proj='cyl')
axes.format(lonlim=(-160,-100), latlim=(65,30),
              labels=True, coast=True )
lons=wrfData.SWDOWN[16,:,:].XLONG
lats=wrfData.SWDOWN[16,:,:].XLAT

#inData.T2[0,:,:].plot()
for i in range(0,24):
    #print(i)
   
    con=axes[i].contourf(lons,lats,wrfData.SWDOWN[i,:,:], 
                    extend='both',cmap = 'terrain_r',levels=np.arange(0,600,50))
    axes[i].set_title(wrfData.SWDOWN[i,:,:].XTIME.values)
    #axes[i].colorbar(con)
#con = axes[0,0].contourf(inData.T2[0,:,:], 
#                      extend='both',cmap = 'coolwarm',levels=np.arange(268,294,2))
    
fig.colorbar(con)
#bar = fig.colorbar(con, loc='b', label='Surface pressure (Pa)') 
fig.format(coast=True,suptitle=wrfData.SWDOWN[16,:,:].description)#,toplabels=['WRF Output','ERA5'])
--DATA UNDERSTANFING Average amount of characters in each text 
SELECT AVG(text_range) AS average_characters
FROM tweets_extended;
-- EFFECT ON DATA How many tweets
SELECT COUNT(tweet_id) AS tweet_count
FROM tweets;
--DATA UNDERSTANDING Average replies
SELECT AVG(reply_count)
FROM tweets; 
--DATA UNDERSTANDING Which language in which most tweets were made
SELECT lang, COUNT(*) AS frequency
FROM tweets
GROUP BY lang
ORDER BY frequency DESC
--DATA UNDERSTANDING In which country most tweets were made
SELECT country, COUNT(*) AS frequency
FROM tweets
GROUP BY country
ORDER BY frequency DESC

-- Unreplied tweets
select relpy_count from data_db 
where reply_count = 0

where reply_count = 0 
                   
--EFFECT ON DATA HOW MANY DIFFERENT LANGUAGES
SELECT lang , COUNT(*) AS language_count
FROM data_db
GROUP BY lang;
-- DATA UNDERSTANDING how many tweets klm has mande 
 SELECT COUNT(*) AS total_count_klm
    FROM user_data
    WHERE user_id = '56377143'
-- DATA UNDERSTANDING how many tweets about klm where made 
SELECT COUNT(*) AS total_count_klm
    FROM tweets_extend
    WHERE user_mention0_id = '56377143' OR user_mention0_name = 'KLM' OR user_mention0_name = 'klm' OR user_mention1_name = 'klm' OR user_mention1_name = 'KLM' OR user_mention1_id = '56377143'
     
                   
-- How many null 
SELECT COUNT(*) AS count_null_url
FROM data_db
WHERE JSON_VALUE(data, '$.url') IS NULL;

-- HOW MANY TWEETS
SELECT COUNT(*) AS tweet_amount
FROM tweets
WHERE tweet_id IS NOT NULL 





                   
SELECT SUM(total_count_klm) AS KLM_tweets
FROM (
    SELECT COUNT(*) AS total_count_klm
    FROM tweets_extend
    WHERE user_mention0_id = '56377143' OR user_mention0_name = 'KLM' OR user_mention0_name = 'klm' OR user_mention1_name = 'klm' OR user_mention1_name = 'KLM' OR user_mention1_id = '56377143'

    UNION ALL

    SELECT COUNT(*) AS total_count_klm
    FROM user_data
    WHERE user_id1 = '56377143'
) AS klm_counts; 
SELECT SUM(total_count_airfrance) AS AirFrance_tweets
FROM (
    SELECT COUNT(*) AS total_count_airfrance
    FROM tweets_extend
    WHERE user_mention0_id = '106062176' OR user_mention0_name = 'AirFrance' OR user_mention0_name = 'airfrance' OR user_mention1_name = 'airfrance' OR user_mention1_name = 'AirFrance' OR user_mention1_id = '106062176'

    UNION ALL

    SELECT COUNT(*) AS total_count_airfrance
    FROM user_data
    WHERE user_id1 = '106062176'
) AS airfrance_counts;
SELECT SUM(total_count_british_airways) AS British_Airways_tweets
FROM (
    SELECT COUNT(*) AS total_count_british_airways
    FROM tweets_extend
    WHERE user_mention0_id = '18332190' OR user_mention0_name = 'British_Airways' OR user_mention0_name = 'british_airways' OR user_mention1_name = 'british_airways' OR user_mention1_name = 'British_Airways' OR user_mention1_id = '18332190'

    UNION ALL

    SELECT COUNT(*) AS total_count_british_airways
    FROM user_data
    WHERE user_id1 = '18332190'
) AS british_airways_counts;
SELECT SUM(total_count_american_airlines) AS American_Airlines_tweets
FROM (
    SELECT COUNT(*) AS total_count_american_airlines
    FROM tweets_extend
    WHERE user_mention0_id = '22536055' OR user_mention0_name = 'AmericanAirlines' OR user_mention0_name = 'americanairlines' OR user_mention1_name = 'americanairlines' OR user_mention1_name = 'AmericanAirlines' OR user_mention1_id = '22536055'

    UNION ALL

    SELECT COUNT(*) AS total_count_american_airlines
    FROM user_data
    WHERE user_id1 = '22536055'
) AS american_airlines_counts;
SELECT SUM(total_count_lufthansa) AS Lufthansa_tweets
FROM (
    SELECT COUNT(*) AS total_count_lufthansa
    FROM tweets_extend
    WHERE user_mention0_id = '124476322' OR user_mention0_name = 'Lufthansa' OR user_mention0_name = 'lufthansa' OR user_mention1_name = 'lufthansa' OR user_mention1_name = 'Lufthansa' OR user_mention1_id = '124476322'

    UNION ALL

    SELECT COUNT(*) AS total_count_lufthansa
    FROM user_data
    WHERE user_id1 = '124476322'
) AS lufthansa_counts;
SELECT SUM(total_count_airberlin) AS AirBerlin_tweets
FROM (
    SELECT COUNT(*) AS total_count_airberlin
    FROM tweets_extend
    WHERE user_mention0_id = '26223583' OR user_mention0_name = 'AirBerlin' OR user_mention0_name = 'airberlin' OR user_mention1_name = 'airberlin' OR user_mention1_name = 'AirBerlin' OR user_mention1_id = '26223583'

    UNION ALL

    SELECT COUNT(*) AS total_count_airberlin
    FROM user_data
    WHERE user_id1 = '26223583'
) AS airberlin_counts;
SELECT SUM(total_count_airberlin_assist) AS AirBerlin_Assist_tweets
FROM (
    SELECT COUNT(*) AS total_count_airberlin_assist
    FROM tweets_extend
    WHERE user_mention0_id = '2182373406' OR user_mention0_name = 'AirBerlin assist' OR user_mention0_name = 'airberlin_assist' OR user_mention1_name = 'airberlin_assist' OR user_mention1_name = 'AirBerlin assist' OR user_mention1_id = '2182373406'

    UNION ALL

    SELECT COUNT(*) AS total_count_airberlin_assist
    FROM user_data
    WHERE user_id1 = '2182373406'
) AS airberlin_assist_counts;
SELECT SUM(total_count_easyjet) AS EasyJet_tweets
FROM (
    SELECT COUNT(*) AS total_count_easyjet
    FROM tweets_extend
    WHERE user_mention0_id = '38676903' OR user_mention0_name = 'easyJet' OR user_mention0_name = 'easyjet' OR user_mention1_name = 'easyjet' OR user_mention1_name = 'easyJet' OR user_mention1_id = '38676903'

    UNION ALL

    SELECT COUNT(*) AS total_count_easyjet
    FROM user_data
    WHERE user_id1 = '38676903'
) AS easyjet_counts;
SELECT SUM(total_count_ryanair) AS Ryanair_tweets
FROM (
    SELECT COUNT(*) AS total_count_ryanair
    FROM tweets_extend
    WHERE user_mention0_id = '1542862735' OR user_mention0_name = 'Ryanair' OR user_mention0_name = 'ryanair' OR user_mention1_name = 'ryanair' OR user_mention1_name = 'Ryanair' OR user_mention1_id = '1542862735'

    UNION ALL

    SELECT COUNT(*) AS total_count_ryanair
    FROM user_data
    WHERE user_id1 = '1542862735'
) AS ryanair_counts;
SELECT SUM(total_count_singapore_airlines) AS Singapore_Airlines_tweets
FROM (
    SELECT COUNT(*) AS total_count_singapore_airlines
    FROM tweets_extend
    WHERE user_mention0_id = '253340062' OR user_mention0_name = 'SingaporeAir' OR user_mention0_name = 'singaporeair' OR user_mention1_name = 'singaporeair' OR user_mention1_name = 'SingaporeAir' OR user_mention1_id = '253340062'

    UNION ALL

    SELECT COUNT(*) AS total_count_singapore_airlines
    FROM user_data
    WHERE user_id1 = '253340062'
) AS singapore_airlines_counts;
SELECT SUM(total_count_qantas) AS Qantas_tweets
FROM (
    SELECT COUNT(*) AS total_count_qantas
    FROM tweets_extend
    WHERE user_mention0_id = '218730857' OR user_mention0_name = 'Qantas' OR user_mention0_name = 'qantas' OR user_mention1_name = 'qantas' OR user_mention1_name = 'Qantas' OR user_mention1_id = '218730857'

    UNION ALL

    SELECT COUNT(*) AS total_count_qantas
    FROM user_data
    WHERE user_id1 = '218730857'
) AS qantas_counts;
SELECT SUM(total_count_etihad_airways) AS Etihad_Airways_tweets
FROM (
    SELECT COUNT(*) AS total_count_etihad_airways
    FROM tweets_extend
    WHERE user_mention0_id = '45621423' OR user_mention0_name = 'EtihadAirways' OR user_mention0_name = 'etihadairways' OR user_mention1_name = 'etihadairways' OR user_mention1_name = 'EtihadAirways' OR user_mention1_id = '45621423'

    UNION ALL

    SELECT COUNT(*) AS total_count_etihad_airways
    FROM user_data
    WHERE user_id1 = '45621423'
) AS etihad_airways_counts;

SELECT SUM(total_count_virgin_atlantic) AS Virgin_Atlantic_tweets
FROM (
    SELECT COUNT(*) AS total_count_virgin_atlantic
    FROM tweets_extend
    WHERE user_mention0_id = '20626359' OR user_mention0_name = 'VirginAtlantic' OR user_mention0_name = 'virginatlantic' OR user_mention1_name = 'virginatlantic' OR user_mention1_name = 'VirginAtlantic' OR user_mention1_id = '20626359'

    UNION ALL

    SELECT COUNT(*) AS total_count_virgin_atlantic
    FROM user_data
    WHERE user_id1 = '20626359'
) AS virgin_atlantic_counts;
NEW ONE


API  | Pagespeed | Performance 


Regarding the deprecated APIs warning: that's unfortunately a result of our script's age, as it was developed several years ago. To tackle this, our product team is actively working on rebuilding the endpoint with a more modern approach, aligning with current web standards.



Regarding the reported slowdown in website performance: our analysis suggests that while Fareharbor contributes to some extent, it's not the primary factor. For instance, optimizing image sizes and especially formats, as well as minimizing code, could significantly improve page speed. In terms of integration and performance enhancement, we unfortunately can't do much. One approach for them would be to remove our API, thus the lightframe popup, and have all links open in new tabs. Then repeat the PageSpeed Insight again.  This would isolate the impact of the API on page speed.




https://pagespeed.web.dev/analysis/https-www-letzgocitytours-com/rvtq89dt91?form_factor=desktop this is the analysis I based my notes on



**********************



Regarding Core Web Vitals, in the test I conducted that part seems okay, but nonetheless FH integration is rarely the deciding factor, and if the score is low we have little impact on it.
Typically, with well-optimized sites, it makes little difference whether our API is present or not.
As for the rest, links and buttons do not cause significant slowdowns.
They can always temporarily remove our API and run a test to understand how much our integration affects the final result.
However, it's also worth considering that their homepage is really heavy on content, which can have a significant impact.
CREATE TABLE tweets_extended AS
SELECT
  JSON_VALUE(tweet_json_obj, '$.extended_tweet.full_text') AS full_text,
  JSON_VALUE(tweet_json_obj, '$.extended_tweet.display_text_range[1]') AS text_range,
  JSON_VALUE(tweet_json_obj, '$.id') AS tweet_id
FROM twitter_db.data_db
WHERE JSON_VALUE(tweet_json_obj, '$.extended_tweet.full_text') IS NOT NULL
  AND JSON_VALUE(tweet_json_obj, '$.extended_tweet.display_text_range[1]') IS NOT NULL
  AND JSON_VALUE(tweet_json_obj, '$.id') IS NOT NULL;
CREATE TABLE user_data AS
SELECT
  JSON_VALUE(tweet_json_obj, '$.id') AS tweet_id,
  JSON_VALUE(tweet_json_obj, '$.user.description') AS user_description,
  JSON_VALUE(tweet_json_obj, '$.user.verified') AS user_verified,
  JSON_VALUE(tweet_json_obj, '$.user.followers_count') AS followers_count,
  JSON_VALUE(tweet_json_obj, '$.user.created_at') AS user_created_at,
  JSON_VALUE(tweet_json_obj, '$.user.translator_type') AS translator_type
FROM twitter_db.data_db
WHERE JSON_VALUE(tweet_json_obj, '$.id') IS NOT NULL
  AND JSON_VALUE(tweet_json_obj, '$.user.description') IS NOT NULL
  AND JSON_VALUE(tweet_json_obj, '$.user.verified') IS NOT NULL
  AND JSON_VALUE(tweet_json_obj, '$.user.followers_count') IS NOT NULL
  AND JSON_VALUE(tweet_json_obj, '$.user.created_at') IS NOT NULL
  AND JSON_VALUE(tweet_json_obj, '$.user.translator_type') IS NOT NULL;
CREATE TABLE tweets AS
SELECT 
  JSON_VALUE(data, '$.id') AS tweet_id,
  JSON_VALUE(data, '$.user.id') AS user_id,
  JSON_VALUE(data, '$.created_at') AS created_at,
  JSON_VALUE(data, '$.in_reply_to_user_id') AS in_reply_to_user_id,
  JSON_VALUE(data, '$.in_reply_to_status_id') AS in_reply_to_status_id,
  JSON_VALUE(data, '$.place.country') AS country,
  JSON_VALUE(data, '$.reply_count') AS reply_count,
  JSON_VALUE(data, '$.quote_count') AS quote_count,
  JSON_VALUE(data, '$.retweet_count') AS retweet_count,
  JSON_VALUE(data, '$.favorite_count') AS favorite_count,
  JSON_VALUE(data, '$.retweeted') AS retweeted,
  JSON_VALUE(data, '$.lang') AS lang,
  JSON_VALUE(data, '$.source') AS source,
  JSON_VALUE(data, '$.is_quote_status') AS is_quote_status
  FROM twitter_db.data_db
WHERE JSON_VALUE(data, '$.id') IS NOT NULL
  AND JSON_VALUE(data, '$.user.id') IS NOT NULL
  AND JSON_VALUE(data, '$.created_at') IS NOT NULL
  AND JSON_VALUE(data, '$.in_reply_to_user_id') IS NOT NULL
  AND JSON_VALUE(data, '$.in_reply_to_status_id') IS NOT NULL
  AND JSON_VALUE(data, '$.place.country') IS NOT NULL
  AND JSON_VALUE(data, '$.reply_count') IS NOT NULL
  AND JSON_VALUE(data, '$.quote_count') IS NOT NULL
  AND JSON_VALUE(data, '$.retweet_count') IS NOT NULL
  AND JSON_VALUE(data, '$.favorite_count') IS NOT NULL
  AND JSON_VALUE(data, '$.favorited') IS NOT NULL
  AND JSON_VALUE(data, '$.retweeted') IS NOT NULL
  AND JSON_VALUE(data, '$.lang') IS NOT NULL
  AND JSON_VALUE(data, '$.source') IS NOT NULL
  AND JSON_VALUE(data, '$.is_quote_status') IS NOT NULL;
CREATE TABLE entities AS
SELECT
JSON_VALUE(tweet_json_obj, '$.extended_tweet.entities.hashtags') AS hashtags,
JSON_VALUE(tweet_json_obj, '$.extended_tweet.entities.user_mentions[0].id') AS user_mention0_id,
JSON_VALUE(tweet_json_obj, '$.extended_tweet.entities.user_mentions[1].id') AS user_mention1_id,
JSON_VALUE(tweet_json_obj, '$.extended_tweet.entities.user_mentions[0].name') AS user_mention0_name,
JSON_VALUE(tweet_json_obj, '$.extended_tweet.entities.user_mentions[1].name') AS user_mention1_name,
JSON_VALUE(tweet_json_obj, '$.extended_tweet.entities.user_mentions[0].screen_name') AS user_mention0_screen,
JSON_VALUE(tweet_json_obj, '$.extended_tweet.entities.user_mentions[1].screen_name') AS user_mention1_screen
  FROM twitter_db.data_db
WHERE JSON_VALUE(tweet_json_obj, '$.extended_tweet.entities.hashtags') IS NOT NULL
  AND JSON_VALUE(tweet_json_obj, '$.extended_tweet.entities.user_mentions[0].id') IS NOT NULL
  AND JSON_VALUE(tweet_json_obj, '$.extended_tweet.entities.user_mentions[1].id') IS NOT NULL
  AND JSON_VALUE(tweet_json_obj, '$.extended_tweet.entities.user_mentions[0].name') IS NOT NULL
  AND JSON_VALUE(tweet_json_obj, '$.extended_tweet.entities.user_mentions[1].name') IS NOT NULL
  AND JSON_VALUE(tweet_json_obj, '$.extended_tweet.entities.user_mentions[0].screen_name') IS NOT NULL
  AND JSON_VALUE(tweet_json_obj, '$.extended_tweet.entities.user_mentions[1].screen_name') IS NOT NULL
  AND JSON_VALUE(data, '$.lang') = 'en'; OR JSON_VALUE(data, '$.lang') = 'nl'
Install ACF Plugin, Check if it is there
add new field

Then on the Main Single Poduct Page
add shortcode 
in choose the ACF option
click on the tube looking thing
select the drop down

Then go to the edit page you should see a blank FH shortcode field, in there, add in the FH shortcode
	for each rec in Large_Issue_Section_20_Tracker
	{		
			for each line in rec.Action_Log
			{
				var = line.Staff_Member_Responsible2.Email;
				var2 = Add_POD_Person[Alias_Email == var].ID;
				line.Staff_Member_Responsible = var2;
from :"support@podmanagement.co.uk"
		to :one.Alias_Email
		subject : input.Title_of_Project + " ID: " input.Number  + " has an Action recorded for you to complete for " + three.Development_Name
	message :("<div>Hi " + one.Name_of_Candidate) + "<br><br> An action has been logged for you in " + input.Title_of_Project + "<br><br> The action is to " + input.Description_of_Action + "<br><br> The due date for this action is " + input.Due_Date_of_Action + "<br><br> Many thanks <br><br> POD Support Team</div>"
Concat(
    Split(LookUp(colADD_General, ID = intLastID,GenHotTopics),", "), ThisRecord.Value, ", "
)
&
With
(
    { x: Concat(
            Filter(ComboBoxHotTopics.SelectedItems, ThisRecord.Data <> Blank()),    
            ThisRecord.Data,", "
        )
    }, If(IsBlank(x),"", ", " & x)
)
<input type="text" id="postcodeInput" placeholder="Enter your postcode" maxlength="6" required>
  
document.getElementById("postcodeInput").addEventListener("input", function(event) {
    this.value = this.value.replace(/[^0-9]/g, '');
}); 
#include <stdio.h>

void print_quadratic(int a, int b, int c) 
{
    printf("%dx^2 ", a);
    if (b >= 0) {
        printf("+ %dx ", b);
    } else {
        printf("- %dx ", -b);
    }
    if (c >= 0) {
        printf("+ %d", c);
    } else {
        printf("- %d", -c);
    }
    printf("\n");
}


int main() 
{
    int a, b, c;

    printf("Enter a: \n");
    scanf("%d", &a);
    printf("Enter b: \n");
    scanf("%d", &b);
    printf("Enter c: \n");
    scanf("%d", &c);

    print_quadratic(a, b, c);

    return 0;
}
var $= jQuery; $(document).on('found_variation', 'form.cart', function(event, variation) {
	//update price in custom box
    if (variation.price_html) {
      $('.custom-price-box .elementor-widget-container').html(variation.price_html);
    }
});
/**
 * Filters the next, previous and submit buttons.
 * Replaces the form's <input> buttons with <button> while maintaining attributes from original <input>.
 *
 * @param string $button Contains the <input> tag to be filtered.
 * @param object $form Contains all the properties of the current form.
 *
 * @return string The filtered button.
 */
add_filter('gform_next_button', 'input_to_button', 10, 2);
add_filter('gform_previous_button', 'input_to_button', 10, 2);
add_filter('gform_submit_button,', 'input_to_button', 10, 2);
function input_to_button($button, $form)
{
  $dom = new DOMDocument();
  $dom->loadHTML('<?xml encoding="utf-8" ?>' . $button);
  $input = $dom->getElementsByTagName('input')->item(0);
  $new_button = $dom->createElement('button');
  $new_button->appendChild($dom->createTextNode($input->getAttribute('value')));
  $input->removeAttribute('value');
  foreach ($input->attributes as $attribute) {
    $new_button->setAttribute($attribute->name, $attribute->value);
  }

  $classes = $new_button->getAttribute('class');
  $classes .= " btn";
  $new_button->setAttribute('class', $classes);
  $input->parentNode->replaceChild($new_button, $input);

  return $dom->saveHtml($new_button);
}
// Invalide a Node cache.
\Drupal::service('cache_tags.invalidator')->invalidateTags(['node:5']);
// Invalidate a custom entity cache.
\Drupal::service('cache_tags.invalidator')->invalidateTags(['custom_entity:5']);
// Invalidate a custom cache tag.
\Drupal::service('cache_tags.invalidator')->invalidateTags(['thing:identifier']);
1.
//main.java
import java.io.*;
import java.text.*;
import java.util.*;
   public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("1.Current Account\n2.Savings Account");
        int choice = scanner.nextInt();
        scanner.nextLine(); // consume newline
        System.out.println("Name");
        String name = scanner.nextLine();
        System.out.println("Account Number");
        int number = scanner.nextInt();
        System.out.println("Account Balance");
        int balance = scanner.nextInt();
        scanner.nextLine(); // consume newline
        System.out.println("Enter the Start Date(yyyy-mm-dd)");
        String startDateStr = scanner.nextLine();
        System.out.println("Enter the Due Date(yyyy-mm-dd)");
        String dueDateStr = scanner.nextLine();

        Date startDate = parseDate(startDateStr);
        Date dueDate = parseDate(dueDateStr);

        Account account;
        if (choice == 1) {
            account = new CurrentAccount(name, number, balance, startDate);
        } else {
            account = new SavingsAccount(name, number, balance, startDate);
        }

        double interest = account.calculateInterest(dueDate);
        String accountType = (choice == 1) ? "Current" : "Savings";
        System.out.printf("%s Account Interest %.2f%n", accountType, interest);
    }

    private static int monthsDifference(Date startDate, Date endDate) {
        Calendar c1 = new GregorianCalendar();
        c1.setTime(startDate);

        Calendar c2 = new GregorianCalendar();
        c2.setTime(endDate);

        int ans = (c2.get(Calendar.YEAR) - c1.get(Calendar.YEAR)) * 12;
        ans += c2.get(Calendar.MONTH) - c1.get(Calendar.MONTH);

        return ans;
    }

    private static Date parseDate(String dateString) {
        try {
            return new SimpleDateFormat("yyyy-MM-dd").parse(dateString);
        } catch (ParseException e) {
            e.printStackTrace();
            return null;
        }
    }
}
//accout.java
import java.util.* ;
   public abstract class Account {
    String name;
    int number;
    int balance;
    Date startDate;

    Account(String name, int number, int balance, Date startDate) {
        this.name = name;
        this.number = number;
        this.balance = balance;
        this.startDate = startDate;
    }

    abstract double calculateInterest(Date dueDate);
    protected static int monthsDifference(Date startDate, Date endDate) {
        Calendar c1 = new GregorianCalendar();
        c1.setTime(startDate);

        Calendar c2 = new GregorianCalendar();
        c2.setTime(endDate);

        int ans = (c2.get(Calendar.YEAR) - c1.get(Calendar.YEAR)) * 12;
        ans += c2.get(Calendar.MONTH) - c1.get(Calendar.MONTH);

        return ans;
    }
  
}
//currentaccount.java
import java.util.*;
public class CurrentAccount extends Account {
    CurrentAccount(String name, int number, int balance, Date startDate) {
        super(name, number, balance, startDate);
    }

    
    double calculateInterest(Date dueDate) {
        int months = monthsDifference(startDate, dueDate);
        double rate = 5.0 / 12 / 100; 
        return balance * rate * months;
    }
      
}   
//savingsaccount.java
import java.util.*;
   public class SavingsAccount extends Account {
    SavingsAccount(String name, int number, int balance, Date startDate) {
        super(name, number, balance, startDate);
    }


    double calculateInterest(Date dueDate) {
        int months = monthsDifference(startDate, dueDate);
        double rate = 12.0 / 12 / 100; 
        return balance * rate * months;
    }
      
}


2..
//icici.java
class Icici implements Notification {
    //Fill your code here
     public void notificationBySms() {
        System.out.println("ICICI - Notification By SMS");
    }

    
    public void notificationByEmail() {
        System.out.println("ICICI - Notification By Mail");
    }


    public void notificationByCourier() {
        System.out.println("ICICI - Notification By Courier");
    }
}

//bankfactory.java
class BankFactory {
    //Fill your code here
    public Icici getIcici() {
        return new Icici();
    }

    public Hdfc getHdfc() {
        return new Hdfc();
    }
}
//notification.java
interface Notification {
   //Fill your code here
    void notificationBySms();
    void notificationByEmail();
    void notificationByCourier();
}
//main.java
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("Welcome to Notification Setup");
        System.out.println("Please select your bank:");
        System.out.println("1) ICICI");
        System.out.println("2) HDFC");
        
        int bankChoice = scanner.nextInt();
        if (bankChoice == 1 || bankChoice == 2) {
            System.out.println("Enter the type of Notification you want to enter");
            System.out.println("1) SMS");
            System.out.println("2) Mail");
            System.out.println("3) Courier");
            
            int notificationChoice = scanner.nextInt();
            
            BankFactory bankFactory = new BankFactory();
            if (bankChoice == 1) {
                Icici icici = bankFactory.getIcici();
                switch (notificationChoice) {
                    case 1:
                        icici.notificationBySms();
                        break;
                    case 2:
                        icici.notificationByEmail();
                        break;
                    case 3:
                        icici.notificationByCourier();
                        break;
                    default:
                        System.out.println("Invalid Input");
                }
            } else {
                Hdfc hdfc = bankFactory.getHdfc();
                switch (notificationChoice) {
                    case 1:
                        hdfc.notificationBySms();
                        break;
                    case 2:
                        hdfc.notificationByEmail();
                        break;
                    case 3:
                        hdfc.notificationByCourier();
                        break;
                    default:
                        System.out.println("Invalid Input");
                }
            }
        } else {
            System.out.println("Invalid Input");
        }
    }
}
//hdfc.java
class Hdfc implements Notification {
    //Fill your code here
     public void notificationBySms() {
        System.out.println("HDFC - Notification By SMS");
    }

    
    public void notificationByEmail() {
        System.out.println("HDFC - Notification By Mail");
    }

    
    public void notificationByCourier() {
        System.out.println("HDFC - Notification By Courier");
    }
}

git checkout master
git pull origin master
git merge test
git push origin master
question 1.

#include <iostream>

using namespace std;
//Abstract class becuase it contain ppure virtual function
class Vehicle{
    
    public:
   virtual void drive() = 0;
};

class Car: public Vehicle{
    public:
    void drive(){
        cout<<"Driving a car "<<endl;
    }
};

class Motorcycle: public Vehicle{
    public:
    void drive(){
        cout<<"Driving a motorcycle"<<endl;
    }
};


int main() {
    //Abstract class can not be instantiated. but you can write as pointer and 
    Vehicle *obj;
   Car c;
   obj = &c;
   obj->drive();
   Motorcycle m;
   obj = &m;
   obj->drive();

    return 0;
}
//OUTPUT:
Driving a car 
Driving a motorcycle
____________________________________________________________

Question 2:
#include <iostream>

using namespace std;

class Shape{
    
    public:
   double Area(){
       return 0.0;
   }
   
};

class Rectangle: public Shape{
    double width;
    double length;
    public:
    Rectangle(double width, double length){
        this->width = 10;
        this->length = 10;
    }
    double Area(){
        //int area = width * length;
        return width * length;
        //cout<<"Area of Rectangle = "<<area<<endl;
    }
    
};

class Triangle: public Shape{
    double base;
    double heigth;
    public:
    Triangle(double b, double h):base(b),heigth(h){
        
    }
    double Area(){
        return 0.5 * base * heigth;
    }
};

int main() {
    Shape *shape;
    Rectangle rect(10, 10);
    shape = &rect;
    shape->Area();
   
    

    return 0;
}

________________________________________________________________-
  Question 3.
#include <iostream>

using namespace std;

class Animal{
    
    protected:
    string name;
    public:
    Animal(string name){
        this->name = name;
    }
    virtual void makeSound(){
        cout<<"Animal: "<<endl;
    }
   
};

class Dog: public Animal{
    string breed;
    public:
    Dog(string name, string breed):Animal(name){
        this->breed = breed;
    }
    void makeSound(){
        //Animal::makeSound(); to call makeSound function in Animal class
        cout<<"Dog makes Sound."<<endl;
    }
    void display(){
        cout<<"Dog Name: "<<name<<endl;
        cout<<"Dog Breed: "<<breed<<endl;
    }
};

class Cat: public Animal{
    string color;
    
    public:
    Cat(string name, string color):Animal(name){
        this->color = color;
    }
    void makeSound(){
        cout<<"Cat makes Sound."<<endl;
    }
    void display(){
        cout<<"Cat Name: "<<name<<endl;
        cout<<"Cat Color "<<color<<endl;
    }
};

int main() {
    
    
    Dog d("Doggy","Male");
    d.display();
    d.makeSound();
    cout<<endl;
    Cat c("Catty","Brown");
    c.display();
    c.makeSound();
   
    

    return 0;
}
//OUTPUT:
Dog Name: Doggy
Dog Breed: Male
Dog makes Sound.

Cat Name: Catty
Cat Color Brown
Cat makes Sound.
#include <iostream>

using namespace std;
//PUre Virtual Function
class Employee{
    int code;
    string name[20];
    public:
    virtual void getData();
    virtual void Display();
};
class Grade : public Employee{
    char grade[20];
    float salary;
    
    public:
    void getData();
    void Display();
};

void Employee::getData(){
    
}
void Employee::Display(){
    
}
void Grade::getData(){
    cout<<"Enter Employee Grade: "<<endl;
    cin>>grade;
    cout<<"Enter Employee Salaray: "<<endl;
    cin>>salary;
}
void Grade::Display(){
    cout<<"Employee Grade is: "<<grade<<endl;
    cout<<"Employee Salaray is: "<<salary<<endl;
}

int main() {
    Employee *ptr;
    Grade obj;
    ptr = &obj;
    ptr->getData();
    ptr->Display();

    return 0;
}
//OUTPUT:
Enter Employee Grade: 
A
Enter Employee Salaray: 
24000
Employee Grade is: A
Employee Salaray is: 24000
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions\
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{24ad3ad4-a569-4530-98e1-ab02f9417aa8}
#include <iostream>

using namespace std;
//Hierarchical inheritance
class Employee{
    
    protected:
    string name;
    int employeeID;
    
    public:
    
    void inputEmployeeInfo(){
        cout<<"Enter name: "<<endl;
        cin>>name;
        cout<<"Enter Employee ID: "<<endl;
        cin>>employeeID;
    }
    void displayEmployeeInfo(){
        cout<<"Name: "<<name<<endl;
        cout<<"Employee ID: "<<employeeID<<endl;
    }
};
//Derived Manager Class From Employee Class

class Manager :virtual public Employee{
    protected:
    int level;
    public:
    void inputManagerInfo(){
        //inputEmployeeInfo();
        cout<<"Enter Manager Level: "<<endl;
        cin>>level;
    }
    void displayManagerInfo(){
        //displayEmployeeInfo();
        cout<<"Manager Level: "<<level<<endl;
    }
};
//Derived Developer Class From Employee
class Developer : virtual public Employee{
    protected:
    int progLang;
    public:
    void inputDeveloperInfo(){
        //inputEmployeeInfo();
        cout<<"Enter Programing Language: "<<endl;
        cin>>progLang;
    }
    void displayDeveloperInfo(){
        //displayEmployeeInfo();
        cout<<"Programing Language: "<<progLang<<endl;
    }
};
//DErived class for Teamlead That will display both info manager and developer
class TeamLead : public Manager, public Developer{
    
    public:
    
    void inputInfo(){
        inputEmployeeInfo();   // Employee Info
        inputManagerInfo();    // Manager Info
        inputDeveloperInfo();   //Developer Info
    }

    void displayInfo(){
        cout<<"Team Lead Details: "<<endl;
        displayEmployeeInfo(); // Employee Info
        displayManagerInfo();  // Manager Info
        displayDeveloperInfo();  //Developer Info
    }
};

int main() {
    
    TeamLead tl;
    tl.inputInfo();
    cout<<endl;
    tl.displayInfo();
    
   

    return 0;
}

//OUTPUT:
Enter name: 
mohamed
Enter Employee ID: 
1222
Enter Manager Level: 
7
Enter Programing Language: 
java

Team Lead Details: 
Name: mohamed
Employee ID: 1222
Manager Level: 7
Programing Language: java
#include <iostream>

using namespace std;
//Hierarchical inheritance
class Shape{
    
    public:
    double area(){
    return 0.0;
    }
    
    void displayShape(){
        cout<<"Generic Shape: ";
    }
};
//Derived REctangle Class From Shape Class
class Rectangle:public Shape{
    double width;
    double length;
    
    public:
    //You can write like this also:
    Rectangle(double w, double l){
        width = w;
        length = l;
    }
    //Both of them are same
    //Rectangle(double w, double l):width(w),length(l){
        
    //}
    double AreaRectangle(){
        return width * length;
    }
    void displayRectangleInfo(){
        displayShape();
        cout<<"Rectangle: \nLength = "<<length<<"\nwidth = "<<width<<"\nArea of Rectangle = "<<AreaRectangle()<<endl;
    }
};
//Second Derived Circle class from Shape class
class Circle:public Shape{
    
    double radius;
    
    public:
    Circle(double r):radius(r){
        
    }
    double AreaCircle(){
        return 3.14 * radius * radius;
    }
    void displayCircleInfo(){
        displayShape();
        cout<<"Circle: \nRadius = "<<radius<<"\nArea of Circle = "<<AreaCircle()<<endl;
    }
};
//Third Derived class from Shape
class Triangle:public Shape {
    
    double base;
    double heigth;
    
    public:
    Triangle(double b, double h):base(b),heigth(h){
        
    }
    double AreaTriangle(){
        return 0.5 * base * heigth;
    }
    void displayTriangleInfo(){
        displayShape();
        cout<<"Triangle: \nBase = "<<base<<"\nHeigth = "<<heigth<<"\nArea of Triangle = "<<AreaTriangle()<<endl;
    }
};

int main() {
    Rectangle rect(10.2, 20.2);
    rect.displayRectangleInfo();
    cout<<endl;
    Circle c(10);
    c.displayCircleInfo();
    cout<<endl;
    Triangle tri(10.2, 10.1);
    tri.displayTriangleInfo();

    return 0;
}
//OUTPUT:
Generic Shape: Rectangle: 
Length = 20.2
width = 10.2
Area of Rectangle = 206.04

Generic Shape: Circle: 
Radius = 10
Area of Circle = 314

Generic Shape: Triangle: 
Base = 10.2
Heigth = 10.1
Area of Triangle = 51.51
setTimeout(async () => {
    // Asynchronously fetch all necessary fields from Feathery
    const {
        bot_triggered,
        reliasure_age_group,
        reliasure_form_zip,
        reliasure_life_event,
        reliasure_insurance_use,
        reliasure_income,
        reliasure_gender,
        reliasure_dob_month,
        reliasure_dob_day,
        reliasure_dob_year,
        reliasure_fname,
        reliasure_lname,
        reliasure_street_address,
        reliasure_city,
        reliasure_state,
        reliasure_zip,
        reliasure_email,
        reliasure_phone,
        reliasure_aca,
        spiderscore,
        utm_source,
        zippopotamus_return,
        fbclid,
        good_lead,
        ipaddress,
        reliasure_edit_address,
        insurance_people,
        reliasure_apply,
        feathery_user_id,
        feathery_form_name
    } = await feathery.getFieldValues();

    if (bot_triggered === false) {
        const payload = {
            reliasure_age_group,
            reliasure_form_zip,
            reliasure_life_event,
            reliasure_insurance_use,
            reliasure_gender,
            reliasure_dob_month,
            reliasure_dob_day,
            reliasure_dob_year,
            reliasure_fname,
            reliasure_lname,
            reliasure_street_address,
            reliasure_city,
            reliasure_state,
            reliasure_zip,
            reliasure_email,
            reliasure_phone,
            reliasure_aca,
            spiderscore,
            utm_source,
            zippopotamus_return,
            fbclid,
            good_lead,
            ipaddress,
            reliasure_edit_address,
            insurance_people,
            reliasure_apply,
            feathery_user_id,
            feathery_form_name
        };

        // Update bot_triggered to true in Feathery to indicate the bot has been triggered
         feathery.setFieldValues({ bot_triggered: true });
        console.log("Triggering bot and setting bot_triggered to true");

        // Function to load URL in a hidden iframe
        const loadUrlInHiddenIframe = () => {
            const refValue = `WebsiteTraffic--${reliasure_fname}--770490--${reliasure_fname}--984184--${reliasure_lname}--658292--${reliasure_email}--578105--${reliasure_phone}--372998--${reliasure_aca}`;
            const iframeUrl = `https://app.strikedm.com/webchat/?p=1325191&ref=${refValue}`;

            const iframe = document.createElement('iframe');
            iframe.style.cssText = "width:0; height:0; border:0; opacity:0; position:absolute;";
            iframe.src = iframeUrl;

            document.body.appendChild(iframe);

            // Cleanup after 5 seconds
            setTimeout(() => document.body.removeChild(iframe), 5000);
        };

        // Call the function to load URL in hidden iframe
        loadUrlInHiddenIframe();
    } else {
        console.log("Bot has already been triggered");
    }
}, 5000); // Delay set for 5 seconds
## EXPIRES HEADER CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType image/svg "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType application/javascript "access 1 month"
ExpiresByType application/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 2 days"
</IfModule>
## EXPIRES HEADER CACHING ##
#include<stdlib.h>
#include<sys/stat.h>
#include<sys/types.h>
#include <stdio.h>
int main(int argc,char *argv[])
{
    const char *p=argv[1];
    const char *f= argv[2];
    mode_t mode=strtol(p,NULL,8);
    if(chmod(f,mode)==-1)
    {
 
       perror("chmod");
       exit (EXIT_FAILURE);
}
   printf("perms are changed");
    return 0;
}
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <dirent.h>
#include <pwd.h>
#include <grp.h>
#include <time.h>
#include <sys/stat.h>
#include <limits.h>

void print_permission(mode_t mode) {
    printf((S_ISDIR(mode)) ? "d" : "-");
    printf((mode & S_IRUSR) ? "r" : "-");
    printf((mode & S_IWUSR) ? "w" : "-");
    printf((mode & S_IXUSR) ? "x" : "-");
    printf((mode & S_IRGRP) ? "r" : "-");
    printf((mode & S_IWGRP) ? "w" : "-");
    printf((mode & S_IXGRP) ? "x" : "-");
    printf((mode & S_IROTH) ? "r" : "-");
    printf((mode & S_IWOTH) ? "w" : "-");
    printf((mode & S_IXOTH) ? "x" : "-");
}

void ls_l(const char *dirname) {
    DIR *dir;
    struct dirent *entry;
    struct stat file_stat;
    
    if ((dir = opendir(dirname)) == NULL) {
        perror("opendir");
        exit(EXIT_FAILURE);
    }
    
    while ((entry = readdir(dir)) != NULL) {
        char path[PATH_MAX];
        snprintf(path, PATH_MAX, "%s/%s", dirname, entry->d_name);
        if (stat(path, &file_stat) == -1) {
            perror("stat");
            exit(EXIT_FAILURE);
        }
        struct passwd *user_info = getpwuid(file_stat.st_uid);
        struct group *group_info = getgrgid(file_stat.st_gid);
        printf("%20s %-8s %-8s %lld ", entry->d_name, user_info->pw_name, group_info->gr_name, (long long)file_stat.st_size);
        print_permission(file_stat.st_mode);
        struct tm *time_info = localtime(&file_stat.st_mtime);
        char time_str[80];
        strftime(time_str, sizeof(time_str), "%b %d %H:%M", time_info);
        printf(" %s\n", time_str);
    }
    closedir(dir);
}

int main(int argc, char *argv[]) {
    ls_l(argv[1]);
    return 0;
}
function testBrackets(input) {
    let bracketsObj = {
        '{':'}',
        '[':']',
        '(': ')'
    }
    let bracketKeys = Object.keys(bracketsObj)
    
    const stack = []
    for(str of input){
        if (bracketKeys.includes(str)){
            stack.push(str)
        } else if (bracketsObj[stack.pop()] !== str){
            return false
        }
    }
    
    return stack.length == 0
}
//GenCode
	myList = {0,1,2,3,4,5,6,7,8,9,10};
	passString = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	newList = "";
	//
	for each index i in myList
	{
		randnum = randomNumber(1,62);
		newList = newList + substring(passString,randnum,randnum + 1);
	}
	verify = replaceAll(newList,",","");
	input.GenCode = verify;
	//Send email
	sendmail
	[
		from :"noreply@podmanagement.co.uk"
		to :input.Email
		subject :"POD Management Work Order Master [Verification Code]"
		message :"<div>Please use the following code to access the report.</div><div><br></div><div><b><span class=\"size\" style=\"font-size: 18.666666666666664px\">" + verify + "<br></span></b><br></div><div><br></div><div><span class=\"size\" style=\"font-size: 13.333333333333332px\">Regards,</span><span class=\"size\" style=\"font-size: 13.333333333333332px\"><br></span></div><div><span class=\"size\" style=\"font-size: 13.333333333333332px\"><br></span></div><div><span class=\"size\" style=\"font-size: 13.333333333333332px\">POD Management Team​</span><br></div>"
	]
		contact_map = Map();
		contact_map.put("First_Name	",rep.get("Name1_First"));
		contact_map.put("Last_Name",rep.get("Name1_Last"));
		contact_map.put("Mailing_City",rep.get("Address3_City"));
		contact_map.put("Phone",rep.get("PhoneNumber2"));
		contact_map.put("Mailing_State",rep.get("Address3_Region"));
		contact_map.put("Mailing_Zip",rep.get("Address3_ZipCode"));
		contact_map.put("Mailing_Street",rep.get("Address3_AddressLine1"));
		contact_map.put("Mailing_Street_Line_2",rep.get("Address3_AddressLine2"));
		contact_map.put("Email",rep.get("Email2"));
		contact_map.put("Mailing_Country",rep.get("Address3_Country"));
		contact_map.put("Social_Security_Number",rep.get("SingleLine4"));
		contact_map.put("Passport_Number",rep.get("SingleLine5"));
		contact_map.put("Is_the_legal_representative_an_American_citizen",rep.get("Dropdown3"));
		contact_map.put("Title",rep.get("SingleLine7"));
		contact_map.put("Occupation",rep.get("SingleLine8"));
		contact_map.put("Account_Name",account_id);
		// 		info contact_map;
		create_contact = zoho.crm.createRecord("Contacts",contact_map);
		info create_contact;
		if(create_contact.containKey("id"))
		{
			contact_id = create_contact.get("id");
			//////// Get Roles Ids /////
			// 		get_contact_roles_ids = invokeurl
			// 		[
			// 			url :"https://www.zohoapis.com/crm/v4/Contacts/roles"
			// 			type :GET
			// 			connection:"zoho_crm"
			// 		];
			// 		info get_contact_roles_ids;
			////////////////////////////////////////////////////
			//////////////// Add Contact role to a specific deal ////////
			role_map = Map();
			role_map.put("name","Legal Representative");
			role_map.put("id","6051205000000006871");
			Contact_Role = Map();
			Contact_Role.put("Contact_Role",role_map);
			data = Map();
			data.put("data",Contact_Role.toList());
          //////// 6051205000001977001 is Contact Id /////////
			add_contact_role_to_deal = invokeurl
			[
				url :"https://www.zohoapis.com/crm/v4/Deals/6051205000001947026/Contact_Roles/6051205000001977001"
				type :PUT
				parameters:data.toString()
				connection:"zoho_crm"
			];
			info add_contact_role_to_deal;
        }
star

Fri May 10 2024 02:27:32 GMT+0000 (Coordinated Universal Time)

@exam123

star

Fri May 10 2024 02:26:35 GMT+0000 (Coordinated Universal Time)

@exam123

star

Fri May 10 2024 02:25:59 GMT+0000 (Coordinated Universal Time)

@exam123

star

Fri May 10 2024 02:25:28 GMT+0000 (Coordinated Universal Time)

@exam123

star

Fri May 10 2024 02:25:01 GMT+0000 (Coordinated Universal Time)

@exam123

star

Fri May 10 2024 02:24:18 GMT+0000 (Coordinated Universal Time)

@exam123

star

Fri May 10 2024 01:01:12 GMT+0000 (Coordinated Universal Time)

@santonil2003

star

Thu May 09 2024 22:05:55 GMT+0000 (Coordinated Universal Time)

@diptish #plotting #wrf

star

Thu May 09 2024 21:27:55 GMT+0000 (Coordinated Universal Time) view-source:https://www.w3schools.com/colors/colors_picker.asp

@enzqr

star

Thu May 09 2024 21:00:51 GMT+0000 (Coordinated Universal Time)

@madgakantara

star

Thu May 09 2024 20:43:47 GMT+0000 (Coordinated Universal Time)

@madgakantara

star

Thu May 09 2024 20:04:59 GMT+0000 (Coordinated Universal Time)

@Shira

star

Thu May 09 2024 17:33:27 GMT+0000 (Coordinated Universal Time)

@madgakantara

star

Thu May 09 2024 16:33:06 GMT+0000 (Coordinated Universal Time)

@Shira

star

Thu May 09 2024 14:58:30 GMT+0000 (Coordinated Universal Time) https://www.youtube.com/watch?v

@Mariukas45

star

Thu May 09 2024 14:49:13 GMT+0000 (Coordinated Universal Time) https://www.youtube.com/watch?v

@Mariukas45

star

Thu May 09 2024 14:42:16 GMT+0000 (Coordinated Universal Time) https://www.youtube.com/watch?v

@Mariukas45

star

Thu May 09 2024 14:38:02 GMT+0000 (Coordinated Universal Time) https://xhamster.com/videos/oral-sex-7156210

@Mariukas45

star

Thu May 09 2024 14:33:24 GMT+0000 (Coordinated Universal Time) https://xhamster.com/videos/anal-sex-xhPYZ4n

@Mariukas45

star

Thu May 09 2024 14:24:27 GMT+0000 (Coordinated Universal Time) https://xhamster.com/videos/anal-sex

@Mariukas45

star

Thu May 09 2024 13:24:16 GMT+0000 (Coordinated Universal Time)

@nishpod

star

Thu May 09 2024 12:36:35 GMT+0000 (Coordinated Universal Time)

@nishpod

star

Thu May 09 2024 12:00:02 GMT+0000 (Coordinated Universal Time)

@Jotab #combobox #default

star

Thu May 09 2024 11:03:42 GMT+0000 (Coordinated Universal Time) https://darkwebmarketbuyer.com/product/gsm-data-receiver-wireless-automatic-atm/

@darkwebmarket

star

Thu May 09 2024 10:22:23 GMT+0000 (Coordinated Universal Time)

@divyasoni23 #javascript

star

Thu May 09 2024 10:01:04 GMT+0000 (Coordinated Universal Time)

@meanaspotato #c

star

Thu May 09 2024 07:49:23 GMT+0000 (Coordinated Universal Time)

@ngoctran #javascript

star

Thu May 09 2024 07:20:54 GMT+0000 (Coordinated Universal Time)

@divyasoni23 #css

star

Thu May 09 2024 05:25:25 GMT+0000 (Coordinated Universal Time) https://drupal.stackexchange.com/questions/255497/how-do-i-invalidate-the-cache-of-an-entity

@al.thedigital #invalidate #node #cache

star

Thu May 09 2024 04:45:56 GMT+0000 (Coordinated Universal Time)

@cms

star

Thu May 09 2024 04:28:37 GMT+0000 (Coordinated Universal Time) https://www.youtube.com/watch?v

@Mariukas45

star

Thu May 09 2024 04:24:55 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/5601931/how-do-i-safely-merge-a-git-branch-into-master

@al.thedigital #git #merge #safely #featuretomaster

star

Thu May 09 2024 00:57:14 GMT+0000 (Coordinated Universal Time)

@Mohamedshariif #c++

star

Wed May 08 2024 21:58:49 GMT+0000 (Coordinated Universal Time)

@Mohamedshariif #c++

star

Wed May 08 2024 21:55:59 GMT+0000 (Coordinated Universal Time) https://g-ek.com/papki-etot-kompyuter-windows-10

@qwdixq

star

Wed May 08 2024 21:55:31 GMT+0000 (Coordinated Universal Time) https://g-ek.com/papki-etot-kompyuter-windows-10

@qwdixq

star

Wed May 08 2024 21:50:39 GMT+0000 (Coordinated Universal Time) https://g-ek.com/papki-etot-kompyuter-windows-10

@qwdixq

star

Wed May 08 2024 21:22:18 GMT+0000 (Coordinated Universal Time) https://app.dhiwise.com/application/663baeaf5db33e0023ddcb7f

@Helda123

star

Wed May 08 2024 21:21:20 GMT+0000 (Coordinated Universal Time) undefined

@Helda123

star

Wed May 08 2024 20:58:43 GMT+0000 (Coordinated Universal Time)

@Mohamedshariif #c++

star

Wed May 08 2024 20:20:56 GMT+0000 (Coordinated Universal Time)

@Mohamedshariif #c++

star

Wed May 08 2024 19:11:38 GMT+0000 (Coordinated Universal Time) https://mapsplatform.google.com/

@uvacoder

star

Wed May 08 2024 19:09:31 GMT+0000 (Coordinated Universal Time) https://GitHub.com

@uvacoder

star

Wed May 08 2024 18:00:19 GMT+0000 (Coordinated Universal Time)

@nikanika4425

star

Wed May 08 2024 16:49:02 GMT+0000 (Coordinated Universal Time) https://kinsta.com/it/knowledgebase/aggiungere-gli-header-expires-in-wordpress/

@mraimondi3

star

Wed May 08 2024 16:46:18 GMT+0000 (Coordinated Universal Time)

@signup

star

Wed May 08 2024 16:37:02 GMT+0000 (Coordinated Universal Time)

@signup

star

Wed May 08 2024 15:47:05 GMT+0000 (Coordinated Universal Time)

@sooraz3871 #javascript

star

Wed May 08 2024 13:40:02 GMT+0000 (Coordinated Universal Time)

@nishpod

star

Wed May 08 2024 13:15:12 GMT+0000 (Coordinated Universal Time)

@RehmatAli2024 #deluge #zoho

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension