Snippets Collections
// App.js

import React from 'react';
import Header from './landing/Header'; // welcome, mrs. header component
import Bed from './landing/Bed'; // and welcome, mr. bed component, to your beautiful new home
import './App.css'; // we'll talk about CSS soon

function App() {
  return (
    <div className="App">
      <Header />
      <Bed />
    </div>
  );
}

export default App; 
def is_staircase(nums):
    col_length = 0
    staircase = []
    input_list = nums.copy()

    while len(input_list) > 0:
        col_length = col_length + 1
        column = []

        for i in range(0, col_length):
            column.append(input_list.pop(0))

            if (len(input_list) == 0):
                if i < col_length - 1:
                    return False
                staircase.append(column)
                return staircase
        staircase.append(column)
#include <stdio.h>
#include <stdlib.h>
 
/* A binary tree node has data, pointer to left child
   and a pointer to right child */
struct node {
    char data;
    struct node* left;
    struct node* right;
};
 
/* Prototypes for utility functions */
int search(char arr[], int strt, int end, char value);
struct node* newNode(char data);
 
/* Recursive function to construct binary of size len from
   Inorder traversal in[] and Preorder traversal pre[].  Initial values
   of inStrt and inEnd should be 0 and len -1.  The function doesn't
   do any error checking for cases where inorder and preorder
   do not form a tree */
struct node* buildTree(char in[], char pre[], int inStrt, int inEnd)
{
    static int preIndex = 0;
 
    if (inStrt > inEnd)
        return NULL;
 
    /* Pick current node from Preorder traversal using preIndex
    and increment preIndex */
    struct node* tNode = newNode(pre[preIndex++]);
 
    /* If this node has no children then return */
    if (inStrt == inEnd)
        return tNode;
 
    /* Else find the index of this node in Inorder traversal */
    int inIndex = search(in, inStrt, inEnd, tNode->data);
 
    /* Using index in Inorder traversal, construct left and
     right subtress */
    tNode->left = buildTree(in, pre, inStrt, inIndex - 1);
    tNode->right = buildTree(in, pre, inIndex + 1, inEnd);
 
    return tNode;
}
 
/* UTILITY FUNCTIONS */
/* Function to find index of value in arr[start...end]
   The function assumes that value is present in in[] */
int search(char arr[], int strt, int end, char value)
{
    int i;
    for (i = strt; i <= end; i++) {
        if (arr[i] == value)
            return i;
    }
}
 
/* Helper function that allocates a new node with the
   given data and NULL left and right pointers. */
struct node* newNode(char data)
{
    struct node* node = (struct node*)malloc(sizeof(struct node));
    node->data = data;
    node->left = NULL;
    node->right = NULL;
 
    return (node);
}
 
/* This function is here just to test buildTree() */
void printInorder(struct node* node)
{
    if (node == NULL)
        return;
 
    /* first recur on left child */
    printInorder(node->left);
 
    /* then print the data of node */
    printf("%c ", node->data);
 
    /* now recur on right child */
    printInorder(node->right);
}
 
/* Driver program to test above functions */
int main()
{
    char in[] = { 'D', 'G', 'B', 'A', 'H', 'E', 'I', 'C', 'F' };
    char pre[] = { 'A', 'B', 'D', 'G', 'C', 'E', 'H', 'I', 'F' };
    int len = sizeof(in) / sizeof(in[0]);
    struct node* root = buildTree(in, pre, 0, len - 1);
 
    /* Let us test the built tree by printing Inorder traversal */
    printf("Inorder traversal of the constructed tree is \n");
    printInorder(root);
    getchar();
}
//OUTPUT:

Inorder traversal of the constructed tree is 
D G B A H E I C F 
const { id, version } = await document.interestCohort();
console.log('FLoC ID:', id);
console.log('FLoC version:', version);
cohort = await document.interestCohort();
url = new URL("https://ads.example/getCreative");
url.searchParams.append("cohort", cohort);
creative = await fetch(url);
defmodule GraphQL.GraphqlSchema do
  use Absinthe.Schema

  alias GraphQL.Book

  @desc "A Book"
  object :book do
    field :id, :integer
    field :name, :string
    field :author, :string

  end

# Example fake data
@book_information %{
  "book1" => %{id: 1, name: "Harry Potter", author: "JK Rowling"},
  "book2" => %{id: 2, name: "Charlie Factory", author: "Bernard"},
  "book3" => %{id: 3, name: "Sherlock Holmes", author: "Sheikhu"}
}

@desc "hello world"
query do
 import_fields(:book_queries)
end

object :book_queries do
  field :book_info, :book do
    arg :id, non_null(:id)
    resolve fn %{id: book_id}, _ ->
      {:ok, @book_information[book_id]}
    end
  end

  field :get_book, :book do
    arg(:id, non_null(:id))
    resolve fn %{id: bookId}, _ ->
      {:ok, Book.get_info!(bookId)}
    end
  end

  field :get_all_books, non_null(list_of(non_null(:book))) do
    resolve fn _, _, _ ->
      {:ok, Book.list_information()}
    end
  end
end

mutation do
  import_fields(:mutations)
end

object :mutations do
  field :create_book, :book do
    arg(:name, non_null(:string))
    arg(:author, non_null(:string))
    resolve fn args, _ ->
       Book.create_info(args)
    end
  end
end
end

# mix.ex
{:absinthe, "~> 1.7"},
{:absinthe_plug, "~> 1.5"},
{:cors_plug, "~> 3.0"}

# For that go to endpoint.ex file. In the file right above plug MyBlogApiWeb.Router add this line plug CORSPlug, origin:"*". The option origin means, what origin we should allow traffic from.
# Adding "*" means we are allowing traffic from everywhere. If we want to be specific for our ember application. We can add origin: "localhost:4200".
plug CORSPlug, origin: "*"
plug CORSPlug, origin: ~r/^https?:\/\/localhost:\d{4}$/

# router.ex

scope "/api", GraphQLWeb do
  pipe_through :api
  forward("/", Absinthe.Plug, schema: GraphQL.Grapha)
end

scope "/" do
  forward "/GraphiQL", Absinthe.Plug.GraphiQL, schema: GraphQL.Grapha
end

# Or endpoint.ex

plug Absinthe.Plug.GraphiQL, schema: App.GraphQL.Schema
import { ApolloClient, InMemoryCache, gql } from '@apollo/client';

// Initialize Apollo Client
const client = new ApolloClient({
  uri: 'http://localhost:4000/GraphiQL',
  cache: new InMemoryCache(),
});

// GraphQL query
const GET_BOOKS = gql`
  query {
  getBook(id: 6) {
    author
    name
  }
  getAllBooks {
    name
  }
  bookInfo(id:"book1"){
  name
  author
  }
}
`;

// Function to fetch data
export async function getBooks() {
  const { data } = await client.query({
    query: GET_BOOKS,
  });
  return data;
}


// GraphQL mutation
const CREATE_BOOKS = gql`
mutation{
  createBook(author: "mohsin khan", name: "allah akbar"){
 author
 name
 id
}
}
`;

// Function to fetch data
export async function getBooks() {
  const { data } = await client.mutate({
    mutation: CREATE_BOOKS,
  });
  return data;
}


// call this in page.js

import { getBooks } from './apollo-client';

const graphql = () => {
  getBooks().then((data) => {
    console.log(data);
  });
}

graphql()
select * from information_schema.columns 
where table_name='table1'and column_name like'a%'
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;


public class VisualizadorCSV extends JFrame{
    
    //los graficos
    public JTextArea areaTexto;
    public JScrollPane barraDesplazamiento;
    
    public VisualizadorCSV(String archivo) throws FileNotFoundException, IOException {
        
        FileReader ruta_archivo_lectura=new FileReader(archivo);
        BufferedReader lector = new BufferedReader(ruta_archivo_lectura);
        
        String linea_archivo="", contenido_archivo="";
        int cont=0;
        
        while ((linea_archivo = lector.readLine()) != null ) 
            contenido_archivo+=linea_archivo+"\n";
         
        
        
        areaTexto=new JTextArea();
        barraDesplazamiento=new JScrollPane(areaTexto);
        getContentPane().add(barraDesplazamiento);
        this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        setSize(500,500);
        
        areaTexto.setText(contenido_archivo);
        
        //lector.close();
        
    }
    
}
import java.util.ArrayList;


public class Surtidor {
    
    public int id;
    public int cantidadActual;
    public double facturado;
    public ArrayList<Operacion> operaciones;
    
    public Surtidor(int id) {
        this.id=id;
        cantidadActual=100000;
        facturado=0.0;
        operaciones=new ArrayList<>();
    }
    
    public void echarGasolina(Empleado e,int cantidad,Auto a) {
        //se realiza nueva operacion
        operaciones.add(new Operacion(e,cantidad));
        //lo descontamos del surtidor
        cantidadActual-=cantidad;
        //se la anadimos al auto
        a.cantidadActual+=cantidad;
        //facturamos
        facturado+=(cantidad*1000);
    }
    
    //modificamos toString para que escriba info tipo csv
    
    @Override
    public String toString() {
        String cadena="s_"+id+"; c_"+cantidadActual+"; facturado:"+facturado+"; ";
        cadena+="operaciones; ";
        for(int i=0; i < operaciones.size(); i++)
            cadena+=operaciones.toString();
        
        cadena+="\n";
        return cadena;
    }
    
}
public class Operacion {
    //una operacion la realiza un empleado y echa una cantidad
    public Empleado empleado;
    public int cantidad;
    
    public Operacion(Empleado empleado, int cantidad) {
        this.empleado=empleado;
        this.cantidad=cantidad;
    }
    
     @Override
    public String toString() {
        return "operacion; empleado "+empleado+";"
                + " cantidad "+cantidad+"; ";
    }
    
}
public class Empleado {
    
    public int id;
    
    public Empleado(int id) {
        this.id=id;
    }
    
    @Override
    public String toString() {
        return "Empleado "+id;
    }
    
}
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;

/**
 *
 * @author clemente
 */
public class Copec {
    //la copec es de un lugar y tiene surtidores y empleados
    public String direccion;
    public Surtidor[] surtidores;
    public Empleado[] empleados;
    //creamos una nueva copec
    public Copec(String direccion) {
        surtidores=new Surtidor[6];
        for(int i=0; i < surtidores.length; i++)
           surtidores[i]=new Surtidor(i);
        empleados=new Empleado[2];
        for(int i=0; i < empleados.length; i++)
           empleados[i]=new Empleado(i);
          
    }
    //el empleado e, echa en a, la cantidad del surtidor
    public void echar(int e,Auto a,int cantidad,int s) {
        surtidores[s].echarGasolina(empleados[e], cantidad,a);
    }
    //imprime la informacion de surtidores
    @Override
    public String toString() {
        String cadena="";
        for(int i=0; i < surtidores.length; i++) {
            cadena+=surtidores[i].toString();
            //cadena+="\n";
        }
        return cadena;
    }
    
    public void guardarInfoCSV() {
        try(FileWriter fw = new FileWriter("copec.csv", true);
            BufferedWriter bw = new BufferedWriter(fw);
            PrintWriter out = new PrintWriter(bw)) {
            
            out.println(toString());
           
        } catch (IOException e) {
    
        }   
    }
    
}import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;

/**
 *
 * @author clemente
 */
public class Copec {
    //la copec es de un lugar y tiene surtidores y empleados
    public String direccion;
    public Surtidor[] surtidores;
    public Empleado[] empleados;
    //creamos una nueva copec
    public Copec(String direccion) {
        surtidores=new Surtidor[6];
        for(int i=0; i < surtidores.length; i++)
           surtidores[i]=new Surtidor(i);
        empleados=new Empleado[2];
        for(int i=0; i < empleados.length; i++)
           empleados[i]=new Empleado(i);
          
    }
    //el empleado e, echa en a, la cantidad del surtidor
    public void echar(int e,Auto a,int cantidad,int s) {
        surtidores[s].echarGasolina(empleados[e], cantidad,a);
    }
    //imprime la informacion de surtidores
    @Override
    public String toString() {
        String cadena="";
        for(int i=0; i < surtidores.length; i++) {
            cadena+=surtidores[i].toString();
            //cadena+="\n";
        }
        return cadena;
    }
    
    public void guardarInfoCSV() {
        try(FileWriter fw = new FileWriter("copec.csv", true);
            BufferedWriter bw = new BufferedWriter(fw);
            PrintWriter out = new PrintWriter(bw)) {
            
            out.println(toString());
           
        } catch (IOException e) {
    
        }   
    }
    
}
public class Auto {
    
    public String id;
    public int cantidadActual;
    
    public Auto(String id,int ca) {
        this.id=id;
        cantidadActual=ca;
    }
    
    public void echar(int temp) {
        cantidadActual=+temp;
    }
    
    @Override
    public String toString() {
        return "Auto ( id "+id+";"
                + "         con combustible "+cantidadActual+" ) ";
    }
    
    
}
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;


public class Main {
    
    public static void main (String[]args) {
        Copec copec=new Copec("Chillan");
        Auto a1=new Auto("AUTO1",30);
        //empleado 0 echa en el a1 50 litros del surtido 1
        copec.echar(0, a1, 50, 1);
        //como queda la copec
        System.out.println(copec.toString());
        //como queda el auto
        System.out.println(a1.toString());
        
        copec.guardarInfoCSV();
        
        try {
            //una vez creado el csv lo voy a mostrar

            VisualizadorCSV visualizador=new VisualizadorCSV("copec.csv");
            visualizador.setVisible(true);
        } catch (IOException ex) {
            System.out.println(ex.toString());
        }
        
    }
    
}
import java.util.ArrayList;

public class Surtidor {
    
    public int id;
    public int cantidadActual;
    public double facturado;
    public ArrayList<Operacion> operaciones;
    
    public Surtidor(int id) {
        this.id=id;
        cantidadActual=100000;
        facturado=0.0;
        operaciones=new ArrayList<>();
    }
    
    public void echarGasolina(Empleado e,int cantidad,Auto a) {
        //se realiza nueva operacion
        operaciones.add(new Operacion(e,cantidad));
        //lo descontamos del surtidor
        cantidadActual-=cantidad;
        //se la anadimos al auto
        a.cantidadActual+=cantidad;
        //facturamos
        facturado+=(cantidad*1000);
    }
    
    //modificamos toString para que escriba info tipo csv
    
    @Override
    public String toString() {
        String cadena="s_"+id+"; c_"+cantidadActual+"; facturado:"+facturado+"; ";
        cadena+="operaciones; ";
        for(int i=0; i < operaciones.size(); i++)
            cadena+=operaciones.toString();
        
        cadena+="\n";
        return cadena;
    }
    
}
public class Operacion {
    //una operacion la realiza un empleado y echa una cantidad
    public Empleado empleado;
    public int cantidad;
    
    public Operacion(Empleado empleado, int cantidad) {
        this.empleado=empleado;
        this.cantidad=cantidad;
    }
    
     @Override
    public String toString() {
        return "operacion; empleado "+empleado+";"
                + " cantidad "+cantidad+"; ";
    }
    
}
public class Empleado {
    
    public int id;
    
    public Empleado(int id) {
        this.id=id;
    }
    
    @Override
    public String toString() {
        return "Empleado "+id;
    }
    
}
public class Empleado {
    
    public int id;
    
    public Empleado(int id) {
        this.id=id;
    }
    
    @Override
    public String toString() {
        return "Empleado "+id;
    }
    
}
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;


public class Copec {
    //la copec es de un lugar y tiene surtidores y empleados
    public String direccion;
    public Surtidor[] surtidores;
    public Empleado[] empleados;
    //creamos una nueva copec
    public Copec(String direccion) {
        surtidores=new Surtidor[6];
        for(int i=0; i < surtidores.length; i++)
           surtidores[i]=new Surtidor(i);
        empleados=new Empleado[2];
        for(int i=0; i < empleados.length; i++)
           empleados[i]=new Empleado(i);
          
    }
    //el empleado e, echa en a, la cantidad del surtidor
    public void echar(int e,Auto a,int cantidad,int s) {
        surtidores[s].echarGasolina(empleados[e], cantidad,a);
    }
    //imprime la informacion de surtidores
    @Override
    public String toString() {
        String cadena="";
        for(int i=0; i < surtidores.length; i++) {
            cadena+=surtidores[i].toString();
            //cadena+="\n";
        }
        return cadena;
    }
    
    public void guardarInfoCSV() {
        try(FileWriter fw = new FileWriter("copec.csv", true);
            BufferedWriter bw = new BufferedWriter(fw);
            PrintWriter out = new PrintWriter(bw)) {
            out.println(toString());
        } catch (IOException e) {
    
        }   
    }
    
}
public class Auto {
    
    public String id;
    public int cantidadActual;
    
    public Auto(String id,int ca) {
        this.id=id;
        cantidadActual=ca;
    }
    
    public void echar(int temp) {
        cantidadActual=+temp;
    }
    
    @Override
    public String toString() {
        return "Auto ( id "+id+";"
                + "         con combustible "+cantidadActual+" ) ";
    }
    
    
}
public class Main {
    
    public static void main (String[]args) {
        Copec copec=new Copec("Chillan");
        Auto a1=new Auto("AUTO1",30);
        //empleado 0 echa en el a1 50 litros del surtido 1
        copec.echar(0, a1, 50, 1);
        //como queda la copec
        System.out.println(copec.toString());
        //como queda el auto
        System.out.println(a1.toString());
        
        copec.guardarInfoCSV();
        
    }
    
}
public class Surtidor {
    
    public int id;
    public int cantidadActual;
    public double facturado;
    public ArrayList<Operacion> operaciones;
    
    public Surtidor(int id) {
        this.id=id;
        cantidadActual=100000;
        facturado=0.0;
        operaciones=new ArrayList<>();
    }
    
    public void echarGasolina(Empleado e,int cantidad,Auto a) {
        operaciones.add(new Operacion(e,cantidad));
        cantidadActual-=cantidad;
        a.cantidadActual+=cantidad;
        facturado+=(cantidad*1000);
    }
    
    @Override
    public String toString() {
        String cadena=" Sutidor "+id+" tiene "+cantidadActual+" y "
                + "facturado:"+facturado+"\n";
        cadena+=" Las operaciones son: \n";
        for(int i=0; i < operaciones.size(); i++)
            cadena+=operaciones.toString();
        
        return cadena;
    }
    
}
public class Operacion {
    //una operacion la realiza un empleado y echa una cantidad
    public Empleado empleado;
    public int cantidad;
    
    public Operacion(Empleado empleado, int cantidad) {
        this.empleado=empleado;
        this.cantidad=cantidad;
    }
    
     @Override
    public String toString() {
        return "Operacion ( Empleado "+empleado+";"
                + "         Cantidad "+cantidad+" ) ";
    }
    
}
public class Empleado {
    
    public int id;
    
    public Empleado(int id) {
        this.id=id;
    }
    
    @Override
    public String toString() {
        return "Empleado "+id;
    }
    
}
public class Copec {
    //la copec es de un lugar y tiene surtidores y empleados
    public String direccion;
    public Surtidor[] surtidores;
    public Empleado[] empleados;
    //creamos una nueva copec
    public Copec(String direccion) {
        surtidores=new Surtidor[6];
        for(int i=0; i < surtidores.length; i++)
           surtidores[i]=new Surtidor(i);
        empleados=new Empleado[2];
        for(int i=0; i < empleados.length; i++)
           empleados[i]=new Empleado(i);
          
    }
    //el empleado e, echa en a, la cantidad del surtidor
    public void echar(int e,Auto a,int cantidad,int s) {
        surtidores[s].echarGasolina(empleados[e], cantidad,a);
    }
    //imprime la informacion de surtidores
    @Override
    public String toString() {
        String cadena="";
        for(int i=0; i < surtidores.length; i++) {
            cadena+=surtidores[i].toString();
            cadena+="\n";
        }
        return cadena;
    }
    
}
public class Auto {
    
    public String id;
    public int cantidadActual;
    
    public Auto(String id,int ca) {
        this.id=id;
        cantidadActual=ca;
    }
    
    public void echar(int temp) {
        cantidadActual=+temp;
    }
    
    @Override
    public String toString() {
        return "Auto ( id "+id+";"
                + "         con combustible "+cantidadActual+" ) ";
    }
    
    
}
public class Main {
    
    public static void main (String[]args) {
        Copec copec=new Copec("Chillan");
        Auto a1=new Auto("AUTO1",30);
        //empleado 0 echa en el a1 50 litros del surtido 1
        copec.echar(0, a1, 50, 1);
        //como queda la copec
        System.out.println(copec.toString());
        //como queda el auto
        System.out.println(a1.toString());
        
    }
    
}
#include "google/cloud/texttospeech/v1/text_to_speech_client.h"
#include <iostream>

auto constexpr kText = R"""(
Four score and seven years ago our fathers brought forth on this
continent, a new nation, conceived in Liberty, and dedicated to
the proposition that all men are created equal.)""";

int main(int argc, char* argv[]) try {
  if (argc != 1) {
    std::cerr << "Usage: " << argv[0] << "\n";
    return 1;
  }

  namespace texttospeech = ::google::cloud::texttospeech_v1;
  auto client = texttospeech::TextToSpeechClient(
      texttospeech::MakeTextToSpeechConnection());

  google::cloud::texttospeech::v1::SynthesisInput input;
  input.set_text(kText);
  google::cloud::texttospeech::v1::VoiceSelectionParams voice;
  voice.set_language_code("en-US");
  google::cloud::texttospeech::v1::AudioConfig audio;
  audio.set_audio_encoding(google::cloud::texttospeech::v1::LINEAR16);

  auto response = client.SynthesizeSpeech(input, voice, audio);
  if (!response) throw std::move(response).status();
  // Normally one would play the results (response->audio_content()) over some
  // audio device. For this quickstart, we just print some information.
  auto constexpr kWavHeaderSize = 48;
  auto constexpr kBytesPerSample = 2;  // we asked for LINEAR16
  auto const sample_count =
      (response->audio_content().size() - kWavHeaderSize) / kBytesPerSample;
  std::cout << "The audio has " << sample_count << " samples\n";

  return 0;
} catch (google::cloud::Status const& status) {
  std::cerr << "google::cloud::Status thrown: " << status << "\n";
  return 1;
}
php artisan storage:link
composer require maatwebsite/excel
  // ------------NewChanges --------------------------------
      // DW ==> allow navigation if incomplete steps list is empty ==> only in GuardianShip and Full Will
      // if (id === 13 && (willTypeID === FULL_WILL || willTypeID === GUARDIANSHIP_WILL)) {
      //   const steps = await dispatch<any>(fetchAllIncompleteWillsSteps(profileGuid, spouseGuid, serviceId));
      //   if (steps.length === 0) {
      //     dispatch(setHighlightedSteps(getDraftWillStepNumber()));
      //     dispatch(setNavigationIndex(getDraftWillStepNumber()));
      //     dispatch(getNewActiveStep(13));
      //   }
      // }

      // /**
      //  * WILL PREVIEW
      //  * if fullWill || Guardianshipwill => allow navigation to Will Preview if only Draft Will is completed else allow navigation if incomplete steps list is empty
      //  */
      // if (id === 21) {
      //   const steps = await dispatch<any>(fetchAllIncompleteWillsSteps(profileGuid, spouseGuid, serviceId));
      //   if (willTypeID === FULL_WILL || willTypeID === GUARDIANSHIP_WILL) {
      //     if (steps.length === 0 && completedStepNumArray.includes(getDraftWillStepNumber())) {
      //       dispatch(setHighlightedSteps(getWillPreviewStepNumber()));
      //       dispatch(setNavigationIndex(getWillPreviewStepNumber()));
      //       dispatch(getNewActiveStep(21));
      //     } else {
      //       await dispatch<any>(resetErrorState());
      //       await dispatch<any>(setErrorInfo('Please complete Draft will to reach to Will Preview'));
      //     }
      //   }

      //   // All other willTypes
      //   if (willTypeID === PROPERTY_WILL
      //     || willTypeID === BUISINESS_OWNERS_WILL
      //     || willTypeID === FINANCIAL_ASSETS_WILL
      //     || willTypeID === TEMPLATED_FULL_WILL) {
      //     if (steps.length === 0) {
      //       dispatch(setHighlightedSteps(getWillPreviewStepNumber()));
      //       dispatch(setNavigationIndex(getWillPreviewStepNumber()));
      //       dispatch(getNewActiveStep(21));
      //     } else {
      //       await dispatch<any>(resetErrorState());
      //       await dispatch<any>(setErrorInfo('Please complete all steps to preview the will'));
      //     }
      //   }
      // }

      // // Book Appointment ==> allow navigation only if will preview is completed
      // if (id === 9) {
      //   const steps = await dispatch<any>(fetchAllIncompleteWillsSteps(profileGuid, spouseGuid, serviceId));
      //   const condition = steps.length === 0 && completedStepNumArray.includes(getWillPreviewStepNumber());
      //   console.log('step condition', condition);
      //   if (condition) {
      //     dispatch(setHighlightedSteps(getBookAppointmentStepNumber()));
      //     dispatch(setNavigationIndex(getBookAppointmentStepNumber()));
      //     dispatch(getNewActiveStep(9));
      //   } else {
      //     await dispatch<any>(resetErrorState());
      //     await dispatch<any>(setErrorInfo('Please complete all steps to book appointment'));
      //   }
      // }

      // // Payment ==> allow navigation only if book appointment is completed
      // if (id === 10) {
      //   const steps = await dispatch<any>(fetchAllIncompleteWillsSteps(profileGuid, spouseGuid, serviceId));
      //   if (steps.length === 0 && completedStepNumArray.includes(getBookAppointmentStepNumber())) {
      //     dispatch(setHighlightedSteps(getBookAppointmentStepNumber()));
      //     dispatch(setNavigationIndex(getBookAppointmentStepNumber()));
      //     dispatch(getNewActiveStep(10));
      //   }
      // }
      // ------------------New Changes --------------------------------

      // -------------------------------Validations in stepper for all willtypes--------------------------------
      // Will Preview navigation in stepper
      // if (id === 21 && isShowBookAppointment) {
      //   dispatch(setHighlightedSteps(getWillPreviewStepNumber()));
      //   dispatch(setNavigationIndex(getWillPreviewStepNumber()));
      //   dispatch(getNewActiveStep(21));
      // } else if (id === 21 && !isShowBookAppointment) {
      //   // Prevent navigation to will preview if all steps are not completed
      //   dispatch(setHighlightedSteps(highlightedStep));
      //   dispatch(setNavigationIndex(highlightedStep));
      //   dispatch(getNewActiveStep(newActiveStep));
      //   await dispatch<any>(resetErrorState());
      //   await dispatch<any>(setErrorInfo('Please complete all steps to proceed!'));
      // }

      /**
       * Navigation to Book Appointment only if isShowBookAppointment = true && draftWill() && WillPreview Completed
       */
      // if (id === 9 && isShowBookAppointment) {
      //   const { testatorSteps } = await getIncompleteStepsList(
      //     profileGuid,
      //     spouseGuid,
      //     profileGuid,
      //     serviceId,
      //   );

      //   if (testatorSteps.length === 0) {
      //     dispatch(setHighlightedSteps(getBookAppointmentStepNumber()));
      //     dispatch(setNavigationIndex(getBookAppointmentStepNumber()));
      //     dispatch(getNewActiveStep(9));
      //   } else {
      //     await dispatch<any>(resetErrorState());
      //     await dispatch<any>(setErrorInfo('Please complete all steps to proceed!'));
      //   }
      // } else if (id === 9 && !isShowBookAppointment) {
      //   await dispatch<any>(resetErrorState());
      //   await dispatch<any>(setErrorInfo('Please complete all steps to proceed!'));
      // }

      // Navigate to payment only if book appointment is completed and isShowBookAppointment === true
      // if (id === 10 && bookAppointmentCompleted && isShowBookAppointment) {
      //   dispatch(setHighlightedSteps(getPaymentStepNumber()));
      //   dispatch(setNavigationIndex(getPaymentStepNumber()));
      //   dispatch(getNewActiveStep(10));
      // }
      // -------------------------------Validations in stepper --------------------------------
<meta name="theme-color" media="(prefers-color-scheme: light)" content="cyan" />
<meta name="theme-color" media="(prefers-color-scheme: dark)" content="black" />
import java.awt.*;
import java.awt.event.*;
public class gui extends Frame{
	private Button red=null;
	private Button green=null;
	public gui(){
	}
	public static void main(String[] args){
		gui f=new gui();
		//f.setLocation(150,150);
		f.setVisible(true);
		//f.setSize(300,300);
		f.setBounds(10,10,500,500);//location and size
		f.add(red);
	}
}
switch (COUNTRY) {
    case 'COUNTRY A':
      return <CountryAWidget />;
    case 'COUNTRY B':
      return <CountryBWidget />;
    default:
      return (
        <CountryCWidget />;
      );
  }
yarn ios-uat id --reset-cache --simulator "iPhone 15 Pro"
sudo letsencrypt certonly --standalone -d [도메인 이름]
#include<stdio.h>
struct Student{
    int id;
    char name[50];
    char session[50];
    float marks;
};
int main()
{
    int i,j;
    struct Student temp;
    struct Student s[10];

    for(i=0;i<10;i++){
        printf("Enter Data for Student %d:\n",i+1);
        scanf("%d%s%s%f",&s[i].id,&s[i].name,&s[i].session,&s[i].marks);
    }
    for(i=0;i<9;i++){
        for(j=0;j<9;j++){
            if(s[j].marks<s[j+1].marks){
                temp = s[j];
                s[j] = s[j+1];
                s[j+1] = temp;
            }
        }
    }
    printf("\n");
    printf("\n");
    printf("---------------------------\n");
    printf("---------------------------\n");
    for(i=0;i<10;i++){
        printf("Data for Student %d:\n",i+1);
        printf("Id:%d\n",s[i].id);
        printf("Name:%s\n",s[i].name);
        printf("Session:%s\n",s[i].session);
        printf("Marks:%.2f\n",s[i].marks);
    }


    return 0;
}
Sub RemoveFormulasFromExcel()
Dim Xws As Worksheet
For Each Xws In Worksheets
Xws.UsedRange.Value = Xws.UsedRange.Value
Next
End Sub
for(var i =0;i<50;i++){

var cart = new sn_sc.CartJS();

var request =
{
  'sysparm_id': 'e995bb921bcbf15476ccbbb88b4bcb79', //sys id of catalog item
  'sysparm_quantity': '1',
  'variables':{
  }
}

var gr = new GlideRecord('sc_req_item');
if (gr.get('0f7cbb001bd33d1076ccbbb88b4bcb8d')) {
   var vars = Object.keys(gr.variables);
  
  
  vars.forEach(function(e){
  request.variables[e]= gr.variables[e].toString();
  
  
  })
}
var cartDetails = cart.orderNow(request);
gs.info(cartDetails);
cartDetails
}
var express = require('express');
var router = express.Router();
const multer  = require('multer');
const Teacher = require('../model/teacher_register');
const fs = require('fs')

const storage = multer.diskStorage({
    destination: function (req, file, cb) {
      cb(null, 'uploads/'); // Store uploaded images in the 'uploads' directory
    },
    filename: function (req, file, cb) {
      cb(null, Date.now() + '-' + file.originalname);
    },
  });
  
const upload = multer({ storage: storage });

const TeacherRegister = async (req, res, next) => {
    try {
        
        const teacher = new Teacher({
            tea_fname: req.body.tea_fname,
            tea_lname: req.body.tea_lname,
            tea_email: req.body.tea_email,
            tea_number: req.body.tea_number,
            tea_address: req.body.tea_address,
            tea_subject: req.body.tea_subject,
            tea_image: req.file.filename,
        })

        const teacher_data = await teacher.save();
        let teacher_id = teacher_data._id;

        res.json({
            status: 200,
            message: "Teacher Register Successfully",
            teacher_id: teacher_id,
            destination: "Please Save your Teacher id Becoses login time is required"

        })

    } catch (error) {

    fs.unlinkSync(req.file.path);
    
    res.json({
        status: 400,
        message: "Please Rechake Your Details",
        hint: "Some information is Duplicate"
    })
        
    }
}



const GetTeacherId = async (req, res , next) => {
  try {

    let teachermail = req.body.Teacheremail;

    const data = await Teacher.aggregate([
    {
      $match: {
        tea_email: teachermail
      }
    },
    {
      $project: {
        _id: 1
      }
    }
  
  ])
  
    res.json({
      status: 200,
      message: "Get Teacher Id Successfully",
      data: data
    })
    
  } catch (error) {

    res.json({
      status: 400,
      message: "Please check email address",
    })
    
  }
}


router.post("/register",upload.single('tea_image'), TeacherRegister); // TeacherRegister
router.get("/getid", GetTeacherId); // TeacherRegister
module.exports = router;
Basic Form Abandonment Script in JavaScript
Here's a basic JavaScript script that tracks form abandonment:

JavaScript
(function() {
  // Variables
  const forms = document.querySelectorAll('form'); // Select all forms on the page
  const abandonmentTime = 3000; // Time in milliseconds before considering abandonment (adjust as needed)

  // Track user activity
  window.addEventListener('beforeunload', (event) => {
    for (const form of forms) {
      if (!form.elementsHaveInteraction()) { // Check if any form element has been interacted with
        event.returnValue = 'Are you sure you want to leave without completing the form?'; // Prompts before leaving
      }
    }
  });

  // Function to check if any form element has been interacted with
  function formElementsHaveInteraction() {
    for (const element of this.elements) {
      if (element.value || element.checked) {
        return true;
      }
    }
    return false;
  }

  // Apply function to all forms
  for (const form of forms) {
    form.elementsHaveInteraction = formElementsHaveInteraction.bind(form);
  }
})();
#include<stdio.h>
// this code is for the recursive implementation of ternary search 
int ternarysearch(int l, int r, int key,int ar[])
{
    if(r >= 1){
        int mid1 = l + (r-1)/3;
        int mid2 = r - (r-1)/3;
        
        if (ar[mid1] == key){
            return mid1;
        }
        if (ar[mid2] == key){
            return mid2;
        }
        if(key < ar[mid1]){
            return ternarysearch(1, mid1-1,key,ar);
        }
        else if(key > ar[mid2]){
            return ternarysearch(mid2+1, mid2-1,key,ar);
        }
    }

    return -1;    

}

int main()
{
    int l,r,p,key;
//sort the array if the array is not sorted
    int ar[] = {1,2,3,4,5,6,7,8,9,10};

    l=0;

    r=9;

    key= 5;

    p= ternarysearch(l, r,key,ar);

    printf("index of %d is%d\n", key,p);

    key = 50;

    p= ternarysearch(l, r, key, ar);

    printf("index of %d is %d",key , p);
}
Certainly! The animation property in CSS is used to apply animations to elements on a webpage. Here is a basic example of how to use it:




.element {
  animation-name: slide-in;
  animation-duration: 2s;
  animation-delay: 1s;
  animation-iteration-count: infinite;
  animation-direction: alternate;
}

@keyframes slide-in {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(0);
  }
}




In the above example, we define an animation called slide-in using the @keyframes rule. We then apply this animation to the .element class using the animation-name property. The animation-duration property specifies how long the animation should take, the animation-delay property adds a delay before the animation starts, the animation-iteration-count property specifies how many times the animation should repeat, and the animation-direction property specifies the direction of the animation.

Within the @keyframes rule, we define the different stages of the animation using percentage values. In this example, we start with the element translated to the left by 100% (transform: translateX(-100%)) and end with the element at its original position (transform: translateX(0)).

You can customize the animation by adjusting these properties and the @keyframes rule to achieve different effects.


https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_4454200103.html#Related-Topics
star

Wed Dec 20 2023 20:37:48 GMT+0000 (Coordinated Universal Time) https://tripleten.com/trainer/web/lesson/9130d953-0d59-4802-b145-4139af0112da/

@Marcelluki

star

Wed Dec 20 2023 20:34:29 GMT+0000 (Coordinated Universal Time)

@KCashwell1

star

Wed Dec 20 2023 19:11:48 GMT+0000 (Coordinated Universal Time)

@Mohamedshariif #java

star

Wed Dec 20 2023 18:25:56 GMT+0000 (Coordinated Universal Time) https://web.dev/articles/floc

@Spsypg #text #+js

star

Wed Dec 20 2023 18:24:29 GMT+0000 (Coordinated Universal Time) https://web.dev/articles/floc

@Spsypg #javascript

star

Wed Dec 20 2023 18:14:19 GMT+0000 (Coordinated Universal Time) https://github.com/WICG/floc

@Spsypg

star

Wed Dec 20 2023 18:12:35 GMT+0000 (Coordinated Universal Time) https://github.com/WICG/floc

@Spsypg

star

Wed Dec 20 2023 16:10:02 GMT+0000 (Coordinated Universal Time)

@devbymohsin #elixir

star

Wed Dec 20 2023 15:50:34 GMT+0000 (Coordinated Universal Time)

@devbymohsin #javascript

star

Wed Dec 20 2023 15:28:47 GMT+0000 (Coordinated Universal Time)

@darshcode #sql

star

Wed Dec 20 2023 13:03:03 GMT+0000 (Coordinated Universal Time)

@javcaves

star

Wed Dec 20 2023 13:02:29 GMT+0000 (Coordinated Universal Time)

@javcaves

star

Wed Dec 20 2023 13:02:05 GMT+0000 (Coordinated Universal Time)

@javcaves

star

Wed Dec 20 2023 13:01:44 GMT+0000 (Coordinated Universal Time)

@javcaves

star

Wed Dec 20 2023 13:01:23 GMT+0000 (Coordinated Universal Time)

@javcaves

star

Wed Dec 20 2023 13:01:02 GMT+0000 (Coordinated Universal Time)

@javcaves

star

Wed Dec 20 2023 13:00:40 GMT+0000 (Coordinated Universal Time)

@javcaves

star

Wed Dec 20 2023 12:58:15 GMT+0000 (Coordinated Universal Time)

@javcaves

star

Wed Dec 20 2023 12:57:33 GMT+0000 (Coordinated Universal Time)

@javcaves

star

Wed Dec 20 2023 12:57:08 GMT+0000 (Coordinated Universal Time)

@javcaves

star

Wed Dec 20 2023 12:57:08 GMT+0000 (Coordinated Universal Time)

@javcaves

star

Wed Dec 20 2023 12:56:46 GMT+0000 (Coordinated Universal Time)

@javcaves

star

Wed Dec 20 2023 12:56:02 GMT+0000 (Coordinated Universal Time)

@javcaves

star

Wed Dec 20 2023 12:55:26 GMT+0000 (Coordinated Universal Time)

@javcaves

star

Wed Dec 20 2023 12:54:40 GMT+0000 (Coordinated Universal Time)

@javcaves

star

Wed Dec 20 2023 12:54:04 GMT+0000 (Coordinated Universal Time)

@javcaves

star

Wed Dec 20 2023 12:53:30 GMT+0000 (Coordinated Universal Time)

@javcaves

star

Wed Dec 20 2023 12:53:03 GMT+0000 (Coordinated Universal Time)

@javcaves

star

Wed Dec 20 2023 12:52:03 GMT+0000 (Coordinated Universal Time)

@javcaves

star

Wed Dec 20 2023 12:51:24 GMT+0000 (Coordinated Universal Time)

@javcaves

star

Wed Dec 20 2023 12:20:34 GMT+0000 (Coordinated Universal Time) https://anvil.works/forum/t/issues-with-anvil-http-request-post/13942

@webdeveloper_

star

Wed Dec 20 2023 12:13:46 GMT+0000 (Coordinated Universal Time) https://cloud.google.com/text-to-speech/docs/libraries

@Spsypg

star

Wed Dec 20 2023 11:53:12 GMT+0000 (Coordinated Universal Time) https://cloud.google.com/text-to-speech/docs/libraries

@Spsypg

star

Wed Dec 20 2023 11:10:30 GMT+0000 (Coordinated Universal Time)

@zaryabmalik

star

Wed Dec 20 2023 09:53:20 GMT+0000 (Coordinated Universal Time)

@alfred555 #react.js

star

Wed Dec 20 2023 08:49:02 GMT+0000 (Coordinated Universal Time) https://products.aspose.com/slides/php-java/conversion/ppt-to-pdf/

@zaryabmalik

star

Wed Dec 20 2023 07:24:43 GMT+0000 (Coordinated Universal Time) https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta/name/theme-color

@zaryabmalik

star

Wed Dec 20 2023 05:22:06 GMT+0000 (Coordinated Universal Time)

@dsce

star

Wed Dec 20 2023 03:10:24 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/77597251/best-approach-to-handle-dynamic-ui-based-on-regions-in-react-native

@rihafhusen

star

Wed Dec 20 2023 03:06:06 GMT+0000 (Coordinated Universal Time)

@rihafhusen

star

Tue Dec 19 2023 22:59:30 GMT+0000 (Coordinated Universal Time)

@wheedo

star

Tue Dec 19 2023 19:52:07 GMT+0000 (Coordinated Universal Time)

@abdul_rehman #c

star

Tue Dec 19 2023 17:51:46 GMT+0000 (Coordinated Universal Time) https://www.thiscodeworks.com/snippets

@spekz369

star

Tue Dec 19 2023 17:50:36 GMT+0000 (Coordinated Universal Time)

@s7g7h ##excel

star

Tue Dec 19 2023 16:56:59 GMT+0000 (Coordinated Universal Time)

@gawlow

star

Tue Dec 19 2023 15:40:13 GMT+0000 (Coordinated Universal Time)

@sid_balar

star

Tue Dec 19 2023 14:02:10 GMT+0000 (Coordinated Universal Time)

@manishsah

star

Tue Dec 19 2023 13:05:26 GMT+0000 (Coordinated Universal Time)

@deba

star

Tue Dec 19 2023 11:49:55 GMT+0000 (Coordinated Universal Time) https://share.bito.ai/static/share?aid=370c4051-69fe-4987-84c0-5fe4dbb7cddb

@codeing #dotenv #css

star

Tue Dec 19 2023 11:08:01 GMT+0000 (Coordinated Universal Time)

@mdfaizi

Save snippets that work with our extensions

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