Category "arrays"

How to set a multiple arrays in javascript

I run into a problem wherein I want to divide my items in by array likes this [ 1 [ 1[[1][2]] 2[[3][4][5]] ], 2[ 1[[1][2]] 2[[3][4][5]]], 3 [ 1[[1][2]]

How to set a multiple arrays in javascript

I run into a problem wherein I want to divide my items in by array likes this [ 1 [ 1[[1][2]] 2[[3][4][5]] ], 2[ 1[[1][2]] 2[[3][4][5]]], 3 [ 1[[1][2]]

In Java how to synchronize cache read and write operations

I am working on implementing a simple cache using ArrayList in my application. I would like to synchronize cache update operations, while updating the cache I s

How to re-write menu using DRY

I'm doing a school project and I really feel that I can acomplish what I want in my code, however I feel like i -always- repeat my code. I have tried to put the

looping through an array of objects that contains three key, value pairs

I have these objects, which could be in an array, like in the example or a database: [ { "payer": "DANNON", "points": 1000, "timestamp": "2020-11-02T14:00:0

How to use .map to get sting from array

This is my first question because I'm just new to coding. I want to use .map to get strings from an array. let root_vegetables = ['potato', 'taro', 'sweet p

How to check if a traversion has reached a certain Index in a 2D-Array in Java?

Let's say we have a 2D-boolean Array as a presentation of a maze, the size of the Array is not fixed and random. The walls are depicted as true: boolean[][] maz

Apply function to every element of a multidimensional array

I have a multidimensional array like this (please ignore the strlen): array(2) { ["document"]=> array(16) { [0]=> string(14) "Value1"

mongodb & php: how can I store and callback a custom js function to parse data?

Before to submit the doubt that I have, let me start from preamble that I'm definitively a newbie on MongoDB world ;( but I'm going to learn quickly! The goal t

c# how to add Button to array and set text of all buttons

Hi my problem is i want to add buttons to array size: 65 and there is a problem here's my code: Button[] buttonsa = new Button[65]; for (int d = 0; d <= but

Is this pointer always a runtime construct

I am learning about the this pointer in C++. And i came across the following statement from the standard: An expression e is a core constant expression unless

Loop through array with setInterval play button and pause it

I want to loop through a array with a pause and a start button. Right now it automatically plays and I am not sure how to connect the setInterval to the play fu

Increasing array size

I just started learning java and I'm having a problem in increasing an array's size with a new length provided by the user. If the user's input is greater than

How to add items from object in DOM with button click in javascript?

first time posting in here :) I have recently started coding and for JS study practice, I wanted to make a button in my navbar that generates an object to DOM a

How to get first N number of elements from an array

I am working with Javascript(ES6) /FaceBook react and trying to get the first 3 elements of an array that varies in size. I would like do the equivalent of Linq

initialization of 'const char **' from incompatible pointer type 'char *'

I am new in learning C. I have an issue in returning double star pointer from the function. This is my code. #include <stdio.h> #include <stdbool.h>

Convert 2D meshgrid into a 3D array in Python

I have coordinates (lat, lon) in a meshgrid, and data asociated with each "point". I want to export into a .csv and have each point asociated with the data i wa

Why println is being executed in this recursive piece of code?

In this code arrLength starts with four and then keeps being decremented until it reaches zero. At the moment it reaches zero it should not execute what is insi

Finding the average of each column in a multi array in excel vba

I have an array that is myarray (1 to 37, 1 to 44) as variant I'm trying to speed up my spreadsheet so rather than using big tables with lots of formulas in I'm

Python find indices of subarrays which are continuous and increasing with difference of 1

The input is always strictly increasing. I could write this with a for loop and lots of if-else conditions, but is there some simple way? Here is an example: in