Category "arrays"

Get the first and last item in an Array - JS

I am trying to get the first and last item in array and display them in an object. What i did is that I use the first and last function and then assign the fir

Combined SELECT from unnested composite type array and regular column

I have a table my_friends_cards: id | name | rare_cards_composite[] | ---+---------+------------------------ 1 | 'timmy' | { {1923, 'baberuth'}, {1999, 'j

Python Numpy: replace values in one array with corresponding values in another array

I am using Python Numpy arrays (rasters converted to 2D arrays, specifically) and what I want to do is take one array that has arbitrary dummy values of -999 re

Get nested json value using ASP Classic and aspJSON

Good afternoon, I'm using aspJSON (https://github.com/rcdmk/aspJSON) to analyze a json that I have below: { "pedido":1507WSC, "destino":"Brasil", "Pas

How to map the two arrays with a duplicate value?

I have two arrays. $array1 = ['id_e' =>[91707, 91708]]; $array2 = ['id_s' => [18, 57]]; If I want to insert or delete into the database, I want to make

Convert regular text to array using notepad++

i am trying to use notepad++ to select a new line and replace it with this " ',' ", so that i can use it in PHP as an array and then work on it, but i dont kno

Linear index upper triangular matrix

If I have the upper triangular portion of a matrix, offset above the diagonal, stored as a linear array, how can the (i,j) indices of a matrix element be extrac

Printing Out Repeated Numbers

so I'm working on a program that takes two strings. For instance [2,3,4] and [1,4,5] and outprints 1,1,4,4,4,5,5,5,5. I don't really have a working code. So, I'

How to format a bash array as a JSON array

I have a bash array X=("hello world" "goodnight moon") That I want to turn into a json array ["hello world", "goodnight moon"] Is there a good way for me

Split array into 4-element chunks then implode into strings

$array = [1, 2, 3, 4, 5, 6, 7, 8, 9]; I want output like ['1, 2, 3, 4', '5, 6, 7, 8', '9'];

Adding 2D arrays in Assembly (x86)

I have to add two 3*3 arrays of words and store the result in another array. Here is my code: .data a1 WORD 1,2,3 WORD 4,2,3 WORD 1,4,3 a2 WORD 4, 3, 8

passing an array to web-service php nusoap

i have a problem with passing an array to a web-service function that i created with php and nusoap. the problem is that i guess i'm doing something wrong.. i s

Merge key and value of array index [duplicate]

I have an array as follows: ['foo'=>'bar','baz'=>'bat'] im trying to determine an elegant way (not using a standard forloop, prefer lea

Printing more than one array using print_r or any other function in php

I need to print contents of multiple arrays in my code. Eg function performOp($n, $inputArr, $workArr) { printf("Entered function, value of n

numpy's interp function - how to find a value of x for a given value of y?

So I have an array of values of x (in increasing order) and the corresponding y values. Numpy's interp function takes in the X value, and the x and y arrays. Ho

3-Dimension List or Map

I need something like a 3-dimension (like a list or a map), which I fill with 2 Strings and an Integer within a loop. But, unfortunately I don't know which data

Remove pair duplicates from array of values

The problem In lua I have an array of values (specifically - x and y position values) from which I would like to remove duplicate pairs. The array looks as fol

In a CUDA kernel, how do I store an array in "local thread memory"?

I'm trying to develop a small program with CUDA, but since it was SLOW I made some tests and googled a bit. I found out that while single variables are by defau

javascript - match string against the array of regular expressions

Is there a way in JavaScript to get Boolean value for a match of the string against the array of regular expressions? The example would be (where the 'if' stat

Why is this PHP array not the same?

I'm not understanding why the array: <? $data = array( 'items[0][type]' => 'screenprint'); ?> Is not the same as <? echo $data['items'][0]['typ