October 22, 2024
Chicago 12, Melborne City, USA
javascript

Prisma returning unwanted count

Doing the query below the Prisma result returns a unwanted "count" property into likes object. We can see that the _count operator is not used anywhere. I tried to change the count to false, but it keeps being returned. How can I disable this? const user = await prisma.user.findUnique({ where: { id: id }, select:

Read More
javascript

exiftool-vendored: `extractBinaryTagToBuffer` Fails Unexpectedly

I want to read XMP data from PDFs in JavaScript: const { exiftool } = require('exiftool-vendored'); const fs = require('fs'); async function extractXMPData(filename) { try { const buffer = await exiftool.extractBinaryTagToBuffer('XMP', filename); console.log(buffer.toString()); } catch (error) { console.error('Error reading XMP data:', error); } // Close the exiftool instance to free resources await exiftool.end(); } const

Read More
javascript

Can't load images from local files in React, React is trying to pull image from proxy?

I am currently building a small react webpage and the component I’m building returns one of two images based on whether a certain variable is null or not (it is supposed to hold the link to an image after an api request is made, but starts null). When that link isn’t available the code is

Read More
javascript

Download all of the files from Inspect Element's sources

I would like to download all of the .jpg images that I can see in Safari’s Inspect Element’s "sources" tab on one particular webpage. I’ve been running this in the console: (function () { function downloadFile(file) { const element = document.createElement('a'); element.setAttribute('href', file); element.setAttribute('target', '_blank'); element.style.display = 'none'; document.body.appendChild(element); element.click(); document.body.removeChild(element); } (new PerformanceObserver((list) =>

Read More
javascript

NativePHP + javascript event listening

Im having trouble with NativePHP and JS. As stated in the NativePHP docs NativePHP injects a window.Native object into every window. However Native.on("Native\\Laravel\\Events\\Windows\\WindowFocused", (payload, event) => { alert("it works"); }); results in Uncaught ReferenceError: Native is not defined – clearly nothing is injected in Window. Can anyone help me, what am I missing…? Thank you.

Read More
javascript

Can a C# source file call the JS function of a different aspx source file?

So I have two different files in a .NET project: A. File1.aspx and cs B. File2.aspx and cs Can File1 C# source file call a JS function from File2 ASPX source file? If so, how could they do this? You need to sign in to view this answers

Read More
javascript

SupabaseJS join without including join table as a property in the response

const { data, error } = await this.client .from('tableA') .select('*, tableB!inner(tableC!inner())') .eq('tableAPK', pk) .eq('tableB.tableC.id', tableCPK) .returns<TableAObject[]>(); This code returns TableAObject array with tableB: {} property within each object. As in, { …tableAProperties, tableB: {} }. However, I would like for it to not be there. I joined purely for filtering reasons. Any help is appreciated.

Read More
javascript

show pictures in html tabs (overwritten)

<html><head><title>Report</title> <style> .tab {cursor: pointer; padding: 10px; display: inline-block;} </style> </head><body> <h1>Report</h1> <div class="tabs"> <span class="tab" onclick="showPlot('functionPlot')">Function Plot</span> <span class="tab" onclick="showPlot('secondDerivPlot')">Second Derivative Plot</span> </div> <div id="plotContainer"> <img id="functionPlot" src="val_0.png" style="display:block;"> <img id="secondDerivPlot" src="deriv_0.png" style="display:block;"> </div> <script> function showPlot(plotID) { document.getElementById("functionPlot").style.display = "none"; document.getElementById("secondDerivPlot").style.display = "none"; document.getElementById(plotID).style.display = "block"; } </script> </body></html> <div class="iteration-summary"> <h2>Iteration 1</h2>

Read More
javascript

how to sort option elements in html

so I made a HTML for a library wherein if students want to borrow a book they would need to enter the following, student name, Book name and book type well it did work somehow the program was able to input the name of student, book, subject and the date it was borrowed though my

Read More
javascript

How do I intercept the openDefaultBrowser(url) call in Thunderbird?

Is there some kind of ‘beforeLinkClick’ event which can be canceled, on certain URLs? Or an option to rewrite the openDefaultBrowser(url) function, which I’m guessing gets called, when you click a link? The end-goal is to develop a ‘Link-Blocker’ for emails opened in Thunderbird. I already found out that there is a setting under network.protocol-handler.external-default

Read More