Geo hash – getting nearby location in firebase realtime database using php or laravel php

We are developed the location based projects . i am very struggled with getting nearbase location data in firebase database using laravel php . below is my code . please help me to that how to get the nearby location datas using geo hash in laravel php based on the radis .

$fire_drivers = $this->database->getReference(‘drivers’)->orderByChild(‘g’)->startAt($lower_hash)->endAt($higher_hash)->getValue();

    $firebase_drivers = [];

    $i=-1;

    foreach ($fire_drivers as $key => $fire_driver) {
        $i +=1; 
        
        $driver_updated_at = Carbon::createFromTimestamp($fire_driver['updated_at'] / 1000)->timestamp;


    if(array_key_exists('vehicle_type',$fire_driver) && $fire_driver['vehicle_type']==$vehicle_type && $fire_driver['is_active']==1 && $fire_driver['is_available']==1 && $conditional_timestamp < $driver_updated_at){


            $distance = distance_between_two_coordinates($pick_lat,$pick_lng,$fire_driver['l'][0],$fire_driver['l'][1],'K');

            if($distance <= $driver_search_radius){

                $firebase_drivers[$fire_driver['id']]['distance']= $distance;

            }

        }elseif(array_key_exists('vehicle_types',$fire_driver)  && in_array($vehicle_type, $fire_driver['vehicle_types']) && $fire_driver['is_active']==1 && $fire_driver['is_available']==1 && $conditional_timestamp < $driver_updated_at)
            {


            $distance = distance_between_two_coordinates($pick_lat,$pick_lng,$fire_driver['l'][0],$fire_driver['l'][1],'K');

            if($distance <= $driver_search_radius){

                $firebase_drivers[$fire_driver['id']]['distance']= $distance;

            }

        }

    }

    asort($firebase_drivers);

enter image description here

i am developing the project for client regarding location based project .

Not able find verifymail

My code is not able to find verifymail. What is exactly going wrong and what steps on how to solve it. Any help like point out what is wrong would be greatly appreciated.

<!DOCTYPE html>
<html lang="en">
<head>
    <script src="ajax.js"></script>
    <script src="../JS/forgetpasswordemail.js" defer></script>
</head>
<body>
    <div class="container">
        <div class="header">
            <div class="header-text">StudentLink</div>
        </div>
        <div class="profile-picture"></div>
        <div class="eye-segment">
            <div class="eye-segment-black1"></div>
            <div class="eye-segment-black2"></div>
        </div>
        <div class="create-account">Forget Password</div>
        <div class="background-section">Please Type the email address associated with the account</div>
        <form id="myForm"> 
            <button type="" style=" padding: 10px;
            left: 666px;
            top: 626px;
            position: absolute;
            background: white;
            border-radius: 5px;
            justify-content: center;
            align-items: center;
            gap: 10px;
            display: inline-flex;" onClick="verifymail()">Enter</button>
            <div class="password-container" style="top: 525px;">
                <input type="email" style="width: 1158px;
                padding: 10px;
                left: 141px;
                height:25px;
                border-color: black;
                border-radius: 5px;
                background:white ;" id="email-container input" placeholder="Email address"> 
            </div>
        </form>
        <!-- <div class="email-address-container">
            <input type="text" style="width: 1158px;
            padding: 10px;
            left: 141px;
            top: 431px;
            border-color: black;
            border-radius: 5px;
            background:white ;" placeholder="Email Address" id="email" required> 
        </div> -->
    </div>
</body>
</html>

The verifymail() is present in the forgetpassword.js

Cookie was blocked because neither did the request URL’s domain exactly | Next js and Node js

I’ve developed a Node.js backend paired with a Next.js frontend. The Node.js backend is hosted on sub2.sub1.example.com, and the frontend is situated at sub1.example.com. To authenticate users, I employ a Next.js middleware that validates the token stored as a cookie on the client’s computer.

Upon a user’s login attempt, the cookie is set. However, during the redirection to the dashboard page, the cookie isn’t send along with the get request to the next js server. Due to this the middleware redirects back enter image description hereto login page.

How to draw complex SVGs within a Flutter Application?

I am developing an application with Flutter that involves render, and then interacting with, an svg-encoded piece of sheet music. Specifically, I need to be able to draw and re-draw quickly, and get the id attribute of whatever element is under any mouse events. Doing this in a Javascript environment (not in Flutter) is quite easy and just requires adding in the svg to a , and attaching a mouse listener.

The specific problem that I am running into in Flutter is that none of the svg libraries support the kinds of features that this sheet music encoding scheme uses (nested tag, tag, , , overflow attributes, etc). So my question is, what can I do to get this kind of svg rendering? And does that still allow for determining the element that is under a mouse event?

I imagine that converting the svg to an image (png, jpeg, etc) is too slow, and that would require re-rendering the image to a different resolution when the user scrolls. What options exist? Is there a way to define a different drawing solution for each platform I want to use? I hope to port my application to Desktop (primary platform), Web (in a limited capacity), and perhaps Mobile.

I have tried the following libraries in flutter’s pub dev:
flutter_svg
jovial_svg

Neither of them were able to render any kind of image from my svg file. Though I got both to work with a simple svg file (an example dart icon)

Thanks for any suggestions and help!

More information:

My system: Windows 64
Flutter 3.16.9
Dart 3.2.6
Engine: revision 41456452f2

(Svg files being rendered dynamically by the c++ open-source library Verovio)

Example of the syntax of the svg file itself: (abridged from it’s original 760-line file)

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="630px" height="891px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:mei="http://www.music-encoding.org/ns/mei" overflow="visible">
   <desc>Engraved by Verovio 4.2.0-dev[undefined]</desc>
   <defs>
      <symbol id="E242-1chrny2" viewBox="0 0 1000 1000" overflow="inherit">
         <path transform="scale(1,-1)" d="M206 -748c32 48 49 100 49 149c0 89 -55 168 -168 203c-18 5 -47 9 -87 16v190v190h22c8 0 33 -61 71 -95c4 -3 -2 3 61 -56c62 -58 122 -137 122 -241c0 -32 -7 -65 -17 -96c11 -29 17 -60 17 -94c0 -71 -32 -148 -67 -190c-6 -5 -10 -7 -13 -7s-5 2 -5 5l4 10 c1 3 6 8 11 16zM248 -463c4 18 7 38 7 57c0 105 -80 173 -168 200c-11 3 -27 6 -47 9c9 -17 23 -61 53 -88c4 -3 -2 3 61 -56c36 -33 71 -74 94 -122z" />
      </symbol>
      <symbol id="E050-1chrny2" viewBox="0 0 1000 1000" overflow="inherit">
         <path transform="scale(1,-1)" d="M441 -245c-23 -4 -48 -6 -76 -6c-59 0 -102 7 -130 20c-88 42 -150 93 -187 154c-26 44 -43 103 -48 176c0 6 -1 13 -1 19c0 54 15 111 45 170c29 57 65 106 110 148s96 85 153 127c-3 16 -8 46 -13 92c-4 43 -5 73 -5 89c0 117 16 172 69 257c34 54 64 82 89 82 c21 0 43 -30 69 -92s39 -115 41 -159v-15c0 -109 -21 -162 -67 -241c-13 -20 -63 -90 -98 -118c-13 -9 -25 -19 -37 -29l31 -181c8 1 18 2 28 2c58 0 102 -12 133 -35c59 -43 92 -104 98 -184c1 -7 1 -15 1 -22c0 -123 -87 -209 -181 -248c8 -57 17 -110 25 -162 c5 -31 6 -58 6 -80c0 -30 -5 -53 -14 -70c-35 -64 -88 -99 -158 -103c-5 0 -11 -1 -16 -1c-37 0 -72 10 -108 27c-50 24 -77 59 -80 105v11c0 29 7 55 20 76c18 28 45 42 79 44h6c49 0 93 -42 97 -87v-9c0 -51 -34 -86 -105 -106c17 -24 51 -36 102 -36c62 0 116 43 140 85 c9 16 13 41 13 74c0 20 -1 42 -5 67c-8 53 -18 106 -26 159zM461 939c-95 0 -135 -175 -135 -286c0 -24 2 -48 5 -71c50 39 92 82 127 128c40 53 60 100 60 140v8c-4 53 -22 81 -55 81h-2zM406 119l54 -326c73 25 110 78 110 161c0 7 0 15 -1 23c-7 95 -57 142 -151 142h-12 zM382 117c-72 -2 -128 -47 -128 -120v-7c2 -46 43 -99 75 -115c-3 -2 -7 -5 -10 -10c-70 33 -116 88 -123 172v11c0 68 44 126 88 159c23 17 49 29 78 36l-29 170c-21 -13 -52 -37 -92 -73c-50 -44 -86 -84 -109 -119c-45 -69 -67 -130 -67 -182v-13c5 -68 35 -127 93 -176 s125 -73 203 -73c25 0 50 3 75 9c-19 111 -36 221 -54 331z" />
      </symbol>
   </defs>
   <style type="text/css">g.page-margin{font-family:Times,serif;} g.ending, g.fing, g.reh, g.tempo{font-weight:bold;} g.dir, g.dynam, g.mNum{font-style:italic;} g.label{font-weight:normal;}</style>
   <svg class="definition-scale" color="black" viewBox="0 0 21000 29700">
      <g class="page-margin" transform="translate(500, 500)">
         <g id="myw3f4h" class="mdiv pageMilestone" />
         <g id="si7b7ih" class="score pageMilestone" />
         <g id="schrbg5" class="system">
            <path d="M1523 1395 L1523 4072" stroke="currentColor" stroke-width="27" />
            <g id="gkn1966" class="grpSym">
               <path d="M1438,4054 C1078,3514 1528,2914 1258,2734 C1591,2914 1141,3514 1438,4054" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="18" />
               <path d="M1438,1413 C1141,1953 1591,2554 1258,2734 C1528,2554 1078,1953 1438,1413" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="18" />
            </g>
            <g id="l1lnivk3" class="label">
               <text x="1105" y="2824" text-anchor="end" font-size="0px">
                  <tspan id="t5bi2fu" class="text">
                     <tspan font-size="405px">Piano</tspan>
                  </tspan>
               </text>
            </g>
            <g id="spkgdb0" class="section systemMilestone" />
            <g id="d1e104" class="measure">
               <g id="ssrt8ln" class="staff">
                  <path d="M1510 3352 L5744 3352" stroke="currentColor" stroke-width="13" />
                  <path d="M1510 3532 L5744 3532" stroke="currentColor" stroke-width="13" />
                  <path d="M1510 3712 L5744 3712" stroke="currentColor" stroke-width="13" />
                  <path d="M1510 3892 L5744 3892" stroke="currentColor" stroke-width="13" />
                  <path d="M1510 4072 L5744 4072" stroke="currentColor" stroke-width="13" />
                  <g id="c1yswqtr" class="clef">
                     <use xlink:href="#E062-1chrny2" x="1627" y="3532" height="720px" width="720px" />
                  </g>
                  <g id="kf5ls9m" class="keySig">
                     <g id="kzwb8ht" class="keyAccid">
                        <use xlink:href="#E260-1chrny2" x="2308" y="3892" height="720px" width="720px" />
                     </g>
                  </g>
                  <g id="m1xwh8sv" class="meterSig">
                     <use xlink:href="#E082-1chrny2" x="2616" y="3532" height="720px" width="720px" />
                     <use xlink:href="#E084-1chrny2" x="2621" y="3892" height="720px" width="720px" />
                  </g>
                  <g id="l1d0tlud" class="layer">
                     <g id="sjlp4ru" class="space" />
                  </g>
               </g>
               <g id="d1x1taea" class="dir">
                  <text x="3189" y="276" font-size="0px">
                     <tspan id="rk2beft" class="rend">
                        <tspan id="t1x5g3fw" class="text">
                           <tspan font-size="405px">Not fast.</tspan>
                        </tspan>
                     </tspan>
                  </text>
               </g>
               <g id="t5anxs" class="tie">
                  <path d="M4250,1260 C4315,1107 4500,1107 4566,1260 C4473,1154 4342,1154 4250,1260" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="9" />
               </g>
               <g id="t1xucvsx" class="tie">
                  <path d="M4250,2160 C4342,2267 4473,2267 4566,2160 C4500,2314 4315,2314 4250,2160" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="9" />
               </g>
               <g id="b11owwib" class="barLine">
                  <path d="M5731 1395 L5731 2115" stroke="currentColor" stroke-width="27" />
                  <path d="M5731 3352 L5731 4072" stroke="currentColor" stroke-width="27" />
               </g>
            </g>
...

How to change color of leaflet marker svg

how can i change only the color of the marker? previously i used just two svgs, one that is active and one that is not, now i wanted to add more icons and making two copies of each icon just to show its active state is not very good approach ig, what can i do?
i tried with divIcon and replacing its html but that didnt work either

icon = L.divIcon({
    className: "custom-icon",
    html: iconSvg,
    iconSize: [24, 24],
    iconAnchor: [12, 12],
  });

        active.options.icon.options.html.replace(
          'fill="#FFD400"',
          'fill="#FF1900"'
        );

i dont know how to solve this it UncaughtClientError > TypeError Uncaught Javascript Error > Cannot read p

UncaughtClientError > TypeError
Uncaught Javascript Error > Cannot read properties of undefined (reading 'replaceChildren')
TypeError: Cannot read properties of undefined (reading 'replaceChildren')
    at Object.confirm (https://bobot-editor.odoo.com/web/assets/b6a4648/website.backend_assets_all_wysiwyg.min.js:3646:552)
    at CodeEditorDialog.onConfirm (https://bobot-editor.odoo.com/web/assets/b6a4648/website.backend_assets_all_wysiwyg.min.js:3644:24)
    at Object.mainEventHandler (https://bobot-editor.odoo.com/web/assets/8a0854f/web.assets_web.min.js:1581:77)
    at HTMLButtonElement.listener (https://bobot-editor.odoo.com/web/assets/8a0854f/web.assets_web.min.js:757:15)

i want it to open file exproil

How can I get the parent coordinates when clicking an iframe inside it

i want to get the coordinates of the parent containing a div when clicking inside the div. I already add an event listener in the iframe and I send the coordinates via postMessage but those are the coordinates of the iframe itself, I want the coordinates of the parent window, those are different. How can i achieve this?

I’ve already tried something like this:

useEffect(() => {
    const iframe = document.getElementById('titanpad') as HTMLIFrameElement;
    const iframeDocument = iframe?.contentDocument || iframe?.contentWindow?.document;

    const handleClick = (event: MouseEvent) => {
      const x = event.clientX;
      const y = event.clientY;
      setClickCoordinates({ x, y });
    };

    if (iframeDocument) {
      iframeDocument.addEventListener('click', handleClick);
    }

    return () => {
      if (iframeDocument) {
        iframeDocument.removeEventListener('click', handleClick);
      }
    };
  }, []);

This didn’t work.

send data from javascript to django without sending request, post, get

I have a project is about web game, if the player end the game

#e.g.
bool state == false

then it will send the score back to the django backend, but i don’t want the player have to press the submit button, is there any ways to do that?

i have no any complete idea, i just found some solution is about ajax, fetch api…, but i don’t really know if those work or not.

my post can’t pass the quality standard, is that means my post’s word too less?

Alternate solution for the deprecated execCommand when copying a rich-text from the displayed HTML

I have this javascript to copy some rich text (for example bolds, tables, etc.) when a button is clicked:

<script>
    window.addEventListener( 'load', () => {
        const btnCopy = document.getElementById( 'my-nice-btn-copy' );
        const richTextToCopy = document.getElementById( 'some-complex-html-structure' );

        btnCopy.addEventListener('click', () => {
            const range = document.createRange();
            range.selectNode( richTextToCopy );
            window.getSelection().removeAllRanges();
            window.getSelection().addRange( range );

            document.execCommand( 'copy' );
            window.getSelection().removeAllRanges();
        });
    } );
</script>

PhpStorm tells me that execCommand() is deprecated.

Here it says I should use the Clipboard API but here it says I need to create a new ClipboardItem element and there I start getting lost.

How should I modify my javascript function to use the native Clipboard API?

TypeError: setOpenModal is not a function (ReactJs)

I am getting an error when trying to display a dialog modal in ReactJS. First, I pass the state of the dialog into a page, which is Work.jsx, which renders a component named ProjectCard. Inside the component ProjectCard, I pass in the states of the opening and closing of it. Now, inside the ProjectCard component, I have an event listener onclick. When somebody clicks on that component, the dialog will show. As soon as it shows, I change its state to true and pass in the data it’s supposed to render, which is the ProjectDetails component given below. I get an error in the ProjectCard component when I click it, saying that setopenmodal is not a function. Can someone please explain what it means? Here is the code… The error is inside the ProjectCard component on the card click event listener.

The App.js Code

function App(){
  const [openModal, setOpenModal] = useState({ state: false, work: null });
  return (
    <Router >
    <div className="app">
      <Navbar />
      <Header />
      <About />
      <Work openModal={openModal} setOpenModal={setOpenModal} />
      {openModal.state && (
        <ProjectDetails openModal={openModal} setOpenModal={setOpenModal} />
      )}
</div>
</Router>
)}

The Work Page Code

const Work = ({ openModal, setOpenModal }) => {
return(
<motion.div
        animate={animateCard}
        transition={{ duration: 0.5, delayChildren: 0.5 }}
        className="app__work-portfolio"
      >
        {filterWork.map((work, index) => (
          <CardContainer>
            <ProjectCard
              key={index}
              work={work}
              openModal={openModal}
              setOpenModal={setOpenModal}
            />
          </CardContainer>
        ))}
      </motion.div>
)
}

The Project Card Component

const ProjectCard = ({ work,setOpenModal }) => {
  const handleClick = () => {
    setOpenModal({ state: true, work: work });
  };
  return (
    <Card onClick={handleClick}>
      <Image src={urlFor(work.imgUrl).url()} alt={work.name} />
      <Technologies>
        {work?.technology.map((technology) => (
          <Technology>{technology}</Technology>
        ))}
      </Technologies>
      <Details>
        <Title>{work.title}</Title>
        <Date>{work.date}</Date>
        <Description>{work.description}</Description>
      </Details>
      <Members>
        <Title2>Members :</Title2>
        {work.members?.map((members) => (
          <Avatar src={urlFor(members.imgUrl).url()} alt={members.name} />
        ))}
      </Members>
      <Tags>
        <Title3>Tag(s) :</Title3>
        {work?.tags.map((tags) => (
          <Tag>{tags}</Tag>
        ))}
      </Tags>
    </Card>
  );
};

The ProjectDetails Component

const ProjectDetails = ({ openModal, setOpenModal }) => {
  const work = openModal?.work;
  return (
    <Modal
      open={true}
      onClose={() => setOpenModal({ state: false, work: null })}
    >
      <Container>
        <Wrapper>
          <CloseRounded
            style={{
              position: 'absolute',
              top: '10px',
              right: '20px',
              cursor: 'pointer',
            }}
            onClick={() => setOpenModal({ state: false, work: null })}
          />
          <Image src={urlFor(work.imgUrl).url()} alt={work.name} />
          <Title>{work?.title}</Title>
          <Date>{work.date}</Date>
          <Technologies>
            {work?.technology.map((technology) => (
              <Technology>{technology}</Technology>
            ))}
          </Technologies>
          <Desc>{work?.description}</Desc>
          {work.members && (
            <>
              <Label>Members</Label>
              <Members>
                {work?.members.map((members) => (
                  <Member>
                    <MemberImage src={urlFor(members.imgUrl).url()} alt={members.name}/>
                    <MemberName>{members.name}</MemberName>
                    <a
                      href={members.githubLink}
                      target="new"
                      style={{ textDecoration: 'none', color: 'inherit' }}
                    >
                      <GitHub />
                    </a>
                    <a
                      href={members.linkdinLink}
                      target="new"
                      style={{ textDecoration: 'none', color: 'inherit' }}
                    >
                      <LinkedIn />
                    </a>
                  </Member>
                ))}
              </Members>
            </>
          )}
          <ButtonGroup>
            <Button dull href={work?.codeLink} target="new">
              View Code
            </Button>
            <Button href={work?.projectLink} target="new">
              View Live App
            </Button>
          </ButtonGroup>
        </Wrapper>
      </Container>
    </Modal>
  );
};

The Problem is inside the ProjectCard Component on the card on click
i was expecting For The Modal To Display as i don’t understand whats the issue with the code

How to track window open url

I am doing this

<button id="gbs" class="btn btn-standard" style="margin-top:5px;margin-left:20px;" onclick="window.open('https://example.com/#appraisal')">
  Create Appraisal
</button>

When I try to get the URL from open event with document.referrer I get the original page url:

https://example.com/api/ACinvoices.php?invoices=915212&print=1&customer=21402

Attaching image to understand me better:

enter image description here

Using prototypes to check whether an object is an instance of a class

I tried to solve the 2618s problem in LeetCode “https://leetcode.com/problems/check-if-object-instance-of-class/description/” and wanted to know if there is a way to resolve it using only properties like prototype, proto and constructor, without a while loop and instanceof? Any help please.

Theres a bunch of examples I tried but nothing works

  return obj.constructor.prototype === classFunction.prototype

 if (classFunction === Number || classFunction === String || classFunction === Date) {
        return obj.__proto__ === classFunction.prototype
    } else return obj.__proto__.constructor.__proto__.prototype === classFunction.prototype

how to fire click event for disabled dropdown in gridview in javascript?

how to fire click event for disabled dropdown for this $(“#AdditionalInfo”).find(“tr”).find(‘#ddlLineDBItem_AddGrdInfo’).attr(‘disabled’, ‘disabled’) in javascript and click event is not firing for disabled dropdown in gridview

$(“#AdditionalInfo”).find(“tr”).eq(cnt – 2).find(‘#ddlLineDBItem_AddGrdInfo’).attr(‘disabled’, ‘disabled’).on(‘click’, function () {
// Code to be executed on mouseover
gd_open_pop(this, ‘divInfoLinePopupAdditional’, ‘c’, ‘bl’, ‘EditLineItemSpecilist’, GridID, ”);
$(this).css(‘background-color’, ‘lightgray’);
// Example: Change background color on mouseover
})

            .mouseout(function () {
                // Code to be executed on mouseout           
                $(this).css('background-color', '');
                // Example: Reset background color on mouseout   
        and click event is not firing

How do I retrieve the values of a radio group from an HTML dialog?

index.html:

  <body>
    <dialog class="dialog">
      <form class="report__form" method="dialog">
        <div>
          <input type="radio" name="report" vale="vulgar" />
          <label for="vulgar">Vulgar/Offensive Language</label>
        </div>
        <div>
          <input type="radio" name="report" vale="duplicate" />
          <label for="Duplicate">Duplicate</label>
        </div>
        <div>
          <input type="radio" name="report" vale="broken" />
          <label for="broken">Broken</label>
        </div>
        <button class="dialog__submit">Submit</button>
      </form>
    </dialog>
    <button class="open">open dialog</button>
    <script src="script.js"></script>
  </body>

script.js:

const dialog = document.querySelector(".dialog");
const reportForm = document.querySelector(".report__form");
const submitButton = document.querySelector(".dialog__submit");
const openButton = document.querySelector(".open");

openButton.addEventListener("click", () => {
  dialog.showModal();
});

I’m having a hard time figuring out how to retrieve the radio input values within an HTML dialog. I read the MDN docs on radio inputs but am still struggling to get it to work within the context of a dialog. I figure I need to set a default value, loop through the inputs, and update that value if I click one of them, but I can’t get it to work.