I’m getting an error when trying to create bip32 root key

This is my code and im getting this error;

[TypeError: Cannot read properties of undefined (reading ‘fromSeed’)]

var bip39 = require('bip39')

var bitcoin = require('bitcoinjs-lib')

const mnemonic = bip39.generateMnemonic()
const seed = bip39.mnemonicToSeedSync(mnemonic);

const root = bitcoin.bip32.fromSeed(seed);  //this line i got error

console.log(root)

i tried get to bip32 rootkey but im getting error

When we install npm i ffmpeg , its getting like issue

./node_modules/@ffmpeg/ffmpeg/dist/umd/ffmpeg.js 55:4
Module parse failed: Unexpected character ‘#’ (55:4)
File was processed with these loaders:

  • ./node_modules/babel-loader/lib/index.js
    You may need an additional loader to handle the result of these loaders.
    | new Error(“failed to import ffmpeg-core.js”);

I need to convert avi , wmv files to mp4 type format in react

Insert peity in typed.js

I’d like to insert a peity graphic inside typed.js but it doesn’t work the way I’ve done it. My code:

let typed = new Typed('#typedintro1', {
        strings: ['<h3 class="h1intromodal1">Product with<b style="color: #dd4b39;"> low contribution </b>margin.</h3>',
        '<div><span id="peityDropStatus1">12, 50, 38</span> The contribution is very large. Please</div>',
        '<h3 class="h1intromodal1"><b style="color: #56cc66;">Effortlessly</b>...</h3>'],
        loop: true,
        typeSpeed: 25,
        backSpeed: 15,
        startDelay: 1,
        backDelay: 1
     });

$(function() {
       $('#peityDropStatus1').peity('donut', {
       fill: ['purple', 'yellow', 'green'],
       width: 40,
       height: 45,
       innerRadius: 12
       });
     })
<head>
  <script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
  <script src='https://cdn.jsdelivr.net/npm/[email protected]/jquery.peity.min.js'></script>
  <script src='https://cdn.jsdelivr.net/npm/[email protected]'></script>
</head>

<body>
<div id='typedintro1' style='position: relative; top: 12px;'></div>
</body>

Note that the graph doesn’t appear, only the numbers inside the span tag.

doesn’t execute javascript in rails

I want to implement prototype for calculate system in javascript with rails
Seemingly it’s not wrong code but doesn’t execute it
this code attempt to get html elements
then caluculate value for each types
I checked process with console.log
so that I noticed that I couldn’t go to in the if state
could you like to help me?

estimate js 

function estimate(Genre, Amount) {
var estimated;

if(Genre == "Add Genre ") {

    estimated = Amount *  11111;
    price.value  = estimated;
  
} else if (Genre == "Add Topic") {

    estimated = Amount * 11111;
    price.value  = estimated;
   
   } 
  

}

export default estimate;

application js 

 var initAmount = 1;
 var Genre;
 var selected = document.getElementById("selected")
 var amount = document.getElementById("amount")
 var price =  document.getElementById("price");
document.addEventListener('turbolinks:load', () => {

   amount.addEventListener("change", function(){
   Amount = this.value;
   Amount = parseInt(selectedAmount);
   estimate(Genre, Amount);
 }

selected.addEventListener("change", function(){
  console.log('Selected Genre:', Genre);
  Genre = this.value;
  estimate(Genre, Amount);


 });
 }

_form.hrml.erb





    <%= form_with model: @order, url: checkouts_path  ,remote: true  do  |f|  %>
   <div class ="field col-12">
    <% f.label :ad_type %><br />
    <%= f.select :ad_type,  ["Choose Type", t("layout.add_genre"), 
    t("layout.add_topic") ], {}, {id: "selected"} %><br />
</div>


   <div class ="field col-12">
   <%= f.label :amount %><br />
   <%= f.number_field :amount,value: 1, id: "amount" %><br />
   </div>

     <div class ="field col-12">
      <%= f.label :price %><br />
      <%= f.text_field :price ,readonly: true,id: "price"%><br />
      </div>

   <div class="actions col-12 ">
    <%= f.submit "checkout", class: "site-btn mb-sm-1" %>
   </br>
   </div>
    <% end %>

locales en.yml

en:
 layout: 
   add_genre: Add Genre
   add_topic: Add Topic 

How to Display Values Next to Legend in React Pie Chart? Getting ‘Undefined’ Error

I am trying to display value next to legend, but I am getting undefined.
Debugged but no luck, can you let me know how to fix it.

Providing my code snippet and stackblitz below

https://stackblitz.com/edit/react-piechart-padding-complete-8jdttg?file=index.js

status_pie_data: [
  // {"name":"On Arrival","value":0},
  { name: 'Daily', value: 100 },
  { name: 'Weekly', value: 20 },
  { name: 'Monthly', value: 30 },
  { name: 'One Time', value: 50 },
  // {"name":"Active","value":0},
  // {"name":"Completed","value":0}
],

<Legend
            layout="vertical"
            verticalAlign="middle"
            align="right"
            wrapperStyle={{
              fontFamily: 'Lato',
              fontWeight: 400,
              fontColor: '#000',
              fontSize: '9pt',
              marginRight: '0px',
            }}
            formatter={(value, entry, index) => `${entry.name}: ${value}`} // Customize formatter

Discord Normal user channel ids [closed]

Does there a way to get all my account channel ids on discord ,thanks 😀

i will i just looking if there a way to get discord account all channel ids

//just for the characters

hotdog hotdog hotdog hotdog hotdog hotdog hotdog hotdog hotdog

How to apply css animation to a specific section when it appears in the viewport

I have a section that the animation currently only applies on page load but I would like the animation to be applied when the section appears on the screen each time I tried using the observer method for the specific class and an in ViewPort function but it doesn’t seem to be working as the animation isn’t applying when that section occurs in the page

html section:

<section class="next-gen-agency" >
  <div class="container" style="display: flex; justify-content: center; align-items: center;">
    <div style="max-width: 70rem;" >
      <div style="display: flex; flex-direction: column; gap: 2rem; margin-top: 2rem;">
        <h1
          style="font-size: 4rem; font-weight: bold; background-image: linear-gradient(to right, #00e0ff, #ff007a); -webkit-background-clip: text; background-clip: text; color: transparent;">
          The Next Generation Agency.
        </h1>
        <!-- <p style="max-width: 40rem; font-size: 1.25rem; color: #c21f71">
          Our team of experts at Strive Now Management use a specialized approach to cater to your unique needs. We
          prioritize your success by understanding your goals and tailoring our strategies to help you thrive on the
          platform.
        </p> -->
        <div class="stats-div" style="display: flex; justify-content: center; align-items: center; gap: 3rem;">
          <div style="display: flex; flex-direction: column; align-items: center;">
            <h2 class="agency-stats" style="font-size: 2.5rem; font-weight: bold;">60+</h2>
            <p class="agency-stats" style="font-size: 1rem; font-weight: bold;">ACCOUNTS MANAGED</p>
          </div>
          <div class="stats-div" style="display: flex; flex-direction: column; align-items: center;">
            <h2 class="agency-stats" style="font-size: 2.5rem; font-weight: bold;">25+</h2>
            <p class="agency-stats" style="font-size: 1rem; font-weight: bold;">BRAND COLLABORATIONS</p>
          </div>
          <div class="stats-div" style="display: flex; flex-direction: column; align-items: center;">
            <h2 class="agency-stats" style="font-size: 2.5rem; font-weight: bold;">£100k+</h2>
            <p class="agency-stats" style="font-size: 1rem; font-weight: bold;">TOTAL EARNINGS</p>
          </div>
        </div>
      </div>
    </div>
  </div>
</section>

css styles:

.next-gen-agency {
  animation: slideIn 1.5s ease-in-out forwards;
  opacity: 0;
  background-color: #E4D8D3;
  margin-top: 8rem;
}

.agency-stats {
  background-image: linear-gradient(to right,
    #00e0ff,
    #3eb6d4);
  -webkit-background-clip: text;
  background-clip: text; color: transparent;
}

javascript code:

 <script>
  // Function to check if html element is in the viewport
  function isInViewport(element) {
    const rect = element.getBoundingClientRect();
    return (
      rect.top >= 0 &&
      rect.left >= 0 &&
      rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
      rect.right <= (window.innerWidth || document.documentElement.clientWidth)
    );
  }
  const startAnimation = (entries, observer) => {
    entries.forEach(entry => {
      entry.target.classList.toggle("slideIn", entry.isIntersecting);
    });
  };

  const observer = new IntersectionObserver(startAnimation);
  const options = { root: null, rootMargin: '0px', threshold: 1 };

  const elements = document.querySelectorAll('.next-gen-agency');
  elements.forEach(el => {
    console.log("el = ", el);
    observer.observe(el, options);
  });
</script>

Fix for my JavaScript Calculator using React

I have built a calculator using JS/React and I can’t seem to implement a function.

Basically I want that if 2 or more operators are entered consecutively, the operation performed should be the last operator entered (excluding the negative (-) sign).

So 2*-9=-18, but 12*-/3=4.

Also when I type 5*-, without even entering a second operand, it becomes 5*5.

My Code:

const { useState } = React;

function Calculator() {
  const [displayValue, setDisplayValue] = useState('0');
  const [firstOperand, setFirstOperand] = useState(null);
  const [operator, setOperator] = useState(null);
  const [waitingForSecondOperand, setWaitingForSecondOperand] = useState(false);

  const inputDigit = (digit) => {
    if (waitingForSecondOperand) {
      setDisplayValue(String(digit));
      setWaitingForSecondOperand(false);
    } else {
      setDisplayValue(displayValue === '0' ? String(digit) : displayValue + digit);
    }
  };

  const inputDecimal = () => {
    if (!displayValue.includes('.')) {
      setDisplayValue(displayValue + '.');
    }
  };

  const performOperation = (nextOperator) => {
    const inputValue = parseFloat(displayValue);

    if (firstOperand === null) {
      setFirstOperand(inputValue);
    } else if (operator) {
      const result = calculate(firstOperand, inputValue, operator);
      setDisplayValue(String(result));
      setFirstOperand(result);
    }

    setWaitingForSecondOperand(true);
    setOperator(nextOperator);
  };

  const calculate = (firstOperand, secondOperand, operator) => {
    switch (operator) {
      case '+':
        return firstOperand + secondOperand;
      case '-':
        return firstOperand - secondOperand;
      case '*':
        return firstOperand * secondOperand;
      case '/':
        return firstOperand / secondOperand;
      default:
        return secondOperand;
    }
  };

  const resetCalculator = () => {
    setDisplayValue('0');
    setFirstOperand(null);
    setOperator(null);
    setWaitingForSecondOperand(false);
  };

  return (
    <div className="calculator">
      <div id="display" className="display">{displayValue}</div>
      <button id="clear" className="button" onClick={resetCalculator}>AC</button>
      <button id="divide" className="button operator" onClick={() => performOperation('/')}>/</button>
      <button id="multiply" className="button operator" onClick={() => performOperation('*')}>*</button>
      <button id="subtract" className="button operator" onClick={() => performOperation('-')}>-</button>
      <button id="seven" className="button" onClick={() => inputDigit(7)}>7</button>
      <button id="eight" className="button" onClick={() => inputDigit(8)}>8</button>
      <button id="nine" className="button" onClick={() => inputDigit(9)}>9</button>
      <button id="add" className="button operator" onClick={() => performOperation('+')}>+</button>
      <button id="four" className="button" onClick={() => inputDigit(4)}>4</button>
      <button id="five" className="button" onClick={() => inputDigit(5)}>5</button>
      <button id="six" className="button" onClick={() => inputDigit(6)}>6</button>
      <button id="decimal" className="button" onClick={inputDecimal}>.</button>
      <button id="one" className="button" onClick={() => inputDigit(1)}>1</button>
      <button id="two" className="button" onClick={() => inputDigit(2)}>2</button>
      <button id="three" className="button" onClick={() => inputDigit(3)}>3</button>
      
      <button id="equals" className="button equals" onClick={() => performOperation('=')}>=</button>
      <button id="zero" className="button" onClick={() => inputDigit(0)}>0</button>
    </div>
  );
}

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

I have tried everything that came to mind but nothing seems to work, or even if it works it will break the whole calculator.

Hi everyone, not a conventional coding question. How do I stay relevant with AI getting more advanced everyday?

For context, I am a software engineer in an MNC with about two years of experience.

I have worked in manual and very little automated testing, primarily. I have little experience in SQL and databases and currently working as data extractor, meaning, some data is required and I code SQL queries for it.
I want to advance my career in development but don’t know where to start. With AI improving by the minute, I want to get ahead of the curve and build a more lucrative career in software development while also ensuring job security and industry relevance.

I do have an undergraduate degree in computer science but no development experience so far.
I watched this video, https://www.youtube.com/watch?v=9s29LKfEFjQ&t=478s , essentially advising to build javascript websites as a start. On the contrary, I have heard that efforts in web development will go in vain.
People also advise on learning AI and ML. But should I just start with it, without getting any solid foundation of software engineering/full stack development?

Long story short, I have received a lot of advices and am overwhelmed. Can anyone with good experience please suggest?

Thanks in advance!

programmaticaly click on a canvas

im trying to click on a canvas programmaticaly but without result

given this canvas of a mine sweeper
https://minesweeperonline.com/

with this function i find the coordinates to be clicked

 function handleMouseClick(event) {
    var x = event.clientX;
    var y = event.clientY;
    console.log("Mouse clicked at coordinates - X: " + x + ", Y: " + y);
}
document.addEventListener('click', handleMouseClick);

then i try to simulate the click

function simulateClick(x, y) {
    var event = new MouseEvent('click', {
        'view': window,
        'bubbles': true,
        'cancelable': true,
        'clientX': x,
        'clientY': y
    });
    
    var element = document.elementFromPoint(x, y);
    if (element) {
        element.dispatchEvent(event);
    } else {
        console.error('No element found at the specified coordinates.');
    }
}

but then when i simulateClick(456, 221)
i see the event dispatching (because it prints again Mouse clicked at coordinates - X: 456, Y: 221)
but nothing happens on the canvas.

any help?
ty

Error “Uncaught SyntaxError: Cannot use import statement outside a module” WordPress theme

I have tried about everything.

  • I tried using the ‘type’: ‘module’ function in the package.json
  • I have tried using .mjs (But that gave me 404 not found errors)
  • I made sure all paths are right
  • At one point I came across a FullySpecified error wich I also gave up upon since I could not fix the error.

I started over and I am now at step 1.
The code as of now is as follows:

package.json:

{
  "name": "fictional-university-theme",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "build": "wp-scripts build",
    "start": "wp-scripts start",
    "dev": "wp-scripts start",
    "devFast": "wp-scripts start",
    "test": "echo "Error: no test specified" && exit 1"   
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@glidejs/glide": "^3.4.1",
    "@wordpress/scripts": "*",
    "axios": "^0.21.1",
    "normalize.css": "^8.0.1"
  }
}

functions.php:

<?php

function swordit_files()
{

    wp_enqueue_script('main_script', get_theme_file_uri('/js/vendor/modernizr-3.5.0.min.js'), array('jquery'), '1.0', true);
    wp_enqueue_script('main_script2', get_theme_file_uri('/js/popper.min.js'), array('jquery'), '1.0', true);
    wp_enqueue_script('main_script3', get_theme_file_uri('/js/bootstrap.min.js'), array('jquery'), '1.0', true);
    wp_enqueue_script('main_script4', get_theme_file_uri('/js/isotope.pkgd.min.js'), array('jquery'), '1.0', true);
    wp_enqueue_script('main_script5', get_theme_file_uri('/js/slick.min.js'), array('jquery'), '1.0', true);
    wp_enqueue_script('main_script6', get_theme_file_uri('/js/jquery.meanmenu.min.js'), array('jquery'), '1.0', true);
    wp_enqueue_script('main_script7', get_theme_file_uri('/js/ajax-form.js'), array('jquery'), '1.0', true);
    wp_enqueue_script('main_script8', get_theme_file_uri('/js/wow.min.js'), array('jquery'), '1.0', true);
    wp_enqueue_script('main_script9', get_theme_file_uri('/js/jquery.scrollUp.min.js'), array('jquery'), '1.0', true);
    wp_enqueue_script('main_script11', get_theme_file_uri('/js/imagesloaded.pkgd.min.js'), array('jquery'), '1.0', true);
    wp_enqueue_script('main_script22', get_theme_file_uri('/js/jquery.magnific-popup.min.js'), array('jquery'), '1.0', true);
    wp_enqueue_script('main_script33', get_theme_file_uri('/js/waypoints.min.js'), array('jquery'), '1.0', true);
    wp_enqueue_script('main_script44', get_theme_file_uri('/js/jquery.counterup.min.js'), array('jquery'), '1.0', true);
    wp_enqueue_script('main_script55', get_theme_file_uri('/js/plugins.js'), array('jquery'), '1.0', true);
    wp_enqueue_script('main_script66', get_theme_file_uri('/js/swiper-bundle.min.js'), array('jquery'), '1.0', true);
    wp_enqueue_script('main_script77', get_theme_file_uri('/js/main.js'), array('jquery'), '1.0', true);
    wp_enqueue_script('main_script88', get_theme_file_uri('/src/index.js'), array('jquery'), '1.0', true);
    wp_enqueue_script('main_script88', get_theme_file_uri('/src/modules/Search.js'), array('jquery'), '1.0', true);



    


    wp_enqueue_style('swordit_swiper_style', get_theme_file_uri('/css/swiper-bundle.min.css'));
    wp_enqueue_style('swordit_slick_style', get_theme_file_uri('/css/slick.css'));
    wp_enqueue_style('swordit_icofont_style', get_theme_file_uri('/css/icofont.min.css'));
    wp_enqueue_style('swordit_magnific_style', get_theme_file_uri('/css/magnific-popup.css'));
    wp_enqueue_style('swordit_aos_style', get_theme_file_uri('/css/aos.min.css'));
    wp_enqueue_style('swordit_animate_style', get_theme_file_uri('/css/animate.min.css'));
    wp_enqueue_style('swordit_bootstrap_style', get_theme_file_uri('/css/bootstrap.min.css'));
    wp_enqueue_style('swordit_main_style', get_theme_file_uri('/css/style.css'));

}
add_action('wp_enqueue_scripts', 'swordit_files');

add_theme_support('menus');

register_nav_menus(
    array(
        'top-menu' => __('Top Menu', 'theme'),
    )
);

function my_theme_setup(){
    add_theme_support('post-thumbnails');
}

add_action('after_setup_theme', 'my_theme_setup');

index.js:

import Search from "./modules/Search";

const search = new Search()

Search.js:

class Search {
    constructor() {
        alert("No")
    }
}

export default Search

I will show the structure in a screenshot below:

enter image description here

Search bar that can change language

Im very new to JavaScript so i don’t know if this is even possible. I have a searchbar with an autocomplete function and i also have a few buttons that can change my websites language:

//searchbar//
let availableKeywords = [
  'example1',
  'exapmle2',
  'example3'
];

const resultsBox = document.querySelector(".result-box");
const inputBox = document.getElementById("query");

inputBox.onkeyup = function(){
  let result = [];
  let input = inputBox.value;
  if(input.length){
    result = availableKeywords.filter((keyword)=>{
      return keyword.toLowerCase().includes(input.toLowerCase());
    });
    console.log(result);
  }
  display(result);

  if(!result.length){
    resultsBox.innerHTML = '';
  }
}

function display(result){
  const content = result.map((list)=>{
    return "<li onclick=selectInput(this)>" + list + "</li>";
  });

  resultsBox.innerHTML = "<ul>" + content.join('') + "</ul>";
}

function selectInput(list){
  inputBox.value = list.innerHTML;
  resultsBox.innerHTML = '';
}

//buttons//
const langEl = document.querySelector(".langWrap");

link.forEach((el) => {
  el.addEventListener("click", () => {
    langEl.querySelector(".active").classList.remove("active");
    el.classList.add("active");
});

I was wondering if it was possible that the content of availableKeywords could change language depending on wich language button is active?

HTTP only cookie in express doesnt set

I have app.ts file:

import express, { Express } from "express";
import cors from "cors";
import cookieParser from "cookie-parser";
//
import userRouter from "./routes/userRoutes";
import cardsRouter from "./routes/cardsRoutes";
import contactsRouter from "./routes/contactsRoutes";
import transferRouter from "./routes/transferRoutes";
import authRouter from "./routes/authRoutes";
//
const app: Express = express();
app.use(express.json());
app.use(cookieParser());
app.use(
  cors({
    credentials: true,
    origin: "http://localhost:4200",
  })
);
app.get("/", (req, res) => {
  res
    .status(202)
    .cookie("Name", "testCookie", {
      sameSite: "strict",
      path: "/",
      expires: new Date(new Date().getTime() + 100 * 1000),
      httpOnly: true,
      secure: false,
    })
    .send("success!");
});
app.use("/api/v1", [
  userRouter,
  cardsRouter,
  contactsRouter,
  transferRouter,
  authRouter,
]);

export default app;

and service:

import { Injectable } from '@angular/core';
import { CookieService } from 'ngx-cookie-service';
import axios from 'axios';
axios.defaults.withCredentials = true;
@Injectable({
  providedIn: 'root',
})
export class AuthService {
  constructor(private cookieService: CookieService) {}
  url = 'http://localhost:8000/api/v1/login';
  token: string = '';

  async login(formObject: any) {
    try {
      await axios
        .get(`${this.url}`, { withCredentials: true })
        .then((res) => console.log(res));

      console.log('http cookie set!');
    } catch (error) {
      console.error(error);
    }
  }
}

login route leads to this controller:

export const checkCookie = async (req: Request, res: Response) => {
  res.status(200).json({ message: "Hello" });
};

when i click login theres no error, but i get no cookie either. I check it in mozilla devtools -> storage -> cookies, and there are test cookies, but no http only cookie. What is wrong? The server runs of 8000 port and frontend od 4200.

How to encrypt and hash a password in frontend and backend to prevent access to client plain text password?

If client send a non encrypted and hashed password to server then attribute can be accessed by me. I should not access to that info. How can I prevent it?

I’m expecting not to access client plain text passwords because I can use that info to access other account systems. If I sell my app to another person that person can access his client password. That is wrong.