React Native Background Fetch not triggering

I am trying to call a supabase function that checks for new messages with a subscription.
I am using React-Native-Background-Fetch I have implemented the call from the docs in the index.ios.js file. I am getting the hello-world call on the setTimeout but that is where the logs end.

What am I doing wrong?

setTimeout(() => {
  console.log('Hello, World!');
}, 900000);
const initBackgroundFetch = async () => {
  console.log('initBackgroundFetch');
  try {
    await BackgroundFetch.configure(
      {
        minimumFetchInterval: 15,
        stopOnTerminate: false,
        startOnBoot: true,
        enableHeadless: true,
        requiresBatteryNotLow: false,
        requiresCharging: false,
        requiresStorageNotLow: false,
        requiresDeviceIdle: false,
        forceAlarmManager: false,
      },
      async taskId => {
        console.log('[BackgroundFetch] taskId:', taskId);
        supabase.channel('CONVERSATION_MESSAGES').on('INSERT', payload => {
          console.log('INSERT', payload);
          notifee.displayNotification({
            title: 'New Message',
            body: payload.new.message,
          });
        });
        BackgroundFetch.finish(taskId);
      },
      error => {
        console.log('[BackgroundFetch] configure error:', error);
      },
    );
  } catch (error) {
    console.error('[BackgroundFetch] configuration error:', error);
  }
};

initBackgroundFetch(); // Call the function to register BackgroundFetch

Calculate the diameter of minimum enclosed circle

I have n number of circle with diameter and I want to find out diameter of minimum enclosing circle which can fit these n number of circle.

Currently I have used circle packing for same but it not calculating correctly, can someone please suggest any other algorithm to calculate the same?

I am looking for the algorithm which can enclose the circle as below

[1]: https://i.stack.imgur.com/LwM9z.png

Discord.js v14 canvas not full sended

Im using discord.js v14 and i am trying to send a message with a canvas. The message its sended but not the canvas. Why?

const welcomeCanvas = {};
welcomeCanvas.create = Canvas.createCanvas(1024, 500);
welcomeCanvas.context = welcomeCanvas.create.getContext('2d');
welcomeCanvas.context.font = '72px sans-serif';
welcomeCanvas.context.fillStyle = '#ffffff';

Canvas.loadImage("./img/bn2.jpg").then(async (img) => {
    welcomeCanvas.context.drawImage(img, 0, 0, 1024, 500);
    welcomeCanvas.context.fillText("welcome", 360, 360);
    welcomeCanvas.context.beginPath();
    welcomeCanvas.context.arc(512, 166, 128, 0, Math.PI * 2, true);
    welcomeCanvas.context.stroke();
    welcomeCanvas.context.fill();

    
    console.log("Canvas cargado con éxito.");
}).catch(error => {
    console.error("Error al cargar la imagen:", error);
});

Client.on('guildMemberAdd', async member => {
    const welcomechannel = member.guild.channels.cache.get('1219469975249485945');
    let canvas = welcomeCanvas;
    canvas.context.font = '42px sans-serif';
    canvas.context.textAlign = 'center';
    canvas.context.fillText(member.user.tag.toUpperCase(), 512, 410);
    canvas.context.font = '32px sans-serif';
    canvas.context.fillText(`Eres el miembro número ${member.guild.memberCount}`, 512, 455);
    canvas.context.beginPath();
    canvas.context.arc(512, 166, 119, 0, Math.PI * 2, true);
    canvas.context.closePath();
    canvas.context.clip();
    await Canvas.loadImage(member.user.displayAvatarURL({ format: 'png', size: 1024 }))
        .then(img => {
            canvas.context.drawImage(img, 393, 47, 238, 238);
            console.log("Imagen de usuario cargada con éxito.");
        }).catch(error => {
            console.error("Error al cargar la imagen de usuario:", error);
        });

    let atta = new AttachmentBuilder(canvas.create.toBuffer(), { name: `welcome-${member.id}.png` });

    try {
        welcomechannel.send(`:wave: Bienvenido ${member} a ${member.guild.name}!`, atta);
        console.log("Mensaje y archivo adjunto enviados con éxito.");
    } catch (error) {
        console.error(error);
    }
});

enter image description here
enter image description here

i tried a lot of things but any worked

Latency problem on the serial link of an ARM embedded system

SerialPort Version

9.0.7

Node Version

14.15.0

Platform

Linux BUILDROOT 4.9.88 #1 SMP PREEMPT Tue Sep 11 00:27:43 CEST 2018 armv7l GNU/Linux

Architecture

ARM

Hardware or chipset of serialport

i.MX6

What steps will reproduce the bug?

GPS Data Source: The GPS data frames are sent via a reliable software, NemaStudio. Use burst mode
Nema Studio screenshoot

GPS Data Example:

$GPRMC,123435.00,A,5725.8902,N,01032.1345,E,0.003,0.0,260224,4.4,E,D,<UTC>
$GPTEST,1,<UTC>,,,,,,,,,,,,,,,,,,,
$GPTEST,2,<UTC>,,,,,,,,,,,,,,,,,,,
$GPTEST,3,<UTC>,,,,,,,,,,,,,,,,,,,
$GPTEST,4,<UTC>,,,,,,,,,,,,,,,,,,,
$GPTEST,5,<UTC>,,,,,,,,,,,,,,,,,,,
$GPTEST,6,<UTC>,,,,,,,,,,,,,,,,,,,
$GPTEST,7,<UTC>,,,,,,,,,,,,,,,,,,,
$GPTEST,8,<UTC>,,,,,,,,,,,,,,,,,,,
$GPTEST,9,<UTC>,,,,,,,,,,,,,,,,,,,
$GPTEST,10,<UTC>,,,,,,,,,,,,,,,,,,,
$GPTEST,11,<UTC>,,,,,,,,,,,,,,,,,,,

Code example:

const port = new SerialPort('/dev/ttyS0', { baudRate: 4800 });

let startTime = Date.now();
port.on('data', (data) => {
  const endTime = Date.now();
  const elapsedTime = endTime - startTime;
  console.log(data.toString())
  console.log(elapsedTime + " ms")
  startTime = endTime
});

My logs :

$GPTEST,9,093439.97,,,,,,,,,,,,,,,,,,,*30
$GPTEST,10,093439.97,,,,,,,,,,,,,,,,,,,*08
$GPTEST,11,093439.97,,,,,,,,,,,,,,,,,,,*09
$GPRMC,123435.00,A,5725.8902,N,01032.1345,E,0.003,0.0,260224,4.4,E,D,093440.97*32
$GPTEST,1,093440.97,,,,,,,,,,,,,,,,,,,*36
$GPTEST,2,093440.97,,,,,,,,,,,,,,,,,,,*35
$GPTEST,3,093440.97,,,,,,,,,,,,,,,,,,,*34
$GPTEST,4,093440.97,,,,,,,,,,,,,,,,,,,*33
$GPTEST,5,093440.97,,,,,,,,,,,,,,,,,,,*32
$GPTEST,6,093440.97,,,,,,,,,,,,,,,,,,,*31
$GPTEST,7,093440.97,,,,,,,,,,,,,,,,,,,*30
$GPTEST,8,093440.97,,,,,,,,,,,,,,,,,,,*3F
$GPTEST,9,093440.97,,,,,,,,,,,,,,,,,,,*3E
$GPTEST,10,093440.97,,,,,,,,,,,,,,,,,,,*06
$GPTEST,11,093440.97,,,,,,,,,,,,,,,,,,,*07
$GPRMC,123435.00,A,5725.8902,N,01032.1345,E,0.003,0.0,260224,4.4,E,D,093441.97*33
$GPTEST,1,093441.97,,,,,,,,,,,,,,,,,,,*37
$GPTEST,2,093441.97,,,,,,,,,,,,,,,,,,,*34
$GPTEST,3,093441.97,,,,,,,,,,,,,,,,,,,*35
$GPTEST,4,093441.97,,,,,,,,,,,,,,,,,,,*32
$GPTEST,5,093441.97,,,,,,,,,,,,,,,,,,,*33
$GPTEST,6,093441.97,,,,,,,,,,,,,,,,,,,*30
$GPTEST,7,093441.97,,,,,,,,,,,,,,,,,,,*31
$GPTEST,8,093441.97,,,,,,,,,,,,,,,,,,,*3E
$GPTEST,9,093441.97,,,,,,,,,,,,,,,,,,,*3F
$GPTEST,10,093441.97,,,,,,,,,,,,,,,,,,,*07
$GPTEST,11,093441.97,,,,,,,,,,,,,,,,,,,*06
$GPRMC,123435.00,A,5725.8902,N,01032.1345,E,0.003,0.0,260224,4.4,E,D,093442.97*30
$GPTEST,1,093442.97,,,,,,,,,,,,,,,,,,,*34
$GPTEST,2,093442.97,,,,,,,,,,,,,,,,,,,*37
$GPTEST,3,093442.97,,,,,,,,,,,,,,,,,,,*36
$GPTEST,4,093442.97,,,,,,,,,,,,,,,,,,,*31
$GPTEST,5,093442.97,,,,,,,,,,,,,,,,,,,*30
$GPTEST,6,093442.97,,,,,,,,,,,,,,,,,,,*33
$GPTEST,7,093442.97,,,,,,,,,,,,,,,,,,,*32
$GPTEST,8,093442.97,,,,,,,,,,,,,,,,,,,*3D
$GPTEST,9,093442.97,,,,,,,,,,,,,,,,,,,*3C
$GPTEST,10,093442.97,,,,,,,,,,,,,,,,,,,*04
$GPTEST,11,093442.97,,,,,,,,,,,,,,,,,,,*05
$GPRMC,123435.00,A,5725.8902,N,01032.1345,E,0.003,0.0,260224,4.4,E,D,093443.97*31
$GPTEST,1,093443.97,,,,,,,,,,,,,,,,,,,*35
$GPTEST,2,093443.97,,,,,,,,,,,,,,,,,,,*36
$GPTEST,3,093443.97,,,,,,,,,,,,,,,,,,,*37
$GPTEST,4,093443.97,,,,,,,,,,,,,,,,,,,*30
$GPTEST,5,093443.97,,,,,,,,,,,,,,,,,,,*31
$GPTEST,6,093443.97,,,,,,,,,,,,,,,,,,,*32
$GPTEST,7,093443.97,,,,,,,,,,,,,,,,,,,*33
$GPTEST,8,093443.97,,,,,,,,,,,,,,,,,,,*3C
$GPTEST,9,093443.97,,,,,,,,,,,,,,,,,,,*3D
$GPTEST,10,093443.97,,,,,,,,,,,,,,,,,,,*05
$GPTEST,11,093443.97,,,,,,,,,,,,,,,,,,,*04
$GPRMC,123435.00,A,5725.8902,N,01032.1345,E,0.003,0.0,260224,4.4,E,D,093444.99*38
$GPTEST,1,093444.99,,,,,,,,,,,,,,,,,,,*3C
$GPTEST,2,093444.99,,,,,,,,,,,,,,,,,,,*3F
$GPTEST,3,093444.99,,,,,,,,,,,,,,,,,,,*3E
$GPTEST,4,093444.99,,,,,,,,,,,,,,,,,,,*39
$GPTEST,5,093444.99,,,,,,,,,,,,,,,,,,,*38
$GPTEST,6,093444.99,,,,,,,,,,,,,,,,,,,*3B
$GPTEST,7,093444.99,,,,,,,,,,,,,,,,,,,*3A
$GPTEST,8,093444.99,,,,,,,,,,,,,,,,,,,*35
$GPTEST,9,093444.99,,,,,,,,,,,,,,,,,,,*34
$GPTEST,10,093444.99,,,,,,,,,,,,,,,,,,,*0C
$GPTEST,11,093444.99,,,,,,,,,,,,,,,,,,,*0D
$GPRMC,123435.00,A,5725.8902,N,01032.1345,E,0.003,0.0,260224,4.4,E,D,093445.99*39
$GPTEST,1,093445.99,,,,,,,,,,,,,,,,,,,*3D
$GPTEST,2,093445.99,,,,,,,,,,,,,,,,,,,*3E
$GPTEST,3,093445.99,,,,,,,,,,,,,,,,,,,*3F
$GPTEST,4,093445.99,,,,,,,,,,,,,,,,,,,*38
$GPTEST,5,093445.99,,,,,,,,,,,,,,,,,,,*39
$GPTEST,6,093445.99,,,,,,,,,,,,,,,,,,,*3A
$GPTEST,7,093445.99,,,,,,,,,,,,,,,,,,,*3B
$GPTEST,8,093445.99,,,,,,,,,,,,,,,,,,,*34
$GPTEST,9,093445.99,,,,,,,,,,,,,,,,,,,*35
$GPTEST,10,093445.99,,,,,,,,,,,,,,,,,,,*0D
$GPTEST,11,093445.99,,,,,,,,,,,,,,,,,,,*0C
$GPRMC,123435.00,A,5725.8902,N,01032.1345,E,0.003,0.0,260224,4.4,E,D,093447.00*3B
$GPTEST,1,093447.00,,,,,,,,,,,,,,,,,,,*3F
$GPTEST,2,093447.00,,,,,,,,,,,,,,,,,,,*3C
$GPTEST,3,093447.00,,,,,,,,,,,,,,,,,,,*3D
$GPTEST,4,093447.00,,,,,,,,,,,,,,,,,,,*3A
$GPTEST,5,093447.00,,,,,,,,,,,,,,,,,,,*3B
$GPTEST,6,093447.00,,,,,,,,,,,,,,,,,,,*38
$GPTEST,7,093447.00,,,,,,,,,,,,,,,,,,,*39
$GPTEST,8,093447.00,,,,,,,,,,,,,,,,,,,*36
$GPTEST,9,093447.00,,,,,,,,,,,,,,,,,,,*37
$GPTEST,10,093447.00,,,,,,,,,,,,,,,,,,,*0F
$GPTEST,11,093447.00,,,,,,,,,,,,,,,,,,,*0E
$GPRMC,123435.00,A,5725.8902,N,01032
8550 ms
.
340 ms
1345,E,0.003,0.0,260224,4.4,E,D,093447.99*3B
$GPTEST,1,093447.99,,,,,,,,,,,,,,,,,,,*3F
$GPTEST,2,093447.99,,,,,,,,,,,,,,,,,,,*3C
$GPTEST,3,093447.99,,,,,,,,,,,,,,,,,,,*3D
$GPTEST,4,093447.99,,,,,,,,,,,,,,,,,,,*3A
$GPTEST,5,093447.99,,,,,,,,,,,,,,,,,,,*3B
$GPTEST,6,093447.99,,,,,,,,,,,,,,,,,,,*38
$GPTEST,7,093447.99,,,,,,,,,,,,,,,,,,,*39
$GPTEST,8,093447.99,,,,,,,,,,,,,,,,,,,*36
$GPTEST,9,093447.99,,,,,,,,,,,,,,,,,,,*37
$GPTEST,10,093447.99,,,,,,,,,,,,,,,,,,,*0F
$GPTEST,11,093447.99,,,,,,,,,,,,,,,,,,,*0E
$GPRMC,123435.00,A,5725.8902,N,01032.1345,E,0.003,0.0,260224,4.4,E,D,093449.00*35
$GPTEST,1,093449.00,,,,,,,,,,,,,,,,,,,*31
$GPTEST,2,093449.00,,,,,,,,,,,,,,,,,,,*32
$GPTEST,3,093449.00,,,,,,,,,,,,,,,,,,,*33
$GPTEST,4,093449.00,,,,,,,,,,,,,,,,,,,*34
$GPTEST,5,093449.00,,,,,,,,,,,,,,,,,,,*35
$GPTEST,6,093449.00,,,,,,,,,,,,,,,,,,,*36
$GPTEST,7,093449.00,,,,,,,,,,,,,,,,,,,*37
$GPTEST,8,093449.00,,,,,,,,,,,,,,,,,,,*38
$GPTEST,9,093449.00,,,,,,,,,,,,,,,,,,,*39
$GPTEST,10,093449.00,,,,,,,,,,,,,,,,,,,*01
$GPTEST,11,093449.00,,,,,,,,,,,,,,,,,,,*00
$GPRMC,123435.00,A,5725.8902,N,01032.1345,E,0.003,0.0,260224,4.4,E,D,093449.98*34
$GPTEST,1,093449.98,,,,,,,,,,,,,,,,,,,*30
$GPTEST,2,093449.98,,,,,,,,,,,,,,,,,,,*33
$GPTEST,3,093449.98,,,,,,,,,,,,,,,,,,,*32
$GPTEST,4,093449.98,,,,,,,,,,,,,,,,,,,*35
$GPTEST,5,093449.98,,,,,,,,,,,,,,,,,,,*34
$GPTEST,6,093449.98,,,,,,,,,,,,,,,,,,,*37
$GPTEST,7,093449.98,,,,,,,,,,,,,,,,,,,*36
$GPTEST,8,093449.98,,,,,,,,,,,,,,,,,,,*39
$GPTEST,9,093449.98,,,,,,,,,,,,,,,,,,,*38
$GPTEST,10,093449.98,,,,,,,,,,,,,,,,,,,*00
$GPTEST,11,093449.98,,,,,,,,,,,,,,,,,,,*01
$GPRMC,123435.00,A,5725.8902,N,01032.1345,E,0.003,0.0,260224,4.4,E,D,093451.00*3C
$GPTEST,1,093451.00,,,,,,,,,,,,,,,,,,,*38
$GPTEST,2,093451.00,,,,,,,,,,,,,,,,,,,*3B
$GPTEST,3,093451.00,,,,,,,,,,,,,,,,,,,*3A
$GPTEST,4,093451.00,,,,,,,,,,,,,,,,,,,*3D
$GPTEST,5,093451.00,,,,,,,,,,,,,,,,,,,*3C
$GPTEST,6,093451.00,,,,,,,,,,,,,,,,,,,*3F
$GPTEST,7,093451.00,,,,,,,,,,,,,,,,,,,*3E
$GPTEST,8,093451.00,,,,,,,,,,,,,,,,,,,*31
$GPTEST,9,093451.00,,,,,,,,,,,,,,,,,,,*30
$GPTEST,10,093451.00,,,,,,,,,,,,,,,,,,,*08
$GPTEST,11,093451.00,,,,,,,,,,,,,,,,,,,*09
$GPRMC,123435.00,A,5725.8902,N,01032.1345,E,0.003,0.0,260224,4.4,E,D,093452.00*3F
$GPTEST,1,093452.00,,,,,,,,,,,,,,,,,,,*3B
$GPTEST,2,093452.00,,,,,,,,,,,,,,,,,,,*38
$GPTEST,3,093452.00,,,,,,,,,,,,,,,,,,,*39
$GPTEST,4,093452.00,,,,,,,,,,,,,,,,,,,*3E
$GPTEST,5,093452.00,,,,,,,,,,,,,,,,,,,*3F
$GPTEST,6,093452.00,,,,,,,,,,,,,,,,,,,*3C
$GPTEST,7,093452.00,,,,,,,,,,,,,,,,,,,*3D
$GPTEST,8,093452.00,,,,,,,,,,,,,,,,,,,*32
$GPTEST,9,093452.00,,,,,,,,,,,,,,,,,,,*33
$GPTEST,10,093452.00,,,,,,,,,,,,,,,,,,,*0B
$GPTEST,11,093452.00,,,,,,,,,,,,,,,,,,,*0A
$GPRMC,123435.00,A,5725.8902,N,01032.1345,E,0.003,0.0,260224,4.4,E,D,093453.02*3C
$GPTEST,1,093453.02,,,,,,,,,,,,,,,,,,,*38
$GPTEST,2,093453.02,,,,,,,,,,,,,,,,,,,*3B
$GPTEST,3,093453.02,,,,,,,,,,,,,,,,,,,*3A
$GPTEST,4,093453.02,,,,,,,,,,,,,,,,,,,*3D
$GPTEST,5,093453.02,,,,,,,,,,,,,,,,,,,*3C
$GPTEST,6,093453.02,,,,,,,,,,,,,,,,,,,*3F
$GPTEST,7,093453.02,,,,,,,,,,,,,,,,,,,*3E
$GPTEST,8,093453.02,,,,,,,,,,,,,,,,,,,*31
$GPTEST,9,093453.02,,,,,,,,,,,,,,,,,,,*30
$GPTEST,10,093453.02,,,,,,,,,,,,,,,,,,,*08
$GPTEST,11,093453.02,,,,,,,,,,,,,,,,,,,*09
$GPRMC,123435.00,A,5725.8902,N,01032.1345,E,0.003,0.0,260224,4.4,E,D,093454.02*3B
$GPTEST,1,093454.02,,,,,,,,,,,,,,,,,,,*3F
$GPTEST,2,093454.02,,,,,,,,,,,,,,,,,,,*3C
$GPTEST,3,093454.02,,,,,,,,,,,,,,,,,,,*3D
$GPTEST,4,093454.02,,,,,,,,,,,,,,,,,,,*3A
$GPTEST,5,093454.02,,,,,,,,,,,,,,,,,,,*3B
$GPTEST,6,093454.02,,,,,,,,,,,,,,,,,,,*38
$GPTEST,7,093454.02,,,,,,,,,,,,,,,,,,,*39
$GPTEST,8,093454.02,,,,,,,,,,,,,,,,,,,*36
$GPTEST,9,093454.02,,,,,,,,,,,,,,,,,,,*37
$GPTEST,10,093454.02,,,,,,,,,,,,,,,,,,,*0F
$GPTEST,11,093454.02,,,,,,,,,,,,,,,,,,,*0E
$GPRMC,123435.00,A,5725.8902,N,01032.1345,E,0.003,0.0,260224,4.4,E,D,093455.03*3B
$GPTEST,1,093455.03,,,,,,,,,,,,,,,,,,,*3F
$GPTEST,2,093455.03,,,,,,,,,,,,,,,,,,,*3C
$GPTEST,3,093455.03,,,,,,,,,,,,,,,,,,,*3D
$GPTEST,4,0934
8180 ms
5
340 ms
5.03,,,,,,,,,,,,,,,,,,,*3A
$GPTEST,5,093455.03,,,,,,,,,,,,,,,,,,,*3B
$GPTEST,6,093455.03,,,,,,,,,,,,,,,,,,,*38
$GPTEST,7,093455.03,,,,,,,,,,,,,,,,,,,*39
$GPTEST,8,093455.03,,,,,,,,,,,,,,,,,,,*36
$GPTEST,9,093455.03,,,,,,,,,,,,,,,,,,,*37
$GPTEST,10,093455.03,,,,,,,,,,,,,,,,,,,*0F
$GPTEST,11,093455.03,,,,,,,,,,,,,,,,,,,*0E
$GPRMC,123435.00,A,5725.8902,N,01032.1345,E,0.003,0.0,260224,4.4,E,D,093456.01*3A
$GPTEST,1,093456.01,,,,,,,,,,,,,,,,,,,*3E
$GPTEST,2,093456.01,,,,,,,,,,,,,,,,,,,*3D
$GPTEST,3,093456.01,,,,,,,,,,,,,,,,,,,*3C
$GPTEST,4,093456.01,,,,,,,,,,,,,,,,,,,*3B
$GPTEST,5,093456.01,,,,,,,,,,,,,,,,,,,*3A
$GPTEST,6,093456.01,,,,,,,,,,,,,,,,,,,*39
$GPTEST,7,093456.01,,,,,,,,,,,,,,,,,,,*38
$GPTEST,8,093456.01,,,,,,,,,,,,,,,,,,,*37
$GPTEST,9,093456.01,,,,,,,,,,,,,,,,,,,*36
$GPTEST,10,093456.01,,,,,,,,,,,,,,,,,,,*0E
$GPTEST,11,093456.01,,,,,,,,,,,,,,,,,,,*0F
$GPRMC,123435.00,A,5725.8902,N,01032.1345,E,0.003,0.0,260224,4.4,E,D,093457.03*39
$GPTEST,1,093457.03,,,,,,,,,,,,,,,,,,,*3D
$GPTEST,2,093457.03,,,,,,,,,,,,,,,,,,,*3E
$GPTEST,3,093457.03,,,,,,,,,,,,,,,,,,,*3F
$GPTEST,4,093457.03,,,,,,,,,,,,,,,,,,,*38
$GPTEST,5,093457.03,,,,,,,,,,,,,,,,,,,*39
$GPTEST,6,093457.03,,,,,,,,,,,,,,,,,,,*3A
$GPTEST,7,093457.03,,,,,,,,,,,,,,,,,,,*3B
$GPTEST,8,093457.03,,,,,,,,,,,,,,,,,,,*34
$GPTEST,9,093457.03,,,,,,,,,,,,,,,,,,,*35
$GPTEST,10,093457.03,,,,,,,,,,,,,,,,,,,*0D
$GPTEST,11,093457.03,,,,,,,,,,,,,,,,,,,*0C
$GPRMC,123435.00,A,5725.8902,N,01032.1345,E,0.003,0.0,260224,4.4,E,D,093458.02*37
$GPTEST,1,093458.02,,,,,,,,,,,,,,,,,,,*33
$GPTEST,2,093458.02,,,,,,,,,,,,,,,,,,,*30
$GPTEST,3,093458.02,,,,,,,,,,,,,,,,,,,*31
$GPTEST,4,093458.02,,,,,,,,,,,,,,,,,,,*36
$GPTEST,5,093458.02,,,,,,,,,,,,,,,,,,,*37
$GPTEST,6,093458.02,,,,,,,,,,,,,,,,,,,*34
$GPTEST,7,093458.02,,,,,,,,,,,,,,,,,,,*35
$GPTEST,8,093458.02,,,,,,,,,,,,,,,,,,,*3A
$GPTEST,9,093458.02,,,,,,,,,,,,,,,,,,,*3B
$GPTEST,10,093458.02,,,,,,,,,,,,,,,,,,,*03
$GPTEST,11,093458.02,,,,,,,,,,,,,,,,,,,*02
$GPRMC,123435.00,A,5725.8902,N,01032.1345,E,0.003,0.0,260224,4.4,E,D,093459.02*36
$GPTEST,1,093459.02,,,,,,,,,,,,,,,,,,,*32
$GPTEST,2,093459.02,,,,,,,,,,,,,,,,,,,*31
$GPTEST,3,093459.02,,,,,,,,,,,,,,,,,,,*30
$GPTEST,4,093459.02,,,,,,,,,,,,,,,,,,,*37
$GPTEST,5,093459.02,,,,,,,,,,,,,,,,,,,*36
$GPTEST,6,093459.02,,,,,,,,,,,,,,,,,,,*35
$GPTEST,7,093459.02,,,,,,,,,,,,,,,,,,,*34
$GPTEST,8,093459.02,,,,,,,,,,,,,,,,,,,*3B
$GPTEST,9,093459.02,,,,,,,,,,,,,,,,,,,*3A
$GPTEST,10,093459.02,,,,,,,,,,,,,,,,,,,*02
$GPTEST,11,093459.02,,,,,,,,,,,,,,,,,,,*03
$GPRMC,123435.00,A,5725.8902,N,01032.1345,E,0.003,0.0,260224,4.4,E,D,093500.02*3B
$GPTEST,1,093500.02,,,,,,,,,,,,,,,,,,,*3F
$GPTEST,2,093500.02,,,,,,,,,,,,,,,,,,,*3C
$GPTEST,3,093500.02,,,,,,,,,,,,,,,,,,,*3D
$GPTEST,4,093500.02,,,,,,,,,,,,,,,,,,,*3A
$GPTEST,5,093500.02,,,,,,,,,,,,,,,,,,,*3B
$GPTEST,6,093500.02,,,,,,,,,,,,,,,,,,,*38
$GPTEST,7,093500.02,,,,,,,,,,,,,,,,,,,*39
$GPTEST,8,093500.02,,,,,,,,,,,,,,,,,,,*36
$GPTEST,9,093500.02,,,,,,,,,,,,,,,,,,,*37
$GPTEST,10,093500.02,,,,,,,,,,,,,,,,,,,*0F
$GPTEST,11,093500.02,,,,,,,,,,,,,,,,,,,*0E
$GPRMC,123435.00,A,5725.8902,N,01032.1345,E,0.003,0.0,260224,4.4,E,D,093501.02*3A
$GPTEST,1,093501.02,,,,,,,,,,,,,,,,,,,*3E
$GPTEST,2,093501.02,,,,,,,,,,,,,,,,,,,*3D
$GPTEST,3,093501.02,,,,,,,,,,,,,,,,,,,*3C
$GPTEST,4,093501.02,,,,,,,,,,,,,,,,,,,*3B
$GPTEST,5,093501.02,,,,,,,,,,,,,,,,,,,*3A
$GPTEST,6,093501.02,,,,,,,,,,,,,,,,,,,*39
$GPTEST,7,093501.02,,,,,,,,,,,,,,,,,,,*38
$GPTEST,8,093501.02,,,,,,,,,,,,,,,,,,,*37
$GPTEST,9,093501.02,,,,,,,,,,,,,,,,,,,*36
$GPTEST,10,093501.02,,,,,,,,,,,,,,,,,,,*0E
$GPTEST,11,093501.02,,,,,,,,,,,,,,,,,,,*0F
$GPRMC,123435.00,A,5725.8902,N,01032.1345,E,0.003,0.0,260224,4.4,E,D,093502.03*38
$GPTEST,1,093502.03,,,,,,,,,,,,,,,,,,,*3C
$GPTEST,2,093502.03,,,,,,,,,,,,,,,,,,,*3F
$GPTEST,3,093502.03,,,,,,,,,,,,,,,,,,,*3E
$GPTEST,4,093502.03,,,,,,,,,,,,,,,,,,,*39
$GPTEST,5,093502.03,,,,,,,,,,,,,,,,,,,*38
$GPTEST,6,093502.03,,,,,,,,,,,,,,,,,,,*3B
$GPTEST,7,093502.03,,,,,,,,,,,,,,,,,,,*3A
$GPTEST,8,093502.03,,,,,,,,,,,,,
8190 ms
,
340 ms
,,,,,*35
$GPTEST,9,093502.03,,,,,,,,,,,,,,,,,,,*34
$GPTEST,10,093502.03,,,,,,,,,,,,,,,,,,,*0C
$GPTEST,11,093502.03,,,,,,,,,,,,,,,,,,,*0D
$GPRMC,123435.00,A,5725.8902,N,01032.1345,E,0.003,0.0,260224,4.4,E,D,093503.02*38
$GPTEST,1,093503.02,,,,,,,,,,,,,,,,,,,*3C
$GPTEST,2,093503.02,,,,,,,,,,,,,,,,,,,*3F
$GPTEST,3,093503.02,,,,,,,,,,,,,,,,,,,*3E
$GPTEST,4,093503.02,,,,,,,,,,,,,,,,,,,*39
$GPTEST,5,093503.02,,,,,,,,,,,,,,,,,,,*38
$GPTEST,6,093503.02,,,,,,,,,,,,,,,,,,,*3B
$GPTEST,7,093503.02,,,,,,,,,,,,,,,,,,,*3A
$GPTEST,8,093503.02,,,,,,,,,,,,,,,,,,,*35
$GPTEST,9,093503.02,,,,,,,,,,,,,,,,,,,*34
$GPTEST,10,093503.02,,,,,,,,,,,,,,,,,,,*0C
$GPTEST,11,093503.02,,,,,,,,,,,,,,,,,,,*0D
$GPRMC,123435.00,A,5725.8902,N,01032.1345,E,0.003,0.0,260224,4.4,E,D,093504.02*3F
$GPTEST,1,093504.02,,,,,,,,,,,,,,,,,,,*3B
$GPTEST,2,093504.02,,,,,,,,,,,,,,,,,,,*38
$GPTEST,3,093504.02,,,,,,,,,,,,,,,,,,,*39
$GPTEST,4,093504.02,,,,,,,,,,,,,,,,,,,*3E
$GPTEST,5,093504.02,,,,,,,,,,,,,,,,,,,*3F
$GPTEST,6,093504.02,,,,,,,,,,,,,,,,,,,*3C
$GPTEST,7,093504.02,,,,,,,,,,,,,,,,,,,*3D
$GPTEST,8,093504.02,,,,,,,,,,,,,,,,,,,*32
$GPTEST,9,093504.02,,,,,,,,,,,,,,,,,,,*33
$GPTEST,10,093504.02,,,,,,,,,,,,,,,,,,,*0B
$GPTEST,11,093504.02,,,,,,,,,,,,,,,,,,,*0A
$GPRMC,123435.00,A,5725.8902,N,01032.1345,E,0.003,0.0,260224,4.4,E,D,093505.02*3E
$GPTEST,1,093505.02,,,,,,,,,,,,,,,,,,,*3A
$GPTEST,2,093505.02,,,,,,,,,,,,,,,,,,,*39
$GPTEST,3,093505.02,,,,,,,,,,,,,,,,,,,*38
$GPTEST,4,093505.02,,,,,,,,,,,,,,,,,,,*3F
$GPTEST,5,093505.02,,,,,,,,,,,,,,,,,,,*3E
$GPTEST,6,093505.02,,,,,,,,,,,,,,,,,,,*3D
$GPTEST,7,093505.02,,,,,,,,,,,,,,,,,,,*3C
$GPTEST,8,093505.02,,,,,,,,,,,,,,,,,,,*33
$GPTEST,9,093505.02,,,,,,,,,,,,,,,,,,,*32
$GPTEST,10,093505.02,,,,,,,,,,,,,,,,,,,*0A
$GPTEST,11,093505.02,,,,,,,,,,,,,,,,,,,*0B
$GPRMC,123435.00,A,5725.8902,N,01032.1345,E,0.003,0.0,260224,4.4,E,D,093506.03*3C
$GPTEST,1,093506.03,,,,,,,,,,,,,,,,,,,*38
$GPTEST,2,093506.03,,,,,,,,,,,,,,,,,,,*3B
$GPTEST,3,093506.03,,,,,,,,,,,,,,,,,,,*3A
$GPTEST,4,093506.03,,,,,,,,,,,,,,,,,,,*3D
$GPTEST,5,093506.03,,,,,,,,,,,,,,,,,,,*3C
$GPTEST,6,093506.03,,,,,,,,,,,,,,,,,,,*3F
$GPTEST,7,093506.03,,,,,,,,,,,,,,,,,,,*3E
$GPTEST,8,093506.03,,,,,,,,,,,,,,,,,,,*31
$GPTEST,9,093506.03,,,,,,,,,,,,,,,,,,,*30
$GPTEST,10,093506.03,,,,,,,,,,,,,,,,,,,*08
$GPTEST,11,093506.03,,,,,,,,,,,,,,,,,,,*09
$GPRMC,123435.00,A,5725.8902,N,01032.1345,E,0.003,0.0,260224,4.4,E,D,093507.01*3F
$GPTEST,1,093507.01,,,,,,,,,,,,,,,,,,,*3B
$GPTEST,2,093507.01,,,,,,,,,,,,,,,,,,,*38
$GPTEST,3,093507.01,,,,,,,,,,,,,,,,,,,*39
$GPTEST,4,093507.01,,,,,,,,,,,,,,,,,,,*3E
$GPTEST,5,093507.01,,,,,,,,,,,,,,,,,,,*3F
$GPTEST,6,093507.01,,,,,,,,,,,,,,,,,,,*3C
$GPTEST,7,093507.01,,,,,,,,,,,,,,,,,,,*3D
$GPTEST,8,093507.01,,,,,,,,,,,,,,,,,,,*32
$GPTEST,9,093507.01,,,,,,,,,,,,,,,,,,,*33
$GPTEST,10,093507.01,,,,,,,,,,,,,,,,,,,*0B
$GPTEST,11,093507.01,,,,,,,,,,,,,,,,,,,*0A
$GPRMC,123435.00,A,5725.8902,N,01032.1345,E,0.003,0.0,260224,4.4,E,D,093508.03*32
$GPTEST,1,093508.03,,,,,,,,,,,,,,,,,,,*36
$GPTEST,2,093508.03,,,,,,,,,,,,,,,,,,,*35
$GPTEST,3,093508.03,,,,,,,,,,,,,,,,,,,*34
$GPTEST,4,093508.03,,,,,,,,,,,,,,,,,,,*33
$GPTEST,5,093508.03,,,,,,,,,,,,,,,,,,,*32
$GPTEST,6,093508.03,,,,,,,,,,,,,,,,,,,*31
$GPTEST,7,093508.03,,,,,,,,,,,,,,,,,,,*30
$GPTEST,8,093508.03,,,,,,,,,,,,,,,,,,,*3F
$GPTEST,9,093508.03,,,,,,,,,,,,,,,,,,,*3E
$GPTEST,10,093508.03,,,,,,,,,,,,,,,,,,,*06
$GPTEST,11,093508.03,,,,,,,,,,,,,,,,,,,*07
$GPRMC,123435.00,A,5725.8902,N,01032.1345,E,0.003,0.0,260224,4.4,E,D,093509.05*35
$GPTEST,1,093509.05,,,,,,,,,,,,,,,,,,,*31
$GPTEST,2,093509.05,,,,,,,,,,,,,,,,,,,*32
$GPTEST,3,093509.05,,,,,,,,,,,,,,,,,,,*33
$GPTEST,4,093509.05,,,,,,,,,,,,,,,,,,,*34
$GPTEST,5,093509.05,,,,,,,,,,,,,,,,,,,*35
$GPTEST,6,093509.05,,,,,,,,,,,,,,,,,,,*36
$GPTEST,7,093509.05,,,,,,,,,,,,,,,,,,,*37
$GPTEST,8,093509.05,,,,,,,,,,,,,,,,,,,*38
$GPTEST,9,093509.05,,,,,,,,,,,,,,,,,,,*39
$GPTEST,10,093509.05,,,,,,,,,,,,,,,,,,,*01
$GPTEST,11,093509.05,,,,,,,,,,,,,,,,,,,*00
$GPRMC,123435.00,A,5725.8902,N,01032.1345,E,0.00
8190 ms
3
340 ms
,0.0,260224,4.4,E,D,093510.05*3D
$GPTEST,1,093510.05,,,,,,,,,,,,,,,,,,,*39
$GPTEST,2,093510.05,,,,,,,,,,,,,,,,,,,*3A
$GPTEST,3,093510.05,,,,,,,,,,,,,,,,,,,*3B
$GPTEST,4,093510.05,,,,,,,,,,,,,,,,,,,*3C
$GPTEST,5,093510.05,,,,,,,,,,,,,,,,,,,*3D
$GPTEST,6,093510.05,,,,,,,,,,,,,,,,,,,*3E
$GPTEST,7,093510.05,,,,,,,,,,,,,,,,,,,*3F

430 ms

What happens?

I am experiencing a significant latency issue while retrieving GPS data via a serial connection using the “serialport” Node.js dependency on an ARM embedded system. The latency manifests as an initial 8-second delay, followed by the reception of multiple frames that should have been received during that period. This pattern repeats with subsequent delays.

When utilizing the port.on(“data”) or parser.on(“data”) events, there are noticeable delays in processing GPS data. This latency impacts the responsiveness of my application and the accuracy of the received data.

What should have happened?

Data should be emitted faster, for example when the buffer defined with “highWaterMark” is full.
How to reduce this latency of almost 8 seconds ?

Additional information

Steps Tried:

  • Change setting “highWaterMark” to increase or reduce the buffer size
  • Don’t use the parser like in the code example
  • Use port.read() with while loop or setTimeout

Important note: I must keep the baudrate at 4800

My original post on node-serialport github : https://github.com/serialport/node-serialport/issues/2754

Is using a hidden input field safe if its value is never submitted?

I’m following a Django tutorial and at one point there is the need to access a template variable {{ totalPrice }} (sum of items in a shopping cart) in a javascript file. This value is critical in the sense that a user should not be able to lower it before it is processed by the javacript.

The structure looks like this.

  • checkout.html: Template HTML file which displays {{ totalPrice }}, the value being computed by and passed in via a Django view.

  • checkout.js: The code in this file needs the value of {{ totalPrice }}.

The proposed solution (by the tutorial) is as follows.

{{ totalPrice }} is put into a hidden (bootstrap class="d-none") input field. The field is not part of a form and cannot be submitted.

<input type="number" class="d-none" id="totalPrice" value={{ totalPrice }}>

It is then accessed in checkout.js like this.

let totalPrice = document.getElementById('totalPrice').value

I have a couple questions about this approach.

  1. According to my research, using hidden input fields in this manner isn’t safe (source1 source2). The first source in fact talks about the very same scenario where a price is stored. However, the difference is that in my scenario, the input field isn’t part of a form and therefore isn’t submitted. Is the approach safe in this case?
  2. A more modern approach in Django seems to be using {{ totalPrice|json_script:'totalPrice' }}. Is it safe in a scenario where the value is not to be mucked with?

Randomly revealing image pixels on a website [closed]

I need to reveal a random pixel of an image on website. The number of exposed pixels must correspond to the variable 10000 – 1 pixel, 20000 -2 pixels etc. and then hide back if the variable decreases. Image is 4k. I probably need to address every pixel. I’m new to JS and I don’t know how to approach this topic.

I tried to use opacity but I couldn’t address the pixels and the whole photo is revealed at once.

Creating a dynamic table on the basis of values i put in a child table

I am working on frappe framework. I have created a child table By the name of size and added one field inside that table by the name of size.
As i am adding values inside the size table

What i want to do?
After adding the values inside this table. The new table should be created by the column name as the values i put in Size table
Table should be created like this

I did try with front-end code.
I created a Html field and for that field i have applied this code.

frappe.ui.form.on('Order Sheet', {
    refresh: function(frm) {
        var htmlField = frm.fields_dict['size_chart'];

        // Clear existing HTML content in the size_chart field
        htmlField.$wrapper.empty();

        // Fixed columns
        var fixedColumns = [
            'PO NO',
            'Store',
            'Col. Cd',
            'Col. Name',
            'Qty',
            'Delivery Date',
            'Intercomes',
            'Forex Rate'
        ];

        // Get the values entered in the "Size" child table
        var sizeValues = frm.doc.size.map(row => row.size).filter(Boolean);

        // Merge fixed columns with dynamic columns
        var allColumns = fixedColumns.concat(sizeValues);

        // Insert 'Qty' column after 'Col. Name'
        var qtyIndex = fixedColumns.indexOf('Col. Name') + 1;
        fixedColumns.splice(qtyIndex, 0, 'Qty');

        // Create the dynamic HTML table with all columns
        if (allColumns.length > 0) {
            var htmlTable = document.createElement('table');
            htmlTable.setAttribute('border', '1');
            htmlTable.style.width = '100%'; // Set table width to 100% to prevent overflow

            // Create the table header (thead) with all columns
            var thead = document.createElement('thead');
            var headerRow = document.createElement('tr');
            allColumns.forEach(function(columnName) {
                var headerCell = document.createElement('th');
                headerCell.textContent = columnName;
                headerRow.appendChild(headerCell);
            });
            thead.appendChild(headerRow);
            htmlTable.appendChild(thead);

            // Create the table body (tbody) with editable input fields
            var tbody = document.createElement('tbody');
            // Initial rows
            var initialRows = 3;
            addRows(tbody, initialRows, allColumns);
            htmlTable.appendChild(tbody);

            // Apply CSS styles for the table container
            var tableContainer = document.createElement('div');
            tableContainer.style.overflow = 'auto'; // Add scroll bar when necessary
            tableContainer.style.maxHeight = '300px'; // Adjust the height as needed
            tableContainer.appendChild(htmlTable);

            // Append the dynamically generated HTML table to the size_chart field
            htmlField.$wrapper.append(tableContainer);

            // Pass the dynamic column names to the updateFormData function
            var columns = allColumns.filter(col => !fixedColumns.includes(col)); // Exclude fixed columns
            frm.custom_columns = columns;

            // Add button to add rows dynamically
            var addButton = document.createElement('button');
            addButton.textContent = 'Add Row';
            addButton.addEventListener('click', function() {
                addRows(tbody, 1, allColumns);
            });
            htmlField.$wrapper.append(addButton);
        }
    }
});

// Function to update form data when input changes
function updateFormData(frm, inputElement) {
    var rowNumber = parseInt(inputElement.getAttribute('data-row'));
    var colName = inputElement.getAttribute('data-size');
    frm.doc.table_data = frm.doc.table_data || [];
    frm.doc.table_data[rowNumber] = frm.doc.table_data[rowNumber] || {};
    frm.doc.table_data[rowNumber][colName] = inputElement.value;
    frm.refresh_field('table_data'); // Refresh the field to reflect changes
}

// Function to add rows to the table dynamically
function addRows(tbody, count, columns) {
    for (var i = 0; i < count; i++) {
        var row = document.createElement('tr');
        columns.forEach(function(columnName) {
            var cell = document.createElement('td');
            var input = document.createElement('input');
            input.setAttribute('type', 'text');
            input.setAttribute('data-row', tbody.childElementCount); // Add a data attribute to identify the row
            input.setAttribute('data-column', columnName); // Add a data attribute to identify the column
            input.addEventListener('change', function() {
                // Update form data when input changes
                updateFormData(cur_frm, this);
            });
            cell.appendChild(input);
            row.appendChild(cell);
        });
        tbody.appendChild(row);
    }
}

the table is created just like i wanted
But as this table is not a part of my database, i am not able save this.
How can i save this data inside the database? What is the correct way of doing this?

Web-powered IDE Syntax Colouring in JS and CSS [closed]

What I need to add is probably simple for you, but I have had some trouble.
The issue is that I need to make a in-web IDE as a challenge without using libraries like code-mirror, so to start I set an editable for the window of the text/code editor:

<!DOCTYPE html>
<div contenteditable="true" id="ce">this is a monospaced font.</div>

and I use CSS to have the code editing div fill the screen, and add a monospace font:

#ce {
    position: absolute;
    left: 0px;
    top: 0px;
    width: 100vw;
    height: 100vh;
    color: #fff;
    background-color: #8f8f8f;
    font-family: 'Courier New', monospace; /* monospaced font */
    font-size: 13px;
    padding: 5px;
}

and the JS, This is the part I am struggling with, since I do not really understand JavaScript as a whole. As of now I am completely new to the idea of making websites.

const editor = document.getElementById("ce")

As you can see in the JavaScript code snippet, the most I could do is define the div, but what I need help with adding is the ability to recolour certain phrases or combinations of symbols if they are detected in the text. Basically just a straightfoward syntax. I know I would have to add seperate CSS classes at least for the seperate syntax, in example:

.string {
   color: #439B30;
}
.num {
   color: #85FF88;
}

Since I defined the seperate classes in CSS for the syntax of different items, how would I go about creating a JavaScript function that refreshes/updates the text whenever a number or string is typed in and put it under the class, so then it creates a tag and puts it undered the class to have it appear with colour? This part is, in my opinion, difficult to do since there are really not alot of JavaScript documentations that cover this. What I request is either documentation about something like this, or guidance to do so, not someone to do it for me.

Javascript onclick function with ACF

I have a repeater field with textarea fields inside. When you click on a day it should display the text that was filled in with the same day. I tried to make variables per text, but I am not sure what I am doing wrong.

<div class="huidigeDag" id="huidigeDag">
    <?php 
    if ( have_rows( 'programma' ) ) : 
        $counter = 0; // Initialize counter variable
        $programma_texts = []; // Array to store all program texts
        while ( have_rows( 'programma' ) ) : 
            the_row(); 
            $counter++; // Increment counter
            $programma_tekst = get_sub_field( 'programma_tekst' ); // Get program text
            $programma_texts[] = $programma_tekst; // Add program text to array
    ?>
            <h3><?php the_sub_field( 'programma_dag' ); ?></h3>
            <p class="programmaTekst" id="programmaTekst<?php echo $counter; ?>"><?php echo $programma_tekst; ?></p>
            <?php $programma_link = get_sub_field( 'programma_link' ); ?>
            <?php if ( $programma_link && $counter === 1 ) : // Check counter value ?>
                <a class="knop" href="<?php echo esc_url( $programma_link['url'] ); ?>" target="<?php echo esc_attr( $programma_link['target'] ); ?>"><?php echo esc_html( $programma_link['title'] ); ?></a>
                <?php break; // Stop the loop after the first item ?>
            <?php endif; ?>
    <?php endwhile; ?>
    <?php endif; ?>
</div>

<?php if ( have_rows( 'programma' ) ) : ?>
    <div class="dagen">
        <?php $counter = 0; // Reset counter ?>
        <?php while ( have_rows( 'programma' ) ) : the_row(); ?>
            <?php $counter++; // Increment counter ?>
            <a class="dag" onclick="displayPhrase(<?php echo $counter; ?>)">
                <h4 class="programmaDag"><?php the_sub_field( 'programma_dag' ); ?></h4>
            </a>
        <?php endwhile; ?>
    </div>
<?php endif; ?>

<script>
    // JavaScript function to display program text based on index
    function displayPhrase(index) {
        var programmaTekst = <?php echo json_encode($programma_texts); ?>; // PHP array to JavaScript array
        var element = document.getElementById("programmaTekst" + index);
        if (element !== null) {
            element.innerHTML = programmaTekst[index - 1];
        }
    }
</script>

    </div>

I tried to mix some javascript and php but still could not figure it out.

v-autocomplete not showing all the item in selection list from list

I am sending array which has value from 1-100 on v-autocomplete item props. But on scrollbar only number till 40-50 shows up.

<template>
  <v-app>
    <v-container>
      <v-autocomplete
        label="Autocomplete"
        :items="CountList"
        variant="outlined"
      >
        <template #item="{ item }">
          <v-list-item>{{ item.raw }}</v-list-item>
        </template>
      </v-autocomplete>
    </v-container>
  </v-app>
</template>

<script setup>
  import { ref, inject } from 'vue'
  const CountList = ref([])
  for (let i = 1; i <= 100; i++) {
    CountList.value.push(i)
  }
</script>

In dwopdown list number till 100 should showup. But when I use <template #item> complete number till 100 doesn’t show up.

not able to make the smart app banner for android show

I am trying to put a smart banner for android devices.
I have followed following links already, have tried the “smartbanner” plugin as well, but nothing works.
reference of links followed:
stack question 1
Creating an android smart app banner

I have coded following the link below then:
https://developer.chrome.com/blog/app-install-banners-native/

using the below code it worked only one time and even after clearing cache and history it is not coming again.
code for manifest.json:

{ 
 "short_name": "Coach",
 "name": "Coach",
 "icons": [
 {
  "src": "/clientlibs/base/sw/resources/icon192x192.png",
  "type": "image/png",
  "sizes": "36x36"
},
{
  "src": "/clientlibs/base/sw/resources/icon192x192.png",
  "type": "image/png",
  "sizes": "48x48"
},
{
  "src": "/clientlibs/base/sw/resources/icon192x192.png",
  "type": "image/png",
  "sizes": "192x192"
},
{
  "src": "/clientlibs/base/sw/resources/icon192x192.png",
  "type": "image/png",
  "sizes": "512x512"
}
],
"prefer_related_applications": true,
"related_applications": [
{
  "platform": "play",
  "id": "com.baa.app_name",
  "url": "https://play.google.com/store/apps/details? 
 id=com.baa.app_name&hl=en_GB&gl=US&pli=1" 
}
],
"start_url": "./", 
"display": "standalone"
}

code for head tag:

<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script> 
    let deferredPrompt;
    window.addEventListener('load', function(e) {
    // Prevent Chrome 67 and earlier from automatically showing the prompt
      e.preventDefault();
      // Stash the event so it can be triggered later.
      deferredPrompt = e;
    window.addEventListener('beforeinstallprompt', function(e) {
        console.log('beforeinstallprompt Event fired!!!!!!!!!!!!!!');
      });
    });
</script>
<link
  rel="manifest"
  href="/clientlibs/core-base/sw/resources/manifest.json"
/>
</head>

“PHP $_POST array inconsistently recognizing data sent via AJAX: data visible in error log but not consistently detected by PHP script”

Problem Description:

I’m encountering an issue with my PHP script where it inconsistently recognizes data sent via AJAX requests from a JavaScript client. Although the AJAX request appears to be correctly configured and data is being sent, the PHP script sometimes fails to process it correctly, resulting in unexpected behavior.

Details:

Expected Behavior:

JavaScript client sends an AJAX request to a PHP script with data.
PHP script receives the AJAX request, processes the data, and responds accordingly.
Issue:

Despite sending data via AJAX, the PHP script sometimes fails to recognize it.
This leads to situations where the PHP script outputs “No data received” even though data was sent from the JavaScript client.

var visitorId = "your_visitor_id"; // Assuming you have the visitor ID
send_value_php(visitorId);

function send_value_php(visitorId) {
    var xmlhttp = new XMLHttpRequest();
    xmlhttp.onreadystatechange = function () {
        if (this.readyState == 4 && this.status == 200) {
            console.log(xmlhttp.responseText); // Log response
        }
    };
    var url = "/boostrap/hmejquery.php"; // URL of PHP script
    xmlhttp.open("POST", url, true);
    xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    var params = "userID=" + visitorId; // Data to send
    xmlhttp.send(params);
}

php code

if ($_SERVER['REQUEST_METHOD'] == "POST") {
    if (isset($_POST['userID']) && trim($_POST['userID']) !== '') {
        // Retrieve the value of the "userID" parameter
        $userId = trim($_POST['userID']);

        // Process $userId as needed

        // Echo the string
        echo "Received data: " . $userId;
    } else {
        echo "No data received.";
    }
} else {
    // If the request method is not POST
    echo "This endpoint only accepts POST requests.";
}

Troubleshooting Attempts:

Checked AJAX request configuration and verified data is being sent.
Inspected PHP script to ensure proper handling of POST data.
Implemented error logging to track behavior and identify inconsistencies.
Expected Outcome:

I expect the PHP script to consistently recognize and process data sent via AJAX requests from the JavaScript client. Upon receiving a POST request with valid data, the PHP script should process it accordingly and respond appropriately. In cases where no data is received, the PHP script should output “No data received.”

PHP Error Log: When examining the PHP error log, I can see entries indicating that the userID parameter is being sent via POST:

[Tue Mar 19 10:51:34.284981 2024] [php:notice] [pid 936] [client 172.30.1.154:54326] POST data: Arrayn(n    [userID] => iRE8ID6Ft9YxcAdNPE8Fn)n, referer: http://172.30.0.201/boostrap/hmejquery.php

What I Tried:

Implemented AJAX requests to send data from client-side JavaScript to a server-side PHP script.
Verified that the AJAX requests were correctly configured and sending data.
Checked the PHP error log, which showed the presence of the userID parameter in some instances.
Added debugging statements to the PHP script to inspect the $_POST array, but found that it was not consistently recognizing the userID data.
Expectation:

I expected the PHP script to consistently recognize and process the userID data sent via AJAX requests.
Specifically, I expected the $_POST array to consistently contain the userID parameter so that it could be processed accordingly in the PHP script.

Cookies.get(‘token’) returns empty/undefined [duplicate]

While reading a cookies from local device it returns empty only for ‘token’ where there are other cookies it can easily get them
here is backend code to set cookies

let tokenData = {
  id: user._id,
  email: user.email,
  name: user.name
}
const token = await jwt.sign(tokenData, process.env.TOKEN_SECRET!, {
  expiresIn: '1d'
})
const response = NextResponse.json({
  message: "Login successfully",
  success: true
})
response.cookies.set("token", token, {
  httpOnly: true,
})

Reading cookies

useEffect(() => {
  const getUser = Cookies.get("token")
  console.log(getUser)
}, [])

Why can’t i read only ‘token” this cookie.

How can I use openjphjs with next.js?

I have a project that uses Next.js. I need to use openjphjs to decode HTJ2K pixel data.

I added openjphjs.js and openjphjs.wasm to a folder in the project.

I also added the following to next.config.js.

    webpack: (config) => {
        config.resolve.fallback = { fs: false };
        return config;
    },

This was done to resolve the following error.

Module not found: Can't resolve 'fs'

I followed the example in example and tried the following.

import openjphjs from './openjphjs/openjphjs.js';

const = decode = () => {
   const decoder = new openjphjs.HTJ2KDecoder();
}

Multiple errors were thrown.

GET http://localhost:3000/_next/static/chunks/openjphjs.wasm 404 (Not Found)
Uncaught (in promise) RuntimeError: Aborted(RuntimeError: Aborted(both async and sync fetching of the wasm failed).
Uncaught TypeError: _openjphjs_openjphjs_js__WEBPACK_IMPORTED_MODULE_8___default(...).HTJ2KDecoder is not a constructor

I tried manually placing openjphjs.wasm in path shown.
I also tried placing the files in the /public folder.