Why and how can I embed a Youtube video on my Vue web app? (Blocked due to X-Content-Type-Options)

I’m trying to embed youtube videos on my vue and it won’t let me because of that policy.

I’ve installed an NPM package but it’s a little broken and I don’t know if it will keep working in the future.

Is there anyone who knows how I can work around this or properly solve it?

I installed a random plugin that’s poorly maintained.
I was expecting allowing some kind of policy like CORS or something like that but I couldn’t find anything about this issue

how to determine the coordinate point code

Open the code from the online attendance application and change the application location data to the desired location, and if you want to make an absence you do not need to be in the specified place, because the location data in the application has been changed into a coordinating point that was specified and verified correctly in the location database

Please help !

If you change the location data in the application, you can be absent from outside the coordinate points specified in the database

MySQL Pool Long-polling ETIMEDOUT and PROTOCOL_CONNECTION_LOST (Node.js)

I am developing software that runs 24/7 on PM2, performing long-polling by querying the database with SELECT statements every second (I also tried querying every 20 seconds, but that didn’t solve the issue). It frequently performs batch INSERT operations, but I am unable to resolve connection timeouts (ETIMEDOUT) and connection loss (PROTOCOL_CONNECTION_LOST).

import mysql from 'mysql2/promise';
import { config } from 'dotenv';
import { images } from './images.js';
import { labels } from './labels.js';
import { nodes } from './nodes.js';
import { runs } from './runs.js';
import { products } from './products.js';
import { utils } from '../utils/_controller.js';
import { queue } from './queue.js';
config();

let pool;

const logger = utils.createDebugLogger('MySQL');

/** 
 * Executes a query on the database
 * @param {string} query - The query to execute
 * @param {Array} params - The parameters to pass to the query
 * @returns {Promise<[mysql.QueryResult, mysql.FieldPacket[]]>} - The result of the query
*/

const _execute = async (query, params, errorDelay, attempts) => {
    if (attempts >= 5) {
        logger.error(`Error while performing query: ${e.message}`, null, e);
        throw new Error('Failed to execute query after 5 attempts');
    }

    let connection;
    const pool = await getInstance();

    try {
        connection = await pool.getConnection();
        return await connection.query(query, params);
    } catch (e) {
        console.error(e);

        const timedOut = e.code == "ETIMEDOUT" || e.code == "PROTOCOL_CONNECTION_LOST";

        logger.error(`Error while performing query: ${e.message}${timedOut ? ", retrying..." : ''}`, null, e);

        if (timedOut) {
            await new Promise(resolve => setTimeout(resolve, errorDelay)); // Wait 30 seconds to restore the connection
            return _execute(query, params, attempts + 1);
        }
    } finally {
        if (connection) {
            try {
                connection.release();
            } catch (releaseError) {
                logger.error(`Error while releasing connection: ${releaseError.message}`, null, releaseError);
            }
        }
    }
}

const execute = async (query, params) => {
    return await _execute(query, params, 30000, 0);
};


/**
 * Gets the database connection instance
 * @returns {Promise<mysql.Pool>}
 */
const getInstance = async () => {
    if (pool) return pool;

    try {
        pool = mysql.createPool({
            host: process.env.DB_HOST,
            user: process.env.DB_USER,
            password: process.env.DB_PASS || "",
            database: process.env.DB_NAME,
            waitForConnections: true,
            connectionLimit: 10,
            queueLimit: 0,
            idleTimeout: 10000,
        });

        logger.success('Created MySQL pool');
    } catch (e) {
        logger.error(`Error while creating MySQL pool: ${e.message}`, null, e);
    }

    return pool;
}


export const db = {
    execute,
    getInstance,
    logger,

    nodes,
    images,
    labels,
    runs,
    queue,
    products
};

I tried to add delays between queries and made it capable of attempting multiple times to prevent the connection to timeout, but I still achieved nothing.

Why is my code returning the full array of data rather than the most common item within the array?

[`This is my first time posting on stack overflow so if someone can advise if there is more info needed to help. I am also super new to JS/Programming

I a trying to get the program to pull out the most common word from an array.

function checkData(array){
    if(array.length == 0)
        return null;
    const checkingMap = {};
    let maxType = "", maxCount = 1;
    for (let j = 0; j < array.length; j++) {
        for (let i = 0; i < array.length; i++) {
            let element = array[i];
            if (checkingMap[element] == null){
                checkingMap[element] = 1;
                }
  
            else {
                checkingMap[element]++;
            }

            if (checkingMap[element] > maxCount){
                maxType = element;
                maxCount = checkingMap[element];
            }
        }
    }
    console.log(maxType);
}

There could be an issue with the data source? I have included the data file below:

const dataCheck = require('./medicineData')


`const patients = [
    {
      name: 'Charlie',
      age: '42',
      allowedMedicine: ['type-a', 'type-b', 'type-c'],
    },
    {
      name: 'Veronica',
      age: '33',
      allowedMedicine: ['type-a', 'type-c'],
    },
    {
      name: 'Spencer',
      age: '57',
      allowedMedicine: ['type-e'],
    },
    {
      name: 'Wolfram',
      age: '74',
      allowedMedicine: ['type-d', 'type-a'],
    },
    {
      name: 'Jennifer',
      age: '22',
      allowedMedicine: ['type-a', 'type-c'],
    },
  ] 
  let newArray = []
  let finalMedicineList = [] 
function arrangeData(){
    for (let i = 0; i < patients.length; i++) {
        newArray.push(patients[i].allowedMedicine)
      } 
     const mergedArray = newArray.flat(1);
   finalMedicineList.push(mergedArray) 

 const array = finalMedicineList

    dataCheck.checkData(finalMedicineList)
    } 

   arrangeData()`

How to Show a Hidden Label When Hovering Over a Button?

We all know you can change the colour of a button when you hover over it in CSS alone.

But, what would I do to make a label within it show up when I hover over it?

Effectively, my button just has an icon/image in it when it is in normal mode. But, when the user hovers over the button it will show a text label as well.

I realise you can put a title into the button with gives a text description of what the button does, but can you put a label into a button when you hover over it?

Is that a good idea, or should I just stick to using title?

Ie, here is my button in normal state:

<button>
    <img src="./images/iconok.png" alt="Submit" />
    <label style="display: none">&nbsp;Submit</label>
</button>

and in my hovered state

<button>
    <img src="./images/iconok.png" alt="Submit" />
    <label style="display: block">&nbsp;Submit</label>
</button>

How do I implement this?

Note: When the button is not being hovered over, I do not want any space being allocated to the label at all, as if it was not even there.

how to validate form textarea have at least 12 characters with bootstrap?

I’m working on the form of website. I’m getting user id, topic, body from user in a form. I’m using bootstrap to validate topic with at least one non white space character. The body should have at least 12 characters excluding leading and trailing white spaces. It prints error message when user does not meet the requirements. However, I cannot get the body to have at least 12 characters.

(function () {
  // Fetch all the forms we want to apply custom Bootstrap validation styles to
  var forms = document.querySelectorAll(".needs-validation");

  // Loop over them and prevent submission
  Array.prototype.slice.call(forms).forEach(function (form) {
    form.addEventListener(
      "submit",
      function (event) {
        var feedback = document.getElementById("customvalidation");
        var body = document.getElementById("body");
        var min_text = 12;
        //trim leading and trailing white space
        var length = body.value.trim().length;

        if (!form.checkValidity() || length < min_text) {          
          feedback.textContent = `body requires minimum ${min_text} characters`;
          event.preventDefault();
          event.stopPropagation();
        }

        form.classList.add("was-validated");
      },
      false
    );
  });
})();
<html>
<head>
<meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <link
      href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
      rel="stylesheet"
      integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH"
      crossorigin="anonymous"
    />
</head>
<body>

<div class="container">
  <form class="needs-validation" novalidate action="">
    <div class="mb-3">
      <label for="id" class="col-form-label">User ID</label>
      <input
        type="text"
        class="form-control"
        id="id"
        placeholder="User ID..."
        maxlength="15"
      />
    </div>
    <div class="mb-3">
      <label for="topic" class="col-form-label">Topic</label>
      <input
        type="text"
        class="form-control"
        id="topic"
        placeholder="What is it about..."
        required
        pattern=".*S+.*"
      />
      <div class="invalid-feedback">
        input at least one non white space character
      </div>
    </div>
    <div class="mb-3">
      <label for="body" class="col-form-label">Body</label>
      <textarea
        class="form-control"
        id="body"
        placeholder="Write something..."
        rows="10"
        required
      ></textarea>
      <div class="invalid-feedback" id="customvalidation"></div>
    </div>
    <button type="submit" class="btn btn-primary">Submit</button>
  </form>
</div>
<script
      src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
      integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz"
      crossorigin="anonymous"
    ></script>
    </body>
    </html>

Can’t call function on object in javascript even though it is there

I cannot call a function on an object in javascript of a class made by wasm-pack (0.13.0), wasm-bindgen, rust.

This is the rust code:

use wasm_bindgen::prelude::*;
use web_sys::HtmlCanvasElement;
use wgpu::{Surface, SurfaceError};

#[wasm_bindgen]
extern "C" {
    #[wasm_bindgen(js_namespace = console)]
    fn log(s: String);
}

#[wasm_bindgen]
// #[derive(Debug)]
struct StateW {
    state_wasm: StateWasm<'static>,
}

#[derive(Debug)]
struct StateWasm<'a> {
    instance: wgpu::Instance,
    surface: Surface<'a>,
    device: wgpu::Device,
    queue: wgpu::Queue,
    config: wgpu::SurfaceConfiguration,
    size: (u32, u32),
}

impl<'a> StateWasm<'a> {
    pub async fn new(canvas: HtmlCanvasElement) -> Self {..}

    pub fn render(&mut self) -> Result<(), SurfaceError> {..}
}

#[wasm_bindgen]
impl StateW {
    #[wasm_bindgen(constructor)]
    pub async fn new(canvas: HtmlCanvasElement) -> Self {
        Self {
            state_wasm: StateWasm::new(canvas).await,
        }
    }

    #[wasm_bindgen(js_name="renderWasm")]
    pub fn render_wasm(&mut self) {
        let error = self.state_wasm.render();
        match error {
            Ok(_) => {},
            Err(e) => log(e.to_string()),
        };
    }

    pub fn good() -> String {
        String::new()
    }
}

This is the class made by wasm-pack:

export class StateW {

    static __wrap(ptr) {
        ptr = ptr >>> 0;
        const obj = Object.create(StateW.prototype);
        obj.__wbg_ptr = ptr;
        StateWFinalization.register(obj, obj.__wbg_ptr, obj);
        return obj;
    }

    __destroy_into_raw() {
        const ptr = this.__wbg_ptr;
        this.__wbg_ptr = 0;
        StateWFinalization.unregister(this);
        return ptr;
    }

    free() {
        const ptr = this.__destroy_into_raw();
        wasm.__wbg_statew_free(ptr, 0);
    }
    /**
    * @param {HTMLCanvasElement} canvas
    */
    constructor(canvas) {
        const ret = wasm.statew_new(addHeapObject(canvas));
        return takeObject(ret);
    }
    /**
    */
    renderWasm() {
        wasm.statew_renderWasm(this.__wbg_ptr);
    }
    /**
    * @returns {string}
    */
    static good() {
        let deferred1_0;
        let deferred1_1;
        try {
            const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
            wasm.statew_good(retptr);
            var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
            var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
            deferred1_0 = r0;
            deferred1_1 = r1;
            return getStringFromWasm0(r0, r1);
        } finally {
            wasm.__wbindgen_add_to_stack_pointer(16);
            wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
        }
    }
}

This is my javascript file:

import init, { StateW } from './pkg/game.js';

await init();

document.body.setAttribute("style", "margin:0;")

let canvas = document.getElementById("canvas");
canvas.width = innerWidth;
canvas.height = innerHeight;
 
const statew = new StateW(canvas);

console.log(StateW.good());
statew.renderWasm();

This is the error from browser (chrome Version 128.0.6613.120 (Official Build) (arm64)):

Uncaught TypeError: statew.renderWasm is not a function
    at index.js:15:8

I tried changing the name of the class, function, variable, changing the variable to const and even adding a dummy function (pub fn good). When the dummy function is a static function it works as intended. But just as when it is not static it gives an error.

I want to know how can I ban an Instagram id if there any methods that can lead to Instagram id ban please tell me about that [closed]

I want to learn how can I ban an Instagram account

I have tried from reporting the account but that didn’t working and I have also tried like various method where someone increase their followers using third party app I have reported that account but still it didn’t got banned I want to know if there are any other mmethodthat can lead to Instagram id ban

Django + JS : value with double curly braces not sent to a JS function. Others are OK [closed]

A mystery hits me !

I display with a loop many shipping services available for a given order on a page containing all my orders.

{% for serv in account.services %}
    <div class="service">
        <label class="form-check-label" for="service{{order.pk}}"><small>{{serv}}</small></label>
        {% if forloop.first %}
            <input class="form-check-input" type="radio" name="service{{order.pk}}" value="{{serv.pk}}" ismulti="{{serv.is_multiparcel}}" checked>
        {% else %}
            <input class="form-check-input" type="radio" name="service{{order.pk}}" value="{{serv.pk}}" ismulti="{{serv.is_multiparcel}}">
        {% endif %}
        {% if order.base_subtotal > serv.insurance_from %}
            <div class=" form-text text-danger insur-alert{{order.pk}}">Assur. appliquée car € HT sup. à {{serv.insurance_from}}</div>
        {% endif %}
        {% if order.weight > serv.max_weight %}
            <div class="form-text badge bg-danger" name="weight-alert">Poids commande > max. service {{serv.max_weight}} kg</div>
            <script>
                disableCheckCauseWeight("service{{ order.pk }}", "{{serv.pk}}");
            </script>
        {% endif %}
     </div>
 {% endfor %}

One of these services can be selected with a radio button and is identified by 2 prameters : service{{order.pk}} and {{serv.pk}}.
Both of them are well displaying in my html code:

enter image description here

Later in my code, for each loop, I call a JS function for disabling the given service if the order’s weight is higher than the weight accepted by the service.

But, {{serv.pk}} isn’t sent to disableCheckCauseWeight()function, despite it’s well displayed above in value="{{serv.pk}}".
A console log shows well service{{order.pk}} but not {{serv.pk}}. I tried with other values like {{order.pk}}or “tintin” or any other variable, and it’s ok.

Why do I have this issue with {{serv.pk}} ?

Why doesn’t setIp update the value

In React 18.3.1 when I try to use useState to set the new ip with setIp it doesn’t update.

import { useEffect, useState } from "react";
import { useIsLoading } from "./useIsLoading";
import { useError } from "./useError";

export const useFetchIp = () => {
  const [ip, setIp] = useState(null);
  const { changeIsLoading } = useIsLoading()
  const { changeError } = useError()

  useEffect(() => {
    changeIsLoading(true)
    const FetchIp = async () => {
      const url = 'https://api.ipify.org/?format=json';
      try {
        const response = await fetch(url);
        if (response.ok) {
          const ipDetail = await response.json()
          const ipMain = ipDetail.ip;
          setIp(ipMain)
          changeError(null)
          changeIsLoading(false)
        } else {
          throw new Error("Couldn't Get The IP")
        }
      } catch(err) {
        changeIsLoading(false)
        changeError(err)
      }
    }
    FetchIp()
  }, [])
  return { ip }
}

The useFetchIp function returns null. I thought I may not fetching the IP so, I got the value of ipDetail which was { "ip": "5.126.121.39" }

User can use the X++ and and Y++?

How to? X++ Y– can use A JavaScript number VarIable.

  1. Set up your JavaScript page.

  2. Type to VarIables.

  3. Put ++ or –.

Results:

var number = 1;
1++;

Use it.
Learn more in.

Again!

  1. Set up your JavaScript page.

  2. Type to VarIables.

  3. Put ++ or –.

MathQuill always set `avgChWidth` to `Infinity`

When reading line 199 of text.ts of MathQuill,
I think this.text is a function defined at line 80, and the length of a function provides the number of arguments passed to the function, so this.text.length is always zero, and the division by zero sets avgChWidth to Infinity.

// insert cursor at approx position in DOMTextNode
var avgChWidth = this.jQ.width() / this.text.length;

I think it should be textPc.text.length to get the length of the text content.

how to i use select option in script [duplicate]

im using script for dynamic adding row for table
but on of the option in my row should be in select from my database`
var items = 0;

function addItem(){
    items++;
    var html = "<tr>";
        html += "<td>" + items + "</td>";
        html += "<td><input class='form-control' name='machine[]' placeholder='machine'><td>";
        html += "<td><input class='form-control' name='meterstart[]' placeholder='meter start'><td>";
        html += "<td><input class='form-control' name='meterend[]' placeholder='meter end'><td>";
        html += "</tr>";

        document.getElementById("tbody").insertRow().innerHTML =  html;
}

`
this is my script

`
var items = 0;

function addItem(){
    items++;
    var html = "<tr>";
        html += "<td>" + items + "</td>";
        html += "<select class="form-control" name="machine" required="true">
                                        <option selected hidden>select machine</option>
                                        <?php 
                                        if($machine_list_result->num_rows > 0){
                                        while($mac = $machine_list_result->fetch_array()){
                                        ?>
                                        <option value="<?php echo $mac['id']; ?>" ><?php echo $mac['model']." -".$mac['machinenumber']; ?></option>
                                         <?php
                                            }
                                            }
                                        ?>
                                    </select>";
        html += "<td><input class='form-control' name='meterstart[]' placeholder='meter start'><td>";
        html += "<td><input class='form-control' name='meterend[]' placeholder='meter end'><td>";
        html += "</tr>";

        document.getElementById("tbody").insertRow().innerHTML =  html;
}

`

this what im trying to achieve

Error in changing the front-end department from website to application

i am a new member and i start by building a e-commerce website in order to gain experience. My steps had been followed the video of personally making an e-commerce website, but I have some troubles when changing from website layout to application one. I used the extension “Live Server” and when i finished the code “@media” and changed it into application layout, it didn’t change anything. The difference between my project and the one in the tutorial video is the error in console: “Could not establish connection. Receiving end does not exist.”. It made me unable to do the next step, and i couldn’t understand the problems.

I hope that someone will help me solve this problem and give me some clear explanation in order to improve my knowledge 🙁
Thanks very much.

anime.js elements enter from bottom and animate vertically up out of viewport

Using anime.js how can targeted DOM elements be animated to enter the viewport from the bottom, move vertically upward, and exit the viewport off the top? Is a timeline required or a simple anime() call would suffice?

For example, see the iOS chat bubble animation at the bottom of this page. This example is built with Framer Motion. What is the equivalent in anime.js?