Snippets Collections
# Create a virtual environment
python -m venv venv  # Windows
python3 -m venv venv  # MacOS/Linux

# Activate the virtual environment
venv\Scripts\activate  # Windows
source venv/bin/activate  # MacOS/Linux

# Install required packages
pip install kivy

# Create requirements.txt file
pip freeze > requirements.txt

# Run a test script
python test.py

--------------------------
in case of an POLICY error -- 
PS D:\Coding Stuff, Editing\Visual Studio Python Codings\MyProjects\BurgerBillingSystem> .\burger-billing-system-env\Scripts\activate     
.\burger-billing-system-env\Scripts\activate : File D:\Coding Stuff, Editing\Visual Studio Python 
Codings\MyProjects\BurgerBillingSystem\burger-billing-system-env\Scripts\Activate.ps1 cannot be loaded because running scripts is disabled on this system.     
For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ .\burger-billing-system-env\Scripts\activate
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

The error message you are encountering indicates that running scripts is disabled on your systems PowerShell execution policy. This is a security measure to prevent malicious scripts from running.

Here is how to fix this and activate your virtual environment:

Change the Execution Policy (For Administrators Only):

Open PowerShell as Administrator. "Right-click on the PowerShell" icon and select "Run as administrator".

Type the following command and press Enter:
"PowerShell Set-ExecutionPolicy RemoteSigned -Scope CurrentUser"

Activate the Virtual Environment (After Policy Change):
Navigate to your project directory using the cd command in PowerShell.
Run the activation command again:

---------------------------------
For Anaconda Jupyter Notebook -
pip install venv
python -m venv env_test
.\env_test\Scripts\activate
pip install ipykernel
python -m ipykernel install --user --name kernel_ai_cnn_1
import { rdsConnection } from "@/lib/aws";
import { v4 as uuidv4 } from "uuid";

export async function insertVessel(data) {
  const {
    cargo_type,
    cargo_sub_type,
    imo,
    mmsi,
    vessel_name,
    year_of_build,
    flag,
    grt,
    dwt,
    overall_length,
    beam,
  } = data;

  const vessel_id = uuidv4();

  const query = `
    INSERT INTO spotship_vessel (
      vessel_id, cargo_type, cargo_sub_type, ais_enabled, map_enabled, imo, mmsi, vessel_name, year_of_build, flag, grt, dwt, overall_length, beam
    ) VALUES (?, ?, ?, 1, 1, ?, ?, ?, ?, ?, ?, ?, ?, ?)
  `;

  return new Promise((resolve, reject) => {
    rdsConnection.query(
      query,
      [
        vessel_id,
        cargo_type,
        cargo_sub_type,
        imo,
        mmsi,
        vessel_name,
        year_of_build,
        flag,
        grt,
        dwt,
        overall_length,
        beam,
      ],
      (error, results) => {
        if (error) {
          return reject(error);
        }
        resolve(results);
      },
    );
  });
};
import type { NextApiRequest, NextApiResponse } from "next";
import { insertVessel } from "@/lib/db";

export default async function handler(
  req: NextApiRequest,
  res: NextApiResponse,
) {
  if (req.method === "POST") {
    try {
      const result = await insertVessel(req.body);
      return res.status(200).json({ success: true, data: result });
    } catch (error) {
      return res.status(500).json({ success: false, error: error.message });
    }
  } else {
    res.setHeader("Allow", ["POST"]);
    return res
      .status(405)
      .send(`Method ${req.method ?? "Undefined"} Not Allowed`);
  }
}
	$(document).ready(function () {
			$(document).on('mousewheel', function (event) {
				if (event.originalEvent.wheelDelta > 0 || event.originalEvent.detail < 0) {
					// Mouse wheel up
					$('.nav-main, .header__contact').css({
						opacity: '1',
						visibility: 'visible',
						overflow: 'visible',
					});
				} else {
					// Mouse wheel down
					$('.nav-main, .header__contact').css({
						opacity: '0',
						visibility: 'hidden',
						overflow: 'hidden',
					});
				}
			});
		});
# installs nvm (Node Version Manager)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
# download and install Node.js (you may need to restart the terminal)
npm install 20
# verifies the right Node.js version is in the environment
node -v # should print `v20.14.0`
# verifies the right NPM version is in the environment
npm -v # should print `10.7.0`
img {
          margin: 0 auto;
          width: 800px;
          @include respond-to(maxlarge) {
            width: 700px;
          }
            @include respond-to(desktop) {
                width: 600px;
            }
            @include respond-to(tabs) {
                width: 500px;
            }
            @include respond-to(phablet) {
                width: 450px;
            }
          @include respond-to(mobile) {
            width: 420px;
          }
        }


   .slide-video{
            border-radius: 20px;
            width: 800px;
            @include respond-to(maxlarge) {
              width: 700px;
            }
            @include respond-to(desktop) {
              width: 600px;
            }
            @include respond-to(tabs) {
              width: 500px;
            }
            @include respond-to(phablet) {
              width: 450px;
            }
          }
#include <iostream>
using namespace std;

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

    for (int i = 1; i < 30; ++i) {
        cout << "Digite as notas: " << endl;
        cin >> a >> b >> c;
       cout << "Media do aluno e de: "<< (a + b + c)/3 << endl;
    }

    return 0;
}
#include <iostream>
#include <string>
using namespace std;
int main(){
  string meses[12] = {"Janeiro", "Fevereiro", "Marco", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"};
  int numero;
  cin >> numero;
  if (numero >= 1 && numero <= 12){
    cout << meses[numero -1] << endl;
  } else {
    cout << "Numero invalido" << endl;
  }
}
	add_filter('woocommerce_product_add_to_cart_text', 'custom_woocommerce_product_add_to_cart_text');

	function custom_woocommerce_product_add_to_cart_text($text) {
		global $product;
		if ($product->is_type('external')) {
			return __('See Prices', 'woocommerce');
		}
		return $text;
	}
function custom_external_add_to_cart_button($button, $product) {
    if ($product->is_type('external')) {
        // URL of the Amazon icon image
        $icon_url = 'https://mejormovil.es/wp-content/themes/woodmart/images/amazon-icon.png';
        $button_text = 'See Prices';

        // Create the button HTML with the Amazon icon and new text
        $button = sprintf(
            '<a href="%s" class="button product_type_external add-to-cart-loop customize-unpreviewable" data-product_id="%s" aria-label="%s" rel="nofollow">
                <img src="%s" style="width: 20px; height: auto; margin-right: 5px; vertical-align: middle;" alt="Amazon Icon"/> %s
            </a>',
            esc_url($product->add_to_cart_url()), // URL for the product
            esc_attr($product->get_id()), // Product ID
            esc_attr($product->add_to_cart_description()), // ARIA label
            esc_url($icon_url), // Amazon icon URL
            esc_html($button_text) // Button text
        );
    }
    return $button;
}
add_filter('woocommerce_loop_add_to_cart_link', 'custom_external_add_to_cart_button', 10, 2);
impl Point {
    pub fn new(x: u16, y: u16) -> Self {
        Self { x, y }
    }

    pub fn transform(&self, direction: Direction, times: u16) -> Self {
        let times = times as i16;
        let transformation = match direction {
            Direction::Up => (0, -times),
            Direction::Right => (times, 0),
            Direction::Down => (0, times),
            Direction::Left => (-times, 0),
        };

        Self::new(
            Self::transform_value(self.x, transformation.0),
            Self::transform_value(self.y, transformation.1),
        )
    }

    fn transform_value(value: u16, by: i16) -> u16 {
        if by.is_negative() && by.abs() as u16 > value {
            panic!("Transforming value {} by {} would result in a negative number", value, by);
        } else {
            (value as i16 + by) as u16
        }
    }
}
<!DOCTYPE html>
<html>
<body>
​
<h2>Image Maps</h2>
<p>Click on the computer, the phone, or the cup of coffee to go to a new page and read more about the topic:</p>
​
<img src="workplace.jpg" alt="Workplace" usemap="#workmap" width="400" height="379">
​
<map name="workmap">
  <area shape="rect" coords="34,44,270,350" alt="Computer" href="computer.htm">
  <area shape="rect" coords="290,172,333,250" alt="Phone" href="phone.htm">
  <area shape="circle" coords="337,300,44" alt="Cup of coffee" href="coffee.htm">
</map>
​
</body>
</html>
​
​
options = map();
optionlist = list();
optionlist.add("workflow");
options.put("trigger",optionlist);
updateRec= zoho.crm.updateRecord(module_name, updatemap, options, connection);
<StyledTableCell>
                                        {connectedEmail.credentialInfoProvider.toUpperCase() === "IMAP" ? (
                                            <Tooltip
                                                arrow
                                                title="IMAP provider support emails incoming and outgoing, not calendar functionalities"
                                                placement="top"
                                                classes={{ tooltip: classes.tooltip }}
                                            >
                                                <StyledChip style={statusChipColor("WARNING")}>
                                                    {connectedEmail.credentialInfoProvider.toUpperCase()}
                                                </StyledChip>
                                            </Tooltip>
                                        ) : (
                                                <StyledChip style={statusChipColor("WARNING")}>
                                                {connectedEmail.credentialInfoProvider.toUpperCase()}
                                            </StyledChip>
                                        )}
                                    </StyledTableCell>
{
  "associationAccountInfoId": 11,
  "associationId": 30,
  "name": "Dr.Reddys foundation",
  "bankName": "Indian Bank",
  "bankAccountNumber": "6245789568",
  "bankRoutingTypeId": 46,
  "bankRoutingCode": "Indian bank 1234",
  "associationAccountTypeId": 170
}





{
  "associationAccountInfoId": 12,
  "associationId": 30,
  "upiId": "Reddysfoundations@IndianBank",
  "associationAccountTypeId": 171
}
class Solution {
public:
  
   
  int f(int ind, vector<int> &nums, vector<int> &dp) {
    if(ind == 0) return nums[ind];
    if(ind < 0) return 0;
    if(dp[ind] != -1) return dp[ind];
    int pick = nums[ind] + f(ind - 2, nums, dp);
    int notPick = 0 + f(ind - 1, nums, dp);
    return dp[ind] = max(pick, notPick);
}
    int rob(vector<int>& nums) {
        int n=nums.size();
        vector<int> dp(nums.size()+2,-1);
         int a = f(n-1,nums,dp);
         return a;
        
    }
};
const calcTip = (bill) => {
  return bill >= 50 && bill <= 300 ? bill * 0.15 : bill * 0.20;
}



const demandIcon = demand === "low" ? iconArrowDown 
: demand === "stable" ? iconArrowRight 
: demand === "high" ? iconArrowUp : "";
Node.js

Is a Javascript Runtime built on google's open source V8 javascript engine.
Executes js code outside of the browser.

Javascript on the Server:
Perfect conditions for using node.js as a web-server
We can use js on the server-side of web development
build fast, highly scalable network applications (back end)

Node.js pros:

perfect for building fast and scalable data-intensive apps.
javascript across the entire stack, front and back end.
npm: huge library of open source packages
very active

use for:
api with database
data streaming (youtube)
real time chat application
server-side web application

Modules

----------Filessystem----------

//reading and writing to files
const fs = require('fs');

//synchronous way of file reading
//takes filepath and char encoding param
fs.readFileSync('./txt/input.txt', 'utf-8');
console.log(textIn);

//synchronous way of file writing
const textOut = `This is what we know about avocado: ${textIn}.`
//takes output filepath and content to write
fs.writeFileSync('./txt/output.txt', textOut)


//asynchronous way of file reading

//Non-blocking file execution
fs.readFile('input.txt', 'utf-8', (err, data) => {
  console.log(data);
});
console.log('Reading file...');

callback get's called first, starts reading file in background and immediately moves on to next statement, printing console.log.


----------Server----------

const http = require('http');

//creating server, callback will be executed each time a new request hits server
const server = http.createServer((req, res) => {
  res.end('Hello from the server!');
});

//listening for incoming requests
server.listen(8000, '127.0.0.1' () => {
  console.log('Listening to request on port 8000');
});


// ROUTING

const url = require('url');

//creating server, callback will be executed each time a new request hits server
const server = http.createServer((req, res) => {
    // ROUTING
    const pathName = req.url;

    if(pathName === '/' || pathName === '/overview') {
        res.end('This is the OVERVIEW');
    } else if (pathName === '/product') {
        res.end('This is the PRODUCT');
    } else {
        //sending a html header element to the browser
        res.writeHead(404, {
            'Content-type': 'text/html',
            'my-own-header': 'hello-world'
        });
        res.end('<h1>Page not found!</h1>');
    }
});


----------NPM----------

Node Package Manager

//USEFUL DEPENDENCIES
slugify //used to control url params
nodemon //restarts server automatically after code changes
//specify npm scripts:
{  "scripts": {
    "start": "nodemon index.js"
  },}

Used to manage third-party packages in projects.

npm init //creates package.json for projects

npm i //installs locally, only works for specific project

npm i --global //installing dependencies globally (across projects)

npm i *packageName* //installing dependencies for project

npm i *packageName* --save-dev //dependencies for development purposes

npm run start //run npm scripts

npm outdated //check for outdated npm packages

npm i *packageName* @1.0.0 //install a specific version of a package

"dependencies": {
    "slugify": "^1.6.6" //only accepts minor and patch releases
  }

"dependencies": {
    "slugify": "~1.6.6" //only accepts patch releases
  }

"dependencies": {
    "slugify": "*1.6.6" //accepts all update realeases, might create conflicts
  }

npm uninstall *packageName* //uninstall packages

npm install //installs all dependencies in package.json file


























#include <stdio.h>
#include <string.h>

struct Product
{
    char name [20];
    char brand [20];
    float price ;
    int quantity;

};

void print_product(struct Product a_product);

int main(void)
{
    struct Product a_product[3];
    
    sprintf(a_product[0].name,"Xbox One S");
    sprintf(a_product[0].brand,"Microsoft");
    a_product[0].price= 395.50;
    a_product[0].quantity = 35;
    
    sprintf(a_product[1].name,"PlayStation 4 Pro");
    sprintf(a_product[1].brand,"Sony");
    a_product[1].price= 538.00;
    a_product[1].quantity = 71;
    
    sprintf(a_product[2].name,"Switch");
    sprintf(a_product[2].brand,"Nintendo");
    a_product[2].price= 529.95;
    a_product[2].quantity = 8;
    
    for(int i = 0; i < 3; i++)
    {
        print_product(a_product[i]);
    }
	return 0;
}

void print_product(struct Product a_product)
{
	printf("Item name: %s\n", a_product.name);
	printf("Brand:     %s\n", a_product.brand);
	printf("Price:     $%.2f\n", a_product.price);
	printf("Quantity:  %d\n\n", a_product.quantity);
}
#include <stdio.h>
#include <math.h>

struct Circle
{
	float radius;
	float x_position;
	float y_position;
	
};

float distance_between(struct Circle c1, struct Circle c2);

int main(void)
{
	struct Circle c1;
	struct Circle c2;

    float r1 = 0;
    float r2 = 0;
    scanf("%f", &r1);
    scanf("%f", &r2);
	c1.radius = r1;
	c2.radius = r2;
	c1.x_position = 11;
	c1.y_position = 22;
	c2.x_position = 4;
	c2.y_position = 6;

	float distance = distance_between(c1, c2);
	printf("distance between two circle is %f.", distance);

	return 0;
}

float distance_between(struct Circle c1, struct Circle c2)
{
    float distance;
    distance = sqrt( pow((c1.x_position - c2.x_position),2) + pow((c1.y_position - c2.y_position),2)) - c1.radius - c2.radius;
    return distance;
}

#include <stdio.h>

struct SoftDrink
{
    char name[17];
    int size;
    int energy;
    float caffeine;
    int intake;

};

void print_soft_drink(struct SoftDrink* drink);

int main(void)
{
    struct SoftDrink drink = { "Life Modulus",250,529,80.50,500};
    
    print_soft_drink(&drink);
    
    return 0;
    
}

void print_soft_drink(struct SoftDrink *drink)
{   
    printf("A soft drink...\n\n");
    printf("Name: %s\n",drink->name);
    printf("Serving size: %d mL\n",drink->size);
    printf("Energy content: %d kJ\n",drink->energy);
    printf("Caffeine content: %f mg\n",drink->caffeine);
    printf("Maximum daily intake: %d mL\n",drink->intake);

}
$file = fopen('myCSVFile.csv', 'r');
while (($line = fgetcsv($file)) !== FALSE) {
  //$line is an array of the csv elements
  print_r($line);
}
fclose($file);
\Drupal::service('file_system')->realpath(file_default_scheme() . '://');
Your output should use the following template:
#### Summary
#### Highlights
- [Emoji] Bulletpoint

Your task is to summarise the text I have given you in up to seven concise bullet points, starting with a short highlight. Choose an appropriate emoji for each bullet point. Use the text above: {{Title}} {{Transcript}}.
// Shortcode For AUCTION [all-categories]
add_shortcode('all-categories', 'cf_woo_all_categories');
function cf_woo_all_categories()
{
   ob_start(); ?>

<h3 class="headd">All Categories </h3>
<div id="owl-demo" class="all-cat categories-boxes">
               
       <?php
$cat_args = array(
   'hide_empty' => true,
);
$product_categories = get_terms( 'product_cat', $cat_args );
foreach ($product_categories as $key => $category) {
$thumbnail_id = get_term_meta( $category->term_id, 'thumbnail_id', true );
$image = wp_get_attachment_url( $thumbnail_id ); ?>
            <div class="item" style="background:url( <?php echo $image ?> ) no-repeat center center / cover ">
               <div class="content">
                   <div class="readmore">
                    <a href="<?php echo get_term_link($category) ?>"><?php  echo $category->name; ?></a>
                   </div>
               </div>
            </div>
  <?php
}
   ?>
   
   </div> <!-- owl-demo -->
<!-- structucre past hese -->
<?php
wp_reset_postdata();
   return '' . ob_get_clean();
}
// HIDE PLUGIN FROM ADMIN PANEL;
add_action('admin_head', 'hide_plugins_css');

function hide_plugins_css() {
    // Replace 'plugin-folder-1', 'plugin-folder-2', etc., with the actual folder names of the plugins
    $plugin_folder_names = array('gravityforms', 'advanced-custom-fields-pro');

    echo '<style>';
    foreach ($plugin_folder_names as $plugin_folder_name) {
        echo "tr[data-slug='$plugin_folder_name'] { display: none !important; }";
    }
    echo '</style>';
}
// WP CONFIG ADD TO STOP NOTIFICATIONS;
define('DISALLOW_FILE_EDIT', true);
define('DISALLOW_FILE_MODS', true);
// WP CONFIG ADD TO STOP NOTIFICATIONS;

// Disable all WordPress core updates
add_filter('automatic_updater_disabled', '__return_true');
add_filter('auto_update_core', '__return_false');
add_filter('pre_site_transient_update_core', '__return_null');
add_filter('pre_site_transient_update_plugins', '__return_null');
add_filter('pre_site_transient_update_themes', '__return_null');
 
// Disable plugin updates
remove_action('load-update-core.php', 'wp_update_plugins');
add_filter('pre_site_transient_update_plugins', '__return_null');
 
// Disable plugin update checks
add_action('admin_init', function() {
    remove_action('admin_init', '_maybe_update_plugins');
    remove_action('wp_update_plugins', 'wp_update_plugins');
    remove_action('load-plugins.php', 'wp_update_plugins');
});
 
// Disable theme updates
remove_action('load-update-core.php', 'wp_update_themes');
add_filter('pre_site_transient_update_themes', '__return_null');
 
// Disable theme update checks
add_action('admin_init', function() {
    remove_action('admin_init', '_maybe_update_themes');
    remove_action('wp_update_themes', 'wp_update_themes');
    remove_action('load-themes.php', 'wp_update_themes');
});
 
// Disable all automatic updates
add_filter('automatic_updater_disabled', '__return_true');
 
// Disable update notifications
add_filter('admin_init', function() {
    remove_action('admin_notices', 'update_nag', 3);
});
// TOP BAR REMOVED MENU SECTION OF WORDPRESS ADMIN PANEL;
function remove_woodmart_admin_bar_option($wp_admin_bar) {
    $wp_admin_bar->remove_node('xts_dashboard');
    $wp_admin_bar->remove_node('wp-logo');
    $wp_admin_bar->remove_node('comments');
}
add_action('admin_bar_menu', 'remove_woodmart_admin_bar_option', 999);


add_action('admin_init', 'remove_dashboard_meta_boxes', 999);
function remove_dashboard_meta_boxes() {
    remove_action('welcome_panel', 'wp_welcome_panel');
    remove_meta_box('dashboard_incoming_links', 'dashboard', 'normal');
    remove_meta_box('dashboard_plugins', 'dashboard', 'normal');
    remove_meta_box('dashboard_quick_press', 'dashboard', 'side');
    remove_meta_box('dashboard_recent_drafts', 'dashboard', 'side');
    remove_meta_box('dashboard_primary', 'dashboard', 'side');
    remove_meta_box('dashboard_secondary', 'dashboard', 'side');
    remove_meta_box('dashboard_right_now', 'dashboard', 'normal');
    remove_meta_box('dashboard_site_health', 'dashboard', 'normal');
    remove_meta_box('dashboard_woocommerce', 'dashboard', 'normal');
    remove_meta_box('dashboard_activity', 'dashboard', 'normal');
    remove_meta_box('woocommerce_dashboard_status', 'dashboard', 'normal');
    remove_action('admin_footer', 'wp_admin_footer');
    remove_action('wp_footer', 'wp_generator');
    remove_filter('update_footer', 'core_update_footer');
    add_filter('admin_footer_text', '__return_empty_string');
}

add_action( 'admin_menu', 'wpdocs_remove_menus', 999);
function wpdocs_remove_menus(){
    // global $menu;
    // echo '<pre>';
    // print_r( $menu );
    // echo '</pre>';
    if ( current_user_can( 'manage_options' ) ) {
        remove_menu_page( 'cp_calculated_fields_form' );
        remove_menu_page( 'super_forms' );
        remove_menu_page( 'wc-admin&path=/marketing' );
        remove_menu_page( 'edit.php?post_type=custom-css-js' );
    }
    
    if ( current_user_can( 'view_woocommerce_reports' ) ) {
        remove_submenu_page( 'wc-admin', 'wc-admin&path=/analytics/overview' );
    }
    if ( current_user_can( 'manage_woocommerce' ) ) {
        remove_menu_page( 'woocommerce-marketing' );
    }
    remove_menu_page( 'index.php' );
    
    remove_menu_page( 'betheme' );
    remove_menu_page( 'edit-comments.php' );
    remove_menu_page( 'options-general.php' );
    remove_menu_page( 'themes.php' );
    remove_menu_page( 'plugins.php' );
    remove_menu_page( 'users.php' );
    remove_menu_page( 'tools.php' );
    remove_menu_page( 'page=cp_calculated_fields_form' );
    remove_menu_page( 'revslider' );
    remove_menu_page( 'wc-admin' );
    remove_menu_page( 'edit.php?post_type=layout' );
    remove_menu_page( 'edit.php?post_type=slide' );
    remove_menu_page( 'woocommerce' );
    remove_menu_page( 'wpforms-overview' );
    remove_menu_page( 'getwooplugins' );
    remove_menu_page( 'wpcode' );
    remove_menu_page( 'gf_edit_forms' );
    remove_menu_page( 'vc-general' );
    remove_menu_page( 'wc-admin&path=/analytics/overview' );
    remove_menu_page( 'wc-admin&path=/payments/connect' );

    remove_submenu_page( 'woocommerce', 'wc-admin' );
    remove_submenu_page( 'woocommerce', 'wc-reports' );
    remove_submenu_page( 'woocommerce', 'wc-settings' );
    remove_submenu_page( 'woocommerce', 'wc-status' );
    remove_submenu_page( 'woocommerce', 'wc-addons' );
	remove_menu_page( 'wp-hide' );
	remove_menu_page( 'wpfastestcacheoptions' );
}


===============================================
Different CODE
==============================================
add_action( 'admin_init', function () {
// 	remove_menu_page( 'edit.php?post_type=page' );
	remove_menu_page( 'edit.php?post_type=woodmart_layout' );
	remove_menu_page( 'edit.php?post_type=woodmart_slide' );
	remove_menu_page( 'edit.php?post_type=woodmart_sidebar' );
	remove_menu_page( 'edit.php?post_type=portfolio' );
	remove_menu_page( 'edit.php?post_type=cms_block' );
	 $current_user = wp_get_current_user();
    if ($current_user && $current_user->user_login === 'appleagues') {
    	remove_menu_page('edit.php?post_type=acf-field-group');
    	remove_menu_page('edit.php?post_type=product');
    }
});
function remove_gf_menu_page() {
    $current_user = wp_get_current_user();
    if ($current_user && $current_user->user_login === 'appleagues') {
        remove_menu_page( 'gf_edit_forms' );
        remove_menu_page('themes.php');
        remove_menu_page('plugins.php');
        remove_menu_page('users.php');
        remove_submenu_page('options-general.php', 'options-writing.php');
        remove_submenu_page('options-general.php', 'options-reading.php');
        remove_submenu_page('options-general.php', 'options-discussion.php');
        remove_submenu_page('options-general.php', 'options-media.php');
        remove_submenu_page('options-general.php', 'options-permalink.php');
        remove_submenu_page('options-general.php', 'options-privacy.php');
        remove_submenu_page('options-general.php', 'smtp-mailer-settings');
        remove_submenu_page('options-general.php', 'really-simple-security');
        remove_submenu_page('options-general.php', 'table-of-contents');
        remove_submenu_page('options-general.php', 'cpto-options');
    }
}
add_action('admin_menu', 'remove_gf_menu_page', 9999 );
#include <stdio.h>

char to_lower(char letter);

int main(void)
{
	char input;

	printf("Please input a letter: \n");

	scanf("%c", &input);

	printf("%c's lowercase is %c\n", input, to_lower(input));

	return 0;
}

char to_lower(char letter)
{
     if (letter >= 'A' && letter <= 'Z') {
        return letter + 32; // Convert to lowercase by adding 32
    } else {
        return '\0'; // Return null character if not uppercase
    }
}
#include <stdio.h>

int get_length(char *cstring) 
{
    int length = 0;
    while (cstring[length] != '\0') 
    {
        length++;
    }
    return length;
}

int main(void) {
    char *text[] = { "Steffan", "Pascal", "Jade" };

    printf("%s is %d chars.\n", text[0], get_length(text[0]));
    printf("%s is %d chars.\n", text[1], get_length(text[1]));
    printf("%s is %d chars.\n", text[2], get_length(text[2]));
    
    // Do not change the following code
    char user_input[64];
    scanf("%63[^\n]", user_input);
    printf("%s is %d chars.\n", user_input, get_length(user_input));
    
    return 0;
}
#include <stdio.h>

struct Character_Counts
{
	int vowels;
	int consonants;
	int uppercase;
	int lowercase;
	int spaces;
	int digits;
};
//add 
int is_vowel(char ch) {
    char lower_ch = (ch >= 'A' && ch <= 'Z') ? ch + 32 : ch;  // Convert to lowercase if uppercase
    return (lower_ch == 'a' || lower_ch == 'e' || lower_ch == 'i' || lower_ch == 'o' || lower_ch == 'u');
}

int is_alpha(char ch) {
    return ((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z'));
}

int is_upper(char ch) {
    return (ch >= 'A' && ch <= 'Z');
}

int is_lower(char ch) {
    return (ch >= 'a' && ch <= 'z');
}

int is_digit(char ch) {
    return (ch >= '0' && ch <= '9');
}

struct Character_Counts analyse_text(char text[])
{
    struct Character_Counts counts = {0, 0, 0, 0, 0, 0};
    char *ptr = text;

    while (*ptr != '\0') {
        char ch = *ptr;
        if (is_alpha(ch)) {
            if (is_upper(ch)) {
                counts.uppercase++;
            }
            if (is_lower(ch)) {
                counts.lowercase++;
            }
            if (is_vowel(ch)) {
                counts.vowels++;
            } else {
                counts.consonants++;
            }
        } else if (is_digit(ch)) {
            counts.digits++;
        } else if (ch == ' ') {
            counts.spaces++;
        }
        ptr++;
    }

    return counts;
}


void print_counts(struct Character_Counts data)
{
    printf("Vowels = %d\n", data.vowels);
    printf("Consonants = %d\n", data.consonants);
    printf("Uppercase = %d\n", data.uppercase);
    printf("Lowercase = %d\n", data.lowercase);
    printf("Spaces = %d\n", data.spaces);
    printf("Digits = %d\n", data.digits);
}

int main(void)
{
	char buffer[80];
	printf("> ");
	scanf("%79[^\n]", buffer);
	struct Character_Counts results = analyse_text(buffer);
	print_counts(results);
	return 0;
}
#include <stdio.h>

void divide(int dividend, int divisor, int* p_quotient, int* p_remainder);

int main(void)
{
	int numerator = 0;
	printf("Dividend? ");
	scanf("%d", &numerator);
	int denominator = 0;
	printf("\nDivisor?");
	scanf("%d", &denominator);
	int quotient;
	int remainder;
	// TODO: Call divide...
	divide(numerator, denominator, &quotient, &remainder);
	printf("\nQuotient is %d\n", quotient);
	printf("Remainder is %d\n", remainder);
	return 0;
}

// TODO: Define divide function:
void divide(int dividend, int divisor, int* p_quotient, int* p_remainder) 
{
    *p_quotient = dividend / divisor;
    *p_remainder = dividend % divisor;
}

	 	

Maksym Radchenko	
BA
MR. GLAZIER
Honest Estimates
Clean Execution
max@mglazier.com
979 3rd Avenue suite 815, New York NY 10022
<table class="signature_tbl" cellpadding="0" cellspacing="0" border="0" style="border-collapse:collapse;font-size:10px;font-family:Inter,sans-serif;"> <tbody><tr> <td class="layout_maintd" style="line-height:16px;font-family:Inter, sans-serif; border-collapse:collapse;"><table cellpadding="0" cellspacing="0" style="border-collapse: separate;"> <tbody><tr> <td valign="top" align="left" class="layout_border" style="border-collapse:separate; border-radius:5px; border-width: 1px; border-color:#e2e2e2; border-style: solid; padding:3px 8px 8px 8px;"><table border="0" cellspacing="0" cellpadding="0"> <tbody><tr><td style="padding:5px 0 0 0" class="layout-web-icon sicon"><a href="http://mrglazier.com" target="_blank"><img alt="" src="https://app.customesignature.com/images/social/animation/4/web-icon.gif" width="24" style="display:block;"></a></td></tr><tr><td style="padding:5px 0 0 0" class="layout-linkedin-icon sicon"><a href="http://link.com" target="_blank"><img alt="" src="https://app.customesignature.com/images/social/animation/4/linkedin-icon.gif" width="24" style="display:block;"></a></td></tr><tr><td style="padding:5px 0 0 0" class="layout-google-icon sicon"><a href="https://g.page/r/CaH6NEWXm9CWEB0/review" target="_blank"><img alt="" src="https://app.customesignature.com/images/social/animation/4/google-icon.gif" width="24" style="display:block;"></a></td></tr> </tbody></table></td> <td width="8" style="border-collapse:collapse;">&nbsp;</td> <td valign="top" align="left" class="layout_border" style="border-collapse:collapse; padding:15px; border-radius:5px; border-width: 1px; border-color:#e2e2e2; border-style: solid;"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tbody><tr> <td align="left" valign="middle" style="border-collapse:collapse;"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tbody><tr> <td><a href="http://mrglazier.com" id="layout_link"><img class="layout_logo" src="https://app.customesignature.com/upload/signature/complete/5173/5173.gif" width="215" style="display:block;"></a></td> </tr> <tr> <td style="border-collapse: collapse; padding:0 0 10px 0;"><table border="0" cellspacing="0" cellpadding="0"> <tbody><tr> <td style="padding:15px 0 0 0; border-collapse: collapse;"><table border="0" cellspacing="0" cellpadding="0"> <tbody><tr> <td align="left" valign="middle"><span class="layout_firstname" style="font-weight:bold; font-style:normal; color:#000000; font-size:20px;">Maksym Radchenko</span> </td> <td align="left" valign="middle" style="padding-left:5px;"><img class="layout_verified" width="15" height="15" src="https://app.customesignature.com/images/verify.gif" style="display:block;"></td> </tr> </tbody></table></td> </tr> <tr> <td style="border-collapse: collapse;"><span class="layout_jobtitle" style="font-weight:normal; font-style:normal; color:#000000; font-size:12px;">BA</span></td> </tr> </tbody></table></td> </tr> <tr> <td style="border-collapse: collapse;"><span class="layout_company" style="font-weight:bold; font-style:normal; color:#000000; font-size:12px;">MR. GLAZIER</span></td> </tr> <tr> <td style="border-collapse: collapse;"><span style="font-weight:bold; font-style:normal; color:#000000; font-size:12px;">Honest</span> <span style="font-weight:normal; font-style:normal; color:#000000; font-size:10px;">Estimates</span></td> </tr> <tr> <td style="border-collapse: collapse;"><span style="font-weight:bold; font-style:normal; color:#000000; font-size:12px;">Clean</span> <span style="font-weight:normal; font-style:normal; color:#000000; font-size:10px;">Execution</span></td> </tr>              <tr> <td style="border-collapse: collapse;"> <a href="mailto:max@mglazier.com" style="font-weight:normal; font-style:normal; color:#000000; font-size:12px; text-decoration:none;">max@mglazier.com</a></td> </tr>          <tr> <td style="border-collapse: collapse;"> <span style="font-weight:normal; font-style:normal; color:#000000; font-size:12px;">979 3rd Avenue suite 815, New York NY 10022</span></td> </tr>          <tr> <td style="border-collapse:collapse; padding:5px 0 0 0;"><table cellpadding="0" cellspacing="0" border="0" style="border-collapse:collapse;"> <tbody><tr></tr> </tbody></table></td> </tr> <tr> <td style="border-collapse:collapse;"><table cellpadding="0" cellspacing="0" border="0" style="border-collapse:collapse;"> <tbody><tr></tr> </tbody></table></td> </tr> </tbody></table></td> <td align="left" valign="middle" style="padding:0 0 0 15px; border-collapse:collapse;" class="htmltogifClass"><div style="max-height:inherit;overflow:visible"><img style="display:none;border-radius:10px" class="signature_profile image_gif_overlay" src="https://app.customesignature.com/upload/signature/profile/1710476884-5173.jpg" width="140"></div><img src="https://app.customesignature.com//upload/signature/gifs/giphyy-1.gif" class="profile-annimation-gif" name="profile_annimation_gif" style="z-index:-1;position:relative;display:none;border-radius:10px;" width="140"></td> </tr> </tbody></table></td> </tr> </tbody></table></td> </tr> <tr> <td align="left" valign="top"><table border="0" cellspacing="0" cellpadding="0"> <tbody><tr>    </tr> </tbody></table></td> </tr> <tr> </tr><tr> <td style="padding:10px 0 0 0;"><a href="javascript:void(0);" id="layout_bannerlink"><img class="layout_banner" src="https://app.customesignature.com/upload/signature/banner/1710475377-5173.jpg" width="400" style="border-radius:10px; display:none;"></a></td> </tr>      </tbody></table>
<table class="signature_tbl" cellpadding="0" cellspacing="0" border="0" style="border-collapse:collapse;font-size:10px;font-family:Inter,sans-serif;"> <tbody><tr> <td class="layout_maintd" style="line-height:16px;font-family:Inter, sans-serif; border-collapse:collapse;"><table cellpadding="0" cellspacing="0" style="border-collapse: separate;"> <tbody><tr> <td valign="top" align="left" class="layout_border" style="border-collapse:collapse; padding:15px; border-radius:5px; border-width: 1px; border-color:#e2e2e2; border-style: solid;"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tbody><tr> <td align="center" valign="middle" style="padding:15px 15px 0 0;"><a href="http://mrglazier.com" id="layout_link"><img class="layout_logo" src="https://app.customesignature.com/upload/signature/complete/5173/5173.gif" width="215" style="display:block;"></a></td> <td align="left" valign="middle" class="layout_divider" style=" border:none; border-left-width:1px; border-left-color:#000000; border-left-style: solid; padding:0 0 0 15px;"><table width="100%" border="0" cellspacing="0" cellpadding="0" style="border-collapse: separate;"> <tbody><tr> <td style="border-collapse: collapse; padding-bottom:10px;"><table border="0" cellspacing="0" cellpadding="0"> <tbody><tr> <td style="padding:5px 0 0 0; border-collapse: collapse;"><table border="0" cellspacing="0" cellpadding="0"> <tbody><tr> <td align="left" valign="middle"><span class="layout_firstname" style="font-weight:bold; font-style:normal; color:#000000; font-size:20px;">Maksym Radchenko</span> </td> <td align="left" valign="middle" style="padding-left:5px;"><img class="layout_verified" width="15" height="15" src="https://app.customesignature.com/images/verify.gif" style="display:block;"></td> <td align="left" valign="middle" style="padding-left:20px;" class="htmltogifClass"><div style="max-height:inherit;overflow:visible"><img style="display:none;border-radius:10px" class="signature_profile image_gif_overlay" src="https://app.customesignature.com/upload/signature/profile/1710476884-5173.jpg" width="20"></div> <img src="https://app.customesignature.com//upload/signature/gifs/giphyy-1.gif" class="profile-annimation-gif" name="profile_annimation_gif" style="z-index:-1;position:relative;display:none;border-radius:10px;" width="20"></td> </tr> </tbody></table></td> </tr> <tr> <td style="border-collapse: collapse;"><span class="layout_jobtitle" style="font-weight:normal; font-style:normal; color:#000000; font-size:12px;">BA</span></td> </tr> </tbody></table></td> </tr> <tr> <td style="border-collapse: collapse;"><span class="layout_company" style="font-weight:bold; font-style:normal; color:#000000; font-size:12px;">MR. GLAZIER</span></td> </tr> <tr> <td style="border-collapse: collapse;"><span style="font-weight:bold; font-style:normal; color:#000000; font-size:12px;">Honest</span> <span style="font-weight:normal; font-style:normal; color:#000000; font-size:10px;">Estimates</span></td> </tr> <tr> <td style="border-collapse: collapse;"><span style="font-weight:bold; font-style:normal; color:#000000; font-size:12px;">Clean</span> <span style="font-weight:normal; font-style:normal; color:#000000; font-size:10px;">Execution</span></td> </tr>              <tr> <td style="border-collapse: collapse;"> <a href="mailto:max@mglazier.com" style="font-weight:normal; font-style:normal; color:#000000; font-size:12px; text-decoration:none;">max@mglazier.com</a></td> </tr>          <tr> <td style="border-collapse: collapse;"> <span style="font-weight:normal; font-style:normal; color:#000000; font-size:12px;">979 3rd Avenue suite 815, New York NY 10022</span></td> </tr>          <tr> <td valign="top" align="center" style="border-collapse: collapse; padding:5px 0 0 0;"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tbody><tr></tr> </tbody></table></td> </tr> <tr> <td style="border-collapse:collapse;"><table cellpadding="0" cellspacing="0" border="0" style="border-collapse:collapse;"> <tbody><tr></tr> </tbody></table></td> </tr> </tbody></table></td> </tr> </tbody></table></td> <td width="8" style="border-collapse:collapse;">&nbsp;</td> <td valign="top" align="left" class="layout_border" style="border-collapse:separate; border-radius:5px; border-width: 1px; border-color:#e2e2e2; border-style: solid; padding:3px 8px 8px 8px;"><table border="0" cellspacing="0" cellpadding="0"> <tbody><tr><td style="padding:5px 0 0 0" class="layout-web-icon sicon"><a href="http://mrglazier.com" target="_blank"><img alt="" src="https://app.customesignature.com/images/social/animation/4/web-icon.gif" width="24" style="display:block;"></a></td></tr><tr><td style="padding:5px 0 0 0" class="layout-linkedin-icon sicon"><a href="http://link.com" target="_blank"><img alt="" src="https://app.customesignature.com/images/social/animation/4/linkedin-icon.gif" width="24" style="display:block;"></a></td></tr><tr><td style="padding:5px 0 0 0" class="layout-google-icon sicon"><a href="https://g.page/r/CaH6NEWXm9CWEB0/review" target="_blank"><img alt="" src="https://app.customesignature.com/images/social/animation/4/google-icon.gif" width="24" style="display:block;"></a></td></tr> </tbody></table></td> </tr> </tbody></table></td> </tr> <tr> <td align="left" valign="top"><table border="0" cellspacing="0" cellpadding="0"> <tbody><tr>    </tr> </tbody></table></td> </tr> <tr> </tr><tr> <td style="padding:10px 0 0 0;"><a href="javascript:void(0);" id="layout_bannerlink"><img class="layout_banner" src="https://app.customesignature.com/upload/signature/banner/1710475377-5173.jpg" width="400" style="border-radius:10px; display:none;"></a></td> </tr>      </tbody></table>
const printName = (name) => {
    console.log(name)
}
const countLength = (name) => {
    return `${name} ${name.length}`
}
const capitalize = (name) => {
    return name.toUpperCase(name)
}
const trimName = (name) => {
    return name.trim(name)
}

const compose = (...fns) => (val) => fns.reduceRight((prev, fn) => fn(prev), val) 

// printName(countLength(capitalize(trimName(' harsh  '))))

// pipe(trimName,capitalize,countLength,printName)(' harsh  ')

compose(printName,countLength,capitalize,trimName)(' harsh  ')

SELECT * FROM wp_options WHERE (option_id LIKE '%base64_decode%' OR option_name LIKE '%base64_decode%' OR option_value LIKE '%base64_decode%' OR autoload LIKE '%base64_decode%' OR option_id LIKE '%edoced_46esab%' OR option_name LIKE '%edoced_46esab%' OR option_value LIKE '%edoced_46esab%' OR autoload LIKE '%edoced_46esab%' OR option_name LIKE 'wp_check_hash' OR option_name LIKE 'class_generic_support' OR option_name LIKE 'widget_generic_support' OR option_name LIKE 'ftp_credentials' OR option_name LIKE 'fwp' OR option_name LIKE 'rss_%') order by option_id
#include <stdio.h>

void print_assessments(int learning_outcome);

int main()
{
    int learning_outcome;
    
    scanf("%d",&learning_outcome);
    printf("Learning Outcome?\n");
    print_assessments(learning_outcome);
    
}

void print_assessments(int learning_outcome)
{
    if(learning_outcome == 0 || learning_outcome > 10)
    {
        printf("Invalid Learning Outcome.");
    }
    if(learning_outcome >=1 && learning_outcome <= 10)
    {
        printf("\nReporting Journal\n");
    }
    if(learning_outcome >=1 && learning_outcome <= 6)
    {
        printf("Practical Test 1\n");
    }
    if(learning_outcome >=1 && learning_outcome <= 8)
    {
        printf("Practical Test 2\n");
    }
    if(learning_outcome >=1 && learning_outcome <= 9)
    {
        printf("Practical Test 3\n");
    }
    if(learning_outcome >=1 && learning_outcome <= 10)
    {
        printf("Final Practical Exam\n");
    }
    
}
#include <stdio.h>

int calculate_pizza_share(int number_of_people);

int main(void)
{
    int number_of_people;

    // Prompt the user for input
    printf("How many people? \n");
    scanf("%d", &number_of_people);

    // Calculate the pizza share
    int slices_per_person = calculate_pizza_share(number_of_people);

    // Output the result
    if (slices_per_person == -1) 
    {
        printf("Error\n");
    } 

	else 
    {
        printf("%d people get %d slice(s) each.\n", number_of_people, slices_per_person);
    }

    return 0;
}

int calculate_pizza_share(int number_of_people)
{
    if (number_of_people <= 0) 
    {
        return -1; // Error for non-positive number of people
        
    }

    int total_slices = 8; // Total slices in a pizza

    return total_slices / number_of_people;
}
import google.generativeai as genai
import os

genai.configure(api_key=os.environ['API_KEY'])

model = genai.GenerativeModel(name='gemini-1.5-flash')
response = model.generate_content('Teach me about how an LLM works')

print(response.text)
const express = require('express');
const app = express();

const bodyParser = require('body-parser');
app.use(bodyParser.json());
const cors = require('cors');

const dotenv = require('dotenv');
dotenv.config();

//! add db hear
const dbService = require('./dbService');
const connection = require('./dbService');


app.use(cors());

app.use(express.json());
app.use(express.urlencoded({ extended : false }));


// //! create data-base connection
// app.post('/insert', (request, response) => {
//     const { name } = request.body;
//     const db = dbService.getDbServiceInstance();
    
//     const result = db.insertNewName(name);

//     result
//     .then(data => response.json({ data: data}))
//     .catch(err => console.log(err));
// });

// //! read data-base connection
// app.get('/getAll', (request, response) => {
//     const db = dbService.getDbServiceInstance();

//     const result = db.getAllData();
    
//     result
//     .then(data => response.json({data : data}))
//     .catch(err => console.log(err));
// })

// // update
// app.patch('/update', (request, response) => {
//     const { id, name } = request.body;
//     const db = dbService.getDbServiceInstance();

//     const result = db.updateNameById(id, name);
    
//     result
//     .then(data => response.json({success : data}))
//     .catch(err => console.log(err));
// });

// // delete
// app.delete('/delete/:id', (request, response) => {
//     const { id } = request.params;
//     const db = dbService.getDbServiceInstance();

//     const result = db.deleteRowById(id);
    
//     result
//     .then(data => response.json({success : data}))
//     .catch(err => console.log(err));
// });

// app.get('/search/:name', (request, response) => {
//     const { name } = request.params;
//     const db = dbService.getDbServiceInstance();

//     const result = db.searchByName(name);
    
//     result
//     .then(data => response.json({data : data}))
//     .catch(err => console.log(err));
// })





// const connection = require('./dbService');

// Now you can use the 'connection' variable in your app.js file
// For example, you can query the database using this connection
// connection.query('SELECT * FROM names;', (err, results) => {
//     if (err) {
//         console.error(err);
//         return;
//     }
//     console.log(results);
// });





app.post('/login', (req, res) => {
    const { ao_name, ao_status } = req.body;
    console.log('Received login data:', req.body);

    var sql = "INSERT INTO app_occasion ( ao_name, ao_status ) VALUES ?";
    var values = [[ao_name, ao_status]];

  connection.query(sql, [values], function (err, result) {
    if (err) throw err;
    console.log("Records inserted: " + result.affectedRows);
    // Show alert message
    res.status(200).send('Login data received');
  });
});








app.put('/update-application-status/:userId', async (req, res) => {
    const { userId } = req.params;
    const { application_status } = req.body;
  
        // Update logic for the database (example using a fictitious database function)
        // await database.updateApplicationStatus(userId, application_status);

// var sql = "UPDATE  leave_from_rgpl SET application_status = 1 WHERE id = ?",[userId];
connection.query('UPDATE leave_from_rgpl SET ? WHERE id = ?', [{ application_status: "1" }, userId]);


// connection.query(sql, function (err, result) {
//     if (err) throw err;
//     console.log("Records updated: " + result.affectedRows);
//     // Show alert message
//     res.status(200).send('Login data received');
//   });
        console.log("working")



       
});







app.put('/rejected/:userId', async (req, res) => {
    const { userId } = req.params;
    const { application_status } = req.body;
  
        // Update logic for the database (example using a fictitious database function)
        // await database.updateApplicationStatus(userId, application_status);

// var sql = "UPDATE  leave_from_rgpl SET application_status = 1 WHERE id = ?",[userId];
connection.query('UPDATE leave_from_rgpl SET ? WHERE id = ?', [{ application_status: "2" }, userId]);


// connection.query(sql, function (err, result) {
//     if (err) throw err;
//     console.log("Records updated: " + result.affectedRows);
//     // Show alert message
//     res.status(200).send('Login data received');
//   });
        console.log("working")



       
});











// app_super_section
// login_table_rgpl


// !  login from app_super_section
app.post('/aa', (req, res) => {
    const sql = "SELECT * FROM app_super_section WHERE email = ? AND password = ?";
    // const values = [
    //     req.body.email,
    //     req.body.password
    // ];
    
    connection.query(sql, [ req.body.email, req.body.password], (err, data) => {
        if (err) return res.json("Login Failed");
        if(data.length > 0){
            return res.json("Login Successful")
            
        }else {
            return res.json("INCORRECT EMAIL OR PASSWORD");
        }
       
        
    });
});









// var sql = "INSERT INTO leave_from_rgpl (name, college_name, class_coordinator_name, leave_date_from, leave_time_from, leave_date_up_to, leave_time_up_to, leave_type, reason_for_leave) VALUES ?";
// var values = [
//   [name, college_name, class_coordinator_name, `DATE_FORMAT('${leave_date_from}', '%Y-%m-%d`, // Format the date `TIME_FORMAT('${leave_time_from}', '%H:%i:%s.%f`, // Format the time `DATE_FORMAT('${leave_date_up_to}', '%Y-%m-%d`, // Format the date `TIME_FORMAT('${leave_time_up_to}', '%H:%i:%%f')`, // Format the time leave_type, reason_for_leave,
//   ],
// ];

// connection.query(sql, [values], function (err, result) {
//   if (err) throw err;
//   console.log("Records inserted: " + result.affectedRows);
//   // Show alert message
//   res.status(200).send('Login data received');
// });








// !my code
// app.post('/login', (req, res) => {
//     const { username, password } = req.body;

//     console.log('Received login data:');
//     // console.log('Username:', username);
//     // console.log('Password:', password);

//   var q = req.body.username;
//   var w = req.body.password;
// //   console.log(q,w);

// // module.exports =q;

//   // Export q and w variables




//   res.status(200).send('Login data received');


// });






// connection.connect((err) => {
//   if (err) {
//       console.log(err.message);
//   }
// //     //! this is i added for database state 
//   console.log('db ' + connection.state);
//   // console.log(q)
//   // console.log(msg);
// // });

// var sql = "INSERT INTO login (name,user_name,password) VALUES ?";

// // var { q, w } = require('./app');
// // console.log(q,w);

// var values =[[q,w,'123456']];

// connection.query(sql, [values], function (err, result) {
// if (err) throw err;
// console.log("records inserted: "+result.affectedRows);
// });

// });




// // Get all beers
// app.get('', (req, res) => {
//     pool.getConnection((err, connection) => {
//         if (err) throw err;
//         console.log(`connected as id ${connection.threadId}`);

//         connection.query('SELECT * from login', (err, rows) => {
//             connection.release(); // return the connection to the pool

//             if (err) {
//                 res.send(rows);
//             } else {
//                 console.log(err);
//             }
//         });
//     });
// });











app.get('/get-all-data', (req, res) => {
    const query = 'SELECT * FROM leave_from_rgpl'; 
    connection.query(query, (err, results) => {
        if (err) {
            console.error(err.message);
            return res.status(500).send(err);
        }
        res.json(results);
    });
});









app.put('/update-data/:id', (req, res) => {
    const { id } = req.params;
    const { newData } = req.body; // Replace `newData` with actual fields you want to update
    const query = 'UPDATE login SET ? WHERE id = ?'; // Replace with your table and field names

    connection.query(query, [newData, id], (err, results) => {
        if (err) {
            console.error(err.message);
            return res.status(500).send(err);
        }
        res.json({ success: true, message: 'Data updated successfully', results });
    });
});





// Endpoint to delete data
app.delete('/delete-data/:id', (req, res) => {
    const { id } = req.params;
    const query = 'DELETE FROM login WHERE id = ?';
    connection.query(query, [id], (err, results) => {
        if (err) {
            console.error(err.message);
            return res.status(500).send(err);
        }
        res.json({ success: true, message: 'Data deleted successfully', results });
    });
});






app.listen(process.env.PORT, () => console.log('app is running -->',process.env.PORT));


// module.exports = 'hello world';
#include <stdio.h>

// Function declarations
void draw_top_bottom_border(char corner_char, char horizontal_char, int width);
void draw_vertical_sides(char vertical_char, int width, int height);
void draw_ascii_box(char horizontal_char, char vertical_char, char corner_char, int width, int height);

// Function to draw the top and bottom borders
void draw_top_bottom_border(char corner_char, char horizontal_char, int width) 
{
    printf("%c", corner_char);
    for (int i = 0; i < width - 2; i++) 
    {
        printf("%c", horizontal_char);
    }
    printf("%c\n", corner_char);
}

// Function to draw the vertical sides
void draw_vertical_sides(char vertical_char, int width, int height) 
{
    for (int i = 0; i < height - 2; i++) 
    {
        printf("%c", vertical_char);
        for (int j = 0; j < width - 2; j++) 
        {
            printf(" ");
        }
        printf("%c\n", vertical_char);
    }
}

// Function to draw the ASCII box
void draw_ascii_box(char horizontal_char, char vertical_char, char corner_char, int width, int height) {

    
    // Draw top border
    draw_top_bottom_border(corner_char, horizontal_char, width);
    
    // Draw vertical sides
    draw_vertical_sides(vertical_char, width, height);
    
    // Draw bottom border
    draw_top_bottom_border(corner_char, horizontal_char, width);
}

// Main function to get user inputs and test the draw_ascii_box function
int main() {
    char horizontal_char;
    char vertical_char;
    char corner_char;
    int width;
    int height;

    // Get user inputs
    
    scanf(" %c", &horizontal_char);

    scanf(" %c", &vertical_char);

    scanf(" %c", &corner_char);

    scanf("%d", &width);

    scanf("%d", &height);

    // Draw the ASCII box based on user inputs
    draw_ascii_box(horizontal_char, vertical_char, corner_char, width, height);

    return 0;
}
#include <stdio.h>

// Define the structure Triangle
struct Triangle 
{
    int height;
    char inner_symbol;
};

// Function to print the inverted triangle
void print_inverted(struct Triangle inverted_triangle) {
    int height = inverted_triangle.height;
    char symbol = inverted_triangle.inner_symbol;

    // Print the top line
    for (int i = 0; i < 2 * height; i++) 
    {
        printf("_");
    }
    printf("\n");

    // Print the inverted triangle
    for (int i = 0; i < height; i++) 
    {
        // Print leading spaces
        for (int j = 0; j < i; j++) 
        {
            printf(" ");
        }
        
        // Print the left side of the triangle
        printf("\\");
        
        // Print the inner symbols
        for (int j = 0; j < 2 * (height - i - 1); j++) 
        {
            printf("%c", symbol);
        }
        
        // Print the right side of the triangle
        printf("/\n");
    }
}

int main() 
{
    struct Triangle my_triangle;
    
    // Query the user for the desired inverted triangle height and symbol
    printf("Inverted triangle's height?\n");
    scanf("%d", &my_triangle.height);
    
    printf("Inverted triangle's symbol?\n");
    scanf(" %c", &my_triangle.inner_symbol);
    
    // Call the print_inverted function
    print_inverted(my_triangle);
    
    return 0;
}
star

Thu Jun 13 2024 08:24:06 GMT+0000 (Coordinated Universal Time) https://www.google.com/search?q

@eziokittu #python #env #kernel #jupyter #anaconda

star

Thu Jun 13 2024 08:23:59 GMT+0000 (Coordinated Universal Time)

@rafal_rydz

star

Thu Jun 13 2024 08:23:38 GMT+0000 (Coordinated Universal Time)

@rafal_rydz

star

Thu Jun 13 2024 07:41:07 GMT+0000 (Coordinated Universal Time) https://www.beleaftechnologies.com/crypto-casino-game-development

@steeve #crypto #casino #game #development

star

Thu Jun 13 2024 06:40:29 GMT+0000 (Coordinated Universal Time)

@divyasoni23 #jquery

star

Thu Jun 13 2024 05:16:51 GMT+0000 (Coordinated Universal Time) https://www.beleaftechnologies.com/crypto-casino-game-development

@steeve #crypto #casino #game

star

Thu Jun 13 2024 03:35:26 GMT+0000 (Coordinated Universal Time)

@jrray

star

Thu Jun 13 2024 01:08:48 GMT+0000 (Coordinated Universal Time)

@galaxy #css

star

Wed Jun 12 2024 20:48:26 GMT+0000 (Coordinated Universal Time)

@tomasp #c++

star

Wed Jun 12 2024 20:43:19 GMT+0000 (Coordinated Universal Time)

@tomasp #c++

star

Wed Jun 12 2024 19:18:26 GMT+0000 (Coordinated Universal Time)

@Promakers2611

star

Wed Jun 12 2024 19:17:31 GMT+0000 (Coordinated Universal Time)

@Promakers2611

star

Wed Jun 12 2024 19:07:16 GMT+0000 (Coordinated Universal Time) https://blog.scottlogic.com/2020/10/08/lets-build-snake-with-rust.html

@ORDINAL

star

Wed Jun 12 2024 15:21:53 GMT+0000 (Coordinated Universal Time)

@tokoyami_ds

star

Wed Jun 12 2024 12:46:06 GMT+0000 (Coordinated Universal Time) https://www.w3schools.com/html/tryit.asp?filename

@sandeepv

star

Wed Jun 12 2024 12:45:59 GMT+0000 (Coordinated Universal Time) https://www.w3schools.com/html/tryit.asp?filename

@sandeepv #undefined

star

Wed Jun 12 2024 10:57:31 GMT+0000 (Coordinated Universal Time)

@RehmatAli2024 #deluge

star

Wed Jun 12 2024 10:18:30 GMT+0000 (Coordinated Universal Time)

@taufiq_ali

star

Wed Jun 12 2024 10:17:35 GMT+0000 (Coordinated Universal Time) https://studio.youtube.com/channel/UCkNG6QrabEQdyroozJp4nCg/editing/sections

@calazar23

star

Wed Jun 12 2024 10:14:31 GMT+0000 (Coordinated Universal Time)

@Ranjith

star

Wed Jun 12 2024 07:15:08 GMT+0000 (Coordinated Universal Time)

@ayushg103 #c++

star

Wed Jun 12 2024 06:23:57 GMT+0000 (Coordinated Universal Time)

@davidmchale #condtional #ternary

star

Wed Jun 12 2024 04:55:43 GMT+0000 (Coordinated Universal Time)

@NoFox420 #nodejs

star

Wed Jun 12 2024 04:14:25 GMT+0000 (Coordinated Universal Time)

@meanaspotato #c #function #struct

star

Wed Jun 12 2024 03:19:24 GMT+0000 (Coordinated Universal Time)

@meanaspotato #c #function #struct

star

Wed Jun 12 2024 03:12:37 GMT+0000 (Coordinated Universal Time)

@meanaspotato #c #function #struct

star

Wed Jun 12 2024 03:09:58 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/1269562/how-to-create-an-array-from-a-csv-file-using-php-and-the-fgetcsv-function

@al.thedigital #php

star

Wed Jun 12 2024 03:08:55 GMT+0000 (Coordinated Universal Time) https://drupal.stackexchange.com/questions/185572/get-the-public-path-directory

@al.thedigital #php #filepath #sitesdefaultpath

star

Wed Jun 12 2024 01:55:12 GMT+0000 (Coordinated Universal Time)

@calazar23

star

Tue Jun 11 2024 23:44:55 GMT+0000 (Coordinated Universal Time)

@wasim_mm1

star

Tue Jun 11 2024 23:43:51 GMT+0000 (Coordinated Universal Time)

@wasim_mm1

star

Tue Jun 11 2024 23:42:22 GMT+0000 (Coordinated Universal Time)

@wasim_mm1

star

Tue Jun 11 2024 23:41:09 GMT+0000 (Coordinated Universal Time)

@wasim_mm1

star

Tue Jun 11 2024 20:49:42 GMT+0000 (Coordinated Universal Time)

@meanaspotato #c #function

star

Tue Jun 11 2024 20:44:52 GMT+0000 (Coordinated Universal Time)

@meanaspotato #c #function

star

Tue Jun 11 2024 20:43:03 GMT+0000 (Coordinated Universal Time)

@meanaspotato #c #function

star

Tue Jun 11 2024 20:41:15 GMT+0000 (Coordinated Universal Time)

@meanaspotato #c #function

star

Tue Jun 11 2024 17:48:45 GMT+0000 (Coordinated Universal Time)

@oleg

star

Tue Jun 11 2024 16:23:33 GMT+0000 (Coordinated Universal Time)

@oleg

star

Tue Jun 11 2024 16:18:45 GMT+0000 (Coordinated Universal Time)

@oleg

star

Tue Jun 11 2024 13:04:10 GMT+0000 (Coordinated Universal Time) https://www.freecodecamp.org/news/pipe-and-compose-in-javascript-5b04004ac937/

@Harsh_shh ##javascript

star

Tue Jun 11 2024 11:48:52 GMT+0000 (Coordinated Universal Time) https://artprojectgroup.es/tienes-infectada-tu-base-de-datos

@edujca

star

Tue Jun 11 2024 11:03:53 GMT+0000 (Coordinated Universal Time) https://www.pyramidions.com/cryptocurrency-exchange-development-company

@Steve_1

star

Tue Jun 11 2024 10:26:42 GMT+0000 (Coordinated Universal Time)

@meanaspotato #c #function

star

Tue Jun 11 2024 09:37:37 GMT+0000 (Coordinated Universal Time)

@meanaspotato #c #function

star

Tue Jun 11 2024 09:13:48 GMT+0000 (Coordinated Universal Time) https://ai.google.dev/api/python/google/generativeai

@Spsypg

star

Tue Jun 11 2024 09:13:11 GMT+0000 (Coordinated Universal Time) https://ai.google.dev/api/python/google/generativeai

@Spsypg

star

Tue Jun 11 2024 09:08:29 GMT+0000 (Coordinated Universal Time)

@codeing #javascript

star

Tue Jun 11 2024 09:00:43 GMT+0000 (Coordinated Universal Time)

@meanaspotato #c #struct

star

Tue Jun 11 2024 08:54:10 GMT+0000 (Coordinated Universal Time)

@meanaspotato #c #struct

Save snippets that work with our extensions

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