Snippets Collections
const [array, setArray] = React.useState(['One', 'Two', 'Three']);

// this is not the correct way!
array.push('Four');
setArray(array); 

// this is the right way
setArray([...array, 'Four']);
const [rating, setRating] = React.useState(0); // -1, 0 or 1
const [isBlocked, setIsBlocked] = React.useState(false); // true or false
const [notes, setNotes] = React.useState(['no notes yet']); // an array of strings 
// the User functional component
function User(props) {
  // the hook that manages internal state
  const [rating, setRating] = React.useState(0);

  /*
   * event handlers to update internal state
   */
  function handleLike() {
    setRating(1);
  }

  function handleDislike() {
    setRating(-1);
  }

  return (
    <div className="user">
      <img src={`img/${props.id}.png`} width="75" />
      {props.name}
      <div className="rating">
        <button onClick={handleLike} disabled={rating > 0}>👍</button>
        {rating}
        <button onClick={handleDislike} disabled={rating < 0}>👎</button>
      </div>
    </div>
  );
} 
npm run dev - runs development project

npm run build -runs build project that is able to be streamed to the internet
I want to use React to Scroll to Specific Section of my Website, but the navbar, pages all are different .js files

ChatGPT
To implement scrolling to specific sections of your website using React, even when the components are in different files, you can use the react-scroll library. This library provides a smooth scrolling experience between different sections of your webpage.

Here are the steps to achieve this:

npm install react-scroll

// Navbar.js
import React from 'react';
import { Link, animateScroll as scroll } from 'react-scroll';

const Navbar = () => {
  return (
    <nav>
      <ul>
        <li>
          <Link
            activeClass="active"
            to="home"
            spy={true}
            offset={-70}
            duration={1500}
			smooth={'easeOutElastic'}
          >
            Home
          </Link>
        </li>
        <li>
          <Link
            activeClass="active"
            to="about"
            spy={true}
            offset={-70}
            duration={1500}
			smooth={'easeOutElastic'}
          >
            About
          </Link>
        </li>
        {/* Add more links for other sections */}
      </ul>
    </nav>
  );
};

export default Navbar;



// Home.js
import React from 'react';

const Home = () => {
  return (
    <div id="home">
      <h1>Home Section</h1>
      {/* Add content for the home section */}
    </div>
  );
};

export default Home;



// App.js
import React from 'react';
import Navbar from './Navbar';
import Home from './Home';
import About from './About';
// Import other section components

const App = () => {
  return (
    <div>
      <Navbar />
      <Home />
      <About />
      {/* Render other section components */}
    </div>
  );
};

export default App;


Now, when you click on the navigation links in the Navbar, the page will smoothly scroll to the corresponding sections. Make sure to customize the content of each section and adjust the Link components in the Navbar accordingly.
// InfoForm.js

this.state = {
  submitted: false,
  userEmail: '', // we'll start this off as an empty string
}; 

//We can attach the onChange listener to our <input> element. This will be triggered every time a change is made inside our input. For example, if the user enters the string, 'pillow' inside of our input, onChange() will fire 6 times, one for each character inside the string.

// InfoForm.js

<input onChange={this.handleChange} className="infoForm-input" type="email" placeholder="Enter your email here"/> 
  
//Finally, we'll need to create the handleChange() method itself:
  
// InfoForm.js

handleChange = (evt) => {
  this.setState({ userEmail: evt.target.value });
}; 
  
// Date with time
GETDATE()
// Just the year
YEAR(GETDATE())
// Date without the time
CAST( GETDATE() AS Date )
// InfoForm.js

import React from "react";
import "./InfoForm.css";

class InfoForm extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      submitted: false,
    };
  }

  handleSubmit = () => {
    this.setState({ submitted: true });
  };

  render() {
    if (this.state.submitted) {
      return (
        <p className="infoForm-text">
          Thanks. When the kingdom of comfort opens, we'll be in touch!
        </p>
      );
    } else {
      return (
        <div className="infoForm-container">
          <p className="infoForm-text">
            Sign up below and we'll let you know when we launch the next great
            mattress experience!
          </p>
          <form onSubmit={this.handleSubmit} className="infoForm-form">
            <input
              className="infoForm-input"
              type="email"
              placeholder={"Enter your email here"}
            />
            <button className="infoForm-button" type="submit">
              Amaze me!
            </button>
          </form>
        </div>
      );
    }
  }
}

export default InfoForm;
/* Header.css */

@font-face {
    font-family: 'Roboto Condensed';
    src: url('../../fonts/Robotocondensed.woff') format('woff');
}

.header-title {
    text-align: center;
    color: #fff;
    font-size: 40px;
    font-family: 'Roboto Condensed', sans-serif;
    max-width: 220px;
    margin: 0 auto 58px;
    text-transform: uppercase;
} 
select * from information_schema.columns 
where TABLE_SCHEMA ='SCE' and TABLE_NAME like'%Order%' and COLUMN_NAME like'%Order%'

select * from information_schema.columns 
WHERE TABLE_SCHEMA ='SCE' and TABLE_NAME like'vw_ORDERS_1' and COLUMN_NAME like'%Date%'
https://sydneyharbourboattours.com/wp-admin/plugin-install.php
<style>
body{
background:#f9f9fb;    
}
.view-account{
background:#FFFFFF; 
margin-top:20px;
}
.view-account .pro-label {
font-size: 13px;
padding: 4px 5px;
position: relative;
top: -5px;
margin-left: 10px;
display: inline-block
}

.view-account .side-bar {
padding-bottom: 30px
}

.view-account .side-bar .user-info {
text-align: center;
margin-bottom: 15px;
padding: 30px;
color: #616670;
border-bottom: 1px solid #f3f3f3
}

.view-account .side-bar .user-info .img-profile {
width: 120px;
height: 120px;
margin-bottom: 15px
}

.view-account .side-bar .user-info .meta li {
margin-bottom: 10px
}

.view-account .side-bar .user-info .meta li span {
display: inline-block;
width: 100px;
margin-right: 5px;
text-align: right
}

.view-account .side-bar .user-info .meta li a {
color: #616670
}

.view-account .side-bar .user-info .meta li.activity {
color: #a2a6af
}

.view-account .side-bar .side-menu {
text-align: center
}

.view-account .side-bar .side-menu .nav {
display: inline-block;
margin: 0 auto
}

.view-account .side-bar .side-menu .nav>li {
font-size: 14px;
margin-bottom: 0;
border-bottom: none;
display: inline-block;
float: left;
margin-right: 15px;
margin-bottom: 15px
}

.view-account .side-bar .side-menu .nav>li:last-child {
margin-right: 0
}

.view-account .side-bar .side-menu .nav>li>a {
display: inline-block;
color: #9499a3;
padding: 5px;
border-bottom: 2px solid transparent
}

.view-account .side-bar .side-menu .nav>li>a:hover {
color: #616670;
background: none
}

.view-account .side-bar .side-menu .nav>li.active a {
color: #40babd;
border-bottom: 2px solid #40babd;
background: none;
border-right: none
}

.theme-2 .view-account .side-bar .side-menu .nav>li.active a {
color: #6dbd63;
border-bottom-color: #6dbd63
}

.theme-3 .view-account .side-bar .side-menu .nav>li.active a {
color: #497cb1;
border-bottom-color: #497cb1
}

.theme-4 .view-account .side-bar .side-menu .nav>li.active a {
color: #ec6952;
border-bottom-color: #ec6952
}

.view-account .side-bar .side-menu .nav>li .icon {
display: block;
font-size: 24px;
margin-bottom: 5px
}

.view-account .content-panel {
padding: 30px
}

.view-account .content-panel .title {
margin-bottom: 15px;
margin-top: 0;
font-size: 18px
}

.view-account .content-panel .fieldset-title {
padding-bottom: 15px;
border-bottom: 1px solid #eaeaf1;
margin-bottom: 30px;
color: #616670;
font-size: 16px
}

.view-account .content-panel .avatar .figure img {
float: right;
width: 64px
}

.view-account .content-panel .content-header-wrapper {
position: relative;
margin-bottom: 30px
}

.view-account .content-panel .content-header-wrapper .actions {
position: absolute;
right: 0;
top: 0
}

.view-account .content-panel .content-utilities {
position: relative;
margin-bottom: 30px
}

.view-account .content-panel .content-utilities .btn-group {
margin-right: 5px;
margin-bottom: 15px
}

.view-account .content-panel .content-utilities .fa {
font-size: 16px;
margin-right: 0
}

.view-account .content-panel .content-utilities .page-nav {
position: absolute;
right: 0;
top: 0
}

.view-account .content-panel .content-utilities .page-nav .btn-group {
margin-bottom: 0
}

.view-account .content-panel .content-utilities .page-nav .indicator {
color: #a2a6af;
margin-right: 5px;
display: inline-block
}

.view-account .content-panel .mails-wrapper .mail-item {
position: relative;
padding: 10px;
border-bottom: 1px solid #f3f3f3;
color: #616670;
overflow: hidden
}

.view-account .content-panel .mails-wrapper .mail-item>div {
float: left
}

.view-account .content-panel .mails-wrapper .mail-item .icheck {
background-color: #fff
}

.view-account .content-panel .mails-wrapper .mail-item:hover {
background: #f9f9fb
}

.view-account .content-panel .mails-wrapper .mail-item:nth-child(even) {
background: #fcfcfd
}

.view-account .content-panel .mails-wrapper .mail-item:nth-child(even):hover {
background: #f9f9fb
}

.view-account .content-panel .mails-wrapper .mail-item a {
color: #616670
}

.view-account .content-panel .mails-wrapper .mail-item a:hover {
color: #494d55;
text-decoration: none
}

.view-account .content-panel .mails-wrapper .mail-item .checkbox-container,
.view-account .content-panel .mails-wrapper .mail-item .star-container {
display: inline-block;
margin-right: 5px
}

.view-account .content-panel .mails-wrapper .mail-item .star-container .fa {
color: #a2a6af;
font-size: 16px;
vertical-align: middle
}

.view-account .content-panel .mails-wrapper .mail-item .star-container .fa.fa-star {
color: #f2b542
}

.view-account .content-panel .mails-wrapper .mail-item .star-container .fa:hover {
color: #868c97
}

.view-account .content-panel .mails-wrapper .mail-item .mail-to {
display: inline-block;
margin-right: 5px;
min-width: 120px
}

.view-account .content-panel .mails-wrapper .mail-item .mail-subject {
display: inline-block;
margin-right: 5px
}

.view-account .content-panel .mails-wrapper .mail-item .mail-subject .label {
margin-right: 5px
}

.view-account .content-panel .mails-wrapper .mail-item .mail-subject .label:last-child {
margin-right: 10px
}

.view-account .content-panel .mails-wrapper .mail-item .mail-subject .label a,
.view-account .content-panel .mails-wrapper .mail-item .mail-subject .label a:hover {
color: #fff
}

.view-account .content-panel .mails-wrapper .mail-item .mail-subject .label-color-1 {
background: #f77b6b
}

.view-account .content-panel .mails-wrapper .mail-item .mail-subject .label-color-2 {
background: #58bbee
}

.view-account .content-panel .mails-wrapper .mail-item .mail-subject .label-color-3 {
background: #f8a13f
}

.view-account .content-panel .mails-wrapper .mail-item .mail-subject .label-color-4 {
background: #ea5395
}

.view-account .content-panel .mails-wrapper .mail-item .mail-subject .label-color-5 {
background: #8a40a7
}

.view-account .content-panel .mails-wrapper .mail-item .time-container {
display: inline-block;
position: absolute;
right: 10px;
top: 10px;
color: #a2a6af;
text-align: left
}

.view-account .content-panel .mails-wrapper .mail-item .time-container .attachment-container {
display: inline-block;
color: #a2a6af;
margin-right: 5px
}

.view-account .content-panel .mails-wrapper .mail-item .time-container .time {
display: inline-block;
text-align: right
}

.view-account .content-panel .mails-wrapper .mail-item .time-container .time.today {
font-weight: 700;
color: #494d55
}

.drive-wrapper {
padding: 15px;
background: #f5f5f5;
overflow: hidden
}

.drive-wrapper .drive-item {
width: 130px;
margin-right: 15px;
display: inline-block;
float: left
}

.drive-wrapper .drive-item:hover {
box-shadow: 0 1px 5px rgba(0, 0, 0, .1);
z-index: 1
}

.drive-wrapper .drive-item-inner {
padding: 15px
}

.drive-wrapper .drive-item-title {
margin-bottom: 15px;
max-width: 100px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis
}

.drive-wrapper .drive-item-title a {
color: #494d55
}

.drive-wrapper .drive-item-title a:hover {
color: #40babd
}

.theme-2 .drive-wrapper .drive-item-title a:hover {
color: #6dbd63
}

.theme-3 .drive-wrapper .drive-item-title a:hover {
color: #497cb1
}

.theme-4 .drive-wrapper .drive-item-title a:hover {
color: #ec6952
}

.drive-wrapper .drive-item-thumb {
width: 100px;
height: 80px;
margin: 0 auto;
color: #616670
}

.drive-wrapper .drive-item-thumb a {
-webkit-opacity: .8;
-moz-opacity: .8;
opacity: .8
}

.drive-wrapper .drive-item-thumb a:hover {
-webkit-opacity: 1;
-moz-opacity: 1;
opacity: 1
}

.drive-wrapper .drive-item-thumb .fa {
display: inline-block;
font-size: 36px;
margin: 0 auto;
margin-top: 20px
}

.drive-wrapper .drive-item-footer .utilities {
margin-bottom: 0
}

.drive-wrapper .drive-item-footer .utilities li:last-child {
padding-right: 0
}

.drive-list-view .name {
width: 60%
}

.drive-list-view .name.truncate {
max-width: 100px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis
}

.drive-list-view .type {
width: 15px
}

.drive-list-view .date,
.drive-list-view .size {
max-width: 60px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis
}

.drive-list-view a {
color: #494d55
}

.drive-list-view a:hover {
color: #40babd
}

.theme-2 .drive-list-view a:hover {
color: #6dbd63
}

.theme-3 .drive-list-view a:hover {
color: #497cb1
}

.theme-4 .drive-list-view a:hover {
color: #ec6952
}

.drive-list-view td.date,
.drive-list-view td.size {
color: #a2a6af
}

@media (max-width:767px) {
.view-account .content-panel .title {
    text-align: center
}
.view-account .side-bar .user-info {
    padding: 0
}
.view-account .side-bar .user-info .img-profile {
    width: 60px;
    height: 60px
}
.view-account .side-bar .user-info .meta li {
    margin-bottom: 5px
}
.view-account .content-panel .content-header-wrapper .actions {
    position: static;
    margin-bottom: 30px
}
.view-account .content-panel {
    padding: 0
}
.view-account .content-panel .content-utilities .page-nav {
    position: static;
    margin-bottom: 15px
}
.drive-wrapper .drive-item {
    width: 100px;
    margin-right: 5px;
    float: none
}
.drive-wrapper .drive-item-thumb {
    width: auto;
    height: 54px
}
.drive-wrapper .drive-item-thumb .fa {
    font-size: 24px;
    padding-top: 0
}
.view-account .content-panel .avatar .figure img {
    float: none;
    margin-bottom: 15px
}
.view-account .file-uploader {
    margin-bottom: 15px
}
.view-account .mail-subject {
    max-width: 100px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}
.view-account .content-panel .mails-wrapper .mail-item .time-container {
    position: static
}
.view-account .content-panel .mails-wrapper .mail-item .time-container .time {
    width: auto;
    text-align: left
}
}

@media (min-width:768px) {
.view-account .side-bar .user-info {
    padding: 0;
    padding-bottom: 15px
}
.view-account .mail-subject .subject {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}
}

@media (min-width:992px) {
.view-account .content-panel {
    min-height: 800px;
    border-left: 1px solid #f3f3f7;
    margin-left: 200px
}
.view-account .mail-subject .subject {
    max-width: 280px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}
.view-account .side-bar {
    position: absolute;
    width: 200px;
    min-height: 600px
}
.view-account .side-bar .user-info {
    margin-bottom: 0;
    border-bottom: none;
    padding: 30px
}
.view-account .side-bar .user-info .img-profile {
    width: 120px;
    height: 120px
}
.view-account .side-bar .side-menu {
    text-align: left
}
.view-account .side-bar .side-menu .nav {
    display: block
}
.view-account .side-bar .side-menu .nav>li {
    display: block;
    float: none;
    font-size: 14px;
    border-bottom: 1px solid #f3f3f7;
    margin-right: 0;
    margin-bottom: 0
}
.view-account .side-bar .side-menu .nav>li>a {
    display: block;
    color: #9499a3;
    padding: 10px 15px;
    padding-left: 30px
}
.view-account .side-bar .side-menu .nav>li>a:hover {
    background: #f9f9fb
}
.view-account .side-bar .side-menu .nav>li.active a {
    background: #f9f9fb;
    border-right: 4px solid #40babd;
    border-bottom: none
}
.theme-2 .view-account .side-bar .side-menu .nav>li.active a {
    border-right-color: #6dbd63
}
.theme-3 .view-account .side-bar .side-menu .nav>li.active a {
    border-right-color: #497cb1
}
.theme-4 .view-account .side-bar .side-menu .nav>li.active a {
    border-right-color: #ec6952
}
.view-account .side-bar .side-menu .nav>li .icon {
    font-size: 24px;
    vertical-align: middle;
    text-align: center;
    width: 40px;
    display: inline-block
}
}
</style>

<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet">
<div class="container">
    <div class="view-account">
        <section class="module">
            <div class="module-inner">
                <div class="side-bar">
                    <div class="user-info">
                        <img class="img-profile img-circle img-responsive center-block" src="https://bootdey.com/img/Content/avatar/avatar1.png" alt="">
                        <ul class="meta list list-unstyled">
                            <li class="name">Rebecca Sanders
                                <label class="label label-info">UX Designer</label>
                            </li>
                            <li class="email"><a href="#">Rebecca.S@website.com</a></li>
                            <li class="activity">Last logged in: Today at 2:18pm</li>
                        </ul>
                    </div>
            		<nav class="side-menu">
        				<ul class="nav">
        					<li class="active"><a href="#"><span class="fa fa-user"></span> Profile</a></li>
        					<li><a href="#"><span class="fa fa-cog"></span> Settings</a></li>
        					<li><a href="#"><span class="fa fa-credit-card"></span> Billing</a></li>
        					<li><a href="#"><span class="fa fa-envelope"></span> Messages</a></li>
        					
        					<li><a href="user-drive.html"><span class="fa fa-th"></span> Drive</a></li>
        					<li><a href="#"><span class="fa fa-clock-o"></span> Reminders</a></li>
        				</ul>
        			</nav>
                </div>
                <div class="content-panel">
                    <h2 class="title">Profile<span class="pro-label label label-warning">PRO</span></h2>
                    <form class="form-horizontal">
                        <fieldset class="fieldset">
                            <h3 class="fieldset-title">Personal Info</h3>
                            <div class="form-group avatar">
                                <figure class="figure col-md-2 col-sm-3 col-xs-12">
                                    <img class="img-rounded img-responsive" src="https://bootdey.com/img/Content/avatar/avatar1.png" alt="">
                                </figure>
                                <div class="form-inline col-md-10 col-sm-9 col-xs-12">
                                    <input type="file" class="file-uploader pull-left">
                                    <button type="submit" class="btn btn-sm btn-default-alt pull-left">Update Image</button>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-2 col-sm-3 col-xs-12 control-label">User Name</label>
                                <div class="col-md-10 col-sm-9 col-xs-12">
                                    <input type="text" class="form-control" value="Rebecca">
                                </div>
                            </div>
        
                            <div class="form-group">
                                <label class="col-md-2 col-sm-3 col-xs-12 control-label">First Name</label>
                                <div class="col-md-10 col-sm-9 col-xs-12">
                                    <input type="text" class="form-control" value="Rebecca">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-2 col-sm-3 col-xs-12 control-label">Last Name</label>
                                <div class="col-md-10 col-sm-9 col-xs-12">
                                    <input type="text" class="form-control" value="Sanders">
                                </div>
                            </div>
                        </fieldset>
                        <fieldset class="fieldset">
                            <h3 class="fieldset-title">Contact Info</h3>
                            <div class="form-group">
                                <label class="col-md-2  col-sm-3 col-xs-12 control-label">Email</label>
                                <div class="col-md-10 col-sm-9 col-xs-12">
                                    <input type="email" class="form-control" value="Rebecca@website.com">
                                    <p class="help-block">This is the email </p>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-2  col-sm-3 col-xs-12 control-label">Twitter</label>
                                <div class="col-md-10 col-sm-9 col-xs-12">
                                    <input type="text" class="form-control" value="SpeedyBecky">
                                    <p class="help-block">Your twitter username</p>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-2  col-sm-3 col-xs-12 control-label">Linkedin</label>
                                <div class="col-md-10 col-sm-9 col-xs-12">
                                    <input type="url" class="form-control" value="https://www.linkedin.com/in/lorem">
                                    <p class="help-block">eg. https://www.linkedin.com/in/yourname</p>
                                </div>
                            </div>
                        </fieldset>
                        <hr>
                        <div class="form-group">
                            <div class="col-md-10 col-sm-9 col-xs-12 col-md-push-2 col-sm-push-3 col-xs-push-0">
                                <input class="btn btn-primary" type="submit" value="Update Profile">
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </section>
    </div>
</div>
"use client";
import Lenis from "@studio-freight/lenis";
import { useEffect } from "react";

export const LenisScroller = () => {
  useEffect(() => {
    const lenis = new Lenis();

    lenis.on("scroll", (e: any) => {
       console.log(e);
     });

    function raf(time: number) {
      lenis.raf(time);
      requestAnimationFrame(raf);
    }

    requestAnimationFrame(raf);

    return () => {
      lenis.destroy();
    };
  }, []);

  return <></>;
};
USE [AdventureWorks];
GO
SELECT name AS [Name], 
       SCHEMA_NAME(schema_id) AS schema_name, 
       type_desc, 
       create_date, 
       modify_date
FROM sys.objects
WHERE type ='u'
SELECT catalog_name AS DBName, 
    Schema_name, 
    schema_owner
FROM information_schema.SCHEMATA;
SELECT * from INFORMATION_SCHEMA.VIEWS
import java.util.ArrayList;
import java.util.Scanner;

public class LibrarySystem {

    private static ArrayList<Book> books = new ArrayList<>();
    private static Scanner scanner = new Scanner(System.in);

    public static void main(String[] args) {
        while (true) {
            displayMenu();
            int choice = scanner.nextInt();
            scanner.nextLine(); // Consume the newline character

            switch (choice) {
                case 1:
                    addBook();
                    break;
                case 2:
                    viewBookList();
                    break;
                case 3:
                    searchBook();
                    break;
                case 4:
                    System.out.println("Exiting program. Goodbye!");
                    System.exit(0);
                default:
                    System.out.println("Invalid choice. Please try again.");
            }
        }
    }

    private static void displayMenu() {
        System.out.println("Library System Menu:");
        System.out.println("1. Add Book");
        System.out.println("2. View Book List");
        System.out.println("3. Search for Book");
        System.out.println("4. Exit");
        System.out.print("Enter your choice: ");
    }

    private static void addBook() {
        System.out.print("Enter book title: ");
        String title = scanner.nextLine();

        System.out.print("Enter author: ");
        String author = scanner.nextLine();

        books.add(new Book(title, author));
        System.out.println("Book added successfully!");
    }

    private static void viewBookList() {
        if (books.isEmpty()) {
            System.out.println("No books in the library yet.");
        } else {
            System.out.println("Book List:");
            for (Book book : books) {
                System.out.println("Title: " + book.getTitle() + ", Author: " + book.getAuthor());
            }
        }
    }

    private static void searchBook() {
        System.out.print("Enter book title to search: ");
        String searchTitle = scanner.nextLine();

        boolean found = false;
        for (Book book : books) {
            if (book.getTitle().equalsIgnoreCase(searchTitle)) {
                System.out.println("Book found: Title: " + book.getTitle() + ", Author: " + book.getAuthor());
                found = true;
                break;
            }
        }

        if (!found) {
            System.out.println("Book with title '" + searchTitle + "' not found.");
        }
    }

    private static class Book {
        private String title;
        private String author;

        public Book(String title, String author) {
            this.title = title;
            this.author = author;
        }

        public String getTitle() {
            return title;
        }

        public String getAuthor() {
            return author;
        }
    }
}

function perimeter(l, num){
	let dict = new Object();
	dict = {
		's' : 4*num,
		'c' : 2*num*3.14,
	};
	return dict[l] || undefined;
}
function num_of_digits(num) {
	let cnt = 1;
	num = Math.abs(num);
	num = Math.floor(num/10);
	while(num != 0){
		cnt = cnt+1;
		num = Math.floor(num/10);
	}
	return cnt;
}
Sales Rep Rank =

RANKX(
	ALL( Sales[Sales Rep]),
	[Total Sales],
	Dense
)

//Dense = not skip
import java.util.Scanner;
public class RootsOfDemo {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        double det,root1,root2;

        System.out.println("ENTER THE VALUES OF a,b,and c :");

        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        det = (b*b)- 4*a*c;

        if(det>0){
            System.out.println("Roots are Real and Distinct ");
            root1 = (-b) + Math.sqrt(det)/(2*a);
            root2 = (-b) - Math.sqrt(det)/(2*a);
            System.out.println("The Roots are : "+ root1 + root2);
        }

        else if(det==0){
            System.out.println("Roots are Real and Equal ");
            root1 = -b/2*a;
            System.out.println("The Roots are : "+ root1 + root1);
        }

        else{
            System.out.println("Roots are Imaginary ");
            double img = Math.sqrt(det*-1)/2*a;
            //System.out.println("The real part is "+ -b/2*a +" The imaginary part is "+ ( Math.sqrt(det*-1)/2*a ) +"i" );
            System.out.println("The img roots are "+ -b/2*a +"+"+ img + "i");
            System.out.println("The img roots are "+ -b/2*a +"-"+ img + "i");
        }


    }
    
}
Table =

{
	("Nik", 101),
	("Hafiz", 102),
}
Table =

DATATABLE(
	"SNo", INTEGER,
	"Name", STRING,
	{
		{101, "Nik"},
		{102, "Hafiz"},
	}
)
shadow-[0_0_5px_black] hover:shadow-[0_0_15px_black] transition duration-500
var storeName = HttpUtility.ParseQueryString(urlAddress).Get("storeName");
Add following Code in Program.CS :
     builder.Services.AddSession(options =>
     {
         options.IdleTimeout = TimeSpan.FromMinutes(30);
     });
app.UseSession();

In Controller use the following Code: 
To get the Session:
 HttpContext.Session.SetString("Name", "John Smith");

To set the Session:
 ViewBag.Name = HttpContext.Session.GetString(sessionName);


Best Selling Day/Date =

CONCATENATEX(
	TOPN(
		1,
		'Calendar',
		[Total Sales]
		),
	FORMAT( 'Calendar'[Date], "dd-mmm" )
	)
 private readonly dbContext _context;

 public MonthReportsController(dbContext context)
 {
     _context = context;
 }
Top Selling Product =

TOPN(
	1,
	VALUES( Sales[ProductID] ),
	[Total Sales]
)
Best Selling Day/Date =

TOPN(
	1,
	'Calendar',
	[Total Sales]
)
In Program.Cs add following Code: 

Builder.services.Configure<IdentityOptions>(options => 
{     
    options.Password.RequireDigit = true; 
    options.Password.RequireLowercase = true; 
    options.Password.RequireNonAlphanumeric = true; 
    options.Password.RequireUppercase = true; 
    options.Password.RequiredLength = 6; 
    options.Password.RequiredUniqueChars = 1; 
});
(function($){
		'use strict';
		$(document).on('ready', function(){ 

		$('#pcp_wrapper-151 .sp-pcp-post').each(function(){

          var target_url = $(this).find('.sp-pcp-title a').attr('href');
   	 $(this).click(function(){
     			 window.open(target_url, '_self');
     });
          
 
        });
      	});
})(jQuery);
from django.shortcuts import render
from django.http import HttpResponseRedirect, HttpResponse
from django.contrib.auth.models import User
from django.shortcuts import get_object_or_404, render, redirect
from .models import CarModel
from .restapis import get_dealer_by_id, get_dealers_from_cf, get_dealers_by_state, get_dealer_reviews_from_cf, post_request
from django.contrib.auth import login, logout, authenticate
from django.contrib import messages
from datetime import datetime
import logging
import json

# Getting an instance of a logger
logger = logging.getLogger(__name__)

def dealership_list(request):
    url = "https://us-south.functions.appdomain.cloud/api/v1/web/54ee907b-434c-4f03-a1b3-513c235fbeb4/default/myAction"
    dealerships = get_dealers_from_cf(url)  # provide the url argument
    return render(request, 'djangoapp/dealership_list.html', {'dealerships': dealerships})

# View to render the index page with a list of dealerships
def get_dealerships(request):
    if request.method == "GET":
        context = {}
        url = "https://9bebcb01.eu-de.apigw.appdomain.cloud/api/dealership"
        # Get dealers from the Cloudant DB
        context["dealerships"] = get_dealers_from_cf(url)

        # dealer_names = ' '.join([dealer.short_name for dealer in context["dealerships"]])
        # return HttpResponse(dealer_names)

        return render(request, 'djangoapp/index.html', context)

# View to render a static about page
def about(request):
    context = {}
    if request.method == "GET":
        return render(request, 'djangoapp/about.html', context)


# View to return a static contact page
def contact(request):
    context = {}
    if request.method == "GET":
        return render(request, 'djangoapp/contact.html', context)


# View to handle sign in request
def login_request(request):
    context = {}
    if request.method == "POST":
        username = request.POST['username']
        password = request.POST['psw']
        user = authenticate(username=username, password=password)
        if user is not None:
            login(request, user)
            return redirect('djangoapp:index')
        else:
            context['message'] = "Invalid username or password."
            return render(request, 'djangoapp/login.html', context)
    else:
        return render(request, 'djangoapp/login.html', context)


# View to handle sign out request
def logout_request(request):
    # Get the user object based on session id in request
    print("Logging out `{}`...".format(request.user.username))
    # Logout user in the request
    logout(request)
    # Redirect user back to course list view
    return redirect('djangoapp:index')


# View to handle sign up request
def registration_request(request):
    context = {}
    # If it is a GET request, just render the registration page
    if request.method == 'GET':
        return render(request, 'djangoapp/registration.html', context)
    # If it is a POST request
    elif request.method == 'POST':
        # Get user information from request.POST
        username = request.POST['username']
        password = request.POST['psw']
        first_name = request.POST['firstname']
        last_name = request.POST['lastname']
        user_exist = False
        try:
            # Check if user already exists
            User.objects.get(username=username)
            user_exist = True
        except:
            # If not, simply log this is a new user
            logger.debug("{} is new user".format(username))
        # If it is a new user
        if not user_exist:
            # Create user in auth_user table
            user = User.objects.create_user(username=username, first_name=first_name, last_name=last_name,
                                            password=password)
            # Login the user and redirect to course list page
            login(request, user)
            return redirect("/djangoapp/")
        else:
            return render(request, 'djangoapp/registration.html', context)


# View to render the reviews of a dealer
def get_dealer_details(request, dealer_id):
    context = {}
    if request.method == "GET":
        url = 'https://9bebcb01.eu-de.apigw.appdomain.cloud/api/review'
        reviews = get_dealer_reviews_from_cf(url, dealer_id=dealer_id)
        context = {
            "reviews":  reviews, 
            "dealer_id": dealer_id
        }

        return render(request, 'djangoapp/dealer_details.html', context)


# View to submit a new review
def add_review(request, dealer_id):
    # User must be logged in before posting a review
    if request.user.is_authenticated:
        # GET request renders the page with the form for filling out a review
        if request.method == "GET":
            url = f"https://5b93346d.us-south.apigw.appdomain.cloud/dealerships/dealer-get?dealerId={dealer_id}"
            # Get dealer details from the API
            context = {
                "cars": CarModel.objects.all(),
                "dealer": get_dealer_by_id(url, dealer_id=dealer_id),
            }
            return render(request, 'djangoapp/add_review.html', context)

        # POST request posts the content in the review submission form to the Cloudant DB using the post_review Cloud Function
        if request.method == "POST":
            form = request.POST
            review = dict()
            review["name"] = f"{request.user.first_name} {request.user.last_name}"
            review["dealership"] = dealer_id
            review["review"] = form["content"]
            review["purchase"] = form.get("purchasecheck")
            if review["purchase"]:
                review["purchase_date"] = datetime.strptime(form.get("purchasedate"), "%m/%d/%Y").isoformat()
            car = CarModel.objects.get(pk=form["car"])
            review["car_make"] = car.car_make.name
            review["car_model"] = car.name
            review["car_year"] = car.year
            
            # If the user bought the car, get the purchase date
            if form.get("purchasecheck"):
                review["purchase_date"] = datetime.strptime(form.get("purchasedate"), "%m/%d/%Y").isoformat()
            else: 
                review["purchase_date"] = None

            url = "https://9bebcb01.eu-de.apigw.appdomain.cloud/api/review"  # API Cloud Function route
            json_payload = {"review": review}  # Create a JSON payload that contains the review data

            # Performing a POST request with the review
            result = post_request(url, json_payload, dealerId=dealer_id)
            if int(result.status_code) == 200:
                print("Review posted successfully.")

            # After posting the review the user is redirected back to the dealer details page
            return redirect("djangoapp:dealer_details", dealer_id=dealer_id)

    else:
        # If user isn't logged in, redirect to login page
        print("User must be authenticated before posting a review. Please log in.")
        return redirect("/djangoapp/login")

function printPDFfromURL(pdf) { 
	var iframe = document.createElement('iframe');
	iframe.style.display = 'none';
	document.body.appendChild(iframe);

	iframe.onload = function() {
		iframe.contentWindow.print();
		setTimeout(()=>{
			iframe.remove()
		}, 60000);
	};
	iframe.src = pdf;
}

//use:
//  printPDFfromURL("http://localhost/path_pdf.pdf");
$ git commit -m "Something terribly misguided" # (0: Your Accident)
$ git reset HEAD~                              # (1)
[ edit files as necessary ]                    # (2)
$ git add .                                    # (3)
$ git commit -c ORIG_HEAD                      # (4)
<div class=" w-full h-screen p-4">

    <div class="h-14 w-full bg-slate-100 rounded-md font-semibold text-gray-800 flex items-center text-center px-2 transition-colors">
        <div class=" basis-1/3 rounded-md bg-white py-2 shadow-sm">New Items</div>
        <div class=" basis-1/3 rounded-md ">Return Items</div>
        <div class=" basis-1/3 rounded-md ">Issue Items</div>
    </div>

</div>
Qtr =

SWITCH(
	TRUE(),
	MONTH('Calendar[Date]') <=3, "Q1",
	MONTH('Calendar[Date]') <=6, "Q2",
	MONTH('Calendar[Date]') <=9, "Q3",
	"Q4"
)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js" ></script>
<style>
    section.heroCarousel-container.mobile {
     display: none;
    }
    @media (max-width:551px){
        section.heroCarousel-container{
            display: none;
        }
        section.heroCarousel-container.mobile {
            display: block;
        }
        section.heroCarousel-container.mobile .slick-slide {
            display: flex !important;
            justify-content: center;
            position: relative;
        }
        .mobile-carousal-btns {
            position: absolute;
            top: 65%;
            margin: 0 auto;
            width: auto;
        }
        section.heroCarousel-container.mobile .slick-slide img {
            display: block;
            width: 100%;
            /*height: 380px;*/
        }
        /*.cstm-pos{*/
        /*    position: absolute;*/
        /*    background: none !important;*/
        /*    margin-top: 41%;*/
        /*    text-align: center;*/
        /*}*/
        .cstm-pos {
            position: absolute;
            background: none !important;
            text-align: center;
            top: 50%;
        }
        .heroCarousel-content{
            background-color: transparent;
        }
        .carousal-container-mbl{
            display: flex;
            justify-content: center;
            align-items: center;
        }
    }
</style>


{{inject 'hasMainCarousel' true}}
<section class="heroCarousel-container desktop {{#if theme_settings.carousel_banners}} heroCarousel-container--hasBanners{{/if}}">
    <div class="heroCarousel"
        data-slick='{
            "dots": true,
            "mobileFirst": true,
            "slidesToShow": 1,
            "slidesToScroll": 1,
            "autoplay": true,
            "autoplaySpeed": {{carousel.swap_frequency}},
            "lazyLoad": "anticipated"
        }'
        {{#if theme_settings.carousel_video_mute}} data-youtube-mute{{/if}}>
        {{#each carousel.slides}}
        <div class="heroCarousel-slide {{#if ../theme_settings.homepage_carousel_style '==' 'stretch'}}heroCarousel-slide--stretch{{/if}} heroCarousel-slide--{{@index}}{{#if @first}} heroCarousel-slide--first{{/if}}">
            <div class="heroCarousel-image-wrapper{{#and image_height image_width}} heroCarousel-image-wrapper--sized{{/and}}">
                <a href="{{url}}">
                    {{#if @index '==' 0}}
                        {{#if (merge this video=../../theme_settings.carousel_vid0)}}{{/if}}
                    {{/if}}
                    {{#if @index '==' 1}}
                        {{#if (merge this video=../../theme_settings.carousel_vid1)}}{{/if}}
                    {{/if}}
                    {{#if @index '==' 2}}
                        {{#if (merge this video=../../theme_settings.carousel_vid2)}}{{/if}}
                    {{/if}}
                    {{#if @index '==' 3}}
                        {{#if (merge this video=../../theme_settings.carousel_vid3)}}{{/if}}
                    {{/if}}
                    {{#if @index '==' 4}}
                        {{#if (merge this video=../../theme_settings.carousel_vid4)}}{{/if}}
                    {{/if}}

                    

                    {{#if video}}
                        <div class="heroCarousel-video-wrapper">
                            <div class="heroCarousel-image-box" style="{{#if image_width}}width:{{image_width}}px{{/if}}">
                                {{#and image_height image_width}}<div class="heroCarousel-image-box-padding" style="padding-bottom:{{multiply (divide image_height image_width) 100}}%">{{/and}}
                                    {{> components/common/responsive-img
                                        image=stencil_image
                                        class="heroCarousel-image"
                                        fallback_size='1920w'
                                        lazyload='disabled'
                                    }}
                                {{#and image_height image_width}}</div>{{/and}}
                            </div>
                            <div class="heroCarousel-video"><div data-youtube="{{video}}"></div></div>
                        </div>
                    {{else}}
                        <div class="heroCarousel-image-box" style="{{#if image_width}}width:{{image_width}}px{{/if}}">
                            {{#and image_height image_width}}<div class="heroCarousel-image-box-padding" style="padding-bottom:{{multiply (divide image_height image_width) 100}}%">{{/and}}
                                {{#if @first}}
                                    {{> components/common/responsive-img
                                        image=stencil_image
                                        class="heroCarousel-image"
                                        fallback_size='1920w'
                                        lazyload='disabled'
                                        otherAttributes=(concat (concat (concat (concat 'width="' image_width) '" height="') image_height) '"')
                                    }}
                                {{else}}
                                    {{> components/common/responsive-img
                                        image=stencil_image
                                        class="heroCarousel-image"
                                        fallback_size='1920w'
                                        lazyload='lazyload'
                                        otherAttributes=(concat (concat (concat (concat 'width="' image_width) '" height="') image_height) '"')
                                    }}
                                {{/if}}
                            {{#and image_height image_width}}</div>{{/and}}
                        </div>
                    {{/if}}
                    
                    {{#if heading}}
                        {{> components/carousel-content show_background=true}}
                    {{else}}
                        {{#if text}}
                            {{> components/carousel-content show_background=true}}
                        {{else}}
                            {{#if button_text}}
                                {{> components/carousel-content show_background=false}}
                            {{/if}}
                        {{/if}}
                    {{/if}}
                </a>
            </div>
        </div>
        {{/each}}
    </div>
    {{#if theme_settings.carousel_banners}}
        <div class="heroCarousel-banners">
            {{> components/papa-supermarket/sections/section-bc-banner find="papathemesHeroCarouselBanner"}}
        </div>
    {{/if}}
</section>


<!--Custome Carousal for Mobile-->
<section class="heroCarousel-container mobile {{#if theme_settings.carousel_banners}} heroCarousel-container--hasBanners{{/if}}">
    <div class="heroCarousel"
        data-slick='{
            "dots": true,
            "mobileFirst": true,
            "slidesToShow": 1,
            "slidesToScroll": 1,
            "autoplay": true,
            "autoplaySpeed": {{carousel.swap_frequency}},
            "lazyLoad": "anticipated"
        }'
        {{#if theme_settings.carousel_video_mute}} data-youtube-mute{{/if}}>
       
            
    <a href="/" class="cstm-l0">
            <div class="carousal-container-mbl" >
                <img src="https://cdn11.bigcommerce.com/s-r5k51kqrix/product_images/uploaded_images/mobile-carousal-66.jpg" />
    		    <!--<a href="https://www.smartwheel.ca/inokim/" class="heroCarousel-action button button--primary button--large mobile mobile-carousal-btns"></a>-->
    		    <div class="cstm-pos cstm-c0" ></div>
            </div>
        </a>
        
        <a href="/" class="cstm-l1">
            <div class="carousal-container-mbl" >
                <img src="https://cdn11.bigcommerce.com/s-r5k51kqrix/product_images/uploaded_images/mobile-carousal-57.jpg" />
    		    <!--<a href="https://www.smartwheel.ca/inokim/" class="heroCarousel-action button button--primary button--large mobile mobile-carousal-btns"></a>-->
    		    <div class="cstm-pos cstm-c1" ></div>
            </div>
        </a>
		    
        
        <a href="/" class="cstm-l2">
            <div class="carousal-container-mbl" >
                <img src="https://cdn11.bigcommerce.com/s-r5k51kqrix/product_images/uploaded_images/mobile-carousal-53.jpeg" />
            	<!--<a href="/nanrobot-d6-e-scooter-10-2000w-52v-26ah-black/" class="heroCarousel-action button button--primary button--large mobile mobile-carousal-btns">Pre-Order Now</a>-->
                <div class="cstm-pos cstm-c2" ></div>
            </div>
        </a>
       
        <a href="/" class="cstm-l3">
            <div class="carousal-container-mbl" >
                <img src="https://cdn11.bigcommerce.com/s-r5k51kqrix/product_images/uploaded_images/mobile-carousal-31.jpeg"/>
        	    <!--<a href="/OneWheel_c_114.html" class="heroCarousel-action button button--primary button--large mobile mobile-carousal-btns">Learn More</a>-->
        	    <div class="cstm-pos cstm-c3" ></div>
    	    </div>
        </a>
    
            <a href="/" class="cstm-l4">
            <div class="carousal-container-mbl" >
                <img src="https://cdn11.bigcommerce.com/s-r5k51kqrix/product_images/uploaded_images/mobile-carousal-64.jpg" />
        		<!--<a href="/SmartKick_c_127.html" class="heroCarousel-action button button--primary button--large mobile mobile-carousal-btns">Buy Now</a>-->
                <div class="cstm-pos cstm-c4" ></div>
            </div> 
        </a>
      
    </div>
    {{#if theme_settings.carousel_banners}}
        <div class="heroCarousel-banners">
            {{> components/papa-supermarket/sections/section-bc-banner find="papathemesHeroCarouselBanner"}}
        </div>
    {{/if}}
</section>

<script>
    $(document).ready(function(){
        console.log("test")
        setTimeout(function(){
            var i=0;
            $(".desktop .slick-track .heroCarousel-slide").each(function(index, element) {
                console.log("test")
                try{
                    if (!$(this).hasClass("slick-cloned")) {
                        
                        var des =$(".heroCarousel-content",$(element)).html();
                        
                        $(".cstm-c"+i).append(des);
                        
                        var href = $("a",$(element)).attr('href');
                        
                        $(".cstm-l"+i).attr("href", href);
        
                        i++;
                    }
                }
                catch(e){}
            });
        }, 1000);
    })
</script>
    r = sr.Recognizer()
    with anvil.media.TempFile(AudioFile) as file_name:
      with sr.AudioFile(file_name) as source:
        audio = r.record(source)
    response = r.recognize_google(audio)
// C++ program to find LCM of two numbers 
#include <iostream> 
using namespace std; 

// Recursive function to return gcd of a and b 
long long gcd(long long int a, long long int b) 
{ 
if (b == 0) 
	return a; 
return gcd(b, a % b); 
} 

// Function to return LCM of two numbers 
// Time Complexity: O(log(min(a,b) 
// Auxiliary Space: O(log(min(a,b))
long long lcm(int a, int b) 
{ 
	return (a / gcd(a, b)) * b; 
} 

// Function to return LCM of two numbers  Time Complexity: O(min(a,b))
int LCM(int a, int b) 
{ 
    int greater = max(a, b); 
    int smallest = min(a, b); 
    for (int i = greater; ; i += greater) { 
        if (i % smallest  == 0) 
            return i; 
    } 
} 

// Driver program to test above function 
int main() 
{ 
	int a = 15, b = 20; 
	cout <<"LCM of " << a << " and "
		<< b << " is " << lcm(a, b); 
	return 0; 
} 
#include <bits/stdc++.h>
using namespace std;

#define sr srand(time(0));
#define ra(l, h) (rand() % ((h)-(l)+1) + (l))
#define sync { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); }
#define ll long long int
#define vi vector<int>
#define fn(n) for(int i = 0; i < n; i++)
#define fr(i, a, b) for(int i = a; i <= b; i++)
#define rfr(i, a, b) for(int i = a; i >= b; i--)
#define pb push_back
#define all(a) a.begin(), a.end()
#define tt int test; cin >> test; while(test--)
#define ff first
#define ss second
#define en cout<< "\n"
#define cy cout << "YES" << endl
#define cn cout << "NO" << endl



int countTrailingZeros(int num) {
    int count = 0;
    while (num % 10 == 0) {
        count++;
        num /= 10;
    }
    return count;
}

bool isPrime(int n) {
    if (n <= 1) {
        return false;
    }
    for (int i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            return false;
        }
    }
    return true;
}


int main() {
    sync
    tt {
        int n;
        cin >> n;
        vi v(n);
        fn(n) cin >> v[i];
    
        int commonZeros = countTrailingZeros(v[0]);

        for (int i = 1; i < n; i++) {
            int trailingZeros = countTrailingZeros(v[i]);
            commonZeros = min(commonZeros, trailingZeros);
        }
        
        // cout << commonZeros << " ";
        
        int ans = 0;
        set<int> rem;
        for(ll k=2; k<pow(10,18); k++){
            if( isPrime(k) ) {
                k = k * pow(10, commonZeros);
                for(int i=0; i<n; i++){
                    rem.insert(v[i]%k);
                }
                if(rem.size() == 2){
                    ans = k;
                    break;
                }
            }
        }
        
        cout << ans << endl;
    }
    return 0;
}
#include <bits/stdc++.h>
using namespace std;

#define sr srand(time(0));
#define ra(l, h) (rand() % ((h)-(l)+1) + (l))
#define sync { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); }
#define ll long long int
#define vi vector<int>
#define fn(n) for(int i = 0; i < n; i++)
#define fr(i, a, b) for(int i = a; i <= b; i++)
#define rfr(i, a, b) for(int i = a; i >= b; i--)
#define pb push_back
#define all(a) a.begin(), a.end()
#define tt int test; cin >> test; while(test--)
#define ff first
#define ss second
#define en cout<< "\n"
#define cy cout << "YES" << endl
#define cn cout << "NO" << endl


int main() {
    sync
    tt {
        int n;
        cin >> n;
        vi v(n);
        fn(n) cin >> v[i];
        
        fn(n) cout<<v[i]<<" ";
      	cout << "\n";
        
        
    }
    return 0;
}



/*
        
*/ 
            
	function getGoldPrice($apiKey,$symbol) {
  
    $curr = "USD";
    $date = "";

    $url = "https://www.goldapi.io/api/{$symbol}/{$curr}{$date}";

    $myHeaders = array(
        'x-access-token: ' . $apiKey,
        'Content-Type: application/json'
    );

    $curl = curl_init();

    curl_setopt_array($curl, array(
        CURLOPT_URL => $url,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_FOLLOWLOCATION => true,
        CURLOPT_HTTPHEADER => $myHeaders
    ));

    $response = curl_exec($curl);
    $error = curl_error($curl);

    curl_close($curl);

    if ($error) {
        return 'Error: ' . $error;
    } else {
        $data = json_decode($response, true);

        // Check if the response contains a 'price' key
        if (isset($data['price'])) {
            return $data['price'];
        } 
    }
}
	
	function fetchDataAndInsertIntoDatabase($pdo)
	{
		$apiKey = "goldapi-xxd2ktl4miz8nf-io";
		$symbol = "XAU";
		$curr = "SAR";
		$date = "";
		$myHeaders = array(
		'x-access-token: ' . $apiKey,
		'Content-Type: application/json'
		);

		$curl = curl_init();
		$url = "https://www.goldapi.io/api/{$symbol}/{$curr}{$date}";

		curl_setopt_array($curl, array(
		CURLOPT_URL => $url,
		CURLOPT_RETURNTRANSFER => true,
		CURLOPT_FOLLOWLOCATION => true,
		CURLOPT_HTTPHEADER => $myHeaders
		));
		$response = curl_exec($curl);
		$error = curl_error($curl);
		curl_close($curl);

		if ($error) {
		//	echo 'Error: ' . $error;
		} else {
			$data = json_decode($response, true);
			if ($data !== null) {
				$price_gram_24k = $data['price_gram_24k'];
				$price_gram_22k = $data['price_gram_22k'];
				$price_gram_21k = $data['price_gram_21k'];
				$price_gram_20k = $data['price_gram_20k'];
				$price_gram_18k = $data['price_gram_18k'];
				$price_gram_16k = $data['price_gram_16k'];
				$price_gram_14k = $data['price_gram_14k'];
				$price_gram_10k = $data['price_gram_10k'];
				$timestamp = $data['timestamp'];
				$goldPrice = getGoldPrice($apiKey,$symbol);

				try {
					$stmt = $pdo->prepare("INSERT INTO gold (price_gram_24k, price_gram_22k, price_gram_21k, price_gram_20k, price_gram_18k, price_gram_16k, price_gram_14k, price_gram_10k, timestamp,price) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?,?)");

					$stmt->execute([$price_gram_24k,$price_gram_22k, $price_gram_21k, $price_gram_20k, $price_gram_18k, $price_gram_16k,$price_gram_14k,$price_gram_10k, $timestamp,$goldPrice]);

					// echo 'Data inserted successfully!';
				} catch (PDOException $e) {
				//	echo 'Error: ' . $e->getMessage();
				} finally {
					$pdo = null;
				}
			} else {
			//	echo 'Error decoding JSON';
			}
		}
	}
    r = sr.Recognizer()
    with anvil.media.TempFile(AudioFile) as file_name:
      with sr.AudioFile(file_name) as source:
        audio = r.record(source)
    response = r.recognize_google(audio)
function sortEvents(events) {
  //   return Object.keys(events)
  //     .sort()
  //     .reduce((sortedEvents, key) => {
  //       sortedEvents[key] = events[key];
  //       return sortedEvents;
  //     }, {});

  const sortedEvents = {};
  Object.keys(events)
    .sort()
    .forEach((key) => {
      sortedEvents[key] = events[key];
    });
  return sortedEvents;
}
star

Tue Dec 26 2023 23:54:54 GMT+0000 (Coordinated Universal Time) https://tripleten.com/trainer/web/lesson/5adbf722-17fb-4637-89b0-6a8f144d3de9/task/9d9d6270-839b-42c9-9dce-dfe4eb4b808a/

@Marcelluki

star

Tue Dec 26 2023 22:31:29 GMT+0000 (Coordinated Universal Time) https://tripleten.com/trainer/web/lesson/46460f66-7574-4d1b-a269-8e5c08776b78/

@Marcelluki

star

Tue Dec 26 2023 22:23:19 GMT+0000 (Coordinated Universal Time) https://tripleten.com/trainer/web/lesson/46460f66-7574-4d1b-a269-8e5c08776b78/

@Marcelluki

star

Tue Dec 26 2023 21:49:30 GMT+0000 (Coordinated Universal Time)

@Marcelluki

star

Tue Dec 26 2023 21:28:32 GMT+0000 (Coordinated Universal Time) https://chat.openai.com/?__cf_chl_tk

@eziokittu

star

Tue Dec 26 2023 21:17:30 GMT+0000 (Coordinated Universal Time) https://tripleten.com/trainer/web/lesson/9670babf-c9e3-44c3-8784-d5bc9efc6c34/

@Marcelluki

star

Tue Dec 26 2023 21:03:38 GMT+0000 (Coordinated Universal Time)

@darshcode #sql

star

Tue Dec 26 2023 20:18:23 GMT+0000 (Coordinated Universal Time) https://tripleten.com/trainer/web/lesson/c1f7540a-c695-4912-b5f1-ec8b601257f5/task/57b0a0e5-2f34-4eb6-bc1d-3a747e58b05d/

@Marcelluki

star

Tue Dec 26 2023 19:54:04 GMT+0000 (Coordinated Universal Time) https://tripleten.com/trainer/web/lesson/a6036347-14d2-40cd-93f6-d08a9c2d2ecf/task/f6e5b7ab-9da4-4871-873a-36c4461f0c89/

@Marcelluki

star

Tue Dec 26 2023 19:15:41 GMT+0000 (Coordinated Universal Time)

@darshcode #sql

star

Tue Dec 26 2023 18:11:53 GMT+0000 (Coordinated Universal Time)

@Shira

star

Tue Dec 26 2023 18:10:45 GMT+0000 (Coordinated Universal Time) https://www.bootdey.com/snippets/view/Update-user-profile

@PhobiaCide #javascript

star

Tue Dec 26 2023 16:34:30 GMT+0000 (Coordinated Universal Time) https://github.com/studio-freight/lenis/issues/170

@vishalbhan

star

Tue Dec 26 2023 15:14:46 GMT+0000 (Coordinated Universal Time) https://www.sqlshack.com/different-ways-to-search-for-objects-in-sql-databases/

@darshcode #sql

star

Tue Dec 26 2023 14:43:15 GMT+0000 (Coordinated Universal Time) https://www.sqlshack.com/different-ways-to-search-for-objects-in-sql-databases/

@darshcode #sql

star

Tue Dec 26 2023 14:37:35 GMT+0000 (Coordinated Universal Time)

@darshcode #sql

star

Tue Dec 26 2023 13:31:32 GMT+0000 (Coordinated Universal Time) https://www.addustechnologies.com/blog/build-your-own-blockchain-network

@jonathandaveiam

star

Tue Dec 26 2023 12:53:12 GMT+0000 (Coordinated Universal Time) https://www.programiz.com/java-programming/online-compiler/

@Fahrine

star

Tue Dec 26 2023 09:24:36 GMT+0000 (Coordinated Universal Time) https://edabit.com/challenges/javascript

@msagr

star

Tue Dec 26 2023 08:49:13 GMT+0000 (Coordinated Universal Time) https://edabit.com/challenges/javascript

@msagr

star

Tue Dec 26 2023 07:58:24 GMT+0000 (Coordinated Universal Time)

@nikahafiz #ms.pbi #dax #dax.ranks #dax.all #ranking

star

Tue Dec 26 2023 06:47:06 GMT+0000 (Coordinated Universal Time)

@python

star

Tue Dec 26 2023 03:29:11 GMT+0000 (Coordinated Universal Time)

@nikahafiz #ms.pbi #dax #table

star

Tue Dec 26 2023 03:28:03 GMT+0000 (Coordinated Universal Time)

@nikahafiz #ms.pbi #dax #dax.datatable #dax.integer #dax.string #table

star

Mon Dec 25 2023 20:28:13 GMT+0000 (Coordinated Universal Time) https://chat.openai.com/?__cf_chl_tk

@eziokittu

star

Mon Dec 25 2023 16:37:40 GMT+0000 (Coordinated Universal Time)

@abhikash01

star

Mon Dec 25 2023 16:22:36 GMT+0000 (Coordinated Universal Time)

@abhikash01

star

Mon Dec 25 2023 14:08:24 GMT+0000 (Coordinated Universal Time)

@segaplay15

star

Mon Dec 25 2023 14:00:51 GMT+0000 (Coordinated Universal Time)

@abhikash01

star

Mon Dec 25 2023 13:57:48 GMT+0000 (Coordinated Universal Time)

@nikahafiz #ms.pbi #dax #dax.topn #ranking #dax.values

star

Mon Dec 25 2023 13:55:40 GMT+0000 (Coordinated Universal Time)

@nikahafiz #ms.pbi #dax #dax.topn #ranking

star

Mon Dec 25 2023 11:25:19 GMT+0000 (Coordinated Universal Time)

@abhikash01

star

Mon Dec 25 2023 10:26:16 GMT+0000 (Coordinated Universal Time)

@Pulak

star

Mon Dec 25 2023 04:29:40 GMT+0000 (Coordinated Universal Time) https://pastecode.io/s/2vx337en

@styners1

star

Sun Dec 24 2023 21:08:18 GMT+0000 (Coordinated Universal Time)

@marcopinero #javascript

star

Sun Dec 24 2023 16:45:29 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/927358/how-do-i-undo-the-most-recent-local-commits-in-git

@hirsch #bash

star

Sun Dec 24 2023 15:17:13 GMT+0000 (Coordinated Universal Time)

@akilavikum #html #tailwindcss

star

Sun Dec 24 2023 00:28:48 GMT+0000 (Coordinated Universal Time)

@misha@11

star

Sat Dec 23 2023 18:07:33 GMT+0000 (Coordinated Universal Time) https://anvil.works/forum/t/simple-audio-player/3479/3?u

@webdeveloper_

star

Sat Dec 23 2023 17:22:51 GMT+0000 (Coordinated Universal Time) https://anvil.works/forum/t/converting-audio-file-to-text/6625/6

@webdeveloper_

star

Sat Dec 23 2023 16:10:52 GMT+0000 (Coordinated Universal Time) https://github.com/codesFolder/Submissions/tree/master

@coderworld

star

Sat Dec 23 2023 16:08:32 GMT+0000 (Coordinated Universal Time)

@coderworld

star

Sat Dec 23 2023 16:02:58 GMT+0000 (Coordinated Universal Time)

@coderworld

star

Sat Dec 23 2023 15:58:21 GMT+0000 (Coordinated Universal Time)

@coderworld

star

Sat Dec 23 2023 15:40:38 GMT+0000 (Coordinated Universal Time)

@mebean

star

Sat Dec 23 2023 15:29:41 GMT+0000 (Coordinated Universal Time) https://anvil.works/forum/t/converting-audio-file-to-text/6625/6

@webdeveloper_

star

Sat Dec 23 2023 14:33:30 GMT+0000 (Coordinated Universal Time)

@Paloma #vue.js #js

Save snippets that work with our extensions

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