Category "arrays"

Javascript/Google Maps API - "TypeError: undefined is not an object (evaluating 'addresses[x][0]')

I am trying to plot markers on a google map using an array of addresses. The markers are correctly plotting (I used the tips in this post: Multiple markers Goog

Make calculations across multiple tables based on the table suffix in Bigquery

I have a database of daily tables (with prefixes formatted as yyyymmdd) with customers info, and I need to get a 90 day timeline of 90 day ARPUs (average revenu

How to update array value in Laravel

My controller code: $userBasicInfoId = $this->userBasicInfo->where('user_id', $userProfile['id'])->value('id'); if($userBasicInfoId) {

Filter array by skipping every nth element from the end

Is there an efficient way to get an array by skipping every n elements starting from the end (so that the last element is always in the result)? Basically, I ha

Trying to solve symmetric difference using Javascript

I am trying to figure out a solution for symmetric difference using javascript that accomplishes the following objectives: accepts an unspecified number of ar

Combine array with same value and add other [duplicate]

I'm trying to find a way to combine array with the same value, and add other values of associative array. I have an array of something like th

Two 2D array's of coordinates, finding if any of the coordinates from the different arrays are within a set distance of one another (python)

I have been trying to figure out how to make it so there is two 2D arrays, each containing a number of arrays that have x and y coordinates for set objects of t

Checking whether space should be printed in the middle or at the end in for loop?

I am trying to give info to my program whether it should print space or not. My code looks something like this, and its printing spaces at the end (which is not

function loop for more than one times java

so basically i tried to call method that return array from other class java, it works perfectly except it double the size or length of the array 2 times from or

How to apply a function to a 2D numpy array with multiprocessing

Suppose I have the following function: def f(x,y): return x*y How do I apply the funtion to each element in an NxM 2D numpy array using the multiprocessi

Find Duplicate Elements In Array Using Swift

How to find Duplicate Elements in Array? I have array of phone numbers so in the phone numbers i should start searching from the right side to the left side and

Sorting an array of strings in C++

I am trying to accomplish the following task: List the students in alphabetic order, sorted by last name. Do not change the given case of the names. Do not ch

Combine multiple columns into an array as one of the key in a results set

I am having trouble placing data into its right structure. I have a result set data of: array ( 0 => array ( 'company_id' => 1, 'company_ab

How to shuffle strings in arrays in golang?

So I created a program to help me decide which game to play. Before I start my problem let me show you my code: package main import ( "fmt" "strconv"

How can I convert a buffer of a slice of bytes (&[u8]) to an integer?

I am reading raw data from a file and I want to convert it to an integer: fn main() { let buf: &[u8] = &[0, 0, 0, 1]; let num = slice_to_i8(buf

How to find the largest number(s) in a list of elements, possibly non-unique?

Here is my program, item_no = [] max_no = 0 for i in range(5): input_no = int(input("Enter an item number: ")) item_no.append(input_no) for no in item_

PHP array stringify

In a lyrics application I'm coding, I'm using an array to print an artists table. The artists array looks like this: $artists = [ [ "Avril Lavigne"

Check if one element exists in an array of objects

I have the following array of objects: var memberships = [ { id: 1, type: 'guest' }, { id: 2, type: 'member' } ]; How can I verify if

String.join array from last element

I have a scenario where I am getting a comma separated string LastName, FirstName. I have to convert it into FirstName LastName. My code is below: Public stat

Google Sheets linking two sheets using a primary key

I have two sheets that I want to link using a "primary key". At the moment, I have imported from sheet1 into sheet2 some columns using the function =Sheet1!A1