Category "arrays"

MongoDB how to update an object property in nested array

I have the following structure in my MongoDb where I have a topic object inside of a topics array. Within the topic object, I have a messages array. What I am t

Create an array of object properties for each item that has the same key

I'm merging two objects together to create a filter object. However I want to group the merged objects property values where the keys are the same. So... [{cate

Creating an array from each key in an array of objects

I have an array that looks similar to this: The array of objects is much larger and each object has more properties, this is the structure though. let arr = [

Zip multiple arrays in PHP based on their identical keys and not their indices or their positions in array

I have two arrays: $a = ['one'=>1,'two'=> 2,'three'=> 3,'four'=> 4,'five'=> 5, 'six' => 6]; $b = ['one'=>'uno', 'three'=>'tres','two'=&g

Amstrong number using lambda Expressions in Java 8

I am fairly new to functional programming. Following is my code to check the sum of powered digits(Arsmstrong number check). Number is an input for example: 370

How can I get my counter to work properly?

I'm doing my c++ homework on arrays, everything seems to be working fine except the counter for the problem. Before I show the code these are the requirements f

While Using getElementById, How can I access a specific index in a array and reassign digits, after submitting numbers from a input felid with html

I'd successfully obtain arbitrary numbers from an input field while utilizing a callback function on the HTML side which eventually passed the original numbers

Solidity dynamic arrays in memory: overflow bug

I was trying to create a lottery smart contract that stores every tickets (ticket = address) that someone buys into into an array to later on select winners fro

Dask looping over library function call

Goal I would like to parallelize a loop with dask that uses a library function inside the loop. This function, mhw.detect(), calculates some statistics on a sli

Im having trouble with this assignment that has me write vectors and arrays to a file

So in this assignment I have to have one function that has the user enter the vector which is the driver name and then they enter the drivers 4 points. That fun

AJAX/FLASK/JS: How to POST existing array into endpoint?

I am trying to POST the songFiles array pushed from the getTableData() function (inside the ajax request) into the /api/fileNames endpoint, which is then sent t

PHP array filled by a MySQL query [closed]

I need to fill multiple different arrays by using a MySQL query. This would have up to 16 different arrays. I want to specify each array with

I want to new array of 2 array is not equal data [duplicate]

I want to new array of 2 array is not equal data example let a = [{id:1, name:"a"},{id:2, name:"b"},{id:3, name:"c"}]; let b = [{id:1, name:"

Inconvenience when working `as const` arrays - readonly T[] not assignable to T[] - how to remove readonly modifier from array [duplicate]

I keep running into this problem all the time (playground link): const arr = [1,2,3] as const const doSomethingWithNumbers = <T extends nu

A dynamic array that changes size on one click function and being used on in another click function

I'm programming something for a school task and having a problem. I need to create an array, then I need to change its size on one-click function(the size of th

Merge multiple outputs from multiple functions into one array in Javascript?

Example I have these values, there is any way to put them together in a single array? This is one of the functions that make the results, they take their data f

Is there any Fortran function to transpose 3D array?

I need to transpose a 3D matrix in Fortran. I have a 3d array: V(111,222,333); I need to transpose it to V(333,111,222). Is there any function to do that in For

Delete all files without deleting folders

I have a folder named (top) with 10 folders named 1,2,3,4,5,6,7,8,9, and 10. Inside the top folder I have files, too (are not folders). I can list all the files

Initializing an hyperarray parameter agent attribute from a database

I am similar problem to this Initializing an array agent attribute from a database but Im having a problem as it brings back the whole row of data and not only

How can I get N smallest number in an array?

I'm trying to get the N smallest numbers (given by the user) in an array without using methods like sort()... in the last step, I keep getting only the smallest