Snippets Collections
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;
}
#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;
}
vector<int> pf(int n)
{
    vector<int> v;
    for(int i=2;i<=n;++i)
    {
        while(n%i==0)
        {
            v.push_back(i);
            n/=i;
        }
    }
    return v;
}
#include <stdio.h>

float dot_product(float v1[3], float v2[3]) //add this
{
    return (v1[0] * v2[0]) + (v1[1] * v2[1]) + (v1[2] * v2[2]);
}

int main(void)
{
	float vec_a[3];
	float vec_b[3];

	vec_a[0] = 1.5f;
	vec_a[1] = 2.5f;
	vec_a[2] = 3.5f;
	vec_b[0] = 4.0f;
	vec_b[1] = 5.0f;
	vec_b[2] = 6.0f;

	printf("%f\n", dot_product(vec_a, vec_b));

	return 0;
}
#include<stdio.h>

char convert_percent_to_grade(float input)
{
    if(input>=80.0f)
    {
        return 'A';
    }
    else if(input>=60.0f && input <80.0f)
    {
        return 'B';
    }
    else if(input>=50.0f && input < 60.0f)
    {
        return 'C';
    }
    else 
    {
        return 'D';
    }

}

int main()
{
    float input;
    
    printf("What's the percentage:\n");
    scanf("%f",&input);
    
    char output = convert_percent_to_grade(input);
    
    printf("%.2f%% is %c Grade",input,output);
    
    
}
function onEdit(e) {
  if (!e) return;

  var sheet = e.source.getActiveSheet();
  var range = e.range;
  var editedValue = e.value;
  var previousValue = e.oldValue;

  // Define the start columns and start rows for each sheet
  var config = {
    "Pengajuan Konten": { columns: [5, 6, 19, 23, 28], startRow: 3 },
    "Timeline Wilayah": { columns: [8, 9], startRow: 2 },
    "Akun Media Partnership": { startColumn: 7, startRow: 5 }
    // Add more sheets and their configurations here
  };

  var sheetName = sheet.getName();
  if (!config[sheetName]) return; // Exit if the sheet is not configured

  var sheetConfig = config[sheetName];
  var startColumns = sheetConfig.columns || [sheetConfig.startColumn];
  var startRow = sheetConfig.startRow;

  if (startColumns.indexOf(range.getColumn()) !== -1 && range.getRow() >= startRow) {
    if (previousValue == null || previousValue === "") {
      range.setValue(editedValue);
    } else {
      var previousValues = previousValue.split(', ');

      var index = previousValues.indexOf(editedValue);

      if (index === -1) {
        previousValues.push(editedValue);
      } else {
        previousValues.splice(index, 1);
      }

      range.setValue(previousValues.join(', '));
    }
  }
}
#include <stdio.h>
#include <math.h>

struct Point3D
{
    float x;
    float y;
    float z;
};

float compute_distance3d(struct Point3D p1, struct Point3D p2);

int main(void)
{
    struct Point3D p1;
    struct Point3D p2;

    // Initialize the structures with test values
    p1.x = 1.0;
    p1.y = 2.0;
    p1.z = 3.0;

    p2.x = 4.0;
    p2.y = 5.0;
    p2.z = 6.0;

    // Calculate the distance between the test values
    float distance = compute_distance3d(p1, p2);

    // Query user for input coordinates
    printf("Enter coordinates for Point1 (x y z): ");
    scanf("%f %f %f", &p1.x, &p1.y, &p1.z);

    printf("Enter coordinates for Point2 (x y z): ");
    scanf("%f %f %f", &p2.x, &p2.y, &p2.z);

    // Calculate and print the distance based on user input
    distance = compute_distance3d(p1, p2);
    printf("Distance between the two points is %f.\n", distance);

    return 0;
}

float compute_distance3d(struct Point3D p1, struct Point3D p2)
{
    return sqrt(pow(p2.x - p1.x, 2) + pow(p2.y - p1.y, 2) + pow(p2.z - p1.z, 2));
}
EXEC sp_spaceused N'[dbo].[MY_TABLE]'
<nav class="navbar navbar-expand-md bg-light">
    <div class="container">
      <a href="#" class="navbar-brand">Navbar</a>
      <button class="navbar-toggler" data-bs-toggle="collapse" data-bs-target="#nav-collapse"">
        <span class="navbar-toggler-icon"></span>
      </button>
      <div class="collapse navbar-collapse" id="nav-collapse">
        <ul class="navbar-nav ms-auto">
          
          <li class="nav-item">
            <a href="#" class="nav-link active">Home</a>
          </li>  
          <li class="nav-item">
            <a href="#" class="nav-link ">About</a>
          </li>  
          <li class="nav-item">
            <a href="#" class="nav-link ">Contact</a>
          </li>  
      
        </ul>
      </div>
    </div>
  </nav>
setenv ANDROID_HOME ~/Library/Android/sdk
setenv PATH $PATH\:$ANDROID_HOME/tools\:$ANDROID_HOME/tools/bin\:$ANDROID_HOME/platform-tools
  
setenv ANDROID_HOME ~/Library/Android/sdk
setenv PATH $PATH\:$ANDROID_HOME/tools\:$ANDROID_HOME/tools/bin\:$ANDROID_HOME/platform-tools
  
setenv ANDROID_HOME ~/Library/Android/sdk
setenv PATH $PATH\:$ANDROID_HOME/tools\:$ANDROID_HOME/tools/bin\:$ANDROID_HOME/platform-tools
  
import java.util.*;

public class BinarySearchTree3<T extends Comparable<T>> {

    class Node {

        T key;

        Node left, right;

        

        public Node(T item) {

            key = item;

            left = right = null;

        }

    }

    

    private Node root;

    

    public BinarySearchTree3() {

        root = null;

    }

    

    public void insert(T key) {

        root = insertKey(root, key);

    }

    

    private Node insertKey(Node root, T key) {

        if (root == null) {

            root = new Node(key);

            return root;

        }

        

        if (key.compareTo(root.key) < 0) {

            root.left = insertKey(root.left, key);

        } else if (key.compareTo(root.key) > 0) {

            root.right = insertKey(root.right, key);

        }

        

        return root;

    }

    

    public void inorder() {

        inorderRec(root);

    }

    

    private void inorderRec(Node root) {

        if (root != null) {

            inorderRec(root.left);

            System.out.print(root.key + " ");

            inorderRec(root.right);

        }

    }

    

    public void deleteKey(T key) {

        root = deleteRec(root, key);

    }

    

    private Node deleteRec(Node root, T key) {

        if (root == null) return root;

        

        if (key.compareTo(root.key) < 0) {

            root.left = deleteRec(root.left, key);

        } else if (key.compareTo(root.key) > 0) {

            root.right = deleteRec(root.right, key);

        } else {

            if (root.left == null) return root.right;

            else if (root.right == null) return root.left;

            

            root.key = minValue(root.right);

            root.right = deleteRec(root.right, root.key);

        }

        

        return root;

    }

    

    public T minValue(Node root) {

        T minv = root.key;

        while (root.left != null) {

            minv = root.left.key;

            root = root.left;

        }

        return minv;

    }

    

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        BinarySearchTree3<Integer> bst = new BinarySearchTree3<>();

        String ch = "";

        

        do {

            System.out.print("Enter the element to be inserted in the tree: ");

            int n = sc.nextInt();

            sc.nextLine();

            bst.insert(n);

            System.out.print("Do you want to insert another element? (Say 'yes'): ");

            ch = sc.nextLine();

        } while (ch.equals("yes"));

        

        System.out.println();

        System.out.print("Inorder Traversal : The elements in the tree are: ");

        bst.inorder();

        System.out.println();

        System.out.print("Enter the element to be removed from the tree: ");

        int r = sc.nextInt();

        sc.nextLine();

        System.out.println();

        bst.deleteKey(r);

        System.out.print("Inorder traversal after deletion of " + r + ": ");

        bst.inorder();

        System.out.println();

    }

}
<section class="fascia-form-ricerca fascia-form-ricerca__nowrap theme__blue" style="width:100%">
    <div class="wrapper">
        <div class="row">
            <div class="col-xs-12 intestazione_ricerca">
                <p class="heading heading__3">Trova la tua prossima auto a noleggio</p>
            </div>

            <div class="col-xs-12 ">
                <form action="{{{PATH}}}" id="_cerca3">
                    <input type="hidden" name="_tkn" value="{{{tokenCSRF}}}">
                    <input type="hidden" id="_srcctg" name="_srcctg" value="">
                    <div class="flex-row-space-between">
                        <div class="fields-container fields-container__nowrap">


                            <div class="select-wrapper" id="_divAutonomia" style="display:none"><select id="_frsrc_autonomia" name="_frsrc_autonomia">
                                </select>
                            </div>
                            <div class="select-wrapper"><select id="_frsrc_tipo" name="_frsrc_tipo">
                                    <option value="">Tipo di veicolo</option>
                                </select></div>


                            <div class="select-wrapper"><select id="_frsrc_marca" name="_frsrc_marca">
                                    <option value="">Marca</option>
                                </select></div>

                            <div class="select-wrapper" id="_divAlim"><select id="_frsrc_alim" name="_frsrc_alim">
                                    <option value="">Alimentazione</option>
                                </select>
                            </div>

                            <!--div class="select-wrapper" id="_divCambio"><select id="_frsrc_cambio" name="_frsrc_cambio">
                                    <option value="">Cambio</option>
                                </select>
                            </div-->


                            <!--div class="select-wrapper" id="_divCanone"><select id="_frsrc_canone" name="_frsrc_canone">
                                    <option value="">Fascia di canone</option>
                                </select>
                            </div-->
                        </div>
                        <!--button class="btn btn__icon" type="submit"><img alt=""
                                src="{{{PATH}}}_img/icons/find.svg" />Cerca auto</button-->
                        <div class="button-container">
                            <button class="btn btn__icon" style="background-color: #53a653" type="submit"> <img src="{{{PATH}}}_img/icons/find.svg" alt="">Cerca auto </button>

                            <div class="col-xs-12">
                                <h3 style="text-align: center;" id="link_mobile"> <a href="https://www.finrent.it/pronta-consegna/">Scopri le offerte in Pronta
                                        Consegna</a>
                            </div>
                            </h3>
                        </div>
                    </div>



            </div>
            </form>
        </div>
    </div>

    </div>
</section>
<script type="text/javascript" nonce="{{{nonce}}}">
    _automatico = "";
    _ini_aut = "";
    _ini_cb = "";
    _ini_tp = "";
    _ini_mod = "";
    _ini_mar = "";
    _ini_ali = "";
    _ini_fas = "";
    _caricaTipi = true;
    var mtcf = [];
    $(document).ready(function () {
        addlink = "";
        if ($("#_automatico").val() == "1") {
            _ini_aut = $("#_automatico").attr("_aut");
            _ini_cb = $("#_automatico").attr("_cb");
            _ini_tp = $("#_automatico").attr("_tp");
            _ini_mod = $("#_automatico").attr("_mod");
            _ini_mar = $("#_automatico").attr("_mar");
            _ini_fas = $("#_automatico").attr("_fas");
            _ini_ali = $("#_automatico").attr("_ali");
            _automatico = "1";
        }
        $("#_srcctg").val($("#_ctg").val());
        if ($("#_ctg").val() == "1") { addlink = "#privati"; }
        if ($("#_ctg").val() == "2") addlink = "#partitaiva";
        if ($("#_ctg").val() == "5") { addlink = "#elettriche"; setAutonomia(); $("#_divAutonomia").show(); $("#_divCambio").hide(); }
        if ($("#_ctg").val() == "10") {
            addlink = "#ibride";
            //setAutonomia(); $("#_divAutonomia").show(); $("#_divCambio").hide(); 
        }
        if (location.href.indexOf("cambio-manuale") > 0) { addlink = "#cambio-manuale" + addlink; }
        if (location.href.indexOf("cambio-automatico") > 0) { addlink = "#cambio-automatico" + addlink; }
        if (addlink != "") {
            $(".linkmodello").each(function () {
                $(this).attr("href", $(this).attr("href") + addlink);
            });
        }
        if (_caricaTipi) {
            loadMatriceRicerca();
        }
        $("#_btnsearchofferte").on("click", function () {
            window.open("{{{PATH}}}noleggio-lungo-termine-offerte-speciali/", "_self");
        });
        return false;
    });
    
    
    function setAutonomia() {
        /*strx='<option value="">Scegli l\'autonomia</option><option value="100|200">da 100 a 200km</option><option value="200|300">da 200 a 300km</option><option value="300|400">da 300 a 400km</option><option value="400|500">da 400 a 500km</option><option value="500|600">da 500 a 600km</option><option value="600|700">da 600 a 700km</option><option value="700|9999">oltre 700km</option>';
       $("#_frsrc_autonomia").html(strx);
     */
        $("#_frsrc_tipo").val("");
        _caricaTipi = false;
        jQuery.ajax({
            data: "",
            url: "/api/getAutonomiaOption.php?_tkn={{{tokenCSRF}}}&_ctg=" + $("#_srcctg").val() + "&tm=" + Date.now(),
            type: 'POST', timeout: 20000,
            dataType: "html",
            error: function (r) { nocl(); /*alert(r); openAlert("Errore durante la lettura dell'autonomia", "KO");*/ },
            success: function (r) {
                $("#_frsrc_autonomia").html(r);
                if (_ini_aut != "") { $("#_frsrc_autonomia").val(_ini_aut); $("#_frsrc_autonomia").trigger("change"); } else loadTipiVeicolo();
                _ini_aut = "";
            }
        });
    }
    
    var _matrice;
    
    function loadMatriceRicerca() {
        jQuery.ajax({
            data: "_tkn={{{tokenCSRF}}}&_ctg=" + $("#_srcctg").val() + "&_el=" + $("#_frsrc_autonomia").val(),
            url: "/api/getMatriceRicerca.php?el=" + $("#_frsrc_autonomia").val() + "&tm=" + Date.now(),
            type: 'POST', timeout: 20000,
            dataType: "html",
            error: function (r) { nocl(); /*alert(r); openAlert("Errore durante la lettura della matrice", "KO");*/ },
            success: function (r) {
                //eval(r);
                _matrice = JSON.parse(r);
                setFilters(true, true, true, true);
                if (_ini_tp != "") { $("#_frsrc_tipo").val(_ini_tp); setFilters(false, true, true, true); }
                if (_ini_mar != "") { $("#_frsrc_marca").val(_ini_mar); setFilters(false, false, true, true); }
                if (_ini_aut != "") $("#_frsrc_autonomia").val(_ini_aut);
                if (_ini_ali != "") { $("#_frsrc_alim").val(_ini_ali); setFilters(false, false, false, true); }
                if (_ini_cb != "") { $("#_frsrc_cambio").val(_ini_cb); setFilters(false, false, false, false); }
                if (_ini_fas != "") $("#_frsrc_canone").val(_ini_fas);
                _ini_tp = ""; _ini_aut = ""; _ini_cb = ""; _ini_mod = ""; _ini_mar = ""; _ini_ali = ""; _ini_fas = "";
            }
        });
    }
    
    
    $("#_frsrc_marca").on("change", function () {
        setFilters(false, false, true, true);
        return false;
    });
    $("#_frsrc_tipo").on("change", function () {
        setFilters(false, true, true, true);
        return false;
    });
    $("#_frsrc_cambio").on("change", function () {
        setFilters(false, false, false, false);
        return false;
    });
    
    $("#_frsrc_alim").on("change", function () {
        setFilters(false, false, false, true);
        return false;
    });
    $("#_cerca3").on("submit", function () { return cercaModelli('_frsrc_tipo', '_frsrc_marca', '_frsrc_modello', '_srcctg', '_frsrc_autonomia', '_frsrc_cambio', '_frsrc_alim', '_frsrc_canone'); });
    
    function loadMarche() {
        $("#_frsrc_modello").html("<option value=''>Scegli il modello</option>");
        //alert("_tkn={{{tokenCSRF}}}&_ctg="+$("#_srcctg").val()+"&_tp="+$("#_frsrc_tipo").val()+"&_el="+$("#_frsrc_autonomia").val()+"&_cb="+$("#_frsrc_cambio").val());
        jQuery.ajax({
            data: "_tkn={{{tokenCSRF}}}&_ctg=" + $("#_srcctg").val() + "&_tp=" + $("#_frsrc_tipo").val() + "&_el=" + $("#_frsrc_autonomia").val() + "&_cb=" + $("#_frsrc_cambio").val(),
            url: "/api/getMarcheOption.php?tm=" + Date.now(),
            type: 'POST', timeout: 20000,
            dataType: "html",
            error: function (r) { nocl(); /*alert(r); openAlert("Errore durante la lettura delle marche", "KO");*/ },
            success: function (r) {
                $("#_frsrc_marca").html(r);
                if (_ini_mar != "") { $("#_frsrc_marca").val(_ini_mar); $("#_frsrc_marca").trigger("change"); }
                _ini_mar = "";
            }
        });
    }
    
    function loadTipiVeicolo() {
        jQuery.ajax({
            data: "_tkn={{{tokenCSRF}}}&_ctg=" + $("#_srcctg").val() + "&_el=" + $("#_frsrc_autonomia").val(),
            url: "/api/getTipiVeicoloOption.php?el=" + $("_frsrc_autonomia").val() + "&tm=" + Date.now(),
            type: 'POST', timeout: 20000,
            dataType: "html",
            error: function (r) { nocl(); /*alert(r); openAlert("Errore durante la lettura dei tipi veicolo", "KO");*/ },
            success: function (r) {
                $("#_frsrc_tipo").html(r);
                if (_ini_cb != "") { $("#_frsrc_cambio").val(_ini_cb); }
                if (_ini_tp != "") { $("#_frsrc_tipo").val(_ini_tp); $("#_frsrc_tipo").trigger("change"); } else loadMarche();
                _ini_tp = "";
            }
        });
    }
</script>
<style>
    @media screen and (max-width:600px) {
        #link_mobile {
            display: block !Important;
        }
    }
    
    #link_mobile {
        display: none;
    }
</style>
int main() {
    std::vector<int> vec = {1, 2, 2, 3, 4, 4, 5};

    // Sort the vector
    std::sort(vec.begin(), vec.end());

    // Use unique to remove duplicates
    auto last = std::unique(vec.begin(), vec.end());

    // Erase the unused elements
    vec.erase(last, vec.end());

    // Print the result
    for(int n : vec) {
        std::cout << n << " ";
    }

    return 0;
}
 vector<vector<int>> v;

    void f(int i, int tar, vector<int>& nums, vector<int>& can) {
        if ( tar == 0) {
            v.push_back(nums);
            return;
        }
        if (i == can.size() || tar < 0)
            return;
     

        nums.push_back(can[i]);
        f(i, tar - can[i], nums, can);
        nums.pop_back();

        f(i + 1, tar, nums, can);
        
    }

    vector<vector<int>> combinationSum(vector<int>& candidates, int target) {
        vector<int> ds;
        f(0, target, ds, candidates);
        return v;
    }
# Log in to Azure  
az login  
  
# Show current subscription  
az account show --output table  
#Show all subscriptions 
az account list --output table
#Pick subscription
az account set --subscription "Subscription Name or ID".
#include <stdio.h>
#include <string.h>

struct Student
{
    char name [50]; //declare as character array with space for 50 characters
    float lecture_attendance;
    float lab_attendance;
};

int main(void)
{
    struct Student student;
    
    sprintf(student.name,"Jane Doe"); //use sprintf to format and store the string into the name array of the student structure.
    student.lecture_attendance = 0.33f;
    student.lab_attendance = 1.00f;
    printf("Successful!!!");
    return 0;
}
#include <stdio.h>

struct Movie
{
    char title [50];
    int minutes;
    float tomatometer;
};

void print_movie(struct Movie a_super_hero);

int main(void)
{
    struct Movie movie;

	sprintf(movie.title, "Batman Returns");
	movie.minutes = 126;
	movie.tomatometer = 0.81f;

	print_movie(movie);
	
	return 0;
}

void print_movie(struct Movie a_movie)
{
    printf("Movie title:        %s\n",a_movie.title);
    printf("Runtime in minutes: %d\n",a_movie.minutes);
    printf("Tomatometer Score:  %.2f",a_movie.tomatometer);
}
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

star

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

@meanaspotato #c #struct

star

Tue Jun 11 2024 07:16:52 GMT+0000 (Coordinated Universal Time)

@ayushg103 #c++

star

Tue Jun 11 2024 06:34:32 GMT+0000 (Coordinated Universal Time)

@meanaspotato #c #function

star

Tue Jun 11 2024 05:45:35 GMT+0000 (Coordinated Universal Time) https://www.coindeveloperindia.com/p2p-crypto-exchange-development

@jamesright #p2p #p2pcryptoexchange #cryptocurrencyexchange #peertopeer #cryptoexchangedevelopment

star

Tue Jun 11 2024 05:19:27 GMT+0000 (Coordinated Universal Time)

@meanaspotato #c #function

star

Tue Jun 11 2024 04:38:24 GMT+0000 (Coordinated Universal Time) https://keep.google.com/

@fazmukadar #javascript

star

Tue Jun 11 2024 04:02:57 GMT+0000 (Coordinated Universal Time)

@meanaspotato #c #struct

star

Tue Jun 11 2024 03:42:53 GMT+0000 (Coordinated Universal Time) https://www.sqlshack.com/using-sql-server-cursors-advantages-and-disadvantages/

@joshjohn1984 #sql #space

star

Tue Jun 11 2024 01:57:19 GMT+0000 (Coordinated Universal Time) https://www.udemy.com/course/bootstrap-from-scratch/learn/lecture/38476088#overview

@Joe_Devs #frontend #bootstrap

star

Mon Jun 10 2024 22:56:02 GMT+0000 (Coordinated Universal Time) https://developer.android.com/tools/variables#envar

@curtisbarry

star

Mon Jun 10 2024 22:55:59 GMT+0000 (Coordinated Universal Time) https://developer.android.com/tools/variables#envar

@curtisbarry

star

Mon Jun 10 2024 22:55:39 GMT+0000 (Coordinated Universal Time) https://developer.android.com/tools/variables#envar

@curtisbarry

star

Mon Jun 10 2024 19:18:13 GMT+0000 (Coordinated Universal Time)

@signup

star

Mon Jun 10 2024 15:15:38 GMT+0000 (Coordinated Universal Time) undefined

star

Mon Jun 10 2024 15:10:23 GMT+0000 (Coordinated Universal Time)

star

Mon Jun 10 2024 13:47:10 GMT+0000 (Coordinated Universal Time)

@ayushg103 #c++

star

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

@ayushg103 #c++

star

Mon Jun 10 2024 12:45:13 GMT+0000 (Coordinated Universal Time)

@CarlosR

star

Mon Jun 10 2024 12:26:16 GMT+0000 (Coordinated Universal Time)

@meanaspotato #c #struct

star

Mon Jun 10 2024 12:15:06 GMT+0000 (Coordinated Universal Time)

@meanaspotato #c #enum #struct

Save snippets that work with our extensions

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