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

How to save files to a directory using FileSystemDirectoryHandle?

I’m trying to look for some documentation on FileSystemDirectoryHandle and if it is possible to save files to the opened directory. I’ve been searching for a couple hours now, any help will be appreciated. -Alex I tried searching on google but I’ve only found base overviews of the api. And I’ve tried looking at the

Read More
javascript

Is there a way to create the package.json based on the code?

I just start to study javascript and vue and trying to build the example project todo-vue. But it seems that the modules in package.json are too old and always fail during the "npm install". Is there a way that the package.json file can be updated with the latest version or regenerated from the project code?

Read More
javascript

Calculate point coords relative to a rotated DIV

I have a rotated DIV within a non-rotated DIV and I’m trying to work out the cursor position on the outer DIV in relation to the rotated DIV. I guess I need the position as though the coordinate system has been rotated to match the angle of the rotated div. Following is an example of

Read More
javascript

Extruding a 2D PNG into a 3D Mesh in BabylonJS

In BabylonJS, I’m attempting to extrude a 2d png image to a 3d mesh, whilst I’ve considered obtaining the contours/outline of the image by extracting the alpha channel of the image and then using the results to create an extruded polygon. I’ve gone with a more straight forward method which merely seeks to stack multiple

Read More
javascript

chatgpt roasts computer science engineer

here’s my small roast by chatgpt, plz dont judge it, I’m a student asking gpt many question. Alright, Anchal, strap in—this roast is going to come in hot and honest, just like your dream of coding your way to San Francisco while struggling with palindrome questions. 😜 So you’re aiming for a software engineering job

Read More
javascript

How to fix 15: exec: node: not found in a NodeJS project with Typescript on Windows?

I’m new to Nodejs and Typescript and facing a problem on a Windows machine. I set up an empty project with a single index.ts just for testing. I’m also using nodemon. When I use tsc command to generate js files from ts, it works without any error and the files are built in the build

Read More
javascript

Angular async – how to get the string of an async method

I use this service class in order to get the network status: @Injectable() export class NetworkConnectionService { constructor() { } addNetworkConnectionListener() { Network.addListener('networkStatusChange', status => { console.log('Network status changed', status); }); } getCurrentNetworkStatus() { const self = this; const currentNetworkStatus = async () => { const status = await Network.getStatus(); }; return currentNetworkStatus; } }

Read More
javascript

angular/fire@7 storage is not working for my Angular 16 app

I’m trying to use angular/fire@7 storage to store files and I’m getting this error: Error: Uncaught (in promise): Error: Either AngularFireModule has not been provided in your AppModule (this can be done manually or implictly using provideFirebaseApp) or you’re calling an AngularFire method outside of an NgModule (which is not supported). Error: Either AngularFireModule has

Read More
javascript

Testing a react component library project using vite

I have a library project using TS, React, and vite for bundler. Folder structure looks like this - LibraryProject - src - main - TestComponent.tsx - hooks - hookFile.ts - enums - enumFile.enum.ts My current vite config builds a lib properly and I am able to use that in a separate React demo project. To

Read More
javascript

How can you check if a javascript map has a duplicate key

I’m working with a Map in JavaScript and need to check that it doesn’t contain duplicate keys. The map I’m working with is below. const colors = new Map([ [1, 'blue'], [2, 'orange'], [1, 'pink'], // This duplicate key should trigger an error [3, 'yellow'], ]); In this situation because the number 1 is used

Read More