Javascript bytes (Uint8Array) to string and back to bytes or HEX string (careful, magic was here)

Need to produce packets exchange with hardware device via com port, in c, c++ – is not a problem with types of vars like intuint with binary length, but in js – all variables is signed)

device request:
[ 0x0A, 0xC7, 0xAC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE2, 0xAF ]

device answer:
[ 0xFE, 0x9A, 0xAC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA4, 0x9B ]

32 byte per packet, where 0x00 – is filled data, send data – no problem:

something.write(new Uint8Array(packets.request)) – all fine

device answer parse – in js – problems with encoding received data, its received as encoded text, not as binary data

example to repeat:
let bytes = new Uint8Array(packets.answer);
let text = new TextDecoder(‘ascii’).decode(bytes);

console.log(bytes);
console.log(text);
console.log(text.getBytes());
console.log(text.split("").map(c => c.charCodeAt(0).toString(16).padStart(2, "0")).join(' '));

outputs:

Uint8Array(32) [254, 154, 172, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 164, 155, buffer:
ArrayBuffer(32), byteLength: 32, byteOffset: 0, length: 32,
Symbol(Symbol.toStringTag): ‘Uint8Array’] þ𬠤›
(32) [254, 353, 172, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 164, 8250] fe 161 ac 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 a4
203a

yyyep, we all knows about ascii and <= 0x7F, but what happens with.. see “device answer” bytes, 0xFE – is displayed as 254 – ok, but at same time 0x9A -> 353 ?!, and same fun with 0xA4 at end of answer – 164, and 9B – 8250 q[O,o]p

next example:

let x = [ 0x7E, 0x7F, 0x80, 0x81, 0x82 ];
let bytes = new Uint8Array(x);
let text = new TextDecoder('ascii').decode(bytes);

console.log(bytes);
console.log(text);
console.log(text.getBytes());
console.log(text.split("").map(c => c.charCodeAt(0).toString(16).padStart(2, "0")).join(' '));

output:

Uint8Array(5) [126, 127, 128, 129, 130, buffer: ArrayBuffer(5),
byteLength: 5, byteOffset: 0, length: 5, Symbol(Symbol.toStringTag):
‘Uint8Array’] (5) [126, 127, 8364, 129, 8218] 7e 7f 20ac 81 201a

what a magic! 🙂

Firebase fails to create a new document when i call it from a button

i am trying to make a simple program with basic html and javascript to get used to firebase, where i fill up a form and press a button to send its information to the database. I can send the data to fireplace if i keep the await outside of any function, it fills my database on load. But whenever i try to get it inside of a function so the button can call it, it gives me a
@firebase/firestore: Firestore (11.7.1): WebChannelConnection RPC 'Write' stream 0x80362b6e transport errored. Name: undefined Message: undefined
error.

i know this error message can be seen when you dont have (default) as the name of your database, but i do have it, it works whenever i leave the await all by itself.

If any of you would be kind enough to help me solve this problem, here is all my code (i know having everything in 1 file is messy and the structure is bad, it is a test) and the database info is censored for obvius reasons.


<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Almacen proteco</title>

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>

    <style>
        .hidden {
            display: none;
        }
    </style>


</head>

<body>
    <div id="app">

        <form id="creaArticulo">
            <input type="text" id="nombre">
            <input type="text" id="talla">
            <input type="text" id="cantidad">
            <button id="buttonArticulo">Nuevo articulo</button>
        </form>

    </div>



    <script src="https://www.gstatic.com/firebasejs/11.7.1/firebase-app-compat.js"></script>
    <script src="https://www.gstatic.com/firebasejs/11.7.1/firebase-firestore-compat.js"></script>


    <script type="module">
        // Import the functions you need from the SDKs you need
        import { initializeApp } from "https://www.gstatic.com/firebasejs/11.7.1/firebase-app.js";
        import { getFirestore, doc, setDoc, getDoc, getDocs, collection } from "https://www.gstatic.com/firebasejs/11.7.1/firebase-firestore.js";
        // TODO: Add SDKs for Firebase products that you want to use
        // https://firebase.google.com/docs/web/setup#available-libraries

        // Your web app's Firebase configuration
        const firebaseConfig = {
            apiKey: "**",
            authDomain: "**",
            projectId: "**",
            storageBucket: "**",
            messagingSenderId: "**",
            appId: "**"
        };

        // Initialize Firebase
        const app = initializeApp(firebaseConfig);
        const db = getFirestore(app);

        //my code

        async function nuevoArticulo() {
            await setDoc(doc(db, "cities", "LA3"), {
                name: "Los Angeles 3",
                state: "CA",
                country: "USA"
            });
        }


        document.getElementById('buttonArticulo').addEventListener("click", nuevoArticulo);

    </script>


</body>

</html>
  

Google Drive API starting return a 502 when initializing gapi

i had a working implementation of the google drive api.

Now stopped working and I get following error logged in the browser’s console:

GET https://content.googleapis.com/discovery/v1/apis/drive/v3/rest?pp=0&fields=kind%2Cname%2Cversion%2CrootUrl%2CservicePath%2Cresources%2Cparameters%2Cmethods%2CbatchPath%2Cid&key=581000403558-9bno5mqs81fu452qearbqjkrl24jrqln.apps.googleusercontent.com 502 (Bad Gateway)
$h @ cb=gapi.loaded_0?le=scs:169
h @ cb=gapi.loaded_0?le=scs:169
ai @ cb=gapi.loaded_0?le=scs:170
(anonymous) @ cb=gapi.loaded_0?le=scs:170
d @ cb=gapi.loaded_0?le=scs:128
b @ cb=gapi.loaded_0?le=scs:124
trumbowyg.clouddrive.google.min.js:45 gAPI initialization failed with following error: gapix.client.GapiClientError: API discovery response missing required fields.

The code i use to initialize the gapi is:

window.WaXCode.gAPI.onload    = () => {
            console.log('gAPI Loaded.');
            // #region Check for API Key.
            try         { var apiKey = jQuery.trumbowyg.XC.CloudStorage.Browser.refTrumbowyg.o.plugins.WaXCode_OnlineStorage_Google.clientID ;}
            catch( X )  {
                console.error('Google / Drive - API Key not available (is the "Google / Drive (cx_editor)" - TypoScript included in your template?). Unable to initialize Google Drive. Internal: ');
            
                throw X ;}
            // #endregion Check for API Key.
            // #region Load gAPI.
            gapi.load('client', async () => {
                try {
                    await gapi.client.init({
                        apiKey          : apiKey,
                        discoveryDocs   : ['https://www.googleapis.com/discovery/v1/apis/drive/v3/rest']});
                
                    gAPI_Initialized = true ;}
                catch( X ) { console.log('gAPI initialization failed with following error: ' + X );}
            // #endregion Load gAPI.
        });}

Google Cloud Console show that everything is fine with the API-Key etc.

Can’t figure out what the problem is.

Any ideas?

chrome extension is not running the javascript file

i have created this manifest file

{
  "name": "AI-Email Replyer",
  "description": "AI powered email reply generatr",
  "version": "1.0",
  "manifest_version": 3,
  "action": {
    "default_title": "Email Writer Assistant"
  },
  "permissions": ["storage", "activeTab"],
  "host_permissions": [
    "http://localhost:8080/*",
    "https://mail.google.com/*"
  ],
  "content_scripts": [
    {
      "js": ["content.js"],
      "matches": ["https://mail.google.com/*"],
      "css": ["content.css"],
      "run_at": "document_start"

    }
  ],
  "web_accessible_resources": [
    {
      "resources": [ "icons/*" ],
      "matches": [ "https://mail.google.com/*" ]
    }
  ]
}

and in content.js

console.log("AI content script loaded here");

still after loading the extension in chrome browser it not printing any thing in console ( i am checking the console of gmail site only)

what mistake i have done??

Text Not Rendering in Image Generation on Vercel (Next.js 15)

I’m working on a Next.js 15 project where I generate images dynamically. The implementation works fine on localhost, but after deploying to Vercel, the generated image contains blank boxes instead of text.
Even when using a system font like “Arial”, the issue persists.

Here is the relevant code snippet:

'use server'
    import sharp from 'sharp'
    import path from 'path'
    
    interface CreateArgs {
      nomineName: string
      awardName: string
      regionName: string
    }
    
    // Estimate font size so text fits in 1 line and does not exceed SVG width
    function getNomineFontSize(name: string, maxFont = 48, minFont = 16, maxWidth = 380) {
      // Average character width factor (adjust for your font)
      const avgCharWidth = 0.6 // 0.6em per character is a good estimate for most sans-serif fonts
      const estimatedFontSize = Math.floor(maxWidth / (name.length * avgCharWidth))
      return Math.max(minFont, Math.min(maxFont, estimatedFontSize))
    }
    
    // Helper to wrap text at a max character length per line, maxLines = 2
    function wrapText(text: string, maxChars = 20, maxLines = 2) {
      const words = text.split(' ')
      const lines: string[] = []
      let currentLine = ''
    
      for (const word of words) {
        if ((currentLine + ' ' + word).trim().length > maxChars) {
          lines.push(currentLine.trim())
          currentLine = word
          if (lines.length === maxLines - 1) {
            // Add the rest of the words to the last line and break
            currentLine += ' ' + words.slice(words.indexOf(word) + 1).join(' ')
            break
          }
        } else {
          currentLine += ' ' + word
        }
      }
      if (currentLine) lines.push(currentLine.trim())
      // Ensure no more than maxLines
      return lines.slice(0, maxLines)
    }
    
    // Estimate font size for award lines so each line fits in maxWidth (e.g. 390px)
    function getAwardFontSize(lines: string[], maxFont = 28, minFont = 14, maxWidth = 390) {
      // Find the longest line
      const longest = lines.reduce((a, b) => (a.length > b.length ? a : b), '')
      const avgCharWidth = 0.6
      const estimatedFontSize = Math.floor(maxWidth / (longest.length * avgCharWidth))
      return Math.max(minFont, Math.min(maxFont, estimatedFontSize))
    }
    
    export const createBadge = async ({
      nomineName,
      awardName,
      regionName
    }: CreateArgs) => {
      try {
        const rootPath = process.cwd()
        const imagePath = path.resolve(rootPath, './public/badge/badge.png') // Path to your image
        const image = sharp(imagePath)
    
        // Nominee name font size (1 line, full width)
        const nomineFontSize = getNomineFontSize(nomineName)
    
        // Award name: wrap to 2 lines, font size so each line fits maxWidth
        const awardLines = wrapText(awardName, 20, 2)
        const awardFontSize = getAwardFontSize(awardLines)
        const awardTspans = awardLines
          .map((line, i) => `<tspan x="50%" dy="${i === 0 ? 0 : 28}">${line}</tspan>`)
          .join('')
    
        const svgText = `
            <svg width="440" height="440">
              <style>
                .nomine { fill: #ba8f30; font-size: ${nomineFontSize}px; font-weight: bold; font-family: "Arial", sans-serif; }
                .region { fill: #ba8f30; font-size: 40px; font-weight: bold; font-family: "Arial", sans-serif; }
                .award { fill: white; font-size: ${awardFontSize}px; font-weight: bold; font-family: "Arial", sans-serif; }
              </style>
              <text 
                x="50%" 
                y="200px" 
                alignment-baseline="middle" 
                text-anchor="middle" 
                class="nomine"
              >${nomineName}</text>
              <text x="50%" y="255px" alignment-baseline="middle" text-anchor="middle" class="region">${regionName}</text>
              <text x="50%" y="380px" alignment-baseline="middle" text-anchor="middle" class="award">
                ${awardTspans}
              </text>
            </svg>
          `
    
        const buffer = await image
          .composite([{ input: Buffer.from(svgText), top: 30, left: 30 }])
          .toBuffer()
    
       
        return { buffer}
      } catch (error) {
        console.error('Error generating badge:', error)
        throw error // Rethrow the error to be handled by the caller
      }
    }

Troubleshooting Attempts:

  • Works correctly on localhost
  • Tried using system fonts (e.g., Arial)
  • Issue persists only on Vercel deployment
    I’ve attached images from both localhost and Vercel to show the difference.

localhost generated image
localhost generated image

vercel generated image
vercel generated image

Has anyone faced a similar issue or found a solution? Any insights would be appreciated!
Thanks in advance.

Why typescript is narrowing a type even after it has changed [double]

I have a simple game with an status that tells me if the game is going or not. Like so type GameStatus = “running” | “won”; If in my main function I check if the status is “won” then return, then TypeScript properly infert that after, the status can only be “running”. But if I call a function changes the status, TypeScript still thinks the status is only “running” even after it has changed. Why is that?

Example (this is an over simplification to show case the issue)

Even if I change the game.play(move) for a more straighforward game.win() where game.win() only sets the status to “won” without any conditions, TypeScript still thinks that status is “running” even when it should infer it to be “won”. Only if I change the status in the body of the function, and not by calling a function, TypeScript recognizes that the value of status has changed. Why is this behavior? is there some configuration that can be changed or maybe a different way to declare this so that TypeScript can infer the type properly?

How to pass parameters in embedded Power BI paginated report?

I’m using the Power BI Angular library to embed a paginated report with no problems, as defined in https://github.com/microsoft/PowerBI-client-angular

        <powerbi-paginated-report
            [embedConfig]="embedConfig"
            [cssClassName]="'container'">
        </powerbi-paginated-report>

Problem happens when I add parameters to the paginated report. I defined Internal parameters without defaults, where the intent is to pass these parameters when the report is embedded/rendered.

I tried two methods, unsuccessfully:

  1. Append to the Embed URL string the parameter name and values:

    embedUrl = embedUrl + '&rp:fromsk=20&rp:area=A' 
    
  2. Define the parameters in the embedded config object:

        this.embedConfig = {
             type: 'report',
             accessToken: '**********',
             tokenType: models.TokenType.Embed,
             permissions: models.Permissions.ReadWrite,
             viewMode: models.ViewMode.View,
             settings: {
                 parameterValues: [
                     { name: "area", value: "ab" },
                     { name: "fromsk", value: 20 }
                 ]
             }
         };
    

The problem is that either the parameters are ignored or the page is blank. What method should I use? How to make this work?

javafx js invoke java method success, but return failed

I try to invoke a java method in js method, and the java method worked but can’t get the return value, Moreover, the subsequent js cannot be executed either. Unfortunately, I can’t obtain the error log of js

onMounted(() => {
            alert("ready");
            // console.info has been redirect to java log and work fine
            console.info(window.bridge.getLocalApps());
        });

return bad:

    public String getLocalApps() {
        ArrayList<LocalAppRes> localAppRes = new ArrayList<>();
        LocalAppRes localApp = new LocalAppRes();
        localApp.name = "test1";
        localApp.version = "version1";
        localApp.author = "author1";
        localAppRes.add(localApp);
        String ret = JSONObject.toJSONString(localAppRes);
        log.info("getLocalApps: {}", ret); // log ok...
        return ret;
    }

return ok:

    public String getLocalApps() {
        return "[{"author":"author1","name":"test1","version":"version1"}]";
    }

My project(maven) used jdk is corretto-21.0.6.
JSON lib is fastjson2.

I don’t know the specific implementation logic of invoke Java from JS in JavaFX, and want to know how to handle it.

Hope and thanks for every reply~~~~

How do I update `grid-template-columns` in inline styles using Python and Selenium?

I’m using Python and Selenium to dynamically change the inline CSS of a `<div>` element. Updating `background-color` works fine, but I can’t seem to change `grid-template-columns`.

from selenium import webdriver

from selenium.webdriver.common.by import By

driver = webdriver.Chrome()

driver.get(“http://localhost/test.html”) # Simple HTML file with a grid div

grid = driver.find_element(By.ID, “grid”)

driver.execute_script(“arguments[0].style.backgroundColor = ‘yellow’;”, grid) # Works

driver.execute_script(“arguments[0].style.gridTemplateColumns = ‘auto auto auto’;”, grid)

How can I create a fully type-safe useForm hook in React with dynamic field names in TypeScript?

I’m building a custom useForm() hook in React with TypeScript that handles form state generically.
I want to:

Infer the shape of the form values from the generic type T

Support dynamic field updates like setValue(’email’, ‘[email protected]’) with autocompletion and type safety.

I’ve tried using Record<keyof T, any>, but I’m struggling to ensure both flexibility and strong typing for dynamic keys.
What’s the recommended way to type the state and setValue function for this kind of hook?

How do I change the innerHTML of a newly created element watched by a Mutual Observer, WITHOUT causing memory leaks and freezes?

Imagine a website that has infinite scrolling, where a link saying download, appears underneath every post. I would like to change from a word to something else of anything else. (In my case a 24×24 icon image rather than the word “download” but don’t worry about that for now).

HTML

<div id="container">
<span class="download"> Initial download link</span>
</div>

CSS

body { background-color: #1c1c1c; }

span{ 
background-color: darkcyan; color: #dcdcdc; 
padding: 8px; font-family: Tahoma; 
/* font-weight: bold; */
display: inline-block;
margin-right: 8px; margin-bottom: 8px;
border: 2px ridge #1c1c1c;
}

.download {
    background-color: #cc3c3c;
    border: 3px ridge #3c3c3c;
}

Javascript

let i = 1
function insertElement() {
  var newSpan = document.createElement("span")
  newSpan.classList.add("download")
  var newText = document.createTextNode("new button #" + i)
  newSpan.appendChild(newText)
  //console.log(newSpan.classList)

  if (i < 210) {
    document.getElementById("container").appendChild(newSpan)
  }
  setTimeout(insertElement, 4200)
  i++
}

//(function(){
// do some stuff
setTimeout(insertElement)
//})();

var elemToObserve = document.getElementById("container")

//var observer = new MutationObserver(function (mutations) {
var observer = new MutationObserver((mutations) => {
  for (let mutation of mutations) {
    if (mutation.type === "childList") {
      //do NOT use console.log for mutation.target as it causes a HUGE INSTANTANEOUS memory leak
      //console.log(mutation)
      //if (mutation.nodeType === Node.ELEMENT_NODE ) {
      if (mutation.target.classList.contains("download") !== true) {
        console.log("a download button was found")
      }
    }
  }
})

observer.observe(elemToObserve, {
  childList: true,
  attributes: true,
  characterData: false,
  subtree: true,
})

Once this new element with a class of .download has been tracked using the MutationObserver, I would like to change the innerText or innerHTML of it.

You can see what’s going on, can’t you? When I use innerHTML or innerText to change the value of a newly tracked element from MutualObserver, it causes some recursion, to monitor a change of a change of a change.

Here are some ideas for what to change the textNode to. / or a base64 encoded image.

You can test out my work to try for yourself on jsfiddle.

How can I initially hide the active dropdown-menu when a vertical Bootstrap 5 menu is collapsed?

I have converted a horizontal Bootstrap 5 navbar into a vertical sidebar.

The sidebar, when collapsed, is less then 100px wide and shows only icons.

.page {
  min-height: 100vh;
}

.sidebar {
  box-shadow: 3px 0px 11px 0px rgba(0, 0, 0, 0.04);
  width: 82px;
  height: auto !important;
}

.sidebar.show {
  width: 200px;
}

.site-header {
  display: flex;
  align-items: center;
  padding: 0 10px;
  height: 60px;
  box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.05);
}

/* Logo Begin */
.logo-container {
  min-width: 82px;
  display: flex;
  align-items: center;
}

.brand {
  height: 60px;
  display: flex;
  padding-left: 5px;
  align-items: center;
  text-decoration: none;
}

.brand img {
  display: none;
  height: 30px;
  width: auto;
}
/* Logo End */

/* Menu Begin */
.sidebar .brand img.collapsed {
  display: inline;
}

.sidebar.show .brand img {
  display: inline;
}

.sidebar.show .brand img.collapsed {
  display: none;
}

.sidebar .dropdown-toggle {
    position: relative !important;
}

.sidebar .dropdown-toggle::after {
  display: none;
  position: absolute;
  top: 17px;
  right: 15px;
  content: "";
  border: 0;
  border-bottom: 1px solid #495057;
  border-right: 1px solid #495057;
  height: 6px;
  width: 6px;
  transform: rotate(45deg);
}

.sidebar .dropdown-toggle.show::after {
  transform: rotate(225deg);
}

.sidebar .navbar-nav .nav-link {
  position: relative;
  text-align: center;
  padding: 6px 12px;
  color: #198754 !important;
}

.sidebar.show .navbar-nav .nav-link {
  text-align: left;
}

.sidebar .navbar-nav .nav-link:hover,
.sidebar .navbar-nav .nav-link.active {
  background: #e9ecef;
}

.sidebar .navbar-nav .nav-link .link-text {
  display: none;
}

.sidebar.show .navbar-nav .nav-link .menu-icon {
  padding-right: 5px;
}

.sidebar.show .navbar-nav .nav-link .link-text {
  display: inline;
}

.sidebar.show .dropdown-toggle::after {
  display: inline;
}

.sidebar .dropdown-menu {
  border: none !important;
  position: absolute;
  left: 50px !important;
  top: 10px !important;
  border: 1px solid rgba(0, 0, 0, 0.04) !important;
  box-shadow: 3px 0px 11px 0px rgba(0, 0, 0, 0.05);
}

.sidebar.show .dropdown-menu {
  position: static;
  width: 100%;
  left: auto;
  padding: 0;
  box-shadow: none;
}

.sidebar .dropdown-menu .dropdown-item {
  color: inherit;
}

.sidebar.show .dropdown-menu .dropdown-item {
  padding-left: 40px;
}

.sidebar .dropdown-menu .dropdown-item.active,
.sidebar .dropdown-menu .dropdown-item:hover {
  background: #e9ecef;
}

/* Menu End */

.main {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.content {
  flex: 1;
  display: flex;
  flex-direction: column;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>

<div class="page d-flex">
  <aside class="sidebar d-block bg-white">
    <div b-2esi1xgawe="" class="logo-container px-1">
      <button class="navbar-toggler mx-1" type="button" data-bs-toggle="collapse" data-bs-target=".sidebar"
          aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
          <span class="navbar-toggler-icon">
            <img src="data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%2833, 37, 41, 0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e">
          </span>
        </button>

      <a href="#" class="brand">
          <img src="https://i.sstatic.net/bmJ0DHwU.png" alt="Logo">
          <img src="https://i.sstatic.net/rKpG1nkZ.png" alt="Logo" class="collapsed">
        </a>
    </div>
    <div class="navbar-vertical">
      <ul class="navbar-nav">
        <li class="nav-item">
          <a class="nav-link" title="Now playing" href="#"><i class="fa-solid fa-house menu-icon"></i> <span
                class="link-text">Now playing</span></a>
        </li>
        <li class="nav-item">
          <a class="nav-link " title="Top rated" href="#"><i class="fa-solid fa-trophy menu-icon"></i> <span
                class="link-text">Top rated</span></a>
        </li>

        <li class="nav-item dropdown">
          <a class="nav-link dropdown-toggle active show" title="Genres" href="#" role="button" data-bs-toggle="dropdown"
              aria-expanded="false">
              <i class="fa-solid fa-list menu-icon"></i> <span class="link-text">Genres</span>
            </a>
          <ul class="dropdown-menu dropdown-menu-end show" aria-labelledby="Genres">
            <li>
              <a class="dropdown-item" href="#">Action</a>
            </li>
            <li>
              <a class="dropdown-item active" href="#">Adventure</a>
            </li>
            <li>
              <a class="dropdown-item" href="#">Science Fiction</a>
            </li>
          </ul>
        </li>
      </ul>
    </div>
  </aside>

  <div class="main">
    <header class="site-header bg-e">
      <h1 class="page-title">Lorem ipsum dolor sit amet</h1>
    </header>
    <div class="container content">
      <h2 class="mt-3">Lorem, ipsum dolor sit amet consectetur adipisicing elit</h2>
      <p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Placeat nam nobis recusandae rem aut nesciunt
        officiis incidunt voluptatum dicta doloremque, tempora suscipit debitis corporis nihil, corrupti tempore
        aspernatur praesentium. Dolorum.</p>
    </div>
  </div>
</div>

I am facing a problem when I make a dropdown-menu active and the sidebar is collapsed: the dropdown-menu is displayed when the page loads and I want it collapsed and displayed only when the user interacts with the dropdown toggle.

Otherwise, when the menu is expanded, all is ok as it is now.

Questions

  1. Is there a way to keep the dropdown-menu collapsed when the sidebar is collapsed, unless the dropdown toggle is clicked?
  2. Alternatively, when the sidebar is collapsed, how can I make the dropdown-menu show only when the dropdown toggle is hovered?

Nut.js not found but its in the Node_modules folder

I’ve been trying to make a very simple app with nut.js but I just can’t get it to work. I installed nut from a .tgz I built from the monorepo and I listed the depends out just to make sure i installed it correctly and it is there:


[email protected] C:UsersMarkDocumentsCodeMouse App

dependencies:
@nut-tree/nut.js 4.2.0
```. I made a script for testing its very simple: `"test": "node main.js"` but every time i run it I got this big error:

Error: Cannot find module ‘@nut-tree/nut.js/’
Require stack:

  • C:UsersMarkDocumentsCodeMouse Appmain.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1405:15)
    at defaultResolveImpl (node:internal/modules/cjs/loader:1061:19)
    at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1066:22)
    at Module._load (node:internal/modules/cjs/loader:1215:37)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
    at Module.require (node:internal/modules/cjs/loader:1491:12)
    at require (node:internal/modules/helpers:135:16)
    at Object. (C:UsersMarkDocumentsCodeMouse Appmain.js:1:13)
    at Module._compile (node:internal/modules/cjs/loader:1734:14) {
    code: ‘MODULE_NOT_FOUND’,
    requireStack: [ ‘C:UsersMarkDocumentsCodeMouse Appmain.js’ ]
    }
. I think i get this error when node tries to run this: `const nut = require("@nut-tree/nut.js/");`.
 I have no clue why it's not working and I hope someone can help!

I tried out different paths when requiring nut.js and I was obviously expecting it to run without errors.