How to update Firebase storage data from frontend in react js

I am fetching data from the firebase storage and storing that data in redux and also displaying the table on frontend and there is a button on every td when user click on update button than an modal is open and on that modal there is a Edit button, when user click on edit button than he will edit the content or data and there is also an button of update in bottom of the modal when user click on the update button than data updated in firebase and also show updated data in table.

***This is what i want to do.***

Failed open serial port after getPorts() WebSerial

I’m using WebSerial and I have a problem after the first authorization.

This is code for the first time (with popup user authorization):

port = await navigator.serial.requestPort();            
await port.open({ baudRate: 9600 });

all works correctly.

But next time, I using this code:

await navigator.serial.getPorts().then((ports) => {
    if(ports.length>0){
        port = ports[0]; 
        port.open({ baudRate: 9600 });              
    }
}); 

And return this error: “Uncaught (in promise) DOMException: Failed to execute ‘open’ on ‘SerialPort’: Failed to open serial port.”

Why?

What Are the Steps for Deploying a Node.js Application with a MySQL Database on Popular Hosting Platforms? [closed]

I have developed a fully functional website on my local machine using HTML, CSS, SCSS, JavaScript, Node.js, and MySQL as the database. Now I want to deploy this website online so that it is available 24/7.

What hosting platform should I choose for deploying an application that uses Node.js and MySQL? Also, what steps do I need to follow to properly deploy and configure this application on the selected platform?

Technical Requirements:

Frontend: HTML, CSS, SCSS, JavaScript
Backend: Node.js
Database: MySQL
Need: Deployment of a web application with continuous online availability
Explanation: I am looking for a platform that provides reliable hosting for Node.js applications and supports MySQL. I would also like to know about the necessary steps for deployment, including configuration and connecting to the database.

how to add an svg image to the middle of a html/css website, but have it also mask a gallery of images

I want to add a gallery to my website but unsure of where to start. The idea is that there is an ipod in the middle and if you click on the left and right ‘buttons’ it will act as the arrows in the gallery to change the pictures. the ipod therefore acts as a mask for the pictures, but it in itself is static in the middle of the screen. How would I go about doing this? for a project I am working on. Not allowed to use any libraries, has to be pure html/css and javascript only if absolutely necessary.

I have an SVG file of the ipod that I have created on figma and exported, so it just acts as an image I think.

I tried adding the SVG in as an image after all the background things in the HTML file, but it didn’t seem to do anything. Ideally this will be added in and then the user will be able to click on the two buttons for right and left to go between pictures. essentially acting as a window. I am fairly new at coding so I am unsure of where to start/how to approach it correctly

I tried adding this to the html but it did not do anything , I am confident the svg itself is fine. it is a super basic website, there isnt any content on this page other than the background and header.

 <div id="home">
        <svg height="100" width="200" >
          <a href="/graphics/ipod.svg" >
          </a>
        </svg>
  </div>

*/ this is the CSS code for the home id
#home {
    width:100%;
    margin: 0 auto;
    font-family: Kimberlie;
}

Thanks in advance

Extract all matching font-family attributes from string [duplicate]

I’m trying to extract values of all attributes in an HTML snippet that match font-family:"" pattern

Example input:

`<body lang=EN-ZA style='tab-interval:36.0pt;word-wrap:break-word'>
<!--StartFragment--><span style='font-size:14.0pt;line-height:107%;
font-family:"Comic Sans MS";:"Times New Roman";
:"Times New Roman";mso-font-kerning:0pt;mso-ligatures:none;
mso-ansi-language:EN-ZA;mso-fareast-language:EN-ZA;mso-bidi-language:AR-SA'>
Test Font 1
 </span><span
style='font-size:14.0pt;line-height:107%;font-family:"Boucherie Block";
:"Times New Roman";:"Times New Roman";
mso-font-kerning:0pt;mso-ligatures:none;mso-ansi-language:EN-ZA;mso-fareast-language:
EN-ZA;mso-bidi-language:AR-SA'>Test Font 2 </span><!--EndFragment-->
</body>`

Required output:

Comic Sans MS

Boucherie Block

I’ve tried using the following regex:

var tmpStr = targetText.match('font-family:"(.*)";');

enter image description here

But this includes the font after the semicolon (Times New Roman) which I’m not interested in and it doesn’t contain the other font family, which is supposed to be Boucherie Block.
Any tips would be appreciated,if there’s another way to get the required output without using regex I’m open to that,the main thing is to get both fonts out of the string

How to enable Drag and Drop in Vue/JS/HTML with an inventory system?

I want to recreate a inventory system like the one in minecraft as it is helping understand a lot of web dev stuff and just overall becoming a better developer, my code is not working and updating my elements in the grid as it should.

GridBlock.vue

<script setup lang="ts">
import { ref, type Ref } from 'vue'

//const props = defineProps(['item'])

const selected: Ref<HTMLElement | null> = ref(null)

const randomColor = () => {
  //#1f3f5f
  return `#${Math.floor(Math.random() * 10)}f${Math.floor(Math.random() * 10)}f${Math.floor(Math.random() * 10)}f`
}

const handleClick = (e: Event) => {
  let target = e.target as HTMLElement
  target.style.backgroundColor = randomColor()
}

const handleDragStart = (e: DragEvent) => {
  let target = e.target as HTMLElement
  selected.value = target
}

const handleDragOver = (e: DragEvent) => {
  e.preventDefault()
}

const handleDrop = (e: DragEvent) => {
  e.preventDefault()

  let target = e.currentTarget as HTMLElement

  if (selected.value && selected.value !== target) {
    const temp = target.innerHTML
    target.innerHTML = selected.value.innerHTML
    selected.value.innerHTML = temp
    selected.value = null
  }
}
</script>

<template>
  <div
    class="grid-block"
    draggable="true"
    @click="handleClick"
    @dragstart="handleDragStart"
    @dragover="handleDragOver"
    @drop="handleDrop"
  >
    <div class="item-block">
      {{ Math.floor(Math.random() * 100) }}
    </div>
  </div>
</template>

<style>
.grid-block {
  width: 4rem;
  height: 4rem;
  margin-left: auto;
  margin-right: auto;
  margin-top: 2rem;
  border: 2px solid red;
  background-color: beige;
}
.item-block {
  width: 100%;
  height: 100%;
  background-color: black;
}
</style>

GridDisplay.vue

<script setup lang="ts">
import GridBlock from './GridBlock.vue'

function range(start: number, end: number): number[] {
  return Array.from({ length: end - start + 1 }, (_, i) => start + i)
}

const blocks = range(1, 16)
</script>

<template>
  <div class="grid-container">
    <GridBlock v-for="i in blocks" :key="i" :id="i"></GridBlock>
  </div>
</template>

<style>
.grid-container {
  display: grid;
  grid-template-columns: repeat(4, 7.4rem);
  grid-template-rows: repeat(4, 7.4rem);
  border: 1px solid red;
  width: 25%;
  margin-left: auto;
  margin-right: auto;
  background-color: cadetblue;
}
</style>

I tried asking ChatGPT if there are any flaws in my logic and I followed a tutorial on Youtube on the drag and drop feature in vanilla JS then tried implementing it inside VUE, I was expecting that when I drag a grid block on top of another grid block, the target grid block will get all the data and styling inside the selected grid block, but instead nothing happens, and I see no details or errors in my debugging tools that I can use to fix this. I am still a noobie to all this, so help will be apreeciated.

Javascript returns NaN only on IOS [closed]

function Price({ formValues, room, bookingDays }) {
  return (
    <div className={styles.priceWrapper}>
      <p>{Number(bookingDays)}</p>
      Price for {formValues.guests} {formValues.guests > 1 ? "guests" : "guest"}{" "}
      {formValues.children != 0 ? `and ${formValues.children} children` : ""}{" "}
      {bookingDays === 1 ? "for 1 day" : `for ${bookingDays} days`}
      <b className={styles.price}>
        {(
          room.price * formValues.guests +
          (room.price / 2) * formValues.children
        ) * bookingDays}
        $
      </b>
    </div>
  );
}

I have this React component that displays NaN for days and total price only on IOS

function Price({ formValues, room, bookingDays }) {
  return (
    <div className={styles.priceWrapper}>
   <p>{bookingDays}</p>
    </div>
  );
}

This shows NaN

function Price({ formValues, room, bookingDays }) {
  return (
    <div className={styles.priceWrapper}>
   <p>{typeof bookingDays}</p>
    </div>
  );
}

This shows numbers

I made sure that all are of number type and it shows the correct value on desktop and android but on IOS safari or chrome it shows NaN

An element exist in web but it turns out to be null when I scrape it. How could I solve it?

I am scraping a dynamic web which applied JS and react function on it (a blockchain explorer). I attempted to build a program which supposed to be able to scrape with JS running. However, it return me with result null for the element I am looking for. When I double check the element in source code via Chrome, the element exist with value. Why does that happened? What could I do to solve the issue?
(By the way, I tried to find the element by class name, css selector, and Xpath as well, but still, not working)

for your information, class name=tag-item address-tag info-tag tag-item-fit-content
css selector=.tag-item;
Xpath=/html/body/div[1]/div[1]/div[2]/main/div[1]/div/div[1]/div[1]/div[1]/div[2]/div[1]/div

I am looking for the address label. As you may have see there, the element exist text content USDT Token. enter image description here. API is not working for labels obtaining for some kind of address in this website, that why I am using this method.

When I scrape it, it returns me null.

const puppeteer = require('puppeteer'); 
const fs = require('fs').promises; 
 



(async () => { 
    const browser = await puppeteer.launch(); 
    const page = await browser.newPage(); 
    await page.goto('https://tronscan.org/#/address/TAzsQ9Gx8eqFNFSKbeXrbi45CuVPHzA8wr',{
        waitUntil: 'networkidle0', 
    }); 
    const cookies = await page.cookies()
    console.log(cookies);
    const f = await page.$$('.tag-item')
    const text = await (await f.getProperty('textContent')).jsonValue()
    console.log("label is: " + text)
    const html = await page.content(); 
    await fs.writeFile('reactstorefront.html', html); 
    await browser.close(); 
})();

Return:
[]
const text = await (await f.getProperty(‘textContent’)).jsonValue()
^

TypeError: f.getProperty is not a function

Node.js v20.15.0

After checking, the reason of this error may probably because the element is null.

I have no idea why the value is null. I wonder if the reason be the cookie or react but the code above suppose to solve both of the problem already. I could not check where is the problem now since it turns to error now and would not output an updated reactstorefront.html

how to validate Form and Go to Next Page with vue Router

a form after validate must go to next author page with vue-Router using this code but not validate

  <form @submit.prevent="validate">

            <div class="row">
              

                <div class="col-md-4 mb-3">
                    <label>Name</label>
                    <input type="search" class="form-control" placeholder="" v-model.lazy.trim="form.nameTitle">
                    <div class=" text-danger">
                        {{ form.titleNameErrorText }}
                    </div>
                </div>
               

            <div class="row mt-4">
                <div class="col-6 ">
                    <button class="btn btn-primary btn-style" type="submit" @click.stop.prevent="submit()">Submit
                        </button>
                </div>

            </div>
        </form>

js code and vue router handle next page after validation////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

<script>
import { reactive } from "vue";
import { useRoute, useRouter } from 'vue-router'
export default {
    setup() {
        const router = useRouter();
        const form = reactive({
            nameTitle: "", 
            titleNameErrorText: "",
            name: "FormAddress",

        });

        function validate() {

            if (form.nameTitle.length < 3) {
                form.titleNameErrorText = "Number is 3 More..   "
            }
            else {
                form.titleNameErrorText = ""
            }
        }

        function submit() {
        
            router.push('/MapView')
            
        }
        return { form, validate,submit }
    },

}

</script>

submit go to map page and no validate this current page im handle validate page and success form element next page else stay this page////////////////////////////////////////////////////////

Align image with text values [closed]

I am trying to create some component where image is aligned left to all text fields. The code is as follows

function MyCard(props) {
    const imgStyle = {
        float: "left",    
        margin: "0 15px 0 0"
    };   
     return (
        <>
            <p></p> 
            <div>
                <img src={props.imgpath}/>
                <h3>{props.name1}</h3>
                {props.name2}
                {props.name3}
            </div>
            <p></p>
        </>
    );
}

It can be list of such components displayed in the column. What’s wrong/missing in the definition?

Turborepo: can’t import css defined in packages/ui

I’ve defined a CSS export in the packages.json of packages/ui:

{
  "name": "@repo/ui",
  "version": "0.0.0",
  "private": true,
  "exports": {
    "./constants": "./src/constants/index.ts",
    "./types": "./src/types.ts",
    "./css/*": "./src/css/*.css"
  }
}

When I try to import it in my global layout.tsx:

import './globals.css';
// import '../../../packages/ui/src/css/themes.css'; This works!
import '@repo/ui/css/themes.css';

But I get this error:

Module not found: Can't resolve '@repo/ui/css/themes.css'

What could be the issue?

Also posted here.

How to use GLArea with node-gtk?

I keep trying a few codes but it’s not working at all.

I have been trying this:

const gi = require('node-gtk');
const Gtk = gi.require('Gtk', '3.0');

Gtk.init();

const win = new Gtk.Window({
  type: Gtk.WindowType.TOPLEVEL,
  title: 'Gtk.GLArea Example',
});
win.setDefaultSize(800, 600);
win.on('destroy', () => Gtk.mainQuit());

const glArea = new Gtk.GLArea();

glArea.on('realize', () => {
  glArea.makeCurrent();

  console.log('done');
});

glArea.on('render', () => {
  const gl = glArea.getContext();

  gl.clearColor(0.0, 0.0, 0.0, 1.0);
  gl.clear(gl.COLOR_BUFFER_BIT);

  return true;
});

win.add(glArea);
win.showAll();

Gtk.main();

the gl seems to be an instance of GdkWaylandGLContext but it keeps saying TypeError: gl.clearColor is not a function. How am i supposed to actually use GLArea inside of node-gtk and is it even possible?

Error: Couldn’t find a matching chrome browser for tag “123.0.6309.0” on platform “win64”

Error: Error: Couldn’t find a matching chrome browser for tag “123.0.6309.0” on platform “win64”
at setupPuppeteerBrowser (file:///C:/Users/MaheshwariRayavarapu/AppData/Roaming/npm/node_modules/@wdio/cli/node_modules/@wdio/utils/build/node/utils.js:193:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Promise.all (index 0)
at async Promise.all (index 1)
at async Launcher.run (file:///C:/Users/MaheshwariRayavarapu/AppData/Roaming/npm/node_modules/@wdio/cli/build/launcher.js:102:13)

I tried to run the scripts but I am facing above error message and I am expecting the solution to resolve that issue