TypeError [ERR_INVALID_ARG_TYPE]: The “superCtor” argument must be of type function. Received undefined-javascript-node-mysql

Buenas tardes tengo un problema al utilizar express-mysql-session, llevo muy poco programando y me estaba guiando de un tutorial, seguí las indicaciones pero a el le resulto y a mi me dio este problema al conectarlo con la base de datos
este es el video el error apareció en el minuto 2:01:07

las dependencias

aquí importe lo que necesitaba

en si la parte del problema

este es el error que aparece completo

y el error me lleva a esta parte..

no entiendo cual es el error y les agradecería si me pudieran ayudar y explicar.

Estaba mirando por varias partes que decia que tenia que utilizar webpack otras que tenia que utilizar una version de node mas antigua, mas verdaderamente no entiendo el porque..

How to make a radio button with a submit button that redirects to another Local Html File

Continue
That is my code, and I want to redirect this to the value of each one.
Can someone tell me how to do it and provide me with the javascript code. Thanks

I tried everything I found and none of them worked

<input type="radio" onclick="Form()" name="userType" value="signup-customer.html" >Client</br><input type="radio" onclick="Form()" name="userType" value="signup-provider.html" >Provider</br
<input type="radio" onclick="Form()" name="userType" value="signup-supervisor.html" >Supervisor</br>

<script>
$(function(){
    $("form").submit(function(e) {
        e.preventDefault();
        window.location = $(this).find('input[type="radio"]:checked').val();
    });
});
</script>

Why is my useReducer state not updated after refresh API call in nextjs

I have a useContext state that I am using to store user token and I would like to update that state after axios interceptor function that calls my refresh token endpoint successfully. The state is like this
state = { in_memory: null}
I have a reducer function that I use to update it. It works well but doesn’t work on an api refresh call.
This is the reducer function:

 `case actionEnum.SET_IN_MEMORY_VARIABLE:
        return{
            ...state,
            in_memory: action.payload
        }
    `

How do I approach this method? Here is the code that I have but it is not updating the reducer state.
I am doing this on a Next.js application. I used same method in a Create React application and it worked. The idea that I would like to do is when the refresh endpoint is called, a new access token generated, the state.in_memory reducer state should be updated to be available across the app.

 const refreshToken = async()=>{   

    try {
      const res = await axios.post<axiosGetRefreshTokenAttributes>(`${BASE_URL}/refresh`, {}, {withCredentials: true});

      const accessToken = res?.data?.userToken
        dispatch({type: actionEnum.SET_IN_MEMORY_VARIABLE, payload: accessToken});//This was to update the reducer state with the new access token to be available globally

      return accessToken
    } catch (error) {
      return error
    } 
  }

 return refreshToken
 };

This is the axios interceptor code:

const useAxiosPrivate = () =>{

const refreshToken = RefreshFunction()
const {state, dispatch, setRevalidate, revalidate } = useContext(BookingContext);


useEffect(() =>{
 
    const requestInterceptors = axiosPrivate.interceptors.request.use(
        async config =>{
            if(!config.headers['authorization']){
              
                const turf = localStorage.getItem('turf')                    

                if(turf){
                    config.headers['authorization'] = `Bearer ${turf}`
                    config.withCredentials = true
                   
                   
                }
               
                
            }
            return config;
        }, (error) => Promise.reject(error)
    );

    const responseIntercept = axiosPrivate.interceptors.response.use(
        response => response,
        async (error)=>{
            const prevRequest = error?.config;
            console.log(error.response.status, 'kkk')
            if(error?.response.status === 401 && !prevRequest?.sent){
                prevRequest.sent = true;
                
                const getTurf = await refreshToken()
                
                 prevRequest.headers['authorization'] = `Bearer ${getTurf}`;
                
                 
                 return axiosPrivate(prevRequest);
                
               
            }
            return Promise.reject(error);
        }
    );
   
    return()=>{
        axiosPrivate.interceptors.request.eject(requestInterceptors)
        axiosPrivate.interceptors.response.eject(responseIntercept)
    }

  }, [state.in_memory, state.sessionPath])

 return axiosPrivate;   
  };
 export default useAxiosPrivate;

An example of an api call:

 await axiosPrivate.post(`/createcompany`, companyData,  {withCredentials: true, headers: 
  {Authorization: `${state?.in_memory}`}});

Socket.io Multiplayer Rooms – Deleting user data only when user leaves the entire domain

I am trying to create a lobby for a multiplayer game where players can join rooms similarly to how the game “Among Us” does it. My original approach included storing the “socket.id” of every player as they load into the website. However, when I eventually redirected them to a room, the id refreshed. To counter this issue, I began using cookies to store an id for every user. This works great, but there is one issue I cannot seem to fix.

I am looking for a way to trigger an event only when the user leaves the entire domain. It should not be triggered when the user is being redirected to a different website path under the same domain. I would like to use this in order to erase any data stored (their username and cookie id) in a server-side array that contains user data. The main reason for this is to make sure that the information about the user remains if they are just being redirected to another site.

I tried using the socket.io “disconnect” event, but the problem with that is not only does it fire even when redirecting between subpages, but it also restricts me from being able to pass the cookie id. I’ve also tried using an approach like “onbeforeunload”, but for whatever reason, the socket.emit is never received by the server, probably because the connection is disturbed before the request can be made. I also didn’t quite understand how to get and compare the target and current domain within the event function.

I’m not sure what code would be useful, but here is my glitch project if you want to take a look at it.

react-router-dom 5.3 the page doesn’t follow the path

I’m trying to make work the link in this navbar, I’ve checked if the paths are correct, they are because when I click on the link it actually change the address in the browser but it doesn’t redirect me to that page

this is the Navbar.js

import React from "react";
import "./Navbar.css";
import { Link } from "react-router-dom";

function Navbar() {
  return (
    <nav>
  
      <Link to="/" className="nav_logo">
        <img src={require("./logo.svg").default} alt="Hack4Pizza" />
      </Link>
      <div className="nav_right">
        <input className="nav_input" type="email" placeholder="Enter Email address" />

        <div className="nav_container">
          <div className="nav_passcontainer">
            <input className="nav_input" type="password" placeholder="Enter Password" />
            <Link to="/a">Forgot Password?</Link>
          </div>

          <Link to="/profile" className="nav_button">LOGIN</Link>
          <button className="nav_mobilebutton">SIGN UP</button>
        </div>
      </div>
    </nav>
  );
}

export default Navbar;

this is App.js


import './App.css';
import Home from "../Home/Home";
import Navbar from "../Navbar/Navbar";
import React from 'react';
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';
import Profile from '../Profile/Profile';

const App = () => {
  return (
    <Router>
      <Navbar />

      <Switch>
        <Route exact path="/" component={Home} />
        <Route path="/profile" component={Profile} />
      </Switch>
     </Router>
  );
};

export default App;

How do I include a wasm file compiled by golang in a chrome extension?

I’ve tried everything in here:

Golang to wasm compilation

And I can’t get past:

WebAssembly.instantiate(buffer, {wasi_snapshot_preview1: ""})
WebAssembly.instantiate(buffer, {go: {debug: ""}})

i.e. I get errors like:

Failed to load WebAssembly module: TypeError: WebAssembly.instantiate(): Import #0 module="wasi_snapshot_preview1" error: module is not an object or function

or module debug or runtime.resetMemoryDataView or everything in wasm_exec.js

But if I use the simple.wasm from:

https://github.com/inflatablegrade/Extension-with-WASM

it works! That wasm must have been compiled by c or rust and NOT golang? Is there a way to make this work from go?

P.S. that Extension-with-WASM is manifest 2.0 but I got it work with 3.0:

https://github.com/inflatablegrade/Extension-with-WASM/issues/1

How to Embed Telegram Channel in Blogger in 2023?

How to Embed Telegram Channel in Blogger in 2023?
I have created a Telegram Channel recently and i want to add it to my Blogger Website. What shoul I do?

I have tried many things that I can Embed my Telegram Channel into my Blogger Website. I just expecting that I wish I could do this

Is there any CSS code to show a text below the cursor if we hover and place it over for some time?

Many websites have a feature that when some box or image or any element is hovered and place on it for some time just below the cursor a text is shown (describes or tell that what that item is) . how can we make one like that ?

As I am new to web development I do not know whether its related to CSS or not . If yes I want a small explanation and code along demo image (if possible for the output) . Thank you .

Plotly: Javascript Error: Loading chunk 478 failed

With Dash installed, running plotly graph example at
https://plotly.com/python/network-graphs/ :

import plotly.graph_objects as go
import networkx as nx

# Create Edges

G = nx.random_geometric_graph(200, 0.125)
edge_x = []
edge_y = []
for edge in G.edges():
    x0, y0 = G.nodes[edge[0]]['pos']
    x1, y1 = G.nodes[edge[1]]['pos']
    edge_x.append(x0)
    edge_x.append(x1)
    edge_x.append(None)
    edge_y.append(y0)
    edge_y.append(y1)
    edge_y.append(None)

edge_trace = go.Scatter(
    x=edge_x, y=edge_y,
    line=dict(width=0.5, color='#888'),
    hoverinfo='none',
    mode='lines')

node_x = []
node_y = []
for node in G.nodes():
    x, y = G.nodes[node]['pos']
    node_x.append(x)
    node_y.append(y)

node_trace = go.Scatter(
    x=node_x, y=node_y,
    mode='markers',
    hoverinfo='text',
    marker=dict(
        showscale=True,
        # colorscale options
        #'Greys' | 'YlGnBu' | 'Greens' | 'YlOrRd' | 'Bluered' | 'RdBu' |
        #'Reds' | 'Blues' | 'Picnic' | 'Rainbow' | 'Portland' | 'Jet' |
        #'Hot' | 'Blackbody' | 'Earth' | 'Electric' | 'Viridis' |
        colorscale='YlGnBu',
        reversescale=True,
        color=[],
        size=10,
        colorbar=dict(
            thickness=15,
            title='Node Connections',
            xanchor='left',
            titleside='right'
        ),
        line_width=2))


# Color Node Points

node_adjacencies = []
node_text = []
for node, adjacencies in enumerate(G.adjacency()):
    node_adjacencies.append(len(adjacencies[1]))
    node_text.append('# of connections: '+str(len(adjacencies[1])))

node_trace.marker.color = node_adjacencies
node_trace.text = node_text

# Create Network Graph

fig = go.Figure(data=[edge_trace, node_trace],
             layout=go.Layout(
                title='<br>Network graph made with Python',
                titlefont_size=16,
                showlegend=False,
                hovermode='closest',
                margin=dict(b=20,l=5,r=5,t=40),
                annotations=[ dict(
                    text="Python code: <a href='https://plotly.com/ipython-notebooks/network-graphs/'> https://plotly.com/ipython-notebooks/network-graphs/</a>",
                    showarrow=False,
                    xref="paper", yref="paper",
                    x=0.005, y=-0.002 ) ],
                xaxis=dict(showgrid=False, zeroline=False, showticklabels=False),
                yaxis=dict(showgrid=False, zeroline=False, showticklabels=False))
                )
fig.show()

Results in error:

Javascript Error: Loading chunk 478 failed.
(error: http://localhost:8888/lab/extensions/jupyterlab-plotly/static/478.f9a7116e09cbfb956212.js?v=f9a7116e09cbfb956212)

What’s wrong?

Hiding and revealing animated content on a single page?

I am trying to make a website with content displayed in book form, page flipping animations for transitions between content. I know that there are java script programs for this such as turn.js, however I am not sure that they would support everything that I want to do. For each “page” of the content there are different svg pictures which are animated; I am not sure if this is supported.

Essentially, is there any way to show and hide content like I want without having to create an html file for each “page”? The sequence is kind of important and I would not want google to link to some random place as a result for my website. Thanks!

I think asking for help is probably better than searching for the answer for hours. I am relatively new to front-end development and would not know the answer if I saw it. sorry if this is the wrong forum.

JS function in React Native app now constantly ‘exits’ at different points

I’m working on an app in React Native for IOS which has one App.js with all the RN stuff and one helper.js with all the functions I call. There is this one complex function that calls on a bunch of other functions that I made, and it has to do with making several API calls, editing/parsing/analyzing text which takes 3 to 8 seconds on average. This was all working fine for months, but now there is issue after issue. They are independent issues at different steps of the process. The first one has to do with a request to turn a fetch response into text, which often didn’t work for large text for a few days, but now today it magically works. So even when the API stuff works, in the middle of the large function which calls everything else, when I am finally modifying some small arrays, changing text etc, with a TON of log statements to see where I am, almost every time it stops at some random point. No errors, all the inputs are completely fine. Like for example this loop.

console.log(manualFoundArr)
for (let manual = 0; manual < manualFoundArr.length; manual++) {
   if (manualFoundArr[manual] == "") {
     console.log("skipped " + manual)
     continue;
   }
   let ingredient = manualFoundArr[manual].trim();
    //turn the first letter of every word to uppercase
   ingredient = ingredient.charAt(0).toUpperCase() + ingredient.slice(1);
   let fromIndex = 0;
   console.log(ingredient)    
   ...         

manualFoundArr prints as [“”, “”, “”, “”] which is good. Then I am supposed to see skipped 0, skipped 1, skipped 2, skipped 3 as every value in the array is “”. And if that value isnt “”, then I should at least print out ingredient a few lines later, which is just the element at that index with a few modifications. But what I get, for example is:
[“”, “”, “”, “”]
skipped 0
skipped 1
And thats it, and my app UI freezes for some reason . Other times, with the same input, it might finish the for loop and get a bit farther down the code, but still exit. Or even weirder, I once had the function leave in between back to back print statements.

let takePic = async () => {
    let options = {
      quality: 0.4,
      base64: true,
      exif: false
    };

    let newPhoto = await cameraRef.current.takePictureAsync(options);
    const output = await largeFunction(...);
}

What’s very weird is that there is no timeout function that makes the large function quit at some time. All I do is const output = await largeFunction(...). And this was all working perfectly fine last week, it wouldn’t stop randomly and it would never freeze.

Any help would be greatly appreciated.

Wants to make a scroll spy navigation

I wanted to make an scroll spy navigation. I also try to use react-scroll and react-ui-scrollspy libraries but these libraries doesn’t work for me I’ve also attached the picture

This is the image of UI.

When I am scrolling it’s not working even though I tried several libraries for it. Is there any idea what could be the problem which is causing this?

Want to be able to show the signup form without having to click on “Subscribe to Our Newsletter” first

I have this newsletter subscribe “widget” script from a vendor we use to display a sign up form on our webpage. How do we get rid of the need to click on text to display the form? I just want the form to be shown on page load without having to click on “Subscribe To Our Email List”


<style>
.mn-widget.mn-widget-comm{margin:8px}.mn-widget.mn-widget-comm .mn-comm-company,.mn-widget.mn-widget-comm .mn-comm-phone,.mn-widget.mn-widget-comm .mn-form-pretext,.mn-widget.mn-widget-comm .mn-form-reqnote,.mn-widget.mn-widget-comm .mn-widget-head{display:none}.mn-widget.mn-widget-comm .mn-form-req{color:red}.mn-widget.mn-widget-comm .mn-form-pretext,.mn-widget.mn-widget-comm .mn-form-reqnote{margin-bottom:1em}.mn-widget.mn-widget-comm .mn-actions ul{padding:0;margin:0;list-style:none}.mn-widget.mn-widget-comm .mn-form-text,.mn-widget.mn-widget-comm label{width:100%;box-sizing:border-box}.mn-widget.mn-widget-comm .mn-comm-email,.mn-widget.mn-widget-comm .mn-comm-name{width:100%;float:left}.mn-widget.mn-widget-comm .mn-comm-email input,.mn-widget.mn-widget-comm .mn-comm-name input{padding:10px;color:#adadad;border-radius:0;background-color:#fff}.mn-widget.mn-widget-comm .mn-actions input[type=submit]{margin-top:25px;border:0 none;background-color:#0368b1;color:#fff;padding:10px 25px;border-radius:0}.mn-widget.mn-widget-comm .mn-actions input[type=submit]:hover{background-color:#0368b1;cursor:pointer}
</style>

<h3>Subscribe To Our Email List</h3>
<script src="https://sgftechcouncil-dev.growthzoneapp.com/GZContent/PublicWidgets/Subscriptions.js"></script>

Want to be able to show the signup form without having to click on “Subscribe to Our Newsletter” first.

Bootstrap modal isn’t getting prop value on the popup

I have the following codes in two files.

import React, { useState } from "react";
import Modals from "./Modals";

const Names = (props) => {
  const [edit, setEdit] = useState(false);
  let na = props.name;

  const handleClick = () => {
    setEdit(true);
  };
  return (
    <div className="horizontal-card mb-3">
      <div className="d-flex flex-row justify-content-between">
        <div className="horizontal-profile">
          <div className="horizontal-title">{props.name}</div>
          <div className="forms"></div>
        </div>
        <div className="forms">
          <Modals name_us={props} key={props.id} />
        </div>
      </div>
    </div>
  );
};

export default Names;

I’ve passed the prop from the above components and trying to use its value in the Modals component below.

import React, { useEffect, useState } from "react";


const Modals = ({ name_us }) => {
  return (
    <>
      <div className="row mb-4">
        <div className="col text-center" key={name_us.name}>
          <button
            className="btn btn-sm btn-success"
            data-toggle="modal"
            data-target="#basicModal"
          >
            {name_us.name}
          </button>
        </div>
        <div
          className="modal fade"
          id="basicModal"
          tabIndex={-1}
          role="dialog"
          aria-labelledby="basicModal"
          aria-hidden="true"
        >
          <div className="modal-dialog">
            <div className="modal-content">
              <div className="modal-header">
                <h4 className="modal-title" id="myModalLabel">
                  {name_us.name}
                </h4>
                <button
                  type="button"
                  className="close"
                  data-dismiss="modal"
                  aria-label="Close"
                >
                  <span aria-hidden="true">×</span>
                </button>
              </div>
              <div className="modal-body">
                {/* <input type="hidden" name="categorys" value={name_us.name} /> */}
                <br />
                <input type="text" name="update_category" value={name_us.name} />
              </div>
              <div className="modal-footer">
                <button
                  type="button"
                  className="btn btn-default"
                  data-dismiss="modal"
                >
                  Close
                </button>
                <button type="button" className="btn btn-primary">
                  saves
                </button>
              </div>
            </div>
          </div>
        </div>
      </div>
    </>
  );
};

export default Modals;

Now in the modal body, I’m trying to set the input value as a name from the prop I get in the component but it is always showing the name of the first element in every element. How do I fix it? It’s working fine on the button name for each component which is being clicked to show the modal popup.