Unable to connect to Postgres database in JavaScript file

I’m currently using Neon Postgres, which works perfectly fine, when I attempt to connect it directly from Windows.

However, as soon as I go to WSL, and try to connect using the pg client, I get the following error:

AggregateError [ETIMEDOUT]: 
    at internalConnectMultiple (node:net:1116:18)
    at internalConnectMultiple (node:net:1184:5)
    at Timeout.internalConnectMultipleTimeout (node:net:1710:5)
    at listOnTimeout (node:internal/timers:575:11)
    at process.processTimers (node:internal/timers:514:7) {
  code: 'ETIMEDOUT',
  [errors]: [
    Error: connect ETIMEDOUT censored;lookslikeipv4
        at createConnectionError (node:net:1646:14)
        at Timeout.internalConnectMultipleTimeout (node:net:1705:38)
        at listOnTimeout (node:internal/timers:575:11)
        at process.processTimers (node:internal/timers:514:7) {
      errno: -110,
      code: 'ETIMEDOUT',
      syscall: 'connect',
      address: 'censored;lookslikeipv4',
      port: 5432
    },
    Error: connect ENETUNREACH censored;lookslikeipv6 - Local (:::0)
        at internalConnectMultiple (node:net:1180:16)
        at Timeout.internalConnectMultipleTimeout (node:net:1710:5)
        at listOnTimeout (node:internal/timers:575:11)
        at process.processTimers (node:internal/timers:514:7) {
      errno: -101,
      code: 'ENETUNREACH',
      syscall: 'connect',
      address: 'censored;lookslikeipv6',
      port: 5432
    },
    Error: connect ETIMEDOUT censored;lookslikeipv4
        at createConnectionError (node:net:1646:14)
        at Timeout.internalConnectMultipleTimeout (node:net:1705:38)
        at listOnTimeout (node:internal/timers:575:11)
        at process.processTimers (node:internal/timers:514:7) {
      errno: -110,
      code: 'ETIMEDOUT',
      syscall: 'connect',
      address: 'censored;lookslikeipv4',
      port: 5432
    },
    Error: connect ENETUNREACH censored;lookslikeipv6 - Local (:::0)
        at internalConnectMultiple (node:net:1180:16)
        at Timeout.internalConnectMultipleTimeout (node:net:1710:5)
        at listOnTimeout (node:internal/timers:575:11)
        at process.processTimers (node:internal/timers:514:7) {
      errno: -101,
      code: 'ENETUNREACH',
      syscall: 'connect',
      address: 'censored;lookslikeipv6',
      port: 5432
    },
    Error: connect ETIMEDOUT censored;lookslikeipv4
        at createConnectionError (node:net:1646:14)
        at Timeout.internalConnectMultipleTimeout (node:net:1705:38)
        at listOnTimeout (node:internal/timers:575:11)
        at process.processTimers (node:internal/timers:514:7) {
      errno: -110,
      code: 'ETIMEDOUT',
      syscall: 'connect',
      address: 'censored;lookslikeipv4',
      port: 5432
    },
    Error: connect ENETUNREACH 2600:censored;lookslikeipv6 - Local (:::0)
        at internalConnectMultiple (node:net:1180:16)
        at Timeout.internalConnectMultipleTimeout (node:net:1710:5)
        at listOnTimeout (node:internal/timers:575:11)
        at process.processTimers (node:internal/timers:514:7) {
      errno: -101,
      code: 'ENETUNREACH',
      syscall: 'connect',
      address: 'censored;lookslikeipv6',
      port: 5432
    }
  ]
}

How can I fix this?

Laravel Master Blade file keeps loading the page and does’t load

`Hi,

I have wrtitten some php files and a blade file to load the contents of the page. I have incorporated all the styles and javascripts to load the page using Master.blade.php located in the recources/views/layouts folder. When I enter the URL for Ex: localhost/admin/accounts/add_ar, it just keeps loading the page. The only thing I see is the circular page loading icon in the middle. It needs to load the side bar, main bar, header and footer.

When I include @extends(‘layouts.master’) in the welcome.blade.php it loads the top half, but the bottom half does not load.

Can you please help?

I wanted to copy the code here. But this site is asking me to format it and post it. I will paste the required code if needed.

I was expecting it to load a page with a sider bar, header and footer using the styles of the master.blade file.

I have tried to clear the cache and routes.

Thanks
Raj`

How to implement image and video filter for my react native cli project?

I am creating a social media app (React native cli), I am working on post functionality,

for image and video i want to have simple filters like brightness, contrast, sharpness etc.

like we have in gallery where we have slider to adjust above filters.

I am trying to mimic that, I did the research on YouTube and here every thing is old.

i tried gl-react , react-native-image-filter-kit.

but got error after installation(actually i vibe coded this part but it didn’t work).

suggest me with some good library, and if possible share code reference.

also how to save the new edited video/images and upload it cloud or backend.

Delivery/Billing address not updating after selection from modal in checkout until page refresh

Shopware version: 6.6.8.2
No major checkout customization.

I’m experiencing an issue on a Shopware 6 storefront during the checkout process.

There is a button labeled “Change delivery address” on the checkout page. When clicked, it opens a modal that lists the customer’s saved addresses. When the user selects an address from the modal to use as the new delivery address, the UI appears to close the modal and shows the newly selected address.

However, this change is not actually applied to the order. The backend still retains the old delivery address until the user manually refreshes the page. After refreshing, the updated address is correctly applied.

Is there a known issue with Shopware 6’s checkout address modal not persisting the selected address to the order without a page reload?

Very rarely, console error appears 1 out of 10 times.

storefront.js?1745976015:1 Uncaught (in promise) Error: The required element "#shipping-edit-addressEditorAccordion" does not exist in parent node!
    at i.querySelector (storefront.js?1745976015:1:3866)
    at address-editor.plugin.241330.js:1:2033
    at NodeList.forEach (<anonymous>)
    at n.iterate (storefront.js?1745976015:1:6862)
    at c._registerCollapseCallback (address-editor.plugin.241330.js:1:1900)
    at c._registerModalEvents (address-editor.plugin.241330.js:1:1660)
    at address-editor.plugin.241330.js:1:1557
querySelector   @   storefront.js?1745976015:1

Any guidance on resolving this would be greatly appreciated!

Shopware Checkout

WordPress suppressing script tags [duplicate]

How do i include a js file in wordpress with the base plan?

I tried inserting an html block but it does remove the script tags, how do i fix this?

I am unable to reach the html files i can only use the wizard editor from wp-admin as i have the basic plan on it.

See the imageenter image description here

Why is my async function not returning expected data in Node.js?

I’m working in Node.js and trying to fetch data from an API using async/await. Here’s a simplified version of my code:

async function fetchData() {
  const res = await fetch('https://api.example.com/data');
  const data = await res.json();
  return data;
}

const result = fetchData();
console.log(result); // Promise { <pending> }
  • I tried using await in different places.
  • I tried wrapping the call in another async function.
  • I expected console.log(result) to print the actual data from the API, not a Promise.

How can I fix this to get the actual result?

Trying to move the rectangle with arrow keys

Well, I’m trying to make a game wherein the rectangle would be able to move left and right. I’ve tried this eventListener but nothing is happening with the rectangle. It’s just there at the middle of my border even if I’m trying to press the arrow keys.

Here is the code:

<!DOCTYPE html>
<html>
    <head>
        <title> Ichi's Game </title>
        <link rel="stylesheet" href="/main.css">
    </head>

    <body>
        <h1> this is the game </h1>
        <canvas style="border-style:dashed" width="1000" height="500" id="game"></canvas>

        <script>
            const game = document.getElementById("game");
            const context = game.getContext("2d");

            const rectWidth = "50";
            const rectHeight = "50";
            const x = (game.width - rectWidth) / 2;
            const y = game.height - rectHeight;

            function drawRectangle() {
                context.clearRect(0, 0, game.width, game.height); //Clearing the canvas
                context.fillStyle = "blue"; 
                context.fillRect(x, y, rectWidth, rectHeight);
            }


            document.addEventListener("keydown", (event) => {
                const speed = 20;

                if(event.key === "ArrowLeft" && x > 0){
                    x -= speed;
                }
                if(event.key === "ArrowRight" && x + rectWidth < game.width) {
                    x += speed;
                }
                drawRectangle();
            })
            drawRectangle();


            
        </script>
    </body>

</html>

I’ve tried adding an up and down function but nothing happened also. I’ve also tried to change the speed but it didn’t do anything for the rectangle.

Preparing for My Career Change into Software Development [closed]

I’m excited to share that I’m making a career shift into a field I’ve always been passionate about—the world of computers. Starting this Fall 2025, I’ll be studying Software Development.

This will be an entirely new path for me, but as someone who’s naturally creative and full of ideas, I believe I’ll truly enjoy this journey. I’d love to hear any advice you might have to help me prepare and hit the ground running this fall.

Thanks in advance!

How can I find a user-submitted audio file from an html page using python?

I am very new to programming in html and want to be able to access an audio file submitted by a user on the html page and use python in order to extract the audio information. I want the file given by the user, a variable value for frame rate which i will store in the html, and then to run the python file when it’s found it. I want to attach the python file to this html page as a script element.

I’ve already made the part that extracts the audio, i just need to know how to get the audio file and the variable value, and then run it.

Embedded links not clickable inside PDF for iOS devices

I have a SPFx React application where I am using the default window.print() functionality of browser to print the application pages when the user interacts with the Print Pages button.

Once the print window opens with the necessary pages, I save it as a pdf in my local folder. The pages contain embedded links(a tags with href) along with other content, but the links are not clickable in the PDFs only for iPad and iPhone, however the same links are clickable when the pdf is saved via desktop or any android device.

Any insights on this issue would be helpful. Thanks!!!

For the same html structure that is printed and saved as pdf, the links are clickable in desktop and android devices, but not in iOS devices when the application’s print functionality is done from iOS devices and the file is saved as a pdf.

The links should be clickable across all platforms.

Obsidian plugin: How to suppress editor actions (like Enter inserting newline) in custom input mode?

I’m writing an Obsidian plugin that activates a custom “find mode”. While in this mode, I listen to keydown events at the document level, and I want to capture keys like Enter, Escape, Backspace, and all character input without those keys triggering their default behavior in the editor. I call evt.preventDefault() and evt.stopPropagation() inside my handler. However, when I press Enter in find mode, the editor still inserts a newline, even though I call evt.preventDefault().

this.registerDomEvent(document, "keydown", (evt: KeyboardEvent) => {
            if (this.findMode) {
                if (evt.key === "Escape") {
                    this.exitFindMode();
                    evt.preventDefault();
                } else if (evt.key === "Enter") {
                    this.findAndHighlightInCurrentLine();
                    evt.preventDefault();
                    evt.stopPropagation();
                    evt.stopImmediatePropagation();
                } else if (evt.key === "Backspace") {
                    if (this.searchBuffer.length > 0) {
                        this.searchBuffer = this.searchBuffer.substring(
                            0,
                            this.searchBuffer.length - 1
                        );
                        this.updateStatusBar();
                    }
                    evt.preventDefault();
                } else if (
                    !evt.ctrlKey &&
                    !evt.altKey &&
                    !evt.metaKey &&
                    evt.key.length === 1
                ) {
                    this.searchBuffer += evt.key;
                    this.updateStatusBar();
                    evt.preventDefault();
                }
            }
        });

Jest.mock(‘fs’) breaks importing of xml2json package

I’m getting the following error in one of my tests

 FAIL  src/__tests__/xml.spec.mjs
  ● Test suite failed to run

    Could not locate the bindings file. Tried:
     → node_modules/node-expat/lib/build/node_expat.node
     → node_modules/node-expat/lib/build/Debug/node_expat.node
     → node_modules/node-expat/lib/build/Release/node_expat.node
     → node_modules/node-expat/lib/out/Debug/node_expat.node
     → node_modules/node-expat/lib/Debug/node_expat.node
     → node_modules/node-expat/lib/out/Release/node_expat.node
     → node_modules/node-expat/lib/Release/node_expat.node
     → node_modules/node-expat/lib/build/default/node_expat.node
     → node_modules/node-expat/lib/compiled/18.17.1/darwin/arm64/node_expat.node
     → node_modules/node-expat/lib/addon-build/release/install-root/node_expat.node
     → node_modules/node-expat/lib/addon-build/debug/install-root/node_expat.node
     → node_modules/node-expat/lib/addon-build/default/install-root/node_expat.node
     → node_modules/node-expat/lib/lib/binding/node-v108-darwin-arm64/node_expat.node

      1 | import fs from 'fs';
    > 2 | import xml2json from 'xml2json';
        | ^
      3 |
      4 | export const read = (file) => {
      5 |   const xmlText = fs.readFileSync(file, 'utf8');

      at bindings (node_modules/bindings/bindings.js:126:9)
      at Object.<anonymous> (node_modules/node-expat/lib/node-expat.js:4:34)
      at Object.<anonymous> (node_modules/xml2json/lib/xml2json.js:1:115)
      at Object.<anonymous> (node_modules/xml2json/lib/index.js:3:18)
      at Object.<anonymous> (node_modules/xml2json/index.js:1:120)
      at Object.<anonymous> (src/xml.mjs:2:1)
      at Object.<anonymous> (src/__tests__/xml.spec.mjs:2:1)

The test file looks like:

import fs from 'fs';
import { read } from '../xml.mjs';

jest.mock('fs');

describe('read', () => {
  it('reads', () => {
    fs.readFileSync.mockReturnValue('<xml><tag>a</tag></xml>');
    expect(read('someFile')).toBe('{tag:a}');
  });
});

and the actual run looks like

import fs from 'fs';
import xml2json from 'xml2json';

export const read = (file) => {
  const xmlText = fs.readFileSync(file, 'utf8');
  return xml2json.toJson(xmlText);
};

I can’t see the cause of why this might be happening or how to fix it (easily). Any suggestions on what I can do to solve this issue?

Handling window.open() from a

What is the current recommended way to handle window.open() or a click on a link with target=_blank from inside a <webview>? I would like to capture the URL that a Document tried to open but prevent the default behaviour (where allowpopups is enabled).

It appears at some point there was a new-window event dispatched on the webview element, but have I understood correctly that this is deprecated?

WebContentsView is not an option for my use case.

sticky headers in virtualized list/table

i have virtualized list, in which i display elements in absolute position. And i want to display sticky headers (optionally) at left/top/right/bottom. It works almost correct but during scrolling there is delay between elements in headers and in table.

<div
      ref={scrollRef}
      style={{
        width,
        height,
        overflow: "auto",
        position: "relative",
        scrollBehavior: "smooth",
        willChange: "transform",
      }}
      onScroll={(e) => handleScroll(e)}
    >
      <StickyHeaders
        headers={headers}
        rowHeights={rowHeights}
        columnWidths={columnWidths}
        visibleRows={elementVisibilityRows.visible}
        visibleColumns={elementVisibilityCols.visible}
        height={height}
        width={width}
        scrollLeft={scrollLeft}
        scrollTop={scrollTop}
        scrollbarSize={scrollbarSize}
      />

      <div style={contentStyle}>
        {AbsoluteElementComponent ? (
          <AbsoluteElementComponent
            currentLeftOffset={scrollLeft}
            currentTopOffset={scrollTop}
            getElementLeftOffset={(index: number) => {
              const offset =
                typeof columnWidths === "number"
                  ? columnWidths * index
                  : elementVisibilityCols.sizesOffsetOfIndice[index];
              return offset;
            }}
            getElementTopOffset={(index: number) => {
              const offset =
                typeof rowHeights === "number"
                  ? rowHeights * index
                  : elementVisibilityRows.sizesOffsetOfIndice[index];
              return offset;
            }}
            offsetVersion={offsetVersion}
          />
        ) : null}
        {WrapperComponent ? (
          <WrapperComponent>
            <VirtualizedTableContent
              rowsOffsets={elementVisibilityRows.sizesOffsetOfIndice}
              columnsOffsets={elementVisibilityCols.sizesOffsetOfIndice}
              rowHeights={rowHeights}
              columnWidths={columnWidths}
              visibleRows={elementVisibilityRows.visible}
              visibleColumns={elementVisibilityCols.visible}
              CellComponent={CellComponent}
              additionalData={additionalData}
              offsetVersion={offsetVersion}
            />
          </WrapperComponent>
        ) : (
          <VirtualizedTableContent
            rowHeights={rowHeights}
            rowsOffsets={elementVisibilityRows.sizesOffsetOfIndice}
            columnWidths={columnWidths}
            columnsOffsets={elementVisibilityCols.sizesOffsetOfIndice}
            visibleRows={elementVisibilityRows.visible}
            visibleColumns={elementVisibilityCols.visible}
            CellComponent={CellComponent}
            additionalData={additionalData}
            offsetVersion={offsetVersion}
          />
        )}
      </div>
    </div>

Sticky Headers Component.

<div
      style={{
        position: "sticky",
        top: 0,
        left: 0,
        zIndex: 10,
        background: "white",
        display: "flex",
        flexDirection: "row",
        animation: "500ms ease-in-out 0s normal none 1 running fadeInDown"
      }}
      
    >
      <div style={{ position: "relative", height: "100%", width: "100%" }}>
        {headers.top ? (
          <TopHeaderSection
            header={headers.top}
            columnWidths={columnWidths}
            visibleColumns={visibleColumns}
            scrollLeft={scrollLeft}
            leftOffset={headers.left?.size ?? 0}
            headers={headers}
            rowHeights={rowHeights}
          />
        ) : null}

        etc
      </div>
    </div>

Top Header

<div
          style={{
            position: "absolute",
            top: 0,
            zIndex: 10,
            background: "white",
            display: "flex",
            flexDirection: "row",
            left: 0,
            
          }}
        >
          <div style={{ position: "relative", marginLeft: headers.left?.size }}>
            {Array.from(
              {
                length:
                  visibleColumns.lastVisible - visibleColumns.firstVisible + 1,
              },
              (_, colIdx) => {
                const columnIndex = visibleColumns.firstVisible + colIdx;
                const style = getHeaderStyle({
                  indexPosition: columnIndex,
                  direction: "top",
                  rowHeights,
                  columnWidths,
                  size,
                });
                style.left -= scrollLeft;
                return (
                  <header.component
                    key={`top-${columnIndex}`}
                    columnIndex={columnIndex}
                    style={style}
                  />
                );
              }
            )}
          </div>
        </div>
      ) : (
        <div
          style={{
            height: header.size,
            position: "absolute",
            top: 0,
            left: 0,
            right: 0,
          }}
        >
          <header.component
            position={{left: scrollLeft, top: 0}}
            visibleRows={{ firstVisible: 0, lastVisible: 0 }} // optional, no rows for top
            visibleColumns={visibleColumns}
          />
        </div>

i tried to use translate directly on sticky element, and effect is the same. Is it possible to achive what i want. And from where does delay comes from. As i read onScroll event happens before paint, so it seems like it would be possible to synchronize this elements, and you can synchronize two scrolls normally.