Can’t decrypt WhatsApp web socket data

I am trying to send serial messages using WhatsApp web socket. However, I can’t communicate with socket in any way. I can’t access incoming json data or outgoing. I couldn’t decipher the password in any way. How can I decrypt this password with Javascript? I only know c# and javascript.

HEX

enter image description here
Bas64

enter image description here

Utf 8

enter image description here

Example base64

AAC4F7TD+aM7mqjEiQNXPIh/ynCD2VEokjoepVP1C1oC31RYbnyPSfVStYwV5wtnuqA1ogQXMUeuSwOPL5sBHB5BB1SEN+ELiisZVVndoxT0P10YpHVR9K2D9KCyzzRKVaWxQ8ba2pRqJ6gBwzeK94a3XnrxmnXh5vlMUxZRUaHmyR8gnLNji66OeTz7fcljA0YbH4aaBskZeXmuWvfKV2bQlaH8Wpam6NvQS/RkXwO68diYkLH/2cRQpg==

Add a child component with N number .of times inside parent Component (based on a state value)

I want to add a child-component ColorBox in return of parent component ColorBoxContainer based on No of times there is a value in state noOfBoxes: 16. I am trying doing using for-loop but I guess the code is wrong. Can someone help me out, how to achieve this?

import React, { Component } from 'react';
import ColorBox from './ColorBox';

class ColorBoxContainer extends Component {

  constructor(props) {
    super(props);
    this.state = {
      noOfBoxes: 16
    }
  }

  render(){
    return (
      <div>
        {for(i=0;i<this.state.noOfBoxes;i++){
           <ColorBox />
        }}
      </div>
    )
  }  
}

export default ColorBoxContainer1; 

java arralist letter search

So im creating a wordguesser ai for school. It has a list of words as database and it has to guess the word that the user has in mind. Now im stuck at the part where the ai has to check which words are in the list which contain the letters and at the right location. Does anyone know a way to find the words which contain the letters guessed at the right location?

Render child_process in electron

I’m trying to use child_process to open another program through electron, but when I click the button even calling the function to render it doesn’t open the requested application.

Electron version ^16.0.7:

main.js

const { app, shell, BrowserWindow } = require('electron')
const path = require('path')

let mainWindow = null;

function createWindow () {
  mainWindow = new BrowserWindow({
    autoHideMenuBar: true,
    width: 1300,
    height: 840,
    resizable: false,
    webPreferences: {
      preload: path.join(__dirname, 'preload.js'),
      webPreferences: {nodeIntegration: true}
    }
  })

  mainWindow.loadFile('./app/home.html')

}

app.whenReady().then(() => {
  createWindow()

  app.on('activate', () => {
    if (BrowserWindow.getAllWindows().length === 0) {
      createWindow()
    }
  })
})

app.on('window-all-closed', () => {
  if (process.platform !== 'darwin') {
    app.quit()
  }
})

app.on('web-contents-created', (e, contents) => {
  contents.on('new-window', (e, url) => {
    e.preventDefault();
    require('open')(url);
  });
  contents.on('will-navigate', (e, url) => {
    if (url !== contents.getURL()) e.preventDefault(), require('open')(url);
  });
});

preload.js

window.openGaeme = function(executablePath) {
  let child = require('child_process').execFile;
  child(executablePath, function(err, data) {
    if(err){
       console.error(err);
       return;
    }
 
    console.log(data.toString());
});
}

function in renderer.js

function onClick() {
    var executablePath1 = "C:\Program Files (x86)\Game\system\game.exe";
    window.openGaeme(executablePath1);
}

HTML BUTTON AND SCRIPT:

<button class="button-go" role="button" onclick="onClick()">JOIN</button>

<script src="./core/renderer.js"></script>

Nextjs: update state not work in interval

This is my state:

const [time, setTime] = useState(10)

And this is my handler:

const runTimer = () => {
    useEffect(() => {
        const interval = setInterval(() => {
            console.log(time)
            if (time > 0) {
                setTime(time - 1)
            } else {
                console.log("End")
            }
        }, 1000);
        return () => clearInterval(interval)
    }, [])
}

My log:

9
9
9
9
9
.
.
.

Why setTime doesn’t work ?

time variable most increase per 1000 delay

Faster Better Replacement for useReducer?

Hi I am using a simple useReducer Function to Start and Stop a Lottie Animation for a Hamburger Menu Icon
Please suggest a better approach or something with faster performance if it exists or let me know if it is good enough.
Thanks in Advance

import Lottie from 'react-lottie-player/dist/LottiePlayerLight' //@ Lottie Player
import menuIcon from './menu-icon.json' //@ Lottie Menu Icon
import { useReducer } from 'react'

const Menu = () => {
  
  //$ Reducer Hook for Menu State Management
  //@ Reducer Function
  const controlAnim = (controls, action) => {
    switch (action) {
      case 'OPEN':
        return { isClicked: true, close: false }
      case 'CLOSE':
        return { isClicked: true, close: true }
      case 'SWITCH':
        return { isClicked: false, close: !controls.close }
      default:
        return controls
    }
  }
  //@ States and Controls
  const [controls, setControls] = useReducer(controlAnim, {
    isClicked: false,
    close: false,
  })

  return (
        <div className="menu-header-button" onClick={() => (controls.close ? setControls('CLOSE') : setControls('OPEN'))}>
          <Lottie
            className="menu-header-button-lottie"
            animationData={menuIcon}
            loop={false}
            speed={1}
            play={controls.isClicked}
            direction={1}
            segments={controls.close ? [55, 90] : [15, 45]}
            onComplete={() => setControls('SWITCH')}
          />
    </div>
  )
}

export default Menu

I can’t solve the error “Uncaught SyntaxError: Unexpected token ‘<'"

JS:

import React from "react";
import { ReactDOM } from "react";
import './style.css';
import App2 from "./App2.js";

function App() {
    return (
        <App2.js />
    )
}

ReactDOM.render(<App />, document.getElementById('root'))

Referred App2.js in the above file:

import React from "react";
import { ReactDOM } from "react";

export default function App2() {
    return (
        <div>
            <h1>Yusif Ahmedov</h1>
            <button id="email"></button>
            <button id="linkedin"></button>
            <h2>Front-End Developer</h2>
            <header id="about-header">About</header>
            <p id="about">I am a front-end developer who is passionate about coding and engaging both creative and practical side of the human potential.</p>
            <header id="interests-header">Interests</header>
            <p id="interests">Productivity articles, Time Management, Coffee, Music, Sports, Social Activities.</p>
        </div>
    )
    }

And simple HTML:

<!DOCTYPE HTML>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>My Card</title>
    <script type="module" src="./App.js" defer></script>
</head>
<body>
    <div id="root"></div>
</body>
</html>

I wrote all from scratch and so there are no extra files.
When I run it, it gives an error:
Uncaught SyntaxError: Unexpected token ‘<‘ App.js:8(line)

I didn’t get it why it gives an error on the 8th line.

await promise.all chained array-methods

I need to recursively call an API to walk down child entries, and return the filtered results before continuing. I was initially putting the results in an array, and then doing a .forEach, and if I found a match I needed to recurse doing so; however, that didn’t work because of the problem described in the answer to this question. So, I tried to modify the answer to that question, but it’s still not waiting.

const getDatabases = async (blockId) => {
  let databases = [];
  let childDatabases = [];
    
  const children = await getChildren(blockId);
  Promise.all(children.results
    .filter( (child) => {
      return (['child_database', 'database'].includes(child.type)
        || child.has_children === true);
    })
    .map( async (child) => {
      if (['child_database', 'database'].includes(child.type)) {
        return { id: child.id, title: child.child_database.title };
      } else {
        console.log(`Waiting on getDatabases for ${child.id}`); // 1
        childDatabases = await getDatabases(child.id);
        return false;
      }
    })  
  )
    .then((childDbs) => {
      console.log(`Got childDbs`); // 3, 4
      databases = 
        [...databases, ...childDatabases].filter(dbId => dbId !== false);
      return databases;
    })
    .catch((err) => console.log(err));

}

app.get('/api', async (req, res) => {
  const dashboardPage = await getDashboardPage();
  const databases = await getDatabases(dashboardPage);
  console.log('No longer awaiting getDatabases'); // 2
  ...
}

So the question is, why is 2 happening before 3 and 4, instead of after them? Shouldn’t const databases = await getDatabases(dashboardPage); before 2 be waiting for all the recursive calls that pass through childDatabases = await getDatabases(child.id); after 1?

Should we use SSG for deploying a dashboard created using Nuxt.js?

We are going to develop a dashboard for internal use using Nuxt.js. As this will be an internal dashboard there is no need for a universal mode. Generally most of the dashboard are developed in SPA.

But SPA also requires a server to send the initial HTML and js bundle to the browser. So what if we use SSG and deploy it to s3 as it will no longer need a server and we can save the cost?

The scroll method doesn’t work the way I need it to, how to solve?

When scrolling down, the class is added and immediately removed, which is seen in this video https://radikal.ru/video/Ua66Nz79e5D -radikal.

need to make the script work correctly so that the header is removed, and the block with the player is stretched to the full screen by height 100vh

html

<div class="oneboss">
    <div class="header">HEADER</div>
    <div class="main">
        <div class="player"></div>
    </div>
</div>

css

body {
    width: 100%;
    min-height: 100%;
    overflow-x: hidden;
}

.oneboss {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

.main {
    width: 100%;
    overflow: hidden;
    overflow-y: auto;
    position: relative;
}

.player {
    //there is nothing
}

js jq

const $header = $(".header")
let prevScroll
let lastShowPos

$('.main').scroll(function() {
  const scrolled = $('.main').scrollTop()

  if (scrolled > 0 && scrolled > prevScroll) {
    $header.addClass("header_hide")
    lastShowPos = scrolled
  } else if (scrolled <= Math.max(lastShowPos - 255, 0)) {
    $header.removeClass("header_hide")
  }
  prevScroll = scrolled
});

this class is being added.

.header_hide {
  display:none;
}

pls tell me how do solve this?

Trying to get PanelSnap.js work on wordpress

I am trying to get PanelSnap.js work on my wordpresssite.
My coding experience is like read manuals and copy-paste. So I am sorry if basic stuff isn`t right.

I downloaded the panelsnap.js the developer uses on panelsnap.com/panelsnap.js and took the file to upload it to the server (in the child-themes-directory). After that i added this line to the functions.php in the child-theme.

wp_enqueue_script( 'panelSnap', get_template_directory_uri() . '/js/panelsnap.js', array ( 'jquery' ), 1.1, true);

Next step was to use the “Simple Custom CSS and JS”-PlugIn to add some HTML to the Header

      <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.js"></script>
<script src="/wp-content/themes/kadence-child/assets/js/panelsnap.js"></script>
    
<script>
      jQuery(function () {
        new PanelSnap();
      })
    </script>

<script src="/wp-content/themes/kadence-child/assets/js/panelsnap.js" defer></script>
    <script>
        document.addEventListener("DOMContentLoaded", function() {
          new PanelSnap();
        });
    </script>
<script>
  var defaultOptions = {
    container: document.body,
    panelSelector: '> section',
    directionThreshold: 50,
    delay: 0,
    duration: 300,
    easing: function(t) { return t },
  };

  new PanelSnap(options);
</script>

and some JS in to the footer

 jQuery(document).ready(function( $ ){
var options = {
// jQuery object referencing a menu that contains menu items
$menu: false, 
// CSS selector to menu items (scoped within the menu)
menuSelector: 'a',
// css selector to panels (scoped within the container)
panelSelector: 'section', 
// jQuery event namespace that's being used
namespace: '.panelSnap',
// fired before a panel is being snapped
onSnapStart: function(){}, 
// fired after a panel was snapped
onSnapFinish: function(){}, 
// fired before a panel is being snapped.
onActivate: function(){},
// An integer specifying the ammount of pixels required to scroll 
// before the plugin detects a direction and snaps to the next panel.
directionThreshold: 50, 
// The ammount of miliseconds in which the plugin snaps to the desired panel
slideSpeed: 200,
// The jQuery easing animation to use.
easing: 'linear',
// An integer specifying the number of pixels to offset when snapping to a panel.
offset: 0,
// keyboard navigation.
keyboardNavigation: {
  enabled: false,
  nextPanelKey: 40,
  previousPanelKey: 38,
  wrapAround: true
},
strictContainerSelection: true
};
jQuery('body').panelSnap(options);
  });

If I open the site and the console it gives me this

Click to open

I tried even to build one of the sites like should be similiar to the developers demo.

https://mobeil.helfersyndrom-ev.de/522-2/

Thank you for your time reading this and i would appreciate every help or critics.

How to resolve – Cypress detected a cross origin error?

So i am using cypress to log into google and create a google form. I have gotten through the login, but now that I want to select create new form, I am seeing cross origin errors which seem to be blocking such actions. Can anyone help me out here? Heres my code. Its the click on #1f that is not working
see error

”’

 describe('Test', function () {
  it('logs into google', function () {
    Cypress.on('uncaught:exception', (err, runnable) => {
        return false
        })
    cy.visit('http://docs.google.com/forms/u/0')

    cy.xpath("//input[@type='email']").type("[email protected]");
    cy.xpath("//span[contains(text(),'Siguiente')]").click();
    cy.wait(5000);
    cy.xpath("//input[@type='password']").type("1Testagain");
    cy.xpath("//span[contains(text(),'Siguiente')]").click();
    cy.wait(5000);
    ///cy.xpath("//span[contains(text(),'Probar otra manera')]").click();
  ///  cy.wait(5000) 
  ///     cy.xpath("//span[contains(text(),'Confirmar')]").click();
   /// cy.wait(5000)

   //cy.xpath("//span[contains(text(),'Untitled form')]").click();
   //cy.wait(5000)

   cy.get('#:1f').click();
   cy.wait(5000);

”’