Category "arrays"

PHP -> Next nearest date defined by array of days in week

please, really need help with this problem. I have array of offerDays - $offerDays = array(1,6); (mean Monday, and Saturday); For example, input date is Wedne

JQuery get table row values from input and save to array

I have a table with input fields inside the td. How can i get the values from the input fields (by button click) and store them into an array (one row) using JQ

How to zip every element of array to every element of another array in ruby?

Say I have this array: [0, 1, 4], [2, 3] How can I merge them to get: [0,2], [0,3], [1,2], [1,3], [4,2], [4,3] I tried: [0, 1, 4].zip [2, 3] But I got:

Extending Array to check if it is sorted in Swift?

I want to extend Array class so that it can know whether it is sorted (ascending) or not. I want to add a computed property called isSorted. How can I state the

Search for array row with specific column value and return another value from qualifying row

I have a multidimensional array that I am trying to search for a specific value (url) and then retrieve an another value in the same row (value). I also need to

ARRAY_AGG() grouped by another column's values

Here's my table like below p_no type name value ------------------------ 1 A Tomy 1 1 A Nick 2 1 B Tomy 3 1 B Nick 4 1

Sum similar keys in an array of objects

I have an array of objects like the following: [ { 'name': 'P1', 'value': 150 }, { 'name': 'P1', 'value': 150 }

Using JavaScript need to group elements

I am looking for efficient method to modify my object list which looks something like this: const pets = [ {type:"Dog", name:"Spot"}, {type:"Cat"

Vue JS returns [__ob__: Observer] data instead of my array of objects

I've created a page where I want to get all my data from the database with an API call, but I'm kinda new to VueJS and Javascript aswell and I don't know where

How to add names to a numpy array without changing its dimension?

I have an existing two-column numpy array to which I need to add column names. Passing those in via dtype works in the toy example shown in Block 1 below. With

Sum array values

I’m making a shipping service app to Shopify and my callback URL have this JSON post using json_decode to make an array. The value I want to sum is grams

PHP echo values of all sub keys [duplicate]

In the following array: "options": { "front-electric": { "pt": "Vidros Eléctricos dianteir

How to check JSON and add/remove key

I have a JSON file as an export of a nosql database, the sample below is 2 of 1xxx records. { "task": { "id1": { "completed": true,

Find number of int pair in an array that all values between the pair are smaller than or equal to the both

Given an array of integer, find the number of int pair, so that for each pair a_i, a_j, the number between them, i.e. a_(i+1)...a_(j-1) are all smaller than or

Extracting all matrices out of a nested list with varying sublist lengths in R

I have a nested list of matrices. More specifically, I have a list of matrix lists, each with a variable number of matrices. I would like to extract all the mat

building a bottomUp heap

im trying to do a heap bottom up construction from Psuedo code from my text book however the output im getting is not a correct heap im getting out 2 9 8 6 5 7

Value not saving in mongodb

const serverS = await server.findOne({ guildID: message.guild.id }); serverS.settings[1]["links"] = true; serverS.save() The code I use ^^^^ So when it saves t

How to initialize only few elements of an array with some values?

Is it possible to assign some values to an array instead of all? To clarify what I want: If I need an array like {1,0,0,0,2,0,0,0,3,0,0,0} I can create it like:

Yii2 ArrayDataProvider does not show already paginated data

I have an issue with ArrayDataProvider object that Yii2 provides. I have a huge API call that returns more than 7k items (this is a problem because obtaining al

JS Find indices of duplicate values in array if there are more than two duplicates

I'm creating coordinate plane Three in a row game so I have to find out if there are three numbers of the same value in the array BUT WITHOUT sorting array beca