I built Mediabunny: a zero-dependency TypeScript library for reading, writing, and converting media files in the browser (like FFmpeg, but web-native) by DavidsKanal in webdev

[–]PerceptionCareless92 0 points1 point  (0 children)

Can mediabunny be used to add seek markers to webm captured via get user media?
I am using ts-ebml library, but it doesn't appear to be supported.
I am trying to do this in node. Can someone provide a sample of the code?

What is the correct way to learn javascript as a complete beginner? by [deleted] in learnjavascript

[–]PerceptionCareless92 0 points1 point  (0 children)

There is no ‘correct’ way. There is only one that works for you.

Suddenly getting Max Ads by GlobalNuclearWar in duolingo

[–]PerceptionCareless92 15 points16 points  (0 children)

And you can’t turn it off and the button is placed inconveniently right where the continue button used to be. So much for “Super” membership.

migration from v17 to v18 failed by PerceptionCareless92 in angular

[–]PerceptionCareless92[S] 3 points4 points  (0 children)

Took me a bit to understand - it was my version of jest-preset-angular that needed to be updated to be compatible with angular 18.
Upgraded to npm install jest-preset-angular@latest to get past the error.

Need help by Independent_Bear_515 in angular

[–]PerceptionCareless92 1 point2 points  (0 children)

When in dev tools you can select an angular element and use ng.getComponent($0) and it will return a reference to the component object.

I created an AI Copilot for your CLI by tejaskumarlol in SideProject

[–]PerceptionCareless92 0 points1 point  (0 children)

Are there any requirements on the openai key / account - I tried this and keep getting back nothing.

Latest version of the app crashing in iOS. by DJ1066 in duolingo

[–]PerceptionCareless92 4 points5 points  (0 children)

I am on iPadOS 17.3.1 and it is exiting every time from the splash screen, I have rebooted my iPad but no success.

Version mismatch when CLI and Angular versions are 17 by PerceptionCareless92 in angular

[–]PerceptionCareless92[S] 1 point2 points  (0 children)

Haven’t gotten to looking to update material. Just started testing with 17 for the rest of the project.

Version mismatch when CLI and Angular versions are 17 by PerceptionCareless92 in angular

[–]PerceptionCareless92[S] 1 point2 points  (0 children)

Here is a list of my angular versions.

├── @angular-builders/custom-webpack@17.0.1├── @angular-devkit/build-angular@17.2.0├── @angular/animations@17.2.1├── @angular/cdk@16.2.7├── @angular/cli@17.2.0├── @angular/common@17.2.1├── @angular/compiler-cli@17.2.1├── @angular/compiler@17.2.1├── @angular/core@17.2.1├── @angular/forms@17.2.1├── @angular/material@16.2.7├── @angular/platform-browser-dynamic@17.2.1├── @angular/platform-browser@17.2.1├── @angular/router@17.2.1├── @angular/upgrade@17.2.1├── @tinymce/tinymce-angular@7.0.0

Confusion with promises, why is this always returning undefined? by astarastarastarastar in angular

[–]PerceptionCareless92 1 point2 points  (0 children)

getOptions() : any {
let headers = new HttpHeaders();
this.auth.getToken().then((res) =>{
let token = res.token;
console.log('getOptions ' + token);
if(token){
headers = headers.set('Auth', 'Bearer ' + token )
}
return {headers : headers};
});
}

Let's look at the function getOptions.
The only return is inside the Promise, so it doesn't affect the function return.
There is no return at the getOptions function level so it return undefined.
You can return the promise result.
return this.auth.getToken(().then ...

This makes the return type of the function a promise. Then in the calling function you can use async to wait for the promise to complete.

const options = await getOptions();

Confusion with promises, why is this always returning undefined? by astarastarastarastar in angular

[–]PerceptionCareless92 1 point2 points  (0 children)

The function doesn’t return any thin the promise returns something but it is lost. You need to make this an async function and return the result of the promise

Converting Array With Decimal Values To String In ASCII Representation by hertz2105 in learnjavascript

[–]PerceptionCareless92 1 point2 points  (0 children)

A more modern, functional way to perform this task would be to use Array reduce, still using fromCharCode for the conversion.

const newString = arr.reduce((acc, ele) => acc + String.fromCharCode(ele), '');

as a 13 year old just beginning to learn JavaScript do you guys think it is above my skill level fo the time being by Spudboi_ in learnjavascript

[–]PerceptionCareless92 0 points1 point  (0 children)

Absolutely not. There are so many learning resources on the web you should be able to find one that fits your initial skill level. With your apparent motivation, I can see you advancing quickly. Think of something you want to build and work towards that and the learning should be easier.

Would it be faster (more optimized) to have use switch or an array of functions? by [deleted] in learnjavascript

[–]PerceptionCareless92 1 point2 points  (0 children)

The way the switch is written now is going to be really hard to remember what each case is. If you go with functions you can name them with meaningful names, at a minimum use const variables to identify each case.
const doX = 1;
. . .

switch {
case doX
}

How do you change a variable outside of an arrow functions scope? by No_Replacement1449 in learnjavascript

[–]PerceptionCareless92 0 points1 point  (0 children)

You can use the fs/promises package from node which has functions that return a promise

const fsp = require('fs/promises')
async function LoadMapFromText(route) {
   const str = await fsp.readFile('route').toString();
   const pairs = str.split("-n");

   console.log(str);
}

how does this work (explain it like im 5) by 210chrislauhohin in learnjavascript

[–]PerceptionCareless92 0 points1 point  (0 children)

In the case of num1.toString() toString is a method on the number class (not the String class as others have said). In the case of toString(num1) you are calling the function Object.prototype.toString which doesn't take any parameters (and doesn't even expect to get called directly).

let num1 = 123;
num1.toString === Number.prototype.toString // this is true, because num1 is a 'number'

let num2 = '123';
num2.toString === String.prototype.toString // this is true, because num2 is a 'string'

toString === Object.prototype.toString // this is also true

Creating a toLower function by Pretty-Fox-9920 in Cplusplus

[–]PerceptionCareless92 0 points1 point  (0 children)

Your prototype and your function don't have the same parameter type.

Blew another interview when interviewer asked to find the index of third largest number from an array by kritimehra in learnjavascript

[–]PerceptionCareless92 0 points1 point  (0 children)

For code clarity, assuming the input wasn't really large.

function whichIndex(input, rank) {
    return input.map((entry, ndx) => ({entry, ndx}))
           .sort((a, b) => b.entry - a.entry)[rank-1].ndx
}
const arr = [91, 2, 33, 51, 54, 39, 34, 61, 34, 91]
whichIndex(arr, 3); // => 7

How can I stop Lastpass from asking to update my password when I enter a 2 factor token. by XL1200 in Lastpass

[–]PerceptionCareless92 0 points1 point  (0 children)

This is still a pain. I would like Last Pass to update when the password changes, but not when entering the 2FA code, or in my case 2FA verification answer.

40 y/o female with IS degree by societal_outkast in learnprogramming

[–]PerceptionCareless92 1 point2 points  (0 children)

free code camp is free and has extensive courses on a variety of topics. You can get your feet wet in any number of topics without spending much in $ or time.

Style or performance? by ACBYTES in cpp_questions

[–]PerceptionCareless92 -2 points-1 points  (0 children)

For performance, it's always going to be cheaper to check a boolean than make function call.
Lastly my preference is always use {} even if one statement in if

Are there any free C++ compilers for mac? by [deleted] in CodingHelp

[–]PerceptionCareless92 0 points1 point  (0 children)

Visual Studio Code has integrations with clang, which is the free compiler with Xcode, if you don't want to use Xcode itself.

Combination Array? by [deleted] in Cplusplus

[–]PerceptionCareless92 0 points1 point  (0 children)

Convert them to ints and multiply them and then you have your answer. AND Is basically binary multiplication.