Sorting related issue using AG-Grid

I have issue ragarding sorting.

Library : AG grid


 colDefsMedalsExcluded: [],
    groupUseEntireRow: false,
    pinColumns: {
    isPinOption: true,
    columns: [
    {
    colId: 'Company_name',
    pinned: 'left',
    },
    ],
    },
    columnTypes: filters,
    paggination: { isPagging: false, pageSize: 10 },
    isfloatingFilter: true,
    pivotMode: false,
    components: {
    agColumnHeader: CustomToolTipHeader,
    loadingRenderer: loadingRenderer,
    },
    sideBar: columnAndfilterSidebarNoPivotNoColNoRow,
    statusBar: bottomStatusBar,
    suppressAggFuncInHeader: true,
    quickSearchFilter: true,
    aggFuncs: {
    'count(Dist)': distinctCounts,
    },
    headerHeight: 50,
    rowSelection: 'multiple',
    domLayout: 'normal',
    gridHeight: '72vh',
    multiSortKey: 'ctrl',
    ** alwaysMultiSort: false, **
    suppressFieldDotNotation: true,
    rowData:
    props.lstGovernanceScores &&
    props.lstGovernanceScores.map((x) => ({
    ...x,
    // market_cap: x.market_cap !== null ? numberWithCommas(Number(x.market_cap).toFixed(0)) : null,
    TrialStatus: props.trialStatus,
    allowDownload: true,
    })),

Issue is when I apply sorting one column to another column, previous column show sorting icon and i want to remove it from previous column, want to show only cureent selected column. I have disabled alwaysMultiSort: false.

How to deal with string with ” in it? [closed]

For example, a string '{"a":"1","b":"{"c": "2"}"}'with ” in it. When I do JSON.parse('{"a":"1","b":"{"c": "2"}"}'), there is an ‘Uncaught SyntaxError’.

So I thought about replacing ‘”‘ to ‘\”‘, which is '{"a":"1","b":"{\"c\": \"2\"}"}', and then it can be parsed correctly.

But when I tried to replace the string, I never succeed. I tried this str.replace(/\"/g, '\\"'), and it failed.

I don’t know where goes wrong, any help will be appreciated.

Node.js AsyncLocalStorage Official Example: Actual Execution Order Differs from Documentation

Problem Description

While learning about Node.js AsyncLocalStorage, I’ve encountered an interesting discrepancy. The official Node.js documentation provides an example with an expected output order, but when I execute the exact same code, I get a different sequence.

Here’s the official example code:

const http = require('node:http');
const { AsyncLocalStorage } = require('node:async_hooks');

const asyncLocalStorage = new AsyncLocalStorage();

function logWithId(msg) {
  const id = asyncLocalStorage.getStore();
  console.log(`${id !== undefined ? id : '-'}:`, msg);
}

let idSeq = 0;
http.createServer((req, res) => {
  asyncLocalStorage.run(idSeq++, () => {
    logWithId('start');
    // Imagine any chain of async operations here
    setImmediate(() => {
      logWithId('finish');
      res.end();
    });
  });
}).listen(8081);

http.get('http://localhost:8081');
http.get('http://localhost:8081');

According to the documentation, the expected output should be:

0: start
1: start
0: finish
1: finish

However, when I run this exact code, I consistently get:

0: start
0: finish
1: start
1: finish

Questions

  1. Why does the actual execution order differ from what’s described in the official documentation?
  2. Is this behavior related to Node.js event loop mechanics?
  3. How can I modify the code to ensure the output follows the “start start finish finish” pattern?
  4. Does this discrepancy impact how AsyncLocalStorage should be used in real applications?

What I’ve Tried

I’ve attempted the following approaches without achieving the documented output sequence:

  • Adjusting event loop timing by using setImmediate to send requests after the server starts
  • Replacing setImmediate with setTimeout
  • Varying delay times to control the timing of request submissions

Environment Information

  • Node.js version: v20.18.3/v22.12.0
  • Operating system: macos /ubuntu

I would appreciate any insights that explain this behavioral difference and help me understand the underlying mechanics.

generator-videojs-plugin on windows 10 error

I just fallowed this guide. Tried multiple times. but it gives an error.

Error appears after, I try npm install inside the newly created plugin folder.

generator-videojs-plugin

Full error log is longer than this. I removed the long install log part that didn’t show any errors.

6360 silly packumentCache corgi:https://registry.npmjs.org/videojs-languages cache-miss
6361 http fetch GET 200 https://registry.npmjs.org/videojs-languages 3287ms (cache updated)
6362 silly packumentCache corgi:https://registry.npmjs.org/videojs-languages set size:undefined disposed:false
6363 info run [email protected] install node_modules/husky node husky install
6364 info run [email protected] install node_modules/npm-merge-driver-install node src/install.js
6365 info run [email protected] install { code: 1, signal: null }
6366 info run [email protected] install { code: 0, signal: null }
6367 warn cleanup Failed to remove some directories [
6367 warn cleanup   [
6367 warn cleanup     '\\?\C:\vjs\t4\node_modules\husky',
6367 warn cleanup     [Error: EBUSY: resource busy or locked, rmdir 'C:vjst4node_moduleshusky'] {
6367 warn cleanup       errno: -4082,
6367 warn cleanup       code: 'EBUSY',
6367 warn cleanup       syscall: 'rmdir',
6367 warn cleanup       path: 'C:\vjs\t4\node_modules\husky'
6367 warn cleanup     }
6367 warn cleanup   ],
6367 warn cleanup   [
6367 warn cleanup     '\\?\C:\vjs\t4\node_modules\listr2',
6367 warn cleanup     [Error: EPERM: operation not permitted, rmdir 'C:vjst4node_moduleslistr2node_modulesrxjsinternalobservable'] {
6367 warn cleanup       errno: -4048,
6367 warn cleanup       code: 'EPERM',
6367 warn cleanup       syscall: 'rmdir',
6367 warn cleanup       path: 'C:\vjs\t4\node_modules\listr2\node_modules\rxjs\internal\observable'
6367 warn cleanup     }
6367 warn cleanup   ],
6367 warn cleanup   [
6367 warn cleanup     '\\?\C:\vjs\t4\node_modules',
6367 warn cleanup     [Error: EPERM: operation not permitted, rmdir 'C:vjst4node_modulesm3u8-parsernode_modules@videojsvhs-utilstestfixturesformatsts'] {
6367 warn cleanup       errno: -4048,
6367 warn cleanup       code: 'EPERM',
6367 warn cleanup       syscall: 'rmdir',
6367 warn cleanup       path: 'C:\vjs\t4\node_modules\m3u8-parser\node_modules\@videojs\vhs-utils\test\fixtures\formats\ts'
6367 warn cleanup     }
6367 warn cleanup   ]
6367 warn cleanup ]
6368 verbose stack Error: command failed
6368 verbose stack     at promiseSpawn (C:Program Filesnodejsnode_modulesnpmnode_modules@npmclipromise-spawnlibindex.js:22:22)
6368 verbose stack     at spawnWithShell (C:Program Filesnodejsnode_modulesnpmnode_modules@npmclipromise-spawnlibindex.js:124:10)
6368 verbose stack     at promiseSpawn (C:Program Filesnodejsnode_modulesnpmnode_modules@npmclipromise-spawnlibindex.js:12:12)
6368 verbose stack     at runScriptPkg (C:Program Filesnodejsnode_modulesnpmnode_modules@npmclirun-scriptlibrun-script-pkg.js:77:13)
6368 verbose stack     at runScript (C:Program Filesnodejsnode_modulesnpmnode_modules@npmclirun-scriptlibrun-script.js:9:12)
6368 verbose stack     at C:Program Filesnodejsnode_modulesnpmnode_modules@npmcliarboristlibarboristrebuild.js:329:17
6368 verbose stack     at run (C:Program Filesnodejsnode_modulesnpmnode_modulespromise-call-limitdistcommonjsindex.js:67:22)
6368 verbose stack     at C:Program Filesnodejsnode_modulesnpmnode_modulespromise-call-limitdistcommonjsindex.js:84:9
6368 verbose stack     at new Promise (<anonymous>)
6368 verbose stack     at callLimit (C:Program Filesnodejsnode_modulesnpmnode_modulespromise-call-limitdistcommonjsindex.js:35:69)
6369 verbose pkgid [email protected]
6370 error code 1
6371 error path C:vjst4node_modulesnpm-merge-driver-install
6372 error command failed
6373 error command C:WINDOWSsystem32cmd.exe /d /s /c node src/install.js
6374 error C:vjst4node_modulesnpm-merge-driver-installsrcget-root.js:8
6374 error   const rootDir = gitRootResult.stdout.toString().trim();
6374 error                                        ^
6374 error
6374 error TypeError: Cannot read properties of undefined (reading 'toString')
6374 error     at getRoot (C:vjst4node_modulesnpm-merge-driver-installsrcget-root.js:8:40)
6374 error     at Object.<anonymous> (C:vjst4node_modulesnpm-merge-driver-installsrcinstall.js:7:41)
6374 error     at Module._compile (node:internal/modules/cjs/loader:1562:14)
6374 error     at Object..js (node:internal/modules/cjs/loader:1699:10)
6374 error     at Module.load (node:internal/modules/cjs/loader:1313:32)
6374 error     at Function._load (node:internal/modules/cjs/loader:1123:12)
6374 error     at TracingChannel.traceSync (node:diagnostics_channel:322:14)
6374 error     at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
6374 error     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:170:5)
6374 error     at node:internal/main/run_main_module:36:49
6374 error
6374 error Node.js v22.13.0
6375 silly unfinished npm timer reify 1745248985517
6376 silly unfinished npm timer reify:build 1745283537036
6377 silly unfinished npm timer build 1745283537039
6378 silly unfinished npm timer build:deps 1745283537039
6379 silly unfinished npm timer build:run:install 1745283537526
6380 silly unfinished npm timer build:run:install:node_modules/npm-merge-driver-install 1745283537663
6381 verbose cwd C:vjst4
6382 verbose os Windows_NT 10.0.18363
6383 verbose node v22.13.0
6384 verbose npm  v10.9.2
6385 verbose exit 1
6386 verbose code 1
6387 error A complete log of this run can be found in: C:UsersUser NameAppDataLocalnpm-cache_logs2025-04-21T15_22_50_979Z-debug-0.log

I tried with different folder locations, multiple times, with admin cmd. But didn’t work.

Even tried with cleaning npm cache. It didn’t work either.

How does JavaScript event delegation improve performance in large-scale DOM structures?

I’ve read that using event delegation by attaching a single event listener to a parent element is more efficient than adding multiple listeners to child elements.

However, in a real-world scenario with dynamic DOM updates and hundreds of elements, how significant is the performance gain?

Also, are there any caveats or edge cases (like event bubbling limitations) I should be aware of when using delegation on deeply nested elements?

Cannot read properties of undefined (reading ‘__wbindgen_free’) in calling rust function

I am using Rust inside angular as wsam . Installed wsam package cargo install wasm-pack and then created Rust Project using cargo new --lib my-rust-wasm this is my src/lib.rs

     use wasm_bindgen::prelude::*;

     #[wasm_bindgen]
     pub fn greet() -> String {
     "Hello from Rust!".to_string()
    }

building rust-project using wasm-pack build --target web Now this is my angular appComponent.ts

   import { Component, OnInit } from '@angular/core';
   import { RouterOutlet } from '@angular/router';
   import { greet } from '../assets/pkg/my_rust_wasm.js';
   @Component({
     selector: 'app-root',
     imports: [RouterOutlet],
     templateUrl: './app.component.html',
     styleUrl: './app.component.css'
    })
   export class AppComponent implements OnInit {
    async ngOnInit() {
     console.log(greet());
}

   private loadWasmModule(path: string): Promise<any> {
     return import(path);
  }
}

HTML5 Canvas (with multiple SVG files drawn to the canvas) to PNG is not displaying the SVG files; however PNG is not entirely blank? [duplicate]

I’m working on a project that draws repeatedly to an HTML Canvas using a combination of the lineTo and drawImage methods. As far as I can tell, the actual production of the Canvas works as intended. (Not all tiles are intended to be populated, so the below image is an accurate translation from the text file into a visual representation of it.)

a 5×4 tile grid, each tile is 120px in size. SVG images are placed in some (but not all) tiles

The first segment of code I’ll share acts as something of a driver for the rest of the functionality. Essentially, a local text file (formatted according to specifics outlined elsewhere) is opened, read from to populate two vectors, and those vectors accessed by drawGrid() and tileParse().

The reader:

document
    .getElementById('FileInput')
    .addEventListener('change', function (event) {
        let file = event.target.files[0];
        let reader = new FileReader();

        reader.onload = function (event) {
            read(event);
            drawGrid(tilesWidth,tilesHeight);
            tileParse();

            //once map is drawn, convert to image for display
            //attempts have gone here, removed for legibility and elaboration further down
        };

        reader.onerror = (event) => alert(event.error.name);
        reader.readAsText(file);
    });

This draws a grid to the canvas:

function drawGrid(width,height){
    canvas = document.getElementById("canvas");
    canvas.width = width + 20;
    canvas.height = height + 20;

    if (canvas.getContext) {
      const ctxt = canvas.getContext("2d");
      ctxt.save();
      ctxt.beginPath();

      ctxt.strokeStyle = "black";

      var pad = 10; //padding
      //adjust width and height to account for external grid padding

      for(var x = 0; x <= width; x += 120){
        ctxt.moveTo(0.5 + x + pad, pad);
        ctxt.lineTo(0.5 + x + pad, height+pad);
        //ctxt.stroke();
      }

      for (var y = 0; y <=height; y+=120){
        ctxt.moveTo(pad, 0.5 + y + pad);
        ctxt.lineTo(width + pad, 0.5 + y + pad);
        //ctxt.stroke();
      }
      ctxt.stroke();
      ctxt.closePath();

      tileParse();
    }
}

This parses the vectors to add tiles

function tileParse(){
    for (let row = 0; row < tilesArray.length ; row++) {
        for (let col = 0; col < tilesArray[row].length ; col++) {
            let type = tilesArray[row][col][0];
            let extremeness = tilesArray[row][col][1];

            switch(type) {
                case 'R':
                    drawRiver(row,col, extremeness);
                    break;
                case 'M':
                    drawMountain(row,col, extremeness);
                    break;
                case 'V':
                    drawValley(row,col, extremeness);
                    break;
                case 'C':
                    drawSettlement(row,col, extremeness);
                    break;
                case 'F':
                    drawForest(row,col, extremeness);
                    break;
                default:
                    //leave blank
            }
        }
    }
}

And this is one of (the drawRiver() method) the methods called within the tile parser, for reference. All the methods are very very similarly structured, just with changes in line with the different types (Mountain instead of River, for instance).

function drawRiver(tileRow, tileCol, extremeness){
  const canvas = document.getElementById("canvas");
  if (canvas.getContext) {
    const ctxt = canvas.getContext("2d");
    var image = new Image(120,120);
    image.crossOrigin="anonymous";

    switch(extremeness){
      case '1':
        image.src = 'assets/rivers/River1.svg';
        break;
      case '2':
        image.src = 'assets/rivers/River2.svg';
        break;
      case '3':
        image.src = 'assets/rivers/River3.svg';
        break;
      case '4':
        image.src = 'assets/rivers/River4.svg';
        break;
      case '5':
        image.src = 'assets/rivers/River5.svg';
        break;
      default:
        //use original tile as default
        image.src = 'assets/rivers/River.svg';
    }

    image.onload = () => {
      startX = (tileCol*120)+10;
      startY = (tileRow*120)+10;

      ctxt.drawImage(image, startX, startY, image.width, image.height);
    }
    
  }
}

All of this background is because when I attempt to convert the HTML Canvas into a PNG (for display and downloading, but I haven’t implemented any attempts at downloading functionality), the grid (put on the canvas with lineTo()) displays, but none of the SVGs have captured. The below image is a side-by-side of the HTML canvas and the PNG that is currently captured by my code.

a side-by-side comparison of the canvas and the captured png. the png only shows the grid, without any of the svg images

I want to generate a png that captures everything that was added to the canvas. So that side-by-side comparison, if the project were working as intented, should show two elements that look identical when displayed. (No visual differences, that is.)

Note: the SVG files being accessed are stored locally on my computer, and are stored in an assets folder within the GitHub repo that I’m pushing to, so there shouldn’t(?) be any external origin issues with the files.

I have attempted the following attempts at implementation, the first two of which were extracted from this question: Capture HTML canvas as GIF/JPG/PNG/PDF?

const canvas = document.getElementById("canvas");
const url = canvas.toDataURL();
console.log(url);
document.getElementById('finMap').src = url;
canvas.toBlob((blob) => {
            const url = URL.createObjectURL(blob);
            document.getElementById('finMap').src = url;
            })

Both of these techniques, implemented within the reader (the first code snippet I shared), produced the png that only had the grid on it.

This following technique utilizes hongru’s Canvas2Image, but I haven’t been able to get it to work. It throws the following error: InvalidStateError: CanvasRenderingContext2D.drawImage: Canvas exceeds max size.

            import("./canvas2image").then((convertToPNG) => {
            console.log(Canvas2Image.convertToPNG(canvas, tilesWidth*120, tilesHeight*120));
            })

Everything that I’ve read suggests that one of these methods should have worked, or I should have been generating an entirely blank PNG. I can’t figure out where in my implementation things are going awry to be able to further drill down in my troubleshooting.

Why do I have to set up an infinite loop on an Event Source in PHP?

I’m trying to learn about how Event sources work in a JS-PHP environment.

In my project directory, I have 3 mains files:

script.js 
/agents/handler.php
/agents/transmitter.php

The script.js will post a XMLHttpRequest to the handler.php, and then the script.js will immediately open up a connection to transmitter.php.

Here is the relevant code in the script.js

function postToHandler(){
 
    let xhr = new XMLHttpRequest();
    xhr.open("POST", "./agents/handler.php");

    let form = new FormData();
    form.append('listen', "mockData");

    xhr.send(form);

    //Connecting to transmitter
    eventSrc = new EventSource("./agents/transmitter.php");
    eventSrc.addEventListener("ping", displayData);
}

And here’s my handler.php

include "./transmitter.php";

if (!empty($_POST['listen'])) {
    
    for($x=0; $x<10; $x++){
        sleep(1);
        $result = getResult();

        transmitVal($result);
    }
}

function getResult(){
    return rand(10, 100);
}

And here’s my transmitter.php

header("Content-Type: text/event-stream");
header("Cache-Control: no-cache");
ob_end_flush();

function transmitVal($param){
    echo "event: pingn";
    echo "data: ".$param."nn"; 
}

So what I’m trying to do is call the transmitter’s function from inside my handler file. And hopefully that transmitter will echo out those statements to the connection that was opened by the script.js.

However when I try this, it doesn’t seem to work. My script.js is not receiving any data from transmitter.

What I also don’t understand is why do I have to enclose all the code in my transmitter file with while(true)? Every tutorial online does that but I cannot figure out why.

If I am calling the transmitter’s function from inside my handler……why is a loop required?

Swiper Javascript not working on my site but working local

I wanted to add a slider to my own site with the Elementor “HTML” plugin. I tested it on localhost but it didn’t work when it came to the site. On my WordPress based site, only the first image and text worked, but when I scrolled with the button, a white and blank page appeared. The reason for this is probably something blocking it on my site, but I couldn’t find it. I would be very happy if you could help me.

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css"/>

<!-- Galeri -->
<div class="gallery-wrapper">
  <!-- Ana Swiper -->
  <div class="swiper mySwiperMain">
    <div class="swiper-wrapper">
      <div class="swiper-slide">
        <div class="image-box">
          <img src="https://i.ibb.co/Nng62bWf/IMG-20250421-WA0022.jpg" alt="Mavi">
          <div class="slide-text-container">
            <div class="slide-title-fixed">Renk Seçenekleri:</div>
            <div class="slide-text">Mavi</div>
          </div>
        </div>
      </div>
      <div class="swiper-slide">
        <div class="image-box">
          <img src="https://i.ibb.co/HMBBKCB/IMG-20250421-WA0023.jpg" alt="Beyaz">
          <div class="slide-text-container">
            <div class="slide-title-fixed">Renk Seçenekleri:</div>
            <div class="slide-text">Beyaz</div>
          </div>
        </div>
      </div>
      <div class="swiper-slide">
        <div class="image-box">
          <img src="https://i.ibb.co/3ycNMytq/IMG-20250421-WA0024.jpg" alt="Turkuaz">
          <div class="slide-text-container">
            <div class="slide-title-fixed">Renk Seçenekleri:</div>
            <div class="slide-text">Turkuaz</div>
          </div>
        </div>
      </div>
    </div>
    <div class="swiper-button-next custom-next"></div>
  </div>

  <!-- Thumbnail Swiper -->
  <div class="swiper mySwiperThumb">
    <div class="swiper-wrapper">
      <div class="swiper-slide"><img src="https://i.ibb.co/Nng62bWf/IMG-20250421-WA0022.jpg" alt=""></div>
      <div class="swiper-slide"><img src="https://i.ibb.co/HMBBKCB/IMG-20250421-WA0023.jpg" alt=""></div>
      <div class="swiper-slide"><img src="https://i.ibb.co/3ycNMytq/IMG-20250421-WA0024.jpg" alt=""></div>
    </div>
  </div>
</div>

<!-- Swiper JS -->
<script src="https://cdn.jsdelivr.net/npm/swiper@11/swiper-element-bundle.min.js"></script>

<!-- Swiper Ayarları -->
<script>
  window.addEventListener('DOMContentLoaded', () => {
    const swiperThumb = new Swiper(".mySwiperThumb", {
      spaceBetween: 10,
      slidesPerView: 3,
      freeMode: true,
      watchSlidesProgress: true,
    });

    const swiperMain = new Swiper(".mySwiperMain", {
      spaceBetween: 10,
      navigation: {
        nextEl: '.custom-next',
      },
      loop: false, // Loop sorun çıkarıyordu
      thumbs: {
        swiper: swiperThumb,
      },
    });
  });
</script>

<!-- Stil -->
<style>
  body {
    background: #111;
    font-family: sans-serif;
    margin: 0;
    padding: 20px;
  }

  .gallery-wrapper {
    position: relative;
    max-width: 1500px;
    margin: auto;
  }

  .swiper.mySwiperMain {
    border-radius: 15px;
    overflow: hidden;
    position: relative;
  }

  .image-box {
    position: relative;
  }

  .image-box img {
    width: 100%;
    display: block;
  }

  .slide-text-container {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .slide-title-fixed {
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: normal;
  }

  .slide-text {
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: bold;
  }

  .mySwiperThumb {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 10;
    width: auto;
    height: auto;
  }

  .mySwiperThumb .swiper-slide {
    width: 75px !important;
    height: 50px;
    opacity: 1 !important;
    transition: none !important;
    transform: none !important;
  }

  .mySwiperThumb .swiper-slide-thumb-active {
    border: 2px solid white;
    border-radius: 6px;
  }

  .mySwiperThumb .swiper-slide img {
    width: 100%;
    border-radius: 6px;
  }

  .swiper-button-next.custom-next {
    color: white;
    background: dodgerblue;
    padding: 0;
    border-radius: 1px;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    position: absolute;
    z-index: 10;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .swiper-button-next.custom-next::after {
    font-size: 22px;
    font-weight: bold;
  }
</style>

Live error: https://www.pondhavuz.com/fiber-havuzlar/

What is needed to get a simple instance of JBCefBrowser up and running to execute JavaScript?

I’m working on making a possible contribution the Community Edition of Intellij IDEA, adding some enhancements to the Markdown preview feature.

The IDEA code base is primarily Java and Java’s cousin, Kotlin. There is, however, some other open-source code I want to leverage, highlight.js, that’s written it JavaScript.

I’ve found a functional way to get highlight.js to work for me in this code environment, but it took some ugly and unsatisfactory hacking to do it. I think I have the basic elements for a better solution in place, but just can’t get it to actually work.

This is the start of what I hope to be a less kludgy way of running JavaScript code:

var browser = JBCefBrowser()

browser.jbCefClient.addDisplayHandler(object: CefDisplayHandlerAdapter() {
  override fun onConsoleMessage(browser: CefBrowser, level: CefSettings.LogSeverity,
    message: String, source: String, line: Int
  ): Boolean {
    println(message) // <-- Should reach this code, but it's not happening
    return false
  }
}, browser.cefBrowser)

browser.executeJavaScript("console.info('Hello, world.')")

If you’re already feeling a little TL;DR at this point, you can skip past the following explanation of how I arrived here and go to the end of the post for the specific problem I’m running into.

IDEA uses JCEFBrowser (JCEF: Java Chromium Embedded Framework) for a number of things, including for its Markdown preview. Such browsers are capable of executing JavaScript code, so taking advantage of that seems to make a lot more sense that dragging in an additional heavy-weight dependency like GraalVM to run highlight.js.

As the IDEA code is set up, however, the MarkdownJCEFHtmlPanel implementation of a JCEFBrowser can only work on changing code fence highlighting a bit late in the game, after all processing for syntax highlighting should have already been done. With my current solution the user momentarily sees un-highlighted code until the JavaScript running in MarkdownJCEFHtmlPanel locates the code fence contents and then applies highlight.js highlighting.

This results in noticeable flicker when code fence contents are being edited. Without some additional ugly hacking, every code fence had flickered when anything was edited anywhere.

Hence the alternate solution I’m trying to find, and the problem with that solution so far: For reasons I don’t understand the extra JBCefBrowser instance I’m creating is totally unresponsive, dead in the water and not helping me to do anything.

I get no errors and no warnings, just nothing useful happens. Things like waitForPageLoad hang forever.

Does the JCEFBrowser, even if it’s meant to be offscreen, need to be attached to a live view of some sort? Does the browser need to be registered somewhere so that it receives processing time and/or event dispatches?

The debugger tells me browser.cefBrowser.hasDocument() is always false, so I’m sure that’s not a good sign.

I feel like there’s some missing initialization or other form of a kick in the pants needed to get this JBCefBrowser instance up and running in a fully functional state.

Can anyone suggest what that might be?

How to create an outline for an image?

I’m currently using CSS,HTML, and React. I’m trying to make my UI interactable by allowing users to hover over an image, and the outline of the object will be highlighted. I searched multiple threads on how to do it but to no avail. I removed the background of each image but still for some reason when I highlight the outlines, it re-colors the background to a green hue. I do not know how the filter is doing this when I removed the background of the image. The image is a png file.

Here’s what I’m trying to do
What it should look like

Here’s what actually happened:
What it actually looks like

I tried looking through past threads, but they don’t solve the problem.
Here is the CSS File:

html {
  background: gray;
  height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
}

img {
  user-select: none;
  height: 500px;
  width: 500px;
}

.image-w-bg {
  filter: drop-shadow(5px 0 0 green) 
  drop-shadow(0 5px 0 green)
  drop-shadow(-5px 0 0 green) 
  drop-shadow(0 -5px 0 green);
}

Here is where I inserted the image into the page:
return <img className='image-w-bg' src={designImage} alt="Me" />;

How to derive remaining forest mask from Hansen treecover2000 and lossyear in GEE?

I’m loading the Hansen Global Forest Change data, creating three layers:

forest2000 – all pixels with ≥20% tree cover in 2000

forestLoss2002 – all pixels that lost tree cover in 2001

remainingForest2002 – what’s left of forest2000 after removing losses through 2001

I’d expect that, if you toggle on Layer 1 (green) and Layer 2 (red), then Layer 3 (cyan) would be exactly the green minus the red. However, when I inspect them in the map viewer, they don’t line up as perfect complements. Some “cyan” remains where I still see red pixels, and vice versa.

Here’s a minimized version of my script:

// 1. Load Hansen data
var hansen        = ee.Image('UMD/hansen/global_forest_change_2023_v1_11');
var tree2000      = hansen.select('treecover2000');
var lossyear      = hansen.select('lossyear');

// 2. Baseline forest mask (≥20% cover in 2000)
var forest2000 = tree2000.gte(20).selfMask();

// 3. Loss mask: pixels lost in 2001 only
var lossMask2002     = lossyear.gt(0).and(lossyear.lte(1));
var forestLoss2002 = lossMask2002.updateMask(forest2000);

// 4. Remaining forest after 2001 loss
var remainingForest2002 = forest2000.updateMask(lossMask2002.not());

// 5. Display
Map.addLayer(forest2000,         {palette:['green']}, 'Forest2000');
Map.addLayer(forestLoss2002,     {palette:['red']},   'Loss2001');
Map.addLayer(remainingForest2002,{palette:['cyan']},  'Remaining2002');

I loaded the Hansen Global Forest Change image in Earth Engine and created three layers: the baseline forest mask for ≥20 % tree cover in 2000; a loss mask for pixels that lost cover in 2001; and finally a “remaining forest” mask obtained by inverting the loss mask on the baseline. I displayed all three layers together in the map viewer.

What I expected
I expected every red loss pixel to fall entirely within the green forest2000 area, and the cyan remaining‑forest layer to exactly fill all parts of the green layer that were not marked as red. In other words, red and cyan should partition the green without overlap or gaps.

What actually happened
Instead,cyan sometimes overlapped red or left gaps inside the green.

I can’t get Tailwind 4 to work with Next.js 15

I just can’t get it to work, the border classes are being override by something and can’t figure it out, any ideas?

I’ve tried downgrading to Tailwind 3 but no luck.

Tailwind version: 4.1.4
Postcss version: 4.1.4
Next.js version: 15.3.1

postcss.config.js

const config = {
  plugins: {
    '@tailwindcss/postcss': {},
  },
};
export default config;

app/layout.tsx

import type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import "./globals.css";

const geistSans = Geist({
  variable: "--font-geist-sans",
  subsets: ["latin"],
});

const geistMono = Geist_Mono({
  variable: "--font-geist-mono",
  subsets: ["latin"],
});

export const metadata: Metadata = {
  title: "Next.js Calculator",
  description: "A simple Next.js calculator",
};

export default function RootLayout({
  children,
}: Readonly<{
  children: React.ReactNode;
}>) {
  return (
    <html lang="en">
      <body
        className={`${geistSans.variable} ${geistMono.variable} antialiased`}
      >
        {children}
      </body>
    </html>
  );
}

app/global.css

@import "tailwindcss";

app/page.tsx

export default function Home() {
  return (
    <div>
      <input className="border-solid border-black rounded-md" type="text" disabled />
    </div>
  );
}

After trying to add signoz to nextjs app, error shows up

i am trying to add my app to signoz, and as per documentation i have added

'use strict'
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';

// Add otel logging
import { diag, DiagConsoleLogger, DiagLogLevel } from '@opentelemetry/api';
diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.ERROR); // set diaglog level to DEBUG when debugging

const exporterOptions = {
  url: 'http://localhost:4318/v1/traces', // Endpoint of SigNoz/Otel Collector
}

export const traceExporter = new OTLPTraceExporter(exporterOptions);

and

import { registerOTel } from '@vercel/otel';
import { traceExporter } from './instrumentation.node';

export function register() {
  registerOTel({
    serviceName: 'Apple_Music_Art',
    traceExporter: traceExporter,
  });
}

but i just get an error:

{
    "stack": "TypeError: Cannot read properties of undefined (reading 'name') at createResourceMap (D:\better-projects\apple-music-covers\.next\server\chunks\node_modules_34e1f1fe._.js:9181:72) at spanRecordsToResourceSpans (D:\better-projects\apple-music-covers\.next\server\chunks\node_modules_34e1f1fe._.js:9192:25) at createExportTraceServiceRequest (D:\better-projects\apple-music-covers\.next\server\chunks\node_modules_34e1f1fe._.js:9169:24) at Object.serializeRequest (D:\better-projects\apple-music-covers\.next\server\chunks\node_modules_34e1f1fe._.js:9237:257) at OTLPExportDelegate.export (D:\better-projects\apple-music-covers\.next\server\chunks\node_modules_34e1f1fe._.js:9880:52) at OTLPTraceExporter.export (D:\better-projects\apple-music-covers\.next\server\chunks\node_modules_34e1f1fe._.js:8730:30) at s (D:\better-projects\apple-music-covers\.next\server\chunks\node_modules_34e1f1fe._.js:2563:115) at D:\better-projects\apple-music-covers\.next\server\chunks\node_modules_34e1f1fe._.js:2567:38 at AsyncLocalStorage.run (node:internal/async_local_storage/async_hooks:91:14) at Du.with (D:\better-projects\apple-music-covers\.next\server\chunks\node_modules_34e1f1fe._.js:6488:44) at ContextAPI.with (D:\better-projects\apple-music-covers\node_modules\@opentelemetry\api\build\src\api\context.js:60:46) at D:\better-projects\apple-music-covers\.next\server\chunks\node_modules_34e1f1fe._.js:2562:32 at new Promise (<anonymous>) at Go._flushOneBatch (D:\better-projects\apple-music-covers\.next\server\chunks\node_modules_34e1f1fe._.js:2558:95) at e (D:\better-projects\apple-music-covers\.next\server\chunks\node_modules_34e1f1fe._.js:2579:46) at Timeout.<anonymous> (D:\better-projects\apple-music-covers\.next\server\chunks\node_modules_34e1f1fe._.js:2586:69) at listOnTimeout (node:internal/timers:611:17) at process.processTimers (node:internal/timers:546:7)",
    "message": "Cannot read properties of undefined (reading 'name')",
    "name": "TypeError"
}

An idiom for async functions with “busy” indication and progress logging?

I’m working on some JS code (which will run within Thunderbird, but that’s not the main point). This code is kind of old, and does asynchronous work using setTimeout(); I want to transition it to using async functions, await, and try-catch for possible errors. I’m a newbie with regard to their use.

The thing is, that asynchronous code is something I want the app GUI to be reflective of, in the following sense:

  • I want to indicate that the app is busy / running something while my top-level async function is running (never mind sub-functions and such)
  • I want to be able to tell my async function that the user asked to abort it
  • I want my async function to be able to occasionally report its status (e.g. via setting the text of the status bar mmedage)

I realize these are app-specific desires, but they could be made actionable using some generic interface (exposed by my code or for my code to see). My question is, therefore – is there some kind of idiom for doing this with one, or both, of my side-desires?