an error in my vue app : “Cannot access “node:events.EventEmitter” in client code..”?

i was working on the frontend of my project with vue3, all good, untill i wrote a callback function that fetches a certain data from the backend then i passed that data in props from a component to another, when i finished the process, and run the app i got these 2 errors in the console for the 1st time:
Error 1:”
Module “node:events” has been externalized for browser compatibility. Cannot access “node:events.EventEmitter” in client code. See http://vitejs.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
get @ formidable.js?v=c5fd3eb1:39
(anonymous) @ formidable.js?v=c5fd3eb1:328
Show 2 more frames
Show less

Error 2:”
Uncaught TypeError: Class extends value undefined is not a constructor or null
at formidable.js?v=c5fd3eb1:328:55
(anonymous) @ formidable.js?v=c5fd3eb1:328
Show 1 more frame
Show less

i undone all the changes i committed, but even so i still get the same error. if possible can someone pls explain the error and a possible solution.(BTW im working with the composition API in my vue app, i mentioned the stack in tags)
APPRECIATED.

how to properly display dynamic flexible grid in grid style [duplicate]

I have a case of a grid containing grids for a classic dashboard: dynamic number of groups where every group can contain dynamic number of elements

now i style it with grid but if on same row one group has many elements and one only few they keep same width and so row height increase too much

moreover is few groups remains in last row they does not span to entire row to better manage space

i found masonry library but only manage one level and my group element does not have fixed size

is there a way to manage it? i prefer to avoid js but can try it if there are no other solutions

.container{
  display:grid;
  gap:2rem;
  grid-template-columns: repeat(auto-fit,minmax(20rem,1fr));
}

.group{
  display: grid;
  grid-template-columns: repeat(auto-fit,20rem);
  justify-content: space-evenly;
  gap:1rem;
  background-color:gray;
  padding:.6rem;
}

.box{
  width:10rem;
  height:3rem;
  background-color:green;
  text-align: center;
  padding:.6rem;
}
<div class="container">
  <div class="group">
    <div class="box">a1</div>
    <div class="box">a2</div>
  </div>
  <div class="group">
    <div class="box">b1</div>
    <div class="box">b2</div>
    <div class="box">b3</div>
    <div class="box">b4</div>
  </div>
  <div class="group">
    <div class="box">c1</div>
    <div class="box">c2</div>
  </div>
  <div class="group">
    <div class="box">d1</div>
    <div class="box">d2</div>
    <div class="box">d3</div>
    <div class="box">d4</div>
    <div class="box">d5</div>
    <div class="box">d6</div>
    <div class="box">d7</div>
    <div class="box">d8</div>
  </div>
  <div class="group">
   <div class="box">e1</div>
   <div class="box">e2</div>
  </div>
</div>

React Native: Issue with Animated API – Animation Not Triggering on State Change

I’m currently facing an issue with the React Native Animated API. I’m trying to trigger an animation based on a state change, but it doesn’t seem to be working as expected. Here’s a simplified version of my code:

import React, { useState, useEffect } from 'react';
import { View, Text, StyleSheet, Animated, TouchableOpacity } from 'react-native';

export default function MyComponent() {
  const [animation] = useState(new Animated.Value(0));

  const handlePress = () => {
    Animated.timing(animation, {
      toValue: 1,
      duration: 500,
      useNativeDriver: false,
    }).start();
  };

  useEffect(() => {
    // Log to check if state change triggers animation
    console.log('State changed!');
  }, [animation]);

  return (
    <View>
      <Animated.View style={[styles.box, { opacity: animation }]}>
        <Text>Animated Box</Text>
      </Animated.View>
      <TouchableOpacity onPress={handlePress}>
        <Text>Trigger Animation</Text>
      </TouchableOpacity>
    </View>
  );
}

const styles = StyleSheet.create({
  box: {
    width: 100,
    height: 100,
    backgroundColor: 'lightblue',
  },
});

Despite logging the state change correctly, the animation doesn’t seem to be triggered. I’ve ensured that the useNativeDriver is set to false and tried different approaches, but none have worked.

Can someone please provide guidance on how to troubleshoot and resolve this issue with the Animated API not triggering on a state change? Any insights or suggestions would be appreciated. Thank you!

Laravel WebCam doesn’t work on local server

I have created a function that opens the webcam when a button is pressed on, everything works fine when I do php artisan serve but upon trying to run the same application on my local IP address that same button doesn’t work anymore and throws an error. So for example by doing php artisan serve --host=192.168.10.10 I get the following error :

Uncaught TypeError: Cannot read properties of undefined (reading ‘getUserMedia’)

Here’s the a sample of the code:

<button type="button" class="btn btn-primary" onclick="openCamera()">Open camera</button>

<div id="cameraContainer">
    <video id="cameraVideo" style="display: none;"></video>
    <div id="overlayFrame"></div>
    <canvas id="photoCanvas" style="display: none;"></canvas>
</div>

<script>
        var videoStream;

        function openCamera() {
            // Access the camera
            navigator.mediaDevices.getUserMedia({
                    video: true
                })
                .then(function(stream) {
                    videoStream = stream;
                    var video = document.getElementById('cameraVideo');
                    video.srcObject = stream;
                    video.play();
                    video.style.display = 'block';
                    document.getElementById('overlayFrame').style.display = 'block';
                })
                .catch(function(error) {
                    console.error('Error accessing camera: ', error);
                });
        }
    </script>

I wonder if the browser explicitly saying not secure has anything to do with the reason why it doesn’t work
I tried php artisan serve --host=192.168.10.10 --port=443 but that also didn’t work and I got this error :

An attempt was made to access a socket in a way forbidden by its access permissions

Error loading data – google sheet app script, javascript, geohash

I’m trying to calculate the geohash of a lat, long pair in a Google sheet. I’ve created this function in Apps Script:

var base32 = "0123456789bcdefghjkmnpqrstuvwxyz";

function GEOHASH(lat, lon, len) {
  if (len === undefined) {
    len = 9; 
  }
  
  var geohash = [];
  
  lat = Number(lat);
  lon = Number(lon);

  var minLat = -90, maxLat = 90;
  var minLon = -180, maxLon = 180;

  var mid;
  var bits = 0;
  var evenBit = true;

  while (geohash.length < len) {
    if (evenBit) {
      mid = (minLon + maxLon) / 2;
      if (lon > mid) {
        minLon = mid;
        bits |= 1<<bits;
      } else { 
        maxLon = mid; 
      }
    } else {
      mid = (minLat + maxLat) / 2;
      if (lat > mid) { 
        minLat = mid;
        bits |= 1<<bits;  
      } else {
        maxLat = mid;
      }
    }
    evenBit = !evenBit;
    if (bits == parseInt("1".repeat(geohash.length), 2)) {  
      geohash.push(base32.charAt(bits));
      bits = 0; 
    }
  }
  return geohash.join("");  
}

in the sheet, when calling =GEOHASH([lat-cell],[lon-cell],10) I get either Error loading data or Exceeded maximum execution time (line 0).

I suppose the while loop could easily exceed the timelimit placed on scripts?

But I wondered if anyone could see other issues with the code, or suggest other reasons/solutions for the issue. Any other way to calculate the geohash in the sheet are very welcome too.

use php to create a json file made from an array of array

how to handle data in an array of arrays using php to create a json file to use data in js script?

i did this data structure but i have no idea how to populate the arrays:

$json = array(
        "isbn" => array(),
        "mat" => array(),
    );

how can i fill “isbn” and “mat” with data recovered from mySQL database and use that to create a json file to handle data in a js script for create 2 differents select/option tags which the second one depends on the selection of the first

Changing database via Drag and Drop

I am trying to implement a Kanban application (To-Do application) in Flask and HTML.
I can add tasks, they are displayed in the respective column (To-Do, In Progress, Done) and I can change the status of the tasks, which moves them in the respective column.
Now I am trying to make the tasks draggable and change their status according to the respective column they are dropped in, that’s when I had to start using JavaScript to implement the event handlers for the Drag and Drop API of HTML.

In the Jinja Template of the application I have my event listeners defined for the Drag and Drop API ({#...#} are Jinja comments):

<script>
  function allowDrop(ev) {
    ev.preventDefault();
  }

  function dragEnter(ev) {
    ev.preventDefault();
    $(this).addClass('zoomed');
  }
  
  function drag(ev) {
    ev.dataTransfer.setData("task_id", ev.target.id);
  }
  
  function drop(ev) {
    ev.preventDefault();
    var task_id = ev.dataTransfer.getData("task_id");
    var targe_state = ev.target.id;
    {{ dropped(project_id=project.id, task_id=task_id, target_state=target_state) }}
  }
</script>

The actual logic happens in the call to dropped which is a python function passed to the Jinja template:

def dropped(project_id, task_id, target_state):
    project_id = int(project_id)
    task_id = int(task_id)
    if Project.query.get(project_id) is None:
        return render_template("404.html"), 404
    try:
        session = sessions_by_project[project_id]
    except KeyError:
        return render_template("404.html"), 404
    task = session.query(Task).get(int(task_id))
    if task is None:
        return render_template("404.html"), 404
    task.change_status(str2status(target_state))
    session.commit()
    print(f"Dropped called with target ID: {task_id}, state: {target_state}")
    return redirect(url_for("main.kanban", project_id=project_id))

@main.route("/<int:project_id>/kanban", methods=["GET", "POST"])
def kanban(project_id):
    # ...more code ommited...
    return render_template(
        "kanban.html", tasks_by_status=tasks_by_status, project=project, dropped=dropped
    )

The part of the Jinja template were the event handlers are set is (there are two more columns for “In Progress” and “Done” which are basically the same so I omitted them:

    <ol class="kanban To-do" id="todo" ondrop="drop(event)" ondragover="allowDrop(event)" ondragenter="dragEnter(event)">
        <h2> To-Do </h2>
        {% for (depth, pending) in tasks_by_status[1]%}
            <li class="dd-item indent{{depth}}" id="{{pending.id}}" draggable="true" ondragstart="drag(event)">
                <h3 class="title dd-handle"><button name="task" value={{pending.id}}>{{pending.title}}</button></h3>
                <div class="text" contenteditable="true">{{pending.description}}</div>
            </li>
        {% endfor%}
    </ol>

So from what I see during testing and trying around:

  • I can drag the list-items marked with draggable=true
  • Nothing happens when I move the draggable items over the ordered list elements, although drageEnter should be called and make the element appear slightly bigger
  • Also nothing happens when I drop something over the ordered list elements
  • When I use hard coded values for calling the dropped(1,1,"pending") I can see the function print to the console whenever the page is loaded but not when the drop event is fired.

I also tried not to pass the dropped function to the template but rather add it to the flask context processor which also didn’t help.
Hope anyone knows what’s going on and where I made a mistake – I hope it is not too silly. Much appreciated, thanks!

How can I access a variable modified within an anonymous function in FileReader onload, from the external code

I am trying to read the content of some .txt files from client-side.

Here’s my code :

function foo() {

var files = document.getElementById( ‘formFileMultiple’).files; var a = []: var file = files[0]; var reader = new FileReader (); reader.onload = function (event){ a [0]=reader. result; }; reader.readAsText (filel, « windows-1252 ») console.log (a) ; console.log (a. length) ;

So console.log(a) displays exactly the text content, but console.log(a.length) returns 0

I cannot find any solution

Link to an anchor within an iFrame

I need help with this. I know there is some similar topics like this but I couldn’t find the solution for my problem.

I’m using a Nicepage desktop app for web design with one domain and within one of the pages (restoran—jelovnik.html) I have an iFrame which contain the page I have created in Blogger (second domain)(some restaurant menu). iFrame is borderless with no scroll option. Using Blogger html view i have create the anchor:

<div id="vecera"></div>

On my homepage I would like to create the link which should navigate visitor to this specific anchor by scrolling the main page (restoran—jelovnik.html) to it.

How can I do this? 🙁

Thanks.

I try to navigate to anchor within an iFrame of page by scroling the main page which contain that iFrame. Tried lot of examples but without success.

Tailwind CSS JIT Not Compiling Classes Inside @layer Directive

I am working on a Next.js project using Tailwind CSS with JIT mode enabled. I’ve encountered an issue where custom utility classes defined inside the @layer utilities block in my theme.css file are not being compiled and applied as expected. However, when these classes are defined outside the @layer directive, they work correctly.

theme.css (Not working)

@tailwind base;
@tailwind components;
@tailwind utilities;

@layer utilities {
  .h1-bold {
    @apply text-[30px] font-bold leading-[42px] tracking-tighter;
  }
}

theme.css (Working)

@tailwind base;
@tailwind components;
@tailwind utilities;

.h1-bold {
  @apply text-[30px] font-bold leading-[42px] tracking-tighter;
}

globals.css

@tailwind base;
@tailwind components;
@tailwind utilities;
@import url("../styles/theme.css");

body {
  font-family: "Inter", sans-serif;
}

I’m new to Next.JS and tailwind. Could someone point me to the right direction? why Tailwind CSS’s JIT mode is not processing classes inside the @layer directive as expected in this scenario? Is there a specific configuration or project setup that I might be missing?

Observed behavior:
When .h1-bold is inside @layer utilities, the styles seem to revert to default browser styles (like font-size: inherit; font-weight: inherit;). But when defined outside @layer utilities, the custom styles are applied correctly.

Expected behavior:
Custom utility classes defined inside @layer utilities should be compiled and applied by Tailwind’s JIT compiler.

How to output a list of data from an array using comma JS?

Help a beginner in js There is data in the form of:

[
    {
        "cmm": "erl",
        "pk": {
            "from": "",
            "to": "",
            "dt": "ZF"
        },
        "status": true,
        "mk": false,
        "rps": {
            "cll": "B90BD"
        }
    },
    {
        "cmm": "erl",
        "pk": {
            "from": "",
            "to": "",
            "dt": "7E"
        },
        "status": true,
        "mk": false,
        "rps": {
            "cll": "2E147FA3"
        }
    },
        {
        "cmm": "erl",
        "pk": {
            "from": "",
            "to": "",
            "dt": "7E"
        },
        "status": true,
        "mk": false,
        "rps": {
            "cll": "2E147FA3"
        }
    }
]

I want to get a list of “cll” Comma separated. B90BD,2E147FA3,2E147FA3… I tried filtering, but I get an error.

function list(data) {
    const dtt = JSON.parse(data);
    console.log(dtt);
        const addrs = dtt.filter(function (item) {
        return item.rps;}).join(",");
        console.log(addrs);
    console.log(addrs);
        }

This command works, but I only get the data of the first element.

function createTable(data) {
    const dtt = JSON.parse(data);
    const mm = dtt[0].rps;
    var myAr = mm.ccl;
    console.log(myAr);
        }

2.0.0-dev quill drag text not working how make it drag text

Generally, in the quill 1.3 stable version, text can be moved, that is, we can move a certain listing from within and drop it somewhere, or we can drag and drop the text from somewhere, there is no need to do anything extra for this, even this is the case in a plain textarea.

For example, if you try the code below, you will see “Hello World!” “World!” you can cut it and leave it with you “at the beginning” and you will get the cut and pasted effect with dragging.

But if you remove the 2.0.0 dev version comment line and take the 1.3.6 version comment section and run it, how can I make this work if it doesn’t specifically work?

<link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">

<!-- Create the editor container -->
<div id="editor">
  <p>Hello World!</p>
  <p>Some initial <strong>bold</strong> text</p>
  <p><br></p>
</div>

<!-- Include the Quill library -->
<script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
<!-- 
<script src="https://cdnjs.cloudflare.com/ajax/libs/quill/2.0.0-dev.3/quill.min.js"></script> 
-->

<!-- Initialize Quill editor -->
<script>
  var quill = new Quill('#editor', {
    theme: 'snow'
  });
</script>```

Issue with Date and time when work with other country like USA

I have date picker which is select Expiry date this is working fine for india but when i test this for USA location it working differently.

**Problem is like **
Suppose today is 28 December in india and according to indian timezon the current time is 7:00 pm and in USA it is 8:30 am. So When I select date in india it will show 28 December with current time but When I select date From USA at same time it will show me 27 December.
I dont know what’s going wrong with this.
I also Provide you the code also.

This is my React project, and I am providing state, function which is handling the expiry date and input also

    const [formData, setFormData] = useState({
        selectedFile: null,
        DOCUMENT_EXPIRY_DATE: "",
        DOCUMENT_TYPE: "",
    });

    const handleExpiryDateChange = (e) => {
        const selectedDate = e.target.value;

        // Use moment to adjust the date to the user's time zone
        const userTimeZoneDate = moment(selectedDate)
            .tz(moment.tz.guess())
            .format("YYYY-MM-DD");

        setFormData({
            ...formData,
            DOCUMENT_EXPIRY_DATE: userTimeZoneDate,
        });
    




        <div className="row mb-2">
            <div className="form-group col-xl-12">
                 <label className="pb-2 fs-6 rounded p-2">Select Expiry Date </label>
                       <input
                          type="date"
                          className="form-control mb-2 pb-2 pt-2 form-control-2 rounded-0"
                          id="DOCUMENT_EXPIRY_DATE"
                          name=" DOCUMENT_EXPIRY_DATE"
                          onChange={handleExpiryDateChange}
                          value={formData.DOCUMENT_EXPIRY_DATE}
                          required
                       />
            </div>
       </div>

Actually i do not have any idea about but i think there is an date time issue i have to pick the global location according to the timezone.
Expectation is this i need a proper solution using js which is better fit for my code i want to store the local timezone of where the user is selecting the date picker(expiry date).