Category "arrays"

Create dictionary from an array of objects using property of object as key for the dictionary?

With Swift is it possible to create a dictionary of [String:[Object]] from an array of objects [Object] using a property of those objects as the String key for

does array.filter() creates a new array?

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter as per document says The filter() method creates a new array with

Loop ID through cells in Google Apps Script

Good Day! I would like the Purchase Order ID repeated upon submission of a form in an earlier sheet. My current code however repeats this throughout the length

Using Associative arrays

I'm trying to access a position of a associative array which is inside of another array. Here is my array: Array ( [order_data] => stdClass Object

How to change element in array?

Array is 2 dimensional 10x10 gameBoard Code I made for array: int gameBoardLength = gameBoard.length; System.out.print(" "); //two spaces to align t

Create empty array using reflection [duplicate]

How do I create empty array of a type given by reflection? I have tried using the Activator.CreateInstance(Type) method: Type arrayType = typ

How to flatten tree structure into array of arrays

Given a structure like this: var node = { children: [] } That is to say: It only has children property. No parent property. No nextSibling property. How to

Map and filter an array at the same time

I have an array of objects that I want to iterate over to produce a new filtered array. But also, I need to filter out some of the objects from the new array de

transfer a 2d array from python to c++ and back

I am using python to call methods in a shared C++ library. I am having an issue converting a numpy 2D array to a C++ 2D array. I need to enable the following fu

PHP-Sort array based on another array?

OK, I already got this question in stackoverflow but sadly it's in javascript - Javascript - sort array based on another array and I want it in PHP $data = ar

YAML equivalent of array of objects in JSON

I have a JSON array of objects that I'm trying to convert to YAML. {"AAPL": [ { "shares": -75.088, "date": "11/27/2015" }, { "shares": 75.08

React render array of components

Quick question. Anyone know how to render an array of components? Trying to make it easier for a developer to alter a particular component. (It's like a dashboa

How to hook into a method with int[] using xposed?

I am trying to hook into this method in NotificationManagerService using Xposed: void enqueueNotificationInternal(final String pkg, final String opPkg, final i

Implode array with array of glue strings

I have a awkward need but I need to interleave an array with another array before imploding the result. I guess my better option would be less talk more example

React Native - Use a keyExtractor with FlatList

I have been getting the: "VirtualizedList: missing keys for items, make sure to specify a key property on an item or provide a custom keyExtractor" pretty c

Array Problems java.lang.ArrayIndexOutOfBoundsException: 9

I am trying to write a class that takes a phone number that the user inputs as a string, then stores each digit in an array. I converted the string to a long us

C++ sorting an array in ascending order Printing

Im trying to sort an array in ascending order and print it out and Im having trouble of where to put my cout in my code. for (int k=0; k<ARRAY_SIZE; k++) {

CodeFights - issues with time limit when writing FirstDuplicate method

I'm trying to solve the problem below from CodeFights. I left my answer in Java after the question. The code works for all the problems, except the last one. Ti

Print character array as hex in C

I have a 2D array called char **str (allocated by malloc). Lets say str[0] has the string "hello". How would I print that hex? I tried printf("%d\n", (unsigned

appending array to FormData and send via AJAX

I'm using ajax to submit a multipart form with array, text fields and files. I append each VAR to the main data as so var attachments = document.getElementByI