Need assistance with adding custom cursor fluid animation effect to my website

I have tried to install this custom cursor fluid animation webgl effect: https://paveldogreat.github.io/WebGL-Fluid-Simulation/ to my website: www.geldmetai.nl. I used code snippets and it kind of works. Here are some screenshots to my exact settings: https://imgur.com/a/9AVkwUz I have activated all snippets and set auto insert to the site wide body.

However the script seems to be running on their canvas, instead of my website. I was wondering if anyone here knew of a way to fix this?

I have tried to install the scripts in a plugin named code snippets. It seems to be running to some extent. I hoped that it would change my sites cursor, unfortunately it only seems to be working at their canvas, instead of my website.

discord.js v14 private voice channels

Where could I be wrong? I have been trying to get it working for several hours, but to no avail, the code does not work. Can anyone help with this?

const { Client, Collection, ChannelType, GatewayIntentBits } = require("discord.js");

const client = new Client({
    intents: [
        GatewayIntentBits.Guilds,
        GatewayIntentBits.GuildMessages,
        GatewayIntentBits.MessageContent,
        GatewayIntentBits.GuildMembers,
        GatewayIntentBits.GuildVoiceStates,
    ],
});

client.on("voiceStateUpdate",(oldUser,newUser)=>{
    var categoryid = "1081228230321087824";
    var channelid = "103284326182943242";
    
    if(newUser.channel?.id == channelid){
       newState.guild.channels.create(`${newUser.member.user.username}'s channel`,{
            name: "voice-${user.username}",
            type: ChannelType.GuildText,
            parent: categoryid,
            permissionOverwrites:[{
                id: newUser.member.id,
                allow: ["MANAGE_CHANNELS"]
            },{
                id: newUser.guild.id,
                deny:["MANAGE_CHANNELS"]
            }] 
        }).then(channel=>{
            newUser.setChannel(channel)
            channel.createInvite({
                maxAge:0,
                maxUses:0
            })
        })
    } 
    if(oldUser.channel?.id != channelid && oldUser.channel?.parent?.id == categoryid && !oldUser.channel?.members.size) oldUser.channel.delete();
})

Nothing happens at startup, even errors in the logs do not appear.

Passing UTF-16 Japanese string from C# to Webbrowser control hosted in a form

This is work related.
We have a product which supports multiple languages, among them is Japanese.
The problem is that we have a module which is a browser control inside a windows form and when it gets the Japanese text from the C# side, an “Invalid characters” error shows in the log.

Basically the flow is:
C# has a JSON object that contains Japanese text.
Although the JSON appear to be invalid in text editor, it is a valid JSON when checking programmatically.

The object is being passed to the javascript from the C# using:

var plainTextBytes = System.Text.Encoding.Unicode.GetBytes(msg);
            var msgB64 = System.Convert.ToBase64String(plainTextBytes);

            if (msgB64 != "")
            {
                object[] init_args = { msgB64 };
                mForm.GetWebBrowser().Document.InvokeScript("dispatcher", init_args);
            }

Then on the javascript side the encoded text is being decoded as follows:

function dispatcher(message) {
  var decodedString = Base64.decode(message);
var result = "";
for (var i = 0; i < decodedString.length; i += 2) {
  result += String.fromCharCode(decodedString.charCodeAt(i) + (decodedString.charCodeAt(i + 1) << 8));
}

The reason for that is because this is IE running the JS in the background.

This code is just me trying to solve the Japanese issue , so I added the encode in Unicode and the odd code on the JS side.

But still, some strings break and I get “invalid characters” error for the JS side, probably when it tries to JSON.parse it.

Please no suggestion to change infrastructure/webview2 etc..

Thank you!

How can I bind my own input box with the quill editor in Vue so that the toolbar will format the text?

To my knowldge I only have to provide the reference of my input box to the quill constructor, but it”s not working.

Here’s the code I have been trying since yesterday.

<template>
<textarea ref="editor"></textarea>
</template>

export default{
    data(){
        editorOption: {
        modules: {
          toolbar: [["bold", "italic", { list: "ordered" }, { list: "bullet" }]
       }
     }
    }
mounted(){
    new Quill(this.$ref.editor,this.editorOption)
}
}

Javac JavBasics.Java code is not working after changing environment variable also

showing javac : The term ‘javac’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name,
or if a path was included, verify that the path is correct and try again.
At line:1 char:1

  • javac JavaBasics.Java
  •   + CategoryInfo          : ObjectNotFound: (javac:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    

please suggest .

i discovered changing environnment variable and trying to import java utikl biut still showing this.

Using declared variables to write HTML file with Cypess

I am writing a script which searches for any images in Shutterstock with a given search data. I’ve made a minimal reproducible example which opens the first found image. My purpose is to open a number of found images and grab some data from their pages (let’s say, image name).

Throughout the test I need to collect these names for different images to any kind of array and then write them to HTML file. Below is the code. I am an absolute beginner in HTML, so maybe the solution is pretty obvious. I don’t understand how I can use previously declared variables in HTML code which is hardcoded and passed to cy.writeFile() function or maybe there’s another solution?

describe('htmlTest', () => {
  it('htmlTest', () => {
    cy.visit('https://www.shutterstock.com');
    // Accept cookies if there's a popup
    cy.get('body').then(($parent) => {
      if ($parent.find('.ot-sdk-row').length > 0) {
        cy.get('#onetrust-accept-btn-handler').click();
      }
    });
    //Type in search data
    cy.get('.MuiFormControl-root > .MuiInputBase-root')
      .click()
      .type('3d character');
    cy.get('.mui-ukg7ay-searchBarButtons > .MuiButtonBase-root').click();
    cy.wait(5000);
    cy.get('[data-automation="AssetGrids_GridItemContainer_div"]')
      .first()
      .children()
      .eq(0)
      .invoke('attr', 'href')
      .then(($assetUrl) => {
        var link = Cypress.config('baseUrl') + $assetUrl;
        cy.visit(link);
      });

    cy.get('.MuiTypography-root MuiTypography-body1 mui-t63b03-bold').then(
      (label) => {
        const assetName = label.text(); // The name of opened image
        cy.writeFile('cypress/report/test.html', '<div>hello</div>');
      }
    );
  });
});

Issue extracting coordinates from Google Maps DrawingManager overlay

I am trying to extract coordinates from a custom Google Maps overlay to check whether a location is within the drawn geofence. Unfortunately, since it is not a polygon object, I cannot simply call the containsLocation method. I tried calling getSource() on the DrawingManager object, but am getting an error that the method is not defined… And have been trying whatever possible to get the coordinates from the overlay to call containsLocation() on creating a new polygon object to access the method.

If anyone has advice on how I am calling the methods incorrectly to be receiving an error that getSource() is not a valid function for drawingManager and/or e.

let _myPolygon, coords; 

/*
* other code goes here
*/

//add option inside to create button listener for draw geofence button.
 drawGeofenceButton.addEventListener("click", () =>{

    //ensure we can get rid of the old geofence
        if(tri != null && tri != undefined){
            tri.setMap(null);
        }
                       
            drawingManager = new google.maps.drawing.DrawingManager({
                drawingMode: google.maps.drawing.OverlayType.POLYGON,
                drawingControl: true,
                drawingControlOptions: {
                    drawingModes: [
                        google.maps.drawing.OverlayType.POLYGON,
                    ]
                },
                circleOptions: {
                    fillColor: '#FF0000',
                    fillOpacity: 0.6,
                    strokeWeight: 3,
                    clickable: true,
                    editable: true,
                    zIndex: 1
                },
                polygonOptions: {
                    fillColor: '#FF0000',
                    fillOpacity: 0.6,
                    strokeWeight: 3,
                    clickable: true,
                    editable: true,
                    zIndex: 1
                    },
                                      
                });
            drawingManager.setMap(map);
            google.maps.event.addListener(drawingManager, 'overlaycomplete', function(e) {
                _myPolygon = e.overlay;
                //get coordinates of the overlay and store them

                //have tried drawingManager.getPath()
                coords = (e.getPath().getArray());

            });

 

            /**
         * Listener for whether a point is inside the geofence
         */
        google.maps.event.addListener(map, "click", (e) => {

           
            //create a polygon object to compare to
            let my_geofence =  new google.maps.Polygon({
                paths: coords,
                strokeColor: "#FF0000",
                strokeOpacity: 0.8,
                strokeWeight: 3,
                fillColor: "#FF0000",
                fillOpacity: 0.35,
                editable: true
              });

              //check if the point clicked is inside the geofence
            const isInside = google.maps.geometry.poly.containsLocation(
                e.latLng,
                my_geofence
              ) ? true
              : false;

              if(isInside){
                alert("Point inside geofence.");
            } else {
                alert("Point not inside geofence.");
            }
        });
       
        });
        

CSS: Background animation on link hover

I want to add an hover effect to my links like this one: https://codyhouse.co/ds/components/app/related-articles

I’m using the following CSS code for that:

a.headline h3:hover {
    background-size: 100% 100%;
}
a.headline h3 {
    color: $body-color;
    background-repeat: no-repeat;
    background-image: linear-gradient(transparent 50%, rgb(228, 227, 255));
    background-size: 0% 100%;
    will-change: background-size;
    transition: background-size 0.3s ease-in-out;
}

Unfortunately the result is not the same as in the example.
Is there some kind of JS code or is there an error in my CSS?

Here’s a working demo: https://codepen.io/cray_code/pen/poOQJjX

How to modify turborepo build command to only rebuild specific Next.js application based on latest commit?

I have a question about using turborepo with Next.js. I have two applications in my repository’s apps folder, called web and docs. I am deploying them separately application on Vercel, but I am facing an issue where whenever I commit something in the web repository, both applications are rebuilt. I want to modify the build command to only rebuild the application that has changed or its dependencies.

The command I am currently using for building the project on Vercel is:

cd ../.. && npx turbo run build --scope=web --no-deps --include-dependencies

How can I modify this command to only rebuild the relevant application and its dependencies based on the latest commit? Any help would be appreciated.

Why variable i is considered undefined inside the for.. loop?

I’m new to Javascript. I’m trying to build a function which, given a number, return the number in the Fibonacci sequence, in the position of the number given.

For Example:

fibonacci(4) // returns the 4th member of the series: 3 (1, 1, 2, 3).

To achieve that I’m using a for loop like the code below:

const fibonacci = function(num) {
    let vet=[1,1];
    for(let i=2;i<=num;i++);{
       vet.push(vet[i-1]+vet[i-2]);
    }
    return vet[num-1];
};
console.log(fibonacci(15))

The problem is that when i call the function, I receive a reference error saying: i is not defined.
Can anyone help me understanding this?

Thank you so much

My expectation is

fibonacci(4)= 3;
fibonacci(6)=8;
fibonacci(10)=55;
etc. etc.

Creation of Task through ShellExecute fails

I am running a javascript to schedule as task in the machine where the script is run. I have tested that if I run cmd as administrator, I can create the task using the command below :

schtasks /create /XML " + installApp + " /tn AdPlayerKiller

where installApp is the path of the XML used to create the task.

Now to automate this I have js function as below :

function RunTaskCreator(appPath, scriptName)
{
    var installApp = appPath + scriptName;
    
    var cmdLine = "schtasks /create /XML " + installApp + " /tn AdPlayerKiller"
    var oShell = CreateObject("Shell.Application");
    oShell.ShellExecute("cmd.exe","runas","", cmdLine,0);
    
    return true;
}

This function executes but the task is never created. Is there something wrong with the definition of the js function?

How do i get headers using redux toolkit query

In a react app, i’m using RTKQ to access my endpoints(django), in a login endpoint, it returns access and refresh token which im saving in an auth slice. The problem is, I also want to get an x-csrftoken from the headers because I need that token to send to the backend when hitting refresh endpoint. When using axios, I’m getting the headers from the backend, but when using RTK Query, the headers in the meta are empty. headers available when using axios

headers empty when using rtkq

Here is how i’m accessing the endpoints, specifically the login endpoint

import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
import { setCredentials, setCSRFToken, logOut } from '../../features/auth/authSlice'


const baseQuery = fetchBaseQuery({
    baseUrl: 'http://127.0.0.1:8000/api',
    credentials: 'include',
    prepareHeaders: (headers, { getState }) => {
        const token = getState().auth.token

        if (token) {
            headers.set("Authorization", `Bearer ${token}`)
        }

        return headers
    },
})

const baseQueryWithReauth = async (args, api, extraOptions) => {

    const result = await baseQuery(args, api, extraOptions);
    const xcsrftoken = result.meta.response.headers['x-csrftoken'];
    if (xcsrftoken) {
        api.dispatch(setCSRFToken(xcsrftoken));
    }

    return result
}



export const apiSlice = createApi({
    baseQuery: baseQueryWithReauth,
    endpoints: builder => ({})
})

when i log the result, i only get the data(access and refresh tokens) but no headers.

then I access the login endpoint.

import { apiSlice } from "../../app/api/apiSlice";

export const authApiSlice = apiSlice.injectEndpoints({
    endpoints: builder => ({
        login: builder.mutation({
            query: credentials => ({
                url: '/auth/login',
                method: 'POST',
                body: credentials,
                headers: {
                    "Content-Type": "application/json"
                },
            }),
        }),
    })
})




export const {
    useLoginMutation
} = authApiSlice;

i’m very new to RTKQ, anyone with a solution?

How do i make a JavaScript event run on page load?

Im new to JS and replicated this effect according to a showcase of it that i saw which is supposed to “glitch” the text on hover and then make it go back to the original text.
This works by using .onmouseover and running the event after that. I tried changing this to .onload but then it wont run the animation/effect and i can’t figure out why it does not work.

Here is my code:

const symbols = "ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789"


document.getElementById("load-text").onmouseover = event => {
    let iterations = 0

   const interval = setInterval(() => {
    event.target.innerText = event.target.innerText.split("")
    .map((letter, index) => {
        if (index < iterations) {
            return event.target.dataset.value[index];
        }
        
        return symbols[Math.floor(Math.random() * 35)]
   })
    .join("");

    if(iterations >= event.target.dataset.value.length) clearInterval(interval);

    iterations += 1 / 6;
}, 30);
}
body {   
    height: 100vh;
    width: 100vw;
    margin: 0;
    overflow: hidden;
    display: flex;
    background-color: #121012;
    justify-content: center;
}
.loader{
    margin-top: 40vh;
    color: #EEEEEE;
    font-family: monospace;
    font-size: 30pt;

}
<div class="loader">
    <p id="load-text" data-value="LOADER"> LOADER </p>
</div>
    <script src="project.js"></script>

(code pen: https://codepen.io/Tesked/pen/ExedNQX)

I have tried using possible solutions in this thread
How do I call a JavaScript function on page load?
but none of them seem to work, the event still doesn’t fire unless i add the .onmouseover Where it works as it is intended to.

The idea here is to use this as a “loading screen” of sort that will do the glitch effect and then fade in the rest of the page, though this is a problem for another time.

‘https://apiv2.shiprocket.in/v1/external/auth/login’ from origin ‘http://orthocareproducts.com’

enter image description hereenter image description here

Access to fetch at ‘https://apiv2.shiprocket.in/v1/external/auth/login’ from origin ‘http://orthocareproducts.com’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.

const loginToShipRocketSubmit = async (e) => {
e.preventDefault();

const datax = {
  email,
  password'
}
let sd = {};

fetch("https://apiv2.shiprocket.in/v1/external/auth/login", {
  method: 'POST',
  headers: {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    'Access-Control-Allow-Origin': '*',
    'Sec-Fetch-Site': 'cross-site',
    'Sec-Fetch-Mode': 'no-cors',
    'Mode': 'no-cors'
  },
  body: JSON.stringify(datax),
})
  .then((response) => response.json())
  .then((data) => {
    sd = data;
    console.log(data);
  })
  .catch((error) => {
    console.error("Error:", error);
  });

const x_data = sd ? sd : null
window.sessionStorage.setItem("ship_data", JSON.stringify(x_data));

};