How to save a string/object to firebase database

Noob question… Using JS, how do I save a string or object to firebase database? I’m trying to do this on codepen.io. I’ve tried this:

// Initialize Firebase app

const firebaseConfig = {
  // your app config here
};

firebase.initializeApp(firebaseConfig);

// Get a reference to the database

const database = firebase.database();

// Write a string to the database

const myString = "Hello, Firebase!";

database.ref('myData').set(myString);

But I’m not seeing anything added in the firebase console… What steps am I missing.

Making changes in Firefox print does not work , but works well in other browsers

I am trying to modify some content for print alone, and so have a hook

import { useState } from 'react'

const usePrint = () => {
    const [isPrinting, setIsPrinting] = useState(false)
    const handleBeforePrint = () => {
        setIsPrinting(true)
    }
    const handleAfterPrint = () => {
        setIsPrinting(false)
    }

    typeof window !== 'undefined' && window.addEventListener('beforeprint', handleBeforePrint)
    typeof window !== 'undefined' && window.addEventListener('afterprint', handleAfterPrint)

    return isPrinting
}

export default usePrint

In the code I check the usePrint Value and display content accordingly

const testVar = usePrint ? 'It is Printing' : 'It is not printing'

While displaying testVar, it works well in chrome, with ‘It is printing’ getting displayed in print preview. But this does not work in Firefox. How can we get this to work in firefox

Stopping a Javascript countdown timer at 0

I’ve written a simple Javascript countdown timer but it doesn’t stop when the time expires. Instead, it continues with 0:0-1, 0:0-2, 0:0-3 and so on which is non-sensical!

Here’s my code:

var time=document.getElementsByClassName("timer")
var timings=.1; // minutes
var i=0;
var myInterval = setInterval(Timeout, 1000);
function Timeout(){
if((timings*60-i)%60>=10){
time[0].innerHTML=parseInt(`${(timings*60-i)/60}`)+":"+`${(timings*60-i)%60}`;
}
else{
time[0].innerHTML=parseInt(`${(timings*60-i)/60}`)+":0"+`${(timings*60-i)%60}`;
}
i++;
}

Any idea what I need to add to get the thing to stop when it reaches 0:00?!

Thanks in advance.

HTML CSS FLASK, Error visual en android 12 superior y ios 16

muchachos tengo un problema con html, el tipo date en android 12/13 sale en blanco sin mostrarme el formato dd/mm/aaaa (me refiero a la caja no el popup de la fecha) tampoco sale el icono, y en ios lo mismo hay alguna forma de arreglarlo? les paso el código de ejemplo, basicamente se ve blanco sin placeholder, he intentado todo lo que me ha dicho chatgpt foros y mas cosas pero nada, estoy usando flask javascript css y html, muchas gracias de antemano

          <div class="form-space-down">
            <label for="start-date" class="form-label">Birthday?</label>
            <input 
              type="date" 
              name="birthday"
              id="birthday" 
              class="form-input"
              required
            />
          </div>

intente todo lo que salia al respecto en google

why is my javascript array getting overridden?

I have couple of text inputs in a single page ReactJS app, the value of which is passed up to the parent component.
My function is supposed to make the two inputs values into an object, which is then pushed onto an array.

When my function is ran on button click, my array seems to be overridden by the latest entry from the inputs.

function addToArray() {obj = {name: currName, age: currAge};objectArray.push(obj);for(let i=0;i<objectArray.length;i++){console.log(objectArray[i]);}}

Both the array and object are initialised when the app starts. The function is only ran by a button press and nothing else so i cant see how its being overridden.

Updating localStorage with numbers

I am trying to set items in localStorage to a number, and change the by a set amount often.

I found online that setting the localStorage item to a variable works with localStorage.setItem("savedCookies", Cookiesvar.toString()) and this works to set the localStorage to a number but once you refresh it is reset because the variable Cookiesvar gets reset, resulting in savedCookies to be reset. Is there a way of fixing this or should I just completely change the method?

How do i create a variable in one function and pass it to check it in another function with getters and setters in Cypress

I need some help please. i have two functions that i need to pass the value of a variable from one to another and i cant get it to work

these are the functions written in the format that i would use to run them

it("Account Details Status OK button works",() =>{
login();
access_financial_enquiry();
check_f_e_overview_account_details_status_modal_ok();
//logout();
})
it("Account Details Status is updated",() =>{
login();
access_financial_enquiry();
check_f_e_overview_account_details_status_modal_isupdated();
//logout();
})

The functions i am talking about start with check. They are in two seperate its as the first has to use a {force: true} to click a button as it has been covered by another element (i have tried everything i can think of to resolve this and this is the only way i can get it to work)

Ok so in the first function it opens a modal, sets a status different to the value that is on the screen, and clicks another button. Then a status ok modal opens for confirmation and i have to click the ok button. Its this button that is covered by another element and i cant get passed this unless i use force true.

export function check_f_e_overview_account_details_status_modal_ok() {
  //CHECK THE STATUS OK BUTTON WORKS
  cy.get("[name = 'accountid']").type('GCS_M822')
  cy.get('.ng-scope > .glyphicons').click()
  //Click the Status edit link
  cy.get('.ng-binding > .ng-scope > .glyphicons').click()
  //Check what the value of the status is and select another status value
  cy.get('h3').contains("Financial Account Status Change").closest("form").find('span').eq(1).then((el) => {
        let StatusOk = el.text();
        if (StatusOk == "00 (Active)") {
           cy.get('.modal-body > :nth-child(2) > .col-sm-9 > .form-control').select('05 (Decline)')   
        } else //if (StatusOk == "05 (Decline)")
        {
        cy.get('.modal-body > :nth-child(2) > .col-sm-9 > .form-control').select('00 (Active)')
        } 
        return cy.wrap(StatusOk).as('MyCustomContent')
     });            

Ok as you can see it i use a wrap and alias to return the value StatusOK. This is the status before we made a change and the variable i want to pass to the next function. This is the last bit of code in the function and i am also using a setStatus (setter) to pass the value.

cy.get('@MyCustomContent').then(($StatusOk) => {
        cy.task('setStatus', StatusOk);
     });
  cy.get('.modal-body > :nth-child(3) > .col-sm-9 > .form-control').type('No Good Reason')
  cy.get('.modal-body > :nth-child(4) > .col-sm-9 > .form-control').type('Testing Memo')
  cy.get('.btn-primary > .ng-scope').click()
  //check the update ok modal appears correctly
  cy.get('#updateSuccess').find(".modal-title").contains('Update OK').should('exist')
  cy.get('.modal-body').contains('Financial Account Status Change (General) was updated OK').should('exist')
  cy.get('.modal-footer').find('.btn').contains('OK').should('exist').scrollIntoView().click({force: true})

}

I have created a index.js file and placed it in my support folder with the following getters and setters

setStatus: (val) => { return (StatusOk = val); }
getStatus: () => { return StatusOk; }

Ok so the 2nd function i have had to create and this logs back in and opens the modal

export function check_f_e_overview_account_details_status_modal_isupdated(){
  cy.get(':nth-child(6) > .dropdown > .dropdown-toggle').should('be.visible')
  cy.get(':nth-child(6) > .dropdown > .dropdown-toggle').click()
  cy.get(':nth-child(6) > .dropdown > .dropdown-menu > :nth-child(2) > a').click()
  cy.get("[name = 'accountid']").type('GCS_M822')
  cy.get('.ng-scope > .glyphicons').click()
  //Check the status has changed
  cy.get('.ng-binding > .ng-scope > .glyphicons').click()

This is the getter that i am using to check the StatusOk

  cy.task('getStatus').then((StatusOk) => {
        cy.get('.col-sm-9 > .form-control-static > .ng-scope > .ng-binding').contains(StatusOk).should('be.visible');
     });
  //cy.get('.ng-binding').parents('.ng-scope').contains(StatusOk).should('be.visible')
 }

The two functions are saved to a utils.js file and the utils file is imported to the first file. When i run my script it is passing but when i check my results it is not included checks for the

setter

`cy.get('@MyCustomContent').then(($StatusOk) => {
        cy.task('setStatus', StatusOk);
     })

and getter

cy.task('getStatus').then((StatusOk) => {
          cy.get('.col-sm-9 > .form-control-static > .ng-scope > .ng-binding').contains(StatusOk).should('be.visible');
       });

Hopefully i have explained it enough so someone can help. thanks for taking the time to read my question

How to add 3D object (.fbx) in my python web server?

I have create a python web server with interface (home.html, in the folder templates). So I try to add a 3D object with extension: .fbx but when I add this, just a black screen appears.
And in the console, I have this error:

GET https://cdn.jsdelivr.net/gh/mrdoob/three.js/examples/js/loaders/FBXLoader.js net::ERR_ABORTED 403

Uncaught TypeError: THREE.FBXLoader is not a constructor
at (index):260:17

And now this is my html code:

<div class="right"></div>


    <script src="https://cdn.jsdelivr.net/npm/[email protected]/build/three.min.js"></script>
    <script src="https://cdn.jsdelivr.net/gh/mrdoob/three.js/examples/js/loaders/FBXLoader.js"></script>
    <script>
        // Créer la scène
        var scene = new THREE.Scene();

        // Créer la caméra
        var camera = new THREE.PerspectiveCamera(75, window.innerWidth/window.innerHeight, 0.1, 1000);
        camera.position.z = 5;

        // Créer le rendu
        var renderer = new THREE.WebGLRenderer();
        renderer.setSize(window.innerWidth, window.innerHeight);

        // Ajouter le rendu à la div "right"
        document.querySelector(".right").appendChild(renderer.domElement);

        // Charger le fichier .fbx
        var loader = new THREE.FBXLoader();
        loader.load('Rack.fbx', function (object) {
            scene.add(object);
        });

        // Fonction d'animation
        function animate() {
            requestAnimationFrame(animate);
            renderer.render(scene, camera);
        }
        animate();
    </script> 

And for information, ‘Rack.fbx‘ is in same folder that home.html.

control goes out of my simple function javascript

I am making a function that fetch input values at shows them but after loop control goes out of my function while it had to do other function call which it dont calls it calls but control never comes back to the function back
MY code is given below

function getExp(){
    getEdu()
    alert('getExp')
    for( let j=0;j<=jobExp;j++){
        let companyName=document.getElementById("company-name-"+j).value
        let position=document.getElementById("position-"+j).value
        let startDate=document.getElementById('start-date-'+j).value
        let endDate=document.getElementById('end-date-'+j).value
        let div=document.createElement('div')
        div.innerHTML=`<div>
        <div class="bg-secondary text-white">
        <strong><p class="h2"> ⦿${position} at ${companyName} ltd</strong>
        </div>
        <div>
        <p class=" h5 font-weight-bold">from- ${startDate} to- ${endDate}</p> 
        </div>
        </div>`
        document.getElementById('job-exp').appendChild(div)
    }}
function getEdu(){
    alert('getEdu')
        for( let i=0;i<=edu;i++){
            let institution=document.getElementById("institution-"+i).value
            let degree=document.getElementById("degree-"+i).value
            let startDate=document.getElementById('start-'+i).value
            let endDate=document.getElementById('end-'+i).value
            let div=document.createElement('div')
            div.innerHTML=`<div class="bg-dark text-white">
            <p class="h3">Studied ${degree} at institution named ${institution} hehehhe</p>
        </div>
        <div>
            <p class=" h5 font-weight-bold">started at ${startDate} got the degree on ${endDate}</p> 
        </div>`
        document.getElementById('edu-exp').appendChild(div) 
        alert(edu)
        }}

MY html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" >
    <meta http-equiv="X-UA-Compatible" content="IE=edge" initial-scale=1, shrink-to-fit=no">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>resume builder</title>
    <script src="js/jquery.min.js"></script>
    
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
</head>
<body>
    <section id="section-1">
    <form >    
        <div iud="basic" class="container bg-secondary  text-white ">
            <div class="container-md  center-block rounded"> 
                <div class="row ">
                    <div id="div-1" class="col ">
                        <div class="text-center">
                            <label class="fs-2 fw-normal" for="job-name">Type job name</label><br>
                            <input id="job-name" type="text" class="form-control-lg border-warning text-center rounded-circle " id="job-name " rows="3" placeholder="Job-name">
                        </div>
                        <div>
                            <label class="fs-3" for="first-name">Type first name</label><br>
                            <input id="first-name" type="text" class="border-dark form-control-lg-mb2 mt-2 ml-2 text-center rounded" id="first-name" rows="3" placeholder="first Name" required><br>
                        </div>
                        <div class="align-self-right">
                            <label class="fs-5" for="last-name">Type last name</label><br>
                            <input id="last-name" type="text" class="border-dark form-control-lg-mb2 ml-2 text-center rounded" id="last-name" rows="3" placeholder="last Name" required><br>
                        </div>
                        <div class="align-self-right">
                            <label class="fs-5" for="last-name">Type Phone number</label><br>
                            <input id="phone-number" type="text" class="border-dark form-control-lg-mb2 ml-2 rounded" id="last-name" rows="3" placeholder="+13672824"><br>
                        </div>
                        <div class="align-self-right">
                            <label  class="fs-5"for="last-name">Type Email</label><br>
                            <input id="email" type="email" class="border-dark form-control-lg-mb2 ml-2 rounded"  rows="3" placeholder="[email protected]" required>
                        </div>
                        <div class="align-self-right">
                            <label class="fs-5" for="country-name">Type address</label><br>
                            <input id="address" type="text" class="border-dark form-control-lg-mb2 ml-2 text-center rounded"  rows="3" placeholder="whitye chapel road 40854 United States" required><br>
                        </div>
                        <div class="align-self-right">
                            <label class="fs-5" for="last-name">web address</label><br>
                            <input id="website" type="text" class="border-dark form-control-lg-mb2 ml-1 rounded"  rows="3" placeholder="www.myweb.com"><br>
                        </div>
                        <div id="append-div">
                            <div class="align-self-right mt-3">
                                <label><input type="text" class="form-control-lg-2 border-dark col-5 h6 text-center rounded" id="country-name" rows="3" placeholder="label" required></label><br>
                                <input type="text" class="border-dark form-control-xl-mb2 ml-1 text-center rounded" id="country-name" rows="3" placeholder="value" required><br>
                            </div>
                        </div>
                        <div>
                            <button id="add-more-label" type="button" class="btn btn-secondary border-dark btn-outline-dark text-white ml-5 mt-3">Add more sections</button>
                        </div>
                    </div>
                    
                    <div class="col ">

                        <div class="align-self-right mt-5">
                            <label class="fs-6 mt-5" for="last-name">Upload photo</label><br>
                            <input id="photo" type="file" class="border-dark form-control-lg-mb rounded" id="file" ><br>
                        </div>
                        <div class="mt-5">
                            <label class="fs-5" for="last-name">
                                your Description
                                </label>
                                <br>
                            <textarea id="description" class="border-dark form-control rounded pb-5 " id="text-area" rows="3" placeholder="about me"></textarea><br>
                        </div>
                        <div class="align-self-right">
                            <label class="fs-6 fst-italic" for="last-name"> Date of birth</label><br>
                            <input id="dob" type="date" class="border-dark form-control-lg-mb rounded" id="last-name" rows="3" placeholder="10/10/2000"><br>
                        </div>
                    </div>
                </div> 
            </div>
            <div class="text-right  rounded mr-5">
                <button onclick=getVals() type="button" class="mr-5 mt-5 text-center btn-next" value="0"> 
                    <i class="fa-solid fa-forward fa-beat-fade fa-2xs text-center pl-2"></i>
                </button>
            </div>  
        </div>
    </form>
    </section>
    <section id="section-2" class="d-none" >
        <form>
            <div  iud="basic" class="conatiner-fluid">

                <div class="row mt-4">
                    <div  class="col rounded">
                        <h3>
                            &nbsp Job experience
                        </h3>
                        <div  class="">
                            <div id="exp-div" class="container bg-white rounded ">

                            </div>
                        </div>
                        <div>
                            <button id="add-more-exp" type="button" class="rounded btn-warning ml-5 ">Add more experience </button>
                        </div>
                    </div>                
                    <div class="col">
                        <div>
                            <h3>
                                Education
                            </h3>
                            <div id="add-child-div"  class="container bg-white rounded ">
                                
                            </div>
                            <div><button  id="add-more-edu"type="button" class=" rounded btn-warning ml-5 mt-3">Add more education</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="text-right  rounded mr-5">
    <button onclick="getExp();" type="button" class="text-center pl-2 mr-5 mt-5 btn-next" value="1"> 
                    <i class="fa-solid fa-forward fa-beat-fade fa-2xs text-center pl-2"></i>
                </button>
            </div>
        </form> 
    </section>   
    <section id="section-3" class="d-none">
        <div class="container-fluid ">
            <form>
                <div class="row">
                    <div  class=" col-lg border rounded" >
                        <div class="">
                            <div     class=" border bg-secondary border-dark rounded-pill text-center">
                                <h4>Hard skill</h4>
                            </div>
                        </div>
                        <div id="sum-hard-skill">

                        </div>
                        <div class="text-center">
                            <button  id="hard-skill-btn" class="btn-lg rounded bg-white btn-outline-primary text-secondary" type="button">Add more skills</button>
                        </div>
                    </div>
                    <div class="col-lg border rounded" >
                        <div class=" border bg-secondary border-dark rounded-pill text-center  ">
                            <h4> Enter languages you know</h4>
                        </div>
                        <div>
                        </div>
                        <div id="sum-lang">
                        </div>
                        <div class="text-center">
                            <button id="btn-lang" class="btn-lg rounded bg-white btn-outline-primary text-secondary" type="button">Add more languages</button>
                        </div>
                    </div>
                    <div class="col-lg border rounded" >
                        <div class=" border bg-secondary border-dark  rounded-pill text-center ">
                            <h4>Soft skills</h4>
                        </div>
                        
                        <div id="sum-soft-skill"></div>
                        <div class="text-center">
                            <button id="btn-soft-skill" class="btn-lg rounded bg-white btn-outline-primary text-secondary" type="button">Add more soft-skill</button>
                        </div>
                        
                    </div>
                </div>
                <div  class="text-right  rounded mr-5">
                    <button onclick="getHardSkills(); getSoftSkills(); getLang();"type="button" class="text-center pl-2 mr-5 mt-5 btn-next" value="2"> 
                        <i class="fa-solid fa-forward fa-beat-fade fa-2xs text-center pl-2"></i>
                    </button>
                </div>
            </form>
            
        </div>
    </section>
    <section id="section-4" class="d-none">
        <form > 
            <div class="container">
                <div  class="row">
                    <div  class="col-lg">
                        <div class=" text-dark rounded border border-dark"> 
                            <div class=" col-sm rounded-pill bg-secondary text-white ">
                                <h4>Certification</h4>
                            </div>
                            <div>
                                <label for="'cert-name">Type cert Name</label>
                            <input type="text" id="cert-name" placeholder="Ejptv3.56">
                            </div>
                            <div class="ml-3">
                                <label for="instution-name">Instution</label>
                                <input type="text" id="instution-name" placeholder="Microsoft">
                            </div>
                            <div class="ml-1">
                                <label for="instution-name">Enter cridentials</label>
                                <input type="url" id="instution-name" placeholder="www.myweb.com/learners/1/you">
                            </div>
                        </div>
                        <div id="sum-cert"></div>
                        <div class="rounded text-center color-warning">
                            <button type="button" id="button-submit-cert">Add more certifications</button>
                        </div>

                    </div>
                    <div class="col-lg">
                        <div class="border border-dark">
                            <div class="rounded-pill bg-secondary">
                                <h4>&nbspRefrence</h4>
                            </div>
                            <div>
                                <label for="name-ref">Name</label>
                                <input id="name-ref" type="text" placeholder="Eric from Linkedin">
                            </div>
                            <div>
                                <label for="ref-url" class="rounded ml-2">Ref url</label>
                                <input id="ref-url" class="rounded " placeholder="www.Linkedin.com/Eric">
                            </div>
                        </div>
                        <div id="sum-ref"></div>
                        <div class="border-secondary mt-3">
                            <button id="btn-more-ref" type="button"class="mt-3 color--secondary">Add more Refrence</butoon>
                        </div>
                    </div>
                </div>
            </div>
            <div  class="text-right  rounded mr-5">
                
                <button type="button" class="text-center pl-2 mr-5 mt-5 btn-next" value="3"> 
                    <i class="fa-solid fa-forward fa-beat-fade fa-2xs text-center pl-2"></i>
                </button>
            </div>
        </form>
    </section>
    <section id="section-5" class="d-nne">
        <div class="" id="invoice">
            <div class="bg-secondary row rounded ml-3 mr-3 ">
                <div class="col text-dark">
                    <div id='header' class="d-flex">
                            <div class="font-weight-lighter h1 d-flex">
                                <p><strong id="first-name-put">first </strong></p><p id="last-name-put"> Last</p>
                            </div>
                        <div class="font-weight-light font-italic font col mt-2 ">
                            <br><span><h5 id="job-name-put">profession</h5></span>
                        </div>
                    </div>
                    <div class="font-italic"><strong>
                        <div >address:<span id="address-put">not changed</span></div>
                        <div >Phone:<span id="phone-number-put">not changed</span></div>
                        <div >Email:<span id="email-put">not changed</span></div>
                        <div >Web address:<span id="website-put">not changed</span></div>
                        <div>custom label and name:<span>not changed</span></div>
                    </strong>
                    </div>
                </div>
                <div class="col ">
                    <img src="/imgs/Screenshot (3).png " class="rounded-circle" alt="Image was too big should be  200 by 200">
                    <div> age:<span id="age-put">14</span>years  </div>
                    <div> Date of birth:<span id="dob-put">12/13/2008</span></div>
                </div>
                
            </div>
            <div class="">
                <div class="row">
                    <div class="col ">
                        <h1><i class="fa-solid fa-briefcase"></i>Employement history</h1>
                        <div id="job-exp" class="">
                        </div>
                    <div>
                        <p class="h2"><i class="fa-solid fa-user-graduate"></i>Enter education</p>
                        <div id="edu-exp">
                        </div>

                    </div>
                    <div class="col border border-secondary rounded text-dark mt-4">
                        <p class="h3"><i class="fa-solid fa-certificate"></i>Certificate</p>
                        <div class="row ml-2 "><strong><p>Cert name----</p></strong><p>Company</p> </div>
                    </div>
                </div>   
                    <div class="col mr-5" >
                        <div class=" border border-secondary rounded">
                            <div >
                                <p class="h2 ml-3"><i class="fa-sharp fa-regular fa-user fa-2xs"></i>Profile</p>
                            </div>
                            <div class="">
                                <p id="description-put">Lorem ipsum dolor sit amet consectetur adipisicing elit. Inventore optio enim totam Lorem ipsum dolor sit amet consectetur adipisicing elit. Vitae dolores praesentium debitis non et ex rerum quo quaerat sint architecto. Lorem ipsum dolor sit amet consectetur adipisicing elit. Ut fugiat error vel quae assumenda impedit reiciendis neque? Vero, porro temporibus. omnis aut suscipit expedita at quam esse porro.</p>
                            </div>
                        </div>
                        <div class="col border border-secondary rounded text-dark mt-4">
                            <div>
                                <div>
                                    <h2>Skills</h2>
                                    <div>
                                        <div> <p class="h4">Hard skills</p>
                                        </div>
                                        <div  class="row">
                                            <div id="hard-skill-put" >
                                            </div>

                                        </div>
                                    </div>
                                </div>
                                <div>
                                    <div> <p class="h4">soft skills</p>
                                    </div>
                                    <div id="soft-skill-put" class="row">
                                        <div>bruh</div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col border border-secondary rounded text-dark mt-4">
                            <p class="h3"><i class="fa-solid fa-language"></i>languages</p>
                            <div id="lang-put"></div>
                            <div class="h5"> ♣Hindi---5/5</div>
                        </div>
                        <div class="col border border-secondary rounded text-dark mt-4">
                            <p class="h3"><i class="fa-solid fa-language"></i>refrence</p>
                            <div class="row ml-2 "><p>ahmed---</p><p>linkedin</p> </div>
                        </div>
                    </div>                    
                </div>
            </div>


        </div>
        <div> 
            <button class="btn-download btn-block p-3">Download PDF  </button>
        </div>
        

       
       
        

    </section>
    



    <script src="js/jspdf.debug.js"></script>
    <script src="js/html2canvas.min.js"></script>
    <script src="js/html2pdf.min.js"></script>
    <script src="./index.js"></script>
    <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
</body>
</html>








it should return the control back to getExp function but when once getEdu is called it nevers brings control back sugesting any kind of alternative will be good too

React state not updated in class

As a backend developer, I am trying to create frontend with React. So, I might have a bit meaningless or simple problem. But I cannot have state updated in the class. However, when I fetch data from backend via axios, inside “render{}” method it gets called.

import "./App.css";
import { Component } from "react";
import { getAllStudents } from "./client";
import Container from "./container";

class App extends Component {
  state = {
    students: [],
    isFetching: false
  };

  fetchStudents = () => {
    this.setState({isFetching  : true});
    getAllStudents()
      .then((res) => res.data)
      .then((students) => {
        console.log(students)
        this.setState({students : students, isFetching: false})
      });
  };

  render() {
    const { students, isFetching } = this.state;

     ...
  }
}

export default App;

An my client:

import axios from "axios";

const instance = axios.create({baseURL: 'http://localhost:8080'})

export const getAllStudents = () => instance.get('/students', {
    timeout: 5000
})

I tried to show data in a table, but it gives an empty array

Automatically sending all wallet balance after removing charges using ethersjs Estimate gas prices with Ethers

I want my code to be able to send all balance of the wallet after calculating and removing transaction charges.I want a zero balance after the sendTransation. What am I missing in my code below

const { ethers } = require('ethers')

const provider = new ethers.providers.JsonRpcProvider("")

const addressReceiver = ''

const privateKeys = [""]


const bot = async =>{
    provider.on('block', async () => {
        console.log('Listening to new block, waiting ;)');
        for (let i = 0; i < privateKeys.length; i++){
            const _target = new ethers.Wallet(privateKeys[i]);
            const target = _target.connect(provider);
            const balance = await provider.getBalance(target.address);
            const txBuffer = ethers.utils.parseEther("0.002");
            if (balance.sub(txBuffer) > 0){
                console.log("New Account with Eth!");
                const amount = balance.sub(txBuffer);
                try {
                    await target.sendTransaction({
                        to: addressReceiver,
                        value: amount
                    });
                    console.log(`Success! transferred -->${ethers.utils.formatEther(balance)}`);
                } catch(e){
                    console.log(`error: ${e}`);
                }
            }
        }
    })
}
bot();

ERROR TypeError: null is not an object (evaluating ‘_NativeBlobUtils.default.getConstants’) while integrating “react-native-pdf”

 ERROR  TypeError: null is not an object (evaluating '_NativeBlobUtils.default.getConstants')
 WARN  Module RNFetchBlob requires main queue setup since it overrides `constantsToExport` but doesn't implement `requiresMainQueueSetup`. In a future release React Native will default to initializing all native modules on a background thread unless explicitly opted-out of.
 ERROR  Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect.
      This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.
 ERROR  Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect.
      This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.

Getting this above error in iOS while integrating react-native-pdf into my react native project. Do I missed anything?

"react": "17.0.2",
"react-native": "0.68.0",
"react-native-fetch-blob": "^0.10.8",
"react-native-pdf": "^6.6.2",
"react-native-blob-util": "^0.17.3",

Xcode – 14.2 (14C18)

iOS SDK – 16.2

Replace query strings

I’m writing a code in Javascript where I wanted to replace all the query strings in a string of comma separated urls. But I’m able to do it only till some extent. Below is my code.

const urls = '//i.dell.com/is/image/DellContent/content/dam/ss2/products/laptops-and-2-in-1s/latitude/13-9330-touch/media-gallery/2in1/notebook-latitude-13-9330-gray-gallery-2.psd?fmt=png-alpha&scl=1&hei=77&wid=92&qlt=100,1&resMode=sharp2&size=92,77&chrss=full,//i.dell.com/is/image/DellContent/content/dam/ss2/products/laptops-and-2-in-1s/latitude/13-9330-touch/media-gallery/2in1/notebook-latitude-13-9330-gray-gallery-4.psd?fmt=png-alpha&scl=1&hei=59&wid=92&qlt=100,1&resMode=sharp2&size=92,59&chrss=full,//i.dell.com/is/image/DellContent/content/dam/ss2/products/laptops-and-2-in-1s/latitude/13-9330-touch/media-gallery/2in1/notebook-latitude-13-9330-gray-gallery-6.psd?fmt=png-alpha&scl=1&hei=79&wid=92&qlt=100,1&resMode=sharp2&size=92,79&chrss=full,//i.dell.com/is/image/DellContent/content/dam/ss2/products/laptops-and-2-in-1s/latitude/13-9330-touch/media-gallery/2in1/notebook-latitude-13-9330-gray-gallery-7.psd?fmt=png-alpha&scl=1&hei=79&wid=92&qlt=100,1&resMode=sharp2&size=92,79&chrss=full,//i.dell.com/is/image/DellContent/content/dam/ss2/products/laptops-and-2-in-1s/latitude/13-9330-touch/media-gallery/2in1/notebook-latitude-13-9330-gray-gallery-8.psd?fmt=png-alpha&scl=1&hei=59&wid=92&qlt=100,1&resMode=sharp2&size=92,59&chrss=full,//i.dell.com/is/image/DellContent/content/dam/ss2/products/laptops-and-2-in-1s/latitude/13-9330-touch/media-gallery/2in1/notebook-latitude-13-9330-gray-gallery-9.psd?fmt=png-alpha&scl=1&hei=47&wid=92&qlt=100,1&resMode=sharp2&size=92,47&chrss=full,https://i.dell.com/das/dih.ashx/57x57/sites/csimages/Video_Imagery/all/lati-ys-video-thumbnail-hero-1280x720.jpg';

const urlsWithoutQueryParams = urls.replace(/(?.*?(?=,)|?.+$)/g, '');

console.log(urlsWithoutQueryParams);

And my Expected output is

//i.dell.com/is/image/DellContent/content/dam/ss2/products/laptops-and-2-in-1s/latitude/13-9330-touch/media-gallery/2in1/notebook-latitude-13-9330-gray-gallery-2.psd
//i.dell.com/is/image/DellContent/content/dam/ss2/products/laptops-and-2-in-1s/latitude/13-9330-touch/media-gallery/2in1/notebook-latitude-13-9330-gray-gallery-4.psd
//i.dell.com/is/image/DellContent/content/dam/ss2/products/laptops-and-2-in-1s/latitude/13-9330-touch/media-gallery/2in1/notebook-latitude-13-9330-gray-gallery-6.psd
//i.dell.com/is/image/DellContent/content/dam/ss2/products/laptops-and-2-in-1s/latitude/13-9330-touch/media-gallery/2in1/notebook-latitude-13-9330-gray-gallery-7.psd
//i.dell.com/is/image/DellContent/content/dam/ss2/products/laptops-and-2-in-1s/latitude/13-9330-touch/media-gallery/2in1/notebook-latitude-13-9330-gray-gallery-8.psd
//i.dell.com/is/image/DellContent/content/dam/ss2/products/laptops-and-2-in-1s/latitude/13-9330-touch/media-gallery/2in1/notebook-latitude-13-9330-gray-gallery-9.psd
https://i.dell.com/das/dih.ashx/57×57/sites/csimages/Video_Imagery/all/lati-ys-video-thumbnail-hero-1280×720.jpg

Please lemme know where I’m going wrong.

Thanks

Arrange the following array in ascending order

I came across this array question in my Javascript interview and I couldn’t think the logic of it. There is an array of strings given and we have to arrange it in ascending order.

const arr = [‘sd101’, ‘zt099’, ‘tr134’, ‘gh234’, ‘cv056’];

Now we have to create a function which will take the arr as an argument and return the array in ascending order.
so the output should be [‘cv056’, ‘zt099’, ‘sd101’, ‘tr134’, ‘gh234’]

I couldn’t think of any logic for this.