how to use vue 3 globalProperties templet for filter string?

<template>
  <h1>HOOKS</h1>
  <table>
    <tr>
      <th>userId</th>
      <th>id</th>
      <th>title</th>
      <th>body</th>
    </tr>
    <tr v-for="(data, index) in GetDatas" :key="index">
      <td>{{ data.userId }}</td>
      <td>{{ data.id }}</td>
      <td>{{ data.title | snap }}</td>
      <td>{{ data.body }}</td>
    </tr>
  </table>
</template>

main.js

import './assets/main.css'

import { createApp } from 'vue';
import App from './App.vue';

const app = createApp(App);

app.config.globalProperties.$filters = {
  snap(val) {
    if (!val || typeof val !== 'string') return "";
    return val.slice(0, 5);
  }
};

app.mount('#app');

here global function in main js for filter my content slice but i get 0 value in that content in <td>{{ data.title | snap }}</td> what is the reason for its? im miss any this here

if (val === null || val === undefined || typeof val !== 'string') i useed this too but same result

Integrating Roblox CAPTCHA into External Websites for solving

I needed some help to integrate Roblox CAPTCHA verification into an external website, much like how services such as 2Captcha operate. The aim is to the solving of Roblox CAPTCHAs through a real human from external website

<html>

<head>
    <script src="https://client-api.arkoselabs.com/v2/476068BF-9607-4799-B53D-966BE98E2B81/api.js"
        data-callback="render" async defer></script>
    <script>
        function render(enforcement) {
            enforcement.setConfig({
                selector: ".fun-captcha",
                onCompleted: (response) => {
                    window.captchaSolved = true;
                },
                mode: "inline"
            });
        }
    </script>
    <style>
        body {
            justify-content: center;
            align-items: center;
            display: flex;
        }
    </style>
</head>

<body>
    <div>
        <div class="fun-captcha"></div>
    </div>
</body>

</html>

It responses with

{"error":"DENIED ACCESS"}

Microdot or Flask with Fetch without Then()

My program works the way I want it to, but I like to understand what I’m doing

Hi,
I opened a discussion on the Micropython forum (https://github.com/orgs/micropython/discussions/13529) and another on a French Python forum (https://www.developpez.net/forums/d2161662/autres-langages/python/general-python/flask-fetch/) which did not give me a satisfactory answer.
My question is: what does the fetch() command do, without then()?
How does it interact with Flask or Microdot?
Most of the answers were that I should read the documentation, which I did. But I couldn’t find anything about this particular case.
The program in question is in micropython/microdot on the first forum and in python/flask on the second.
I think I’m finally on the right forum to have a clear explanation.
Thanks in advance

Trouble Detecting Method/Properites Typos in VSCode

I recently started working with web development using Visual Studio Code, coming from a Java background where typos in method/Property names would be immediately flagged as errors in my IDE (Eclipse). However, I’ve noticed that when working with Js/jQuery in VSCode, typos in method names don’t seem to trigger any error.

I tested some extensions and searched around, but couldn’t find a solution.

For instance, if I write:

$("h1").textersr(event.key);

Instead of:

$("h1").text(event.key);

VSCode doesn’t flag this as an error. Is there a way to get VSCode to catch these typos? I want something like Eclipse’s error detection in VSCode. Any help is appreciated!

Does it make sense to create worker.js to handle promises?

I am building an electron app that allows the user to load font files from their local drive as FontFace instances or to FontFace. In some cases, there will be tens of thousands of files and therefore promises. When even a small portion of such a large number of promises are rejected for one reason or another, it hangs the application. In researching how to address this, I came across, among many other potential solutions, the idea of using workers. Because promises are asynchronous already, does it make sense to create a worker to merely handle the promises?

// renderer.js

myAPI.onFontListReady(jsonFontList => {

  const worker = new Worker('worker.js');

  jsonFontList.forEach(objFontData => {
    worker.postMessage({
      command: 'load and render',
      objFontData: objFontData
    })


// worker.js

addEventListener('message', message => {
  if (message.data.command === 'load and render')
    loadAndRender(message.data.objFontData)
})

function loadAndRender(objFontData) {
  const
    ff = new FontFace(`_${objFontData.newFileName}`, `url('${objFontData.newFilePath.replace(/\/g, '/')}')`)
  ff.load()
  .then(
    () => {
      document.fonts.add(ff)
      postMessage([objFontData])
    },
    error => {
      console.error('ERROR LOADING @FONT-FACE:', error)
      postMessage([objFontData, 'error'])
    }
  )
}

Razorpay Subscriptions API item price can not be set

I am using RazorPay API to create Subscription plans. Now, I am facing this error :

When I add item amount in number it sends me error : Amount should be atleast 0.10 USD , https://prnt.sc/Gh9wWm363szh
When I add item amount in decimal it sends me error : Amount should be integer : https://prnt.sc/x6toKYCvF3vj

code :

try{
  const data = await razorpay.items.create(body);
  res.status(200).send(data);
}catch(err){
  console.log(err);
  res.status(400).send({
    message:err?.error?.description
  });
}

any help.
screenshots from API calls .

all files are send, except images taken by camera on mobile

Im new in to webdevelopment,
I have a contact form that in principal works. If I select files through folder selection (.jpg, .jpeg, .png) there is no problem with sending the images to reciever.

The problem pops up when using mobile,

If the user selects the camera function to make a photo to be send, This image is not send.

My js validation checks on size and file type before sending and blocks the send if there is something wrong.

Wierd thing is: Sometimes, I mean sometimes, on a newer phone, the created photo is send the first time after filling the contact form in, if the same user, with the same phone, fill the form in for a second time, the image is not send.

sorry comments are Dutch
HTML

 <div class="file-upload-container">

                            <!-- File Upload 1 -->
                            <label for="fileUpload1" data-lang="contact-form-11">Bestand 1:</label>
                            <input type="file" id="fileUpload1" name="fileUpload1" capture="environment"
                                accept=".jpg, .jpeg, .png, .pdf, .doc, .docx">
                            <span id="fileUpload1Name"></span> <!-- Span to display the uploaded file name -->

                            <!-- File Upload 2 -->
                            <label for="fileUpload2" data-lang="contact-form-12">Bestand 2:</label>
                            <input type="file" id="fileUpload2" name="fileUpload2" capture="environment"
                                accept=".jpg, .jpeg, .png, .pdf, .doc, .docx">
                            <span id="fileUpload2Name"></span> <!-- Span to display the uploaded file name -->
                        </div>

JS validation


function validateContactForm() {
    let naam = document.getElementById("name").value;
    let email = document.getElementById("email").value;
    let bericht = document.getElementById("message").value;
    let contactReasons = document.querySelectorAll('input[name="contact_reason"]');
    let isValid = true;
    let errorMessage = '';

    // Vorige foutmeldingen wissen
    document.getElementById("formInputErrorDisplay").innerHTML = '';

    // Naam validatie
    if (naam.trim() === "") {
        errorMessage += getErrorMessage("naamRequired") + "<br>";
        isValid = false;
    }

    // E-mail validatie
    let emailRegex = /^[^s@]+@[^s@]+.[^s@]+$/;
    if (!emailRegex.test(email)) {
        errorMessage += getErrorMessage("invalidEmail") + "<br>";
        isValid = false;
    }

    // Bericht validatie
    if (bericht.trim().length < 100 || bericht.trim().length > 2500) {
        errorMessage += getErrorMessage("messageLength") + "<br>";
        isValid = false;
    }

    // Radio buttons validatie
let isReasonSelected = Array.from(contactReasons).some(radio => radio.checked);
if (!isReasonSelected) {
    errorMessage += getErrorMessage("reasonRequired") + "<br>";
    isValid = false;
}


     // Bestanden validatie
     let bestandsGrootteLimiet = 5242880; // 5MB
     for (let i = 1; i <= 2; i++) {
         let fileUpload = document.getElementById(`fileUpload${i}`);
         if (fileUpload && fileUpload.files.length > 0) {
             let file = fileUpload.files[0];
             if (file.size > bestandsGrootteLimiet) {
                 errorMessage += getErrorMessage("fileTooLarge", {i}) + "<br>";
                 isValid = false;
             }
             if (!['image/jpeg', 'image/png', 'application/pdf', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'].includes(file.type)) {
                 errorMessage += getErrorMessage("invalidFileType", { i }) + "<br>";
                 isValid = false;
                 }
                 }
                 }


       
                 

    // Foutmeldingen weergeven in het div-element
if (!isValid) {
    document.getElementById("formInputErrorDisplay").innerHTML = errorMessage;
}

return isValid;
}

// Event listener toevoegen aan het formulier
document.getElementById("contact_form").addEventListener("submit", function(event) {
if (!validateContactForm()) {
event.preventDefault();
}
});

PHP

 // Bestandsverwerking en -upload
        for ($i = 1; $i <= 2; $i++) {
            $fileInputName = "fileUpload" . $i;
            if (isset($_FILES[$fileInputName]) && $_FILES[$fileInputName]['error'] == UPLOAD_ERR_OK) {
                // Bestandstype en -grootte validatie
                $allowedTypes = ['image/jpeg', 'image/png', 'application/pdf', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'];
                $maxSize = 5 * 1024 * 1024; // 5 MB
                $fileType = $_FILES[$fileInputName]['type'];
                $fileSize = $_FILES[$fileInputName]['size'];

                if (!in_array($fileType, $allowedTypes) || $fileSize > $maxSize) {
                    echo "Ongeldig bestandstype of bestandsgrootte voor bestand $i.<br>";
                    continue;
                }

                // Generate unique file name to prevent duplicates
                $fileExt = pathinfo($_FILES[$fileInputName]['name'], PATHINFO_EXTENSION);
                $newFileName = uniqid("upload_", true) . '.' . $fileExt;
                $target_dir = "../../../back-end/uploads/";
                $target_file = $target_dir . $newFileName;

                // Bestandsupload
                if (move_uploaded_file($_FILES[$fileInputName]["tmp_name"], $target_file)) {
                    $bestanden[] = $target_file;
                    // Logboekbericht
                    $logMessage = "[" . date("d-m-Y H:i:s") . "] Bestand ge&#1043;&#1112;pload: " . $newFileName .
                                  " door " . $email . 
                                  ", Grootte: " . filesize($target_file) . " bytesn";
                    writeToLog($logMessage, $email);
                } else {
                    echo "Er was een probleem met het uploaden van bestand $i.<br>";
                }
            }
        }

as a mailer I use the latest version of PHPmailer.

What am I missing?

I do not know where to go next.

Chirpy theme with jekyll picture is not uploading

use the chirpy theme, and i have this problem i opened a new folder named ‘images’, and on my markdown editor I see the picture perfectly, but on my site, i see it like this

enter image description here

and its not loading it…
any suggestions?
i tried to put an image from online, it did work but when i click on it it does not pop up nicely as it should (getting biger on the website layout it self, and clicking out side the picture getting you back the the post), it just opens the site that the picture is from…
thank you very much~ i looked on it on the console and i got error ‘403’.
thank you very much~

What i tried:
i tried to look at the picture in ‘inspect’ in google chrome, and look at the part of the code for the picture and change it some how in my own code, with no luck.

I Want to get Next Element from Mixed List of Other Tag

I’m making a side bar of my website where I make next button for next page but it will not work if any other tag come.

I tried this, It is working well but after 5th Link it is not fetching sixth element. it is fetching heading class tag and return null

<div class="sidebar">
    <li class="heading">Topic 1</li>
        <li><a href="#">Link1</a></li>
        <li><a href="#">Link2</a></li>
        <li><a href="#">Link3</a></li>
        <li><a href="#">Link4</a></li>
        <li><a href="#" class ="active">Link5</a></li>

    <li class="heading">Topic 2</li>
        <li><a href="#">Link6</a></li>
        <li><a href="#">Link7</a></li>
        <li><a href="#">Link8</a></li>
        <li><a href="#">Link9</a></li>
        <li><a href="#">Link10</a></li>

    <li class="heading">Topic 3</li>
        <li><a href="#">Link11</a></li>
        <li><a href="#">Link12</a></li>
        <li><a href="#">Link13</a></li>
        <li><a href="#">Link14</a></li>
        <li><a href="#">Link15</a></li>
</div>
 function nextpage() {
    var x = document.getElementById("active").parentElement.nextElementSibling.firstElementChild; 
    document.getElementById("next").href = x;
  }

I’m trying to create a SPA based React website with Vite, but nothing is rendering, the page just shows a blank page. How can I fix my vite config?

As the title states, I’m currently trying to create a react website with the use of Vite, but for some reason no matter what I do or try, nothing renders on the page. I’ve tried removing the use of react-router-dom and directly render the Home file, but no luck. Does anyone have any ideas? It seems to render the index.html just fine, but doesn’t render my jsx files.

./src/app.jsx

import ReactDOM from 'react-dom/client';
import { HashRouter, Routes, Route } from 'react-router-dom';
import '../index.css';
import Home from './Pages/Homepage/homepage.jsx';

function App() {
  return (
    <Routes>
      <Route path="/" element={<Home />} />
    </Routes>
  );
}

const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(
  <React.StrictMode>
    <HashRouter>
      <App />
    </HashRouter>
  </React.StrictMode>
);

./src/Pages/Homepage/homepage.jsx
import React from 'react';
import valentinesGif from '../../../Dependencies/saintvalentineday.gif';
import './homepage.css';

function Home() {
  return (
    <div className="home-container">
      <img src={valentinesGif} alt="Valentine's Day" className="centered-gif" />
      <div className="button-container">
        <button>Button 1</button>
        <button>Button 2</button>
      </div>
    </div>
  );
}

export default Home;

vite.config.js
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { resolve } from 'path';

export default defineConfig({
  plugins: [react()],
  resolve: {
    alias: {
      '@': resolve(__dirname, 'src'),
    },
  },
  server: {
    strictPort: true,
    port: 8888,
    open: true,
  },
});

index.html (root)
<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Testing</title>
    <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&display=swap" rel="stylesheet">
    <script src="https://kit.fontawesome.com/6483512793.js" crossorigin="anonymous"></script>
  <body>
    <div id="root"></div>
  </body>
</html>

Is there any way to get real client ip?

I want to know how to get real client ip. Any useful tool or site? Can anyone help me?

I’ve found some useful site like SecurityTrails and Censys, but I don’t how to use them, and I don’t know what information can I get from them.

Something is causing a ram leak and I can’t figure it out

    <style>
        #notes {
            width: 300px;
            height: 200px;
            background: rgba(255, 255, 255, 0.8);
            border: 1px solid #ccc;
            padding: 10px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
            overflow: auto;
            font-family: Arial, sans-serif;
            font-size: 16px;
            line-height: 1.5;
            color: #333;
            position: fixed;
            resize: both;
            cursor: grab;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
        }
    </style>


<textarea id="notes"></textarea>
<!Notepad Positional Resize Data!>
<script>
  // Global db connection
  let dbConnection = null;
  let contentSizeInBytes = 0;

  // Initialize the broadcast channel
  const broadcast = new BroadcastChannel('note_updates');

  // Get the notes element
  const notes = document.getElementById('notes');

  // Debounce function to throttle the number of operations
  function debounce(func, timeout = 300) {
    let timer;
    return (...args) => {
      clearTimeout(timer);
      timer = setTimeout(() => { func.apply(this, args); }, timeout);
    };
  }

  // Function to open a connection to the IndexedDB
  function initDB(callback) {
    if (dbConnection) {
      callback(dbConnection);
      return;
    }
    const request = indexedDB.open('notesDB', 2);
    request.onupgradeneeded = function(event) {
      const db = event.target.result;
      if (!db.objectStoreNames.contains('notes')) {
        db.createObjectStore('notes', { keyPath: 'id' });
      }
    };
    request.onsuccess = function(event) {
      dbConnection = event.target.result;
      callback(dbConnection);
    };
    request.onerror = function(event) {
      console.error('Database error:', event.target.error);
    };
  }
  // Function to save a note to the IndexedDB
  function saveNote(content, position, size) {
    initDB(function(db) {
      const transaction = db.transaction('notes', 'readwrite');
      const objectStore = transaction.objectStore('notes');
      objectStore.put({ id: 'singleNote', content, position, size });
    });
  }

  // Function to load a note from the IndexedDB
  function loadNote() {
    initDB(function(db) {
      const transaction = db.transaction('notes', 'readonly');
      const objectStore = transaction.objectStore('notes');
      const request = objectStore.get('singleNote');
      request.onsuccess = function(event) {
        const data = event.target.result;
        if (data) {
          notes.value = data.content;
          notes.style.top = data.position.top;
          notes.style.left = data.position.left;
          notes.style.width = data.size.width;
          notes.style.height = data.size.height;
        }
      };
    });
  }
  // Function to update the content size in bytes
  function updateContentSize(newContent) {
    contentSizeInBytes = new Blob([newContent]).size;
    checkMemoryUsage();
  }

 // Function to check the memory usage of the notepad
  function checkMemoryUsage() {
    const sizeInMegabytes = contentSizeInBytes / (1024 * 1024);
    console.log(`Estimated notepad size: ${sizeInMegabytes.toFixed(2)} MB`);
    if (sizeInMegabytes >= 10) {
      console.log('Notepad size exceeds 10 MB. Initiating clear.');
      clearNotepad();
    } else {
      console.log('Notepad size within limit. No action taken.');
    }
  }

  // Function to clear the notepad content
  function clearNotepad() {
    notes.value = '';
    contentSizeInBytes = 0; // Reset the content size
    const position = { top: '50%', left: '50%' };
    const size = { width: '300px', height: '200px' };
    saveNote('', position, size);
    broadcast.postMessage({ content: '', position, size });
    console.log('Notepad content cleared and reset to default size and position.');
  }


 // Event listener for input, debounced
  notes.addEventListener('input', debounce(function() {
    const position = { top: notes.style.top, left: notes.style.left };
    const size = { width: notes.style.width, height: notes.style.height };
    updateContentSize(notes.value);
    saveNote(notes.value, position, size);
  }));

  // Function to remove all event listeners if needed
  function removeAllListeners() {
    notes.removeEventListener('input', debounce);
  }

  const debouncedSaveNote = debounce((content, position, size) => {
      saveNote(content, position, size);
  });
  
    function RETURN() {
        const centerX = (window.innerWidth - notes.offsetWidth) / 2;
        const centerY = (window.innerHeight - notes.offsetHeight) / 2;
        notes.style.left = `${centerX}px`;
        notes.style.top = `${centerY}px`;
        const position = { top: `${centerY}px`, left: `${centerX}px` };
        const size = { width: notes.style.width, height: notes.style.height };
        saveNote(notes.value, position, size);
        console.log('Notepad reset to center position.');
    }


    window.RETURN = RETURN;
    // Prevent the context menu on right-click
    notes.addEventListener('contextmenu', function(event) {
        event.preventDefault();
    });
    window.addEventListener('resize', function() {
    const size = { width: notes.style.width, height: notes.style.height };
    saveNote(notes.value, { top: notes.style.top, left: notes.style.left }, size);
});

    // Update the notepad size and position upon mouseup
    notes.addEventListener('mouseup', function() {
        const position = { top: notes.style.top, left: notes.style.left };
        const size = { width: notes.style.width, height: notes.style.height };
        saveNote(notes.value, position, size);
    });
    // Right-click drag functionality
    notes.addEventListener('mousedown', function(event) {
        if (event.button === 2) {
            event.preventDefault();
            let startPos = { x: event.clientX, y: event.clientY };

            const onMove = function(moveEvent) {
                let newPos = {
                    x: notes.offsetLeft + (moveEvent.clientX - startPos.x),
                    y: notes.offsetTop + (moveEvent.clientY - startPos.y)
                };

                notes.style.left = `${newPos.x}px`;
                notes.style.top = `${newPos.y}px`;
                startPos = { x: moveEvent.clientX, y: moveEvent.clientY };
            };

            const onUp = function(upEvent) {
                document.removeEventListener('mousemove', onMove);
                document.removeEventListener('mouseup', onUp);
                saveNote(notes.value, { top: notes.style.top, left: notes.style.left }, { width: notes.style.width, height: notes.style.height });
            };

            document.addEventListener('mousemove', onMove);
            document.addEventListener('mouseup', onUp);
        }
    });

  // Ensure listeners are removed before the page unloads
  window.addEventListener('beforeunload', removeAllListeners);

  // Load the note when the window is fully loaded
  window.addEventListener('load', loadNote);
    </script>

When exceeding the 10mb limit a few times it will just not clear 50 – 100 mib of data and I can’t figure out why.

It should remove all the data in the notepad and the memory shoulddd be its own usage.
I dont know what else to add but stackoverflow is forcing me to put more details even though I dont have any more to share.
The leak
The expected

Cannot redeclare block-scoped variable ‘msg’ and let/const converts to var

I tried this piece of typescript code as I’m just starting and got this error Cannot redeclare block-scoped variable ‘msg’. I have only used let once and modified the variable how is it possible that modification of that variable leads to cannot redeclare error. I’m not using tsconfig.json here I know it resolves the issue but I want to know the reason of this can anyone please explain ?

enter image description here

Also for no reason, when I added a tsconfig.json file with es2017 as target, it still converts all let and const types to var types which should not occur if es6 is target.

Please See the screenshot
enter image description here