Bind a div to a changing variable

There is a loop, which contains a button, on click that button a function runs,

{#each newArray as item (item.id)}
<button class="px-2 py-1" on:click={() => settingFun(item.id)}>(Id: {item.id})<Setting /></button>
{/each}


function settingFun(itemId) {
    toggle = !toggle;
    if (!toggle) {
      settings.classList.remove("hidden");
      settingIcon.classList.add("bg-gray-200", "rounded-lg");
    } else {
      settings.classList.add("hidden");
      settingIcon.classList.remove("bg-gray-200", "rounded-lg");
    }
  }


<div class="hidden" bind:this={settings}>
            <div class="flex justify-between items-center border py-2 shadow-md">
              <div class="flex py-3 px-2">
                <div class="bg-[#D9D9D9] px-3 py-2 rounded-lg font-semibold">
                  <Button label="Not Empty" />
                </div>
                <div class="ml-5 bg-[#D9D9D9] px-3 py-2 rounded-lg font-semibold">
                  <Button label="Is Unique" />
                </div>
              </div>
              <div class="flex relative menus">
            </div>
          </div>

i want to bind this div to item.id or something like connected with item.id [item.id is a unique id generated each time on when loop runs] and also use item.id in settingFun() instead of settings.
In Conclusion, i want a different behaviour for each item in loop.

i tried to bind item.id in place of setting but didn’t work and caused tab crash

I am getting all broken images and alternative text of image in my reactjs project ,any solution for this?

when i run the project the images in the project aren’t visible in the browser,is there any solution for visible of images in the browser!
project is running smooth but the images aren’t visible.
where my

my project structure



header.js code
/* eslint-disable jsx-a11y/img-redundant-alt */
function Header() {
  return (
    <header>
      <h1>Open Source Website</h1>
      <div className="row">
        <img src="me.jpg" alt="image"/>
      </div
>
      <div className="headerbg"></div>
    </header>
  );
}
export default Header;
----------------------
card.js code
function Card(props) {
  return (
    <div className="card">
      <br />
      
      <div className="text-center">
        <img alt="card-img" src={"./img/"+props.img} className="text-center img-fluid" />
      </div>
      <div className="text-center">
        <h3 className="card-title">{props.title}</h3>
      </div>
      <div className="p-3">
        <p className="card-text">
           {props.text}
        </p>
      </div>
    </div>
  );
}
export default Card;
--------------------------------

service.js
import Card from "./Card";
function Services() {
  return (
    <div className="container services">
        <h2 className="main-title text-center">SERVICES</h2>
        <div className="card-cover">
            <div className="col-md-12">
                <div className="row">
                    <div className="col-md-4 mb-2">
                
                        <Card title="Web Development" img="card1.png" text="Morbis eget neque risus. Duis erat quam, porta quis enim id, venenatis blandit nunc. " />
                    </div>
                    <div className="col-md-4 mb-2">
                    <Card title="E-Commerce Services" img="card2.png" text="Maecenas dictum efficitur felis non gravida. Vestibulum vitae ante luctus, accumsan mi vitae, pretium metus." />
                    </div>
                    <div className="col-md-4 mb-2">
                    <Card title="Cyber Security" img="card3.png" text="Phasellus suscipit nibh at nisi finibus vestibulum sit amet vitae massa. Suspendisse non est eget elit pulvinar consectetur nec non sapien." />
                    </div>
                </div>
            </div>
        </div>
    </div>
  );
}
export default Services;
------------------------------------

about.js


function About() {
  return (
    <>
      <div style={{marginTop:'15rem',width:'100%',height:'10px'}} className="about-scroll"></div>

      <div className="container about">
        <div className="row">
          <div className="col-md-6 text-center">
            <img alt="about" src="./img/img1.png" className="img-fluid" />
          </div>
          <div className="col-md-6">
            <h2 className="main-title about-h2">ABOUT</h2>
            <p className="main-p">
              Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur
              quam purus, ullamcorper id risus eu, consectetur consectetur
              purus. Etiam sagittis in eros ac sollicitudin.
            </p>
          </div>
        </div>
      </div>
    </>
  );
}
export default About;
----------------------------------------
index.css

body {
  overflow: auto;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.hidescroll {
  overflow: hidden!important;
}

code {
  font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
    monospace;
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: rgb(62, 62, 62);
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}
.display {
  opacity: 1!important;
}
.container {
  width: auto;
  max-width: 1300px;
  padding-right: var(--bs-gutter-x,.75rem);
  padding-left: var(--bs-gutter-x,.75rem);
  margin-right: auto;
  margin-left: auto;
}
.contact .row {
  width: 100%;
}
.row {
  display: flex;
  z-index: 1;
}
.img-fluid {
  max-width: 60%;
  width: 50%;
}
.text-center {
  text-align: center;
}
.bgred {
  background-color: red;
}
.btn {
  outline: 0;
  border: 0;
  font-size: 20px;
  border-radius: 5px;
  text-decoration: none;
  color:white;
  font-weight: 500;
  z-index: 1;
  background-color: #01bf71;
  padding:  10px 50px;
  margin: 0 0.5rem;
}

.col-md-12 {
  width: 100%;
}
.col-md-6 {
  width: 49.9%;
}
.col-md-3 {
  margin: 0 1rem!important;
  width:100%;
}

.col-md-4 {
  width:33.3%;
}
.col-md-4:first-child {
  margin-right: 1rem;

}
.col-md-4:last-child {
  margin-left: 1rem;

}

.x {
  margin: 0rem 1rem!important;
  width:33.3%;
}
/* Navbar */
.navopened {
  background-color: #010606!important;
}
.navopened .logo {
  color: #fafafa!important;
}
.navopened ul li a {
  color: #fafafa!important;
}
.navopened .burger {
  background-color: #010606!important;
}
.navbar {
  transition: background-color 0.4s;
  position: fixed;
  top: 0;
  width: 100% ;
  padding: 0.5rem;
  background-color: transparent;
  z-index: 2;
  backdrop-filter: blur(2px);
}
.navbar .logo {
  transition: all 0.2s;

  align-items: center;
  align-content: center;
  color: rgb(243, 243, 243);
  letter-spacing: 2px;
  font-weight: 400;
  margin: 0;
  font-size: 28px;
  padding-top: 10px;
}
.navbar ul { 
  transition: all 0.2s;

  margin-left: 17rem;
  list-style: none;
}
.navbar ul li {
  margin: 0 1rem;
  display: inline-block;
}
.navbar ul li a {
  transition: all 0.2s;
  font-size: 20px;
  cursor: pointer;

  text-decoration: none;
  color: rgb(243, 243, 243);
  font-weight: 500;

}
.button {
  cursor: pointer;
  transition: transform 0.2s linear;
  position: fixed;
  transform:translateX(300%);
  top: 20px;
  right: 15px;
  z-index: 1;
}
.burger {
  transition: all 0.2s;

  margin-bottom: 0.45rem;
  width: 25px;
  height: 3px;
  background-color: white;
}
/* Header */
video {
  top: 0;
  object-fit: cover;
  width: 100%;
  height: 100vh;
  position: absolute;
  z-index: -1;
}

.headerbg {
  position: absolute;
  width: 100%;
  height: 100vh;
  z-index: 0;
  top: 0;
  background-color: black;
  opacity: 0.7;

}
header {
  height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-shadow: inset 0 0 0 1000px rgba(0, 0, 0, 0.2);
}
header h1 {
  z-index: 1;
  color: white;
  font-size: 64px;
}
.opened {
  transform: translateX(0%)!important;
}
/* main */
.main-title {
  font-size: 48px;
  color: #01bf71;
}
.main-p {
  font-size: 22px;
  font-weight: 500;
}
main {
  padding: 3rem 0;
  background-color: #fafafa;
  width: 100%;
}
/* footer */
.text-white {
  color: white;
}
.footer-top {
  margin: 0;
  padding: 0.1rem 0;
  background-color: #01bf71;
}
.footer-top p {
  font-size: 18px;
}
.footer-text {
  margin-top: 2.5px;

  font-size: 18px;
  color:#919191;
}
footer {
  width: 100%;
  height: auto;
  margin: 0;
  padding: 1rem 0;
  background-color:#010606;
}
.side1 {
  width: 50%;
}
.side2 {
  width: 50%;

}
footer .col-md-3 {
  height: 100%;
}
footer .logo {
  transition: all 0.2s;
  margin-bottom: 0;
  align-items: center;
  align-content: center;
  color: rgb(243, 243, 243);
  letter-spacing: 2px;
  font-weight: 400;

  font-size: 28px;
}
.logo a{
  text-decoration: none;
  color: #fafafa;
  
}
.footer-title {
  color: #fafafa;
  font-weight: 600;
  font-size: 22px;
  margin-bottom: 0;
  word-wrap:initial;
}
footer ul {
  list-style: none;
  margin-left: 0;
  padding-left: 0;
  margin-top: 2.5px;
}
footer ul li a {
  text-decoration: none;
  color: #919191;
  font-size: 18px;
  font-weight: 500;
}
.gotop {
  transition: all 0.2s;
  background-color: #01bf71;
  position: fixed;
  border-radius: 25px;
  padding: 1rem;
  border: 0;
  opacity: 0;
  outline: 0;
  cursor: pointer;
  font-weight: 1000;
  box-shadow: 0px 0px 5px 0.2px #000000;
  color: white;
  bottom: 20px;
  right: 15px;
  
}
/* Services */
.card-title {
  color: #01bf71;
  font-size: 24px;
}
.p-3 {
  padding: 0.2rem 1rem;
}
.card-text {
  padding: 0rem 0rem 1rem 0rem;
  font-weight: 500;
  font-size: 18px;

}

.card {
  cursor: pointer;
  border-radius: 10px;
  width: 100%;
  transition: all 0.2s;
  background-color: white;
  box-shadow: 5px 5px 5px 5px #e5e5e5;
}
.card:hover {
  transform:scale(1.03);
}

.services .col-md-4 {
  margin: 1rem 1rem 1rem 1rem;


}
ul li a {
  cursor: pointer;
}
.about {
  margin-bottom: 15rem;
}
.card-cover {
  padding: 2rem 0rem;
  border-radius: 15px;
  height: auto;
  width: 100%;
}
.s {
  width: 100%;
  margin: 0 1rem!important;
}

.contact-input {
  color:white;
  border-radius: 5px;
  padding: 15px 0px 10px 5px;
  font-size: 20px;
  width: 100%;
  outline: 0;
  border: 0;
  background-color: rgba(0, 0, 0, 0.76);

}
.form-btn {
  border: 0;
  outline: 0;
  cursor: pointer;
  font-size: 20px;
  border-radius: 5px;
  text-decoration: none;
  color: white;
  width: 100%;
  font-weight: 500;
  z-index: 1;
  background-color: #01bf71;
  padding: 10px 50px;

  transition: background-color 0.2s;
}
.contact-textarea {
  color:white;
  border-radius: 5px;
  padding: 15px 0px 10px 5px;
  font-size: 20px;
  width: 100%!important;
  min-width: 100%!important;
  max-width: 100%!important;
  height: 300px;
  min-height: 300px;
  max-height: 600px;

  outline: 0;
  border: 0;
  background-color: rgba(0, 0, 0, 0.76);

}

@media (max-width: 1300px) {
  .container {
    max-width: 1300px;
  }
}

@media (max-width: 992px) {
  .col-md-4 {
    width: 49.9%;
  }
  .navbar ul {
    margin-left: 5rem;
  }
  .container {
    max-width: 960px;
  }
  .col-md-3 {
    width: 100%;
  }
  .side1 .row {
    display: inline-block;
    width: 100%;
  }
  .side2 .row {
    display: inline-block;
    width: 100%;

  }
}

@media (max-width: 768px) { 
  header h1 {
    text-align: center;
    font-size: 44px!important;
  }
  .container {
    max-width: 720px;
  }
  .navbar ul { 
    margin-left: 0rem;
    list-style: none;
  }
  .col-md-4 {
    width: 55.9%!important;
  }

}
@media (max-width: 576px) { 
  .col-md-4:first-child {
    margin-right: 0;
  
  }
  .col-md-4:last-child {
    margin-left: 0;
  
  }
  .services .col-md-4 {
    margin: 2rem auto!important;
    width: 87.9%!important;

  }
  .col-md-4 {
    
    width: 100%!important;
  }
  .contact .col-md-4 {
    
    margin: none!important;
    }
  .col-md-3 {
    margin: 0!important;
  }

  footer .row {
    display: block;
  }
  .side1 {
    width: 100%;
  }
  .side2 {
    width: 100%;
  
  }
   .navopened ul {
    top: 55px!important;

   }
  .navopened {
    background-color: #010606!important;
  }
  .navopened .logo {
    color: #fafafa!important;
  }
  .navopened ul li a {
    color: #010606!important;
  }
  .navopened .burger {
    background-color: #fafafa!important;
  }
  .container {
    width: auto;
  }
  header h1 {

    font-size: 44px;
  }
  .btn {

    padding:  10px 30px;

  }
  .container {
      max-width: 540px; 
  }

  .button {
    transform:translateX(0);

  }

  .navbar .logo {
    z-index: 3;
    color: #fafafa;
    padding-top: 0;
  }

  .burger {
    background-color: #fafafa;
  }
  .navbar {
    backdrop-filter: none;
    padding: 10px 0;
  }
  .navbar ul { 
    backdrop-filter: blur(20px);

    z-index: -1;
    position: absolute;
    top: 0;
    left: 0;
    height: 100vh;
    width: 100%;
    list-style: none;
    padding: 0;
    text-align: center;
    margin: 0;
    padding-top: 10rem;
    transform: translateX(-100%);
  }

  .navbar ul li {
    margin: 2rem 0rem;
    display: block;
  }
  .navbar ul li a {
      cursor: pointer;
    font-size: 20px;
    text-decoration: none;
    color: #fafafa;
    font-weight: 500;
  
  }
  .col-md-6 {
    width: 100%;
  }
  .row {
    display: inline-block;
  }
}

.mb-2 {
  margin-bottom: 2rem!important;
}
.mb-1 {
  margin-bottom: 1rem!important;
}
-----------------------------------------
App.js
import Navbar from "./components/Navbar";
import Header from "./components/Header";
import Main from "./components/Main";
import Footer from "./components/Footer";

function App() {
  return (
    <>
      <Navbar />
      <Header />
      <Main />
      <Footer />
    </>
  );
}

export default App;

please help me,i had tried different approaches but i had getting same.

  1. here the broken images for card.js
    header.js broken image
    about.js

semicolon is expected. | document.body.style.background.image = “

function toggle() {
     document.body.style.background.image = `
     linear-gradient(
      210deg,
      hsl(0deg 0% 0%) 0%,
      hsl(137deg 0% 1%) 0%,
      hsl(137deg 0% 2%) 0%,
      hsl(137deg 0% 4%) 2%,
      hsl(137deg 0% 5%) 5%,
      hsl(137deg 0% 5%) 10%,
      hsl(137deg 0% 6%) 19%,
      hsl(137deg 0% 6%) 42%,
      hsl(261deg 17% 14%) 88%,
      hsl(259deg 25% 27%) 97%,
      hsl(258deg 28% 40%) 100%,
      hsl(258deg 36% 54%) 100%
    );`;
  }

I am getting an error saying ; is expected.

I don’t know why it does not work.

I tried putting background.image and the error ‘;’ is expected would go away.

I’m trying to create an ai chatbot using electron and python. code is working properly but in js part their is problem

I’m experiencing difficulties with file handling and interfacing between Python and JavaScript in my code hosted on Kaggle. The code, accessible via this link, contains paths for file operations.

My goal is to establish a workflow where:

1)js takes user input and writes it to a file.
2)Python processes the input, writes the response to another file.
3)JavaScript reads the response file and performs operations.
4)All files are deleted and recreated for the next iteration.
5)Despite multiple attempts, the JavaScript component fails to read the output file generated by 6)Python and execute subsequent tasks. I’ve tried adjusting file paths and permissions without success.

Could someone provide guidance on properly implementing this workflow, ensuring seamless interaction between Python and JavaScript for file handling?

I appreciate any insights, code snippets, or suggestions. Thank you!

Why swipe down to refresh is not working for my website?

i am using https://demo.interface.club/limitless/demo/template/html/layout_1/full/index.html

this theme for my admin panel, but some how swipe down to refresh functionality is not wokring.

i want this functionality on mobile devices, but some how it is not working.

i tried different solutions but none of them worked,

here some css properties i tried,

.allow-pull-to-refresh {
    overflow: auto !important;
    overscroll-behavior: auto !important;
}

and i gave this class to body,

but it is not working,

i also tried some script but that also didn’t work,

function preventDefaultTouchmove(event) {
    event.preventDefault();
}

document.addEventListener('touchmove', preventDefaultTouchmove, { passive: false });

document.removeEventListener('touchmove', preventDefaultTouchmove);

Get global data everywhere in app angular

I have global variables that I need to access everywhere in my app. My project use subject as service state management. I don’t want to use NGRX or redux pattern based state management.

I want to get data from Api and set variable in a service when the app loads, whatever the page.
Then data will be get in components from the service.

I am not sure what is the proper way to acquire this. Should I use resolver?

Php session destroy on being redirected

I have a payment gateway integrated into a php code. When the payment gets successful the page gets redirected to the server and php script gets executed. But one thing i observed is that php session variables gets destroyed and on cant access the php session variables.

Sometimes the session variables are accessed but sometimes session variables are not being accessed.

How do you debug fullstack projects in VsCode using breakpoints?

I would like to place breakpoints in a Typescript file for debugging using VScode. I am able to place a breakpoint and run the project in a docker container. I’m expecting to see values of some of my variables in the debug console, but instead see nothing.

I’ve only ever debugged single files with the debugger. Is there anything different I need to do to debug a full stack project?

как работать v реальном времени na vscode с проектом, который открыт на open server? [closed]

как работать v реальном времени na vscode с проектом, который открыт на open server?
please help!

открываю сайт каждый раз эта проблема:

dial tcp: lookup newarchive on 127.0.0.11:53: no such host

я не знаю что делать…..

puppeteer run pages recursively

I have the code down below which I use to fetch a dom with puppeteer. sometimes the DOM can be buggy or i need to fetch the DOM again for some other reason, I do a check and depending on that I create a recursive call which also creates another puppeteer page and connects to a proxy and does the same stuff.

On the recursion, (not the first time the function running) the proxies are bugging out. they dont work correctly and drop. I know it is about the line useProxy(page, 'http://' + prx); because if i dont use a proxy for recursive calls, the function seems to be running smooth.

var fs          = require('fs')
const { Worker, isMainThread, parentPort, workerData } = require('worker_threads');
var { parse }   = require('node-html-parser');
const puppeteer = require('puppeteer');
const useProxy  = require('@lem0-packages/puppeteer-page-proxy');
//var useProxy = require('puppeteer-page-proxy')

//npm i @lem0-packages/puppeteer-page-proxy => https://github.com/Cuadrix/puppeteer-page-proxy/issues/57 change the line
const proxArray  = fs.readFileSync('../ProxyModules/proxies.txt',  { encoding: 'utf8', flag: 'r' }).split(/r?n/)
const proxArray2 = fs.readFileSync('../ProxyModules/proxies2.txt', { encoding: 'utf8', flag: 'r' }).split(/r?n/)

async function main(){

    let browser;
    browser = await puppeteer.launch({ headless:true,
    //  executablePath: '/home/node_modules/chromium/lib/chromium/chrome-linux/chrome',
      defaultViewport: null,
      args: ['--no-sandbox', '--disable-setuid-sandbox', '--disable-dev-shm-usage', '--disable-accelerated-2d-canvas', '--no-first-run', '--no-zygote', '--single-process', '--disable-gpu'] // `--window-size=1920,1080`  //  executablePath: chromium.path
    });


    var promisesArray = [];
    var wholeARR = [];

    for(let z = 50; z < 101; z++){
      promisesArray.push(
        new Promise(async (resolve, reject) => {
                //looping the page.. 3 times until a request is found
               async function fetchOnPage(times, z){
                 try{
                   let page  = await browser.newPage();

                   await page.setViewport({width: 1920, height: 1200, deviceScaleFactor: 1 }); await page.setDefaultNavigationTimeout(0);    page.on("pageerror", function(err) { reject(-1);});   //  page.on("error", function (err) { console.log("Error: " + err.toString())});

                    let indexOfProxyArray = (z % proxArray.length) + times;
                    let prx = proxArray[indexOfProxyArray];
                    useProxy(page, 'http://' + prx);                              //if(times == 0) useProxy(page, 'http://' + prx); this just shows, on 2nd time if i dont use the proxy it work...

                    console.log(`starting ${times} time on page ${z} with prx : ${prx}`);
                    await page.goto("https://www.google.com/", {timeout: 0, waitUntil: 'domcontentloaded'});
                    const DOMAray = await page.evaluate(() => {});

                    if(times == 2 && DOMAray.length == 0 ){
                      reject(-1); return;
                    }else if(times < 2 && DOMAray.length == 0 ){
                      await page.close();
                      fetchOnPage(times + 1, z)

                    }else{
                      Array.prototype.push.apply(wholeARR, DOMAray);
                      resolve(1);
                      return;
                    }

                  }catch(error){console.log(error);}

                }

                fetchOnPage(1, z);
        })
      )
    }

  return Promise.all(promisesArray)
  .then(async function() {
    console.log('finsihed PROMSES');
  }).catch((e) => {console.log(`error ${e}`); })

}


main();

the console output shows that all the firs time requests are made well, but for the 2nd time it is called(recursion) the logs doesnt even appear and the program just hangs. i made a small line //if(times == 0) useProxy(page, 'http://' + prx); which just shows that if i use this line th eprogram runs perfect. but otherwise the program just hangs on the first recursive call to the function.
maybe i shouldn’t be using @lem0-packages/puppeteer-page-proxy, because it is weird that from 50 to 101 (50 times looping) all the pages run perfectly, but just the time i start recursive call, many requests just hang definitely the puppeteer proxy issue. I tried to avoid using a proxy address that is already used on a second recursive call by adding a line if(times == 2) prx = proxArray2[indexOfProxyArray]; yet the console still hangs.. no error no show up anything… I just want to be able to use the puppeteer pages recursively with proxies.. how to fix this hang on console ( no error hshown > )

Boxs object not updating (Tic Tac Toe)

I have a very strange problem with my tic tac toe game and I have no idea why this is happening. In my debug it shows that the boxs has every property always set to 0, however the login for finding a winner still happens with check_win() working fine for the first session and the game resets perfectly. However after this session the game goes bonkers and does not work properly.I am including all of the javascript code because I believe any issue could be anywhere. Neither me nor ChatGPT could find the issue causing this.

Javascript

let global = {
    user:"x",
    count:'1',
    boxs: {
        b1: 0,
        b2: 0,
        b3: 0,
        b4: 0,
        b5: 0,
        b6: 0,
        b7: 0,
        b8: 0,
        b9: 0,
    }
}

    
function change_text(id) {
    let button = document.getElementById(id);
    if (global.user === 'x') {
        global.boxs[id] = 1;

    }
    else {
        global.boxs[id] = 2;
    }
return global.boxs

}
function reset() {
    global.user = "x";
    global.count = 1;
    
    for (property in global.boxs) {
        document.getElementById(`${property}`).innerText = '';
        document.getElementById(`${property}`).disabled = false;
        global.boxs[property] = 0;
    }

}

    
    



function display(winner) {
    document.getElementById('winner').innterText = winner + 'wins!'

}

function check_win() {
    possible = [[global.boxs.b1,global.boxs.b2,global.boxs.b3],
    [global.boxs.b4,global.boxs.b5,global.boxs.b6],
    [global.boxs.b7,global.boxs.b8,global.boxs.b9],
    [global.boxs.b1,global.boxs.b4,global.boxs.b7],
    [global.boxs.b2,global.boxs.b5,global.boxs.b8],
    [global.boxs.b3,global.boxs.b6,global.boxs.b9],
    [global.boxs.b1,global.boxs.b5,global.boxs.b9],
    [global.boxs.b3,global.boxs.b5,global.boxs.b7],
    ]
    for (i= 0; i < 8; i++){
        if (possible[i][0] === possible[i][1] && possible[i][1] === possible[i][2] && possible[i][0] === possible[i][2])
            return possible[i][1]
    
    }
    return 0;


    


}

function change_user(){
    if (global.user === 'x') {
        global.user ='o'

    }
    else {
        global.user = "x"
    }
    return global.user
    
}
function buttonclicked(d) {
    let button = document.getElementById(d);
    let user = global.user
    global.count++
    document.getElementById(d).innerText = user;
    button.disabled = true;

   
    
    

    

    
    
    
    change_user();
    change_text(d);

    let winner = check_win()



    if (winner == 1 || winner == 2) {
        console.log("winner")
        const win = {
            1:"X",
            2:"O"
        }
        display(win.winner)
        reset()
    }
    
    if (global.count == 9){
        reset()
        return

    }
    
    global.count +=1
    console.log(global.boxs)

}

HTMl

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>TicTacToe</title>
    <script src="Javascript.js"></script>
    <link href="CSS.css" rel="stylesheet">

</head>
<body>
    <div class=" header">
        <h1 id="winner"></h1>
    </div>
    <div class=container></div>
    
        <div class="blocks"> 
            <div class = "row">
                <button id="b1" class="block"  class="column1" onclick="buttonclicked('b1')"></button>
                <button id ='b2' class="block" class="column2 "onclick="buttonclicked('b2')"></button>
                <button id='b3' class="block"  class="column3"onclick="buttonclicked('b3')"></button>
            </div>
            <div class = "row">
                <button id='b4' class="block"  class="column1"onclick="buttonclicked('b4')" ></button>
                <button id='b5' class="block"  class="column2"onclick="buttonclicked('b5')"> </button>
                <button type="button" id='b6' class="block"  class="column3"onclick="buttonclicked('b6')"> </button>
            </div>
            <div class="row">
                <button  id='b7'    class="block" text   class="column1"onclick="buttonclicked('b7')"> </button>
                <button  id='b8'    class="block"   class="column2"onclick="buttonclicked('b8')"> </button>
                <button  id='b9'    class="block"   class="column3"onclick="buttonclicked('b9')"> </button>

            </div>
        </div>
    </div>
    <script src="Javascript.js"></script>
</body>
</html>

I tried changing when the reset happens, since that should be the only thing resetting the properties to 0 but the reset definitely does not happen everyturn. Also I would be more sure of the issue if the check_win() logic did not work, but it does which is what confuses me.

javascript) odd/ even/ null…./ NaN

Q. Write a program that separates odd and even numbers by receiving a number from the user

  • Output ‘Cancel Input’ when input is cancelled
    -Distinguish odd-even if a value has been entered

I made it using the if else statement, but I can’t output the input cancel when I cancel the input.
I want to cancel the input, and make it aware when something that is not a number comes in as well.
Is it not possible for if to recognize null and NaN as false?
So how do you make it recognizable?

<!doctype html>
<html lang="ko">
    <head>
        <meta charset="utf-8">
        <title>JAVASCRIPT</title>
    </head>
    <body>
    <script>
     let num = Number(prompt('put a number',15));
        let re;
        if(num == null){
            re = 'no'
        }
        if(num != Number){
            re ='please put a number'
        }
        if(num % 2 === 0){
            re = 'even';
        }else if(num % 2 === 1){
            re = 'odd';
        }
    </script>
    </body>
</html>

Generating maps with folium/flask only works the first time, subsequent requests return the same map

Cut out some parts but this is how i’m trying to save it
I would really want to be able to use the same file name and resave over the map_file_path which I have defined already. It works the first time but any subsequent times when making requests, it takes me back to the original map that I created..

@app.route("/", methods=['GET', 'POST'])
def landing_page():
    if request.method == 'POST':
        address = request.form.get('address', '')
        print(address)
        county_name, lat, lng = geocode_address(address)
        if not county_name:
            return "County geocoding failed, please try again.
        if counties_data:
            folium_map = folium.Map(location=[lat, lng], zoom_start=13)
            # Add GeoJSON layers for counties
            for county_data in counties_data:
                GEOID, county_name, geometry_wkt, crime_percentile = county_data
                if geometry_wkt:
                    geojson = wkt_to_geojson(geometry_wkt)
                    folium.GeoJson(
                        geojson,
                        name=county_name,
                        style_function=lambda feature, crime_percentile=crime_percentile: {
                            'fillColor': color_scale(crime_percentile),
                            'color': 'rgba(0, 0, 0, 0)',
                            'weight': 1,
                            'fillOpacity': 0.3
                        },
                    ).add_to(folium_map)
            # add a marker for the provided address
            folium.Marker([lat, lng], popup=f'<b>{address}</b>').add_to(folium_map)
        else:
            return f"No matching county found in the database for '{county_name}'."
        folium_map.save(map_file_path)
        return redirect(url_for('show_map'))
    return render_template('landing_page.html')

@app.route("/map")
def show_map():
    return render_template('map_view.html')

if __name__ == "__main__":
    app.run()

Patient Queuing Features with Audio PHP

hello I want permission to ask, I am making a feature about the patient queue using voice, I have made the condition if the queue 1 sound is played, what queue 10 and so on, but when I choose queue number 1 the audio in play is 21 I choose number 10 also 21, I inspect I see in the resource each queue has loaded the correct resource already appropriate but when in play what appears 21 all, please help

enter image description here
this is condition to load source audio

enter image description here
and this is condition to play audio

I want when selecting queue 1 audio play according to the queue number