Merge two arrays of dictionaries in javascript

I have two arrays of dictionaries which look something like this: var lat = [{key:"2017-09-20T11:51:32.000Z", value:50.7825333},{key:"2017-09-20T11:51:33.000Z", value:50.7826},...]; var lon = [{key:"2017-09-20T11:51:32.000Z", value:-1.3075833},{key:...
more »

2017-11-09 17:11 (3) Answers

Steps Query from 365 days ago into an array

I am extracting the step data from health kit, in order to upload it to a website. The website takes in 365 integers and then allocates backwards dates to the website. So the first integer is today, second integer is tomorrow e.t.c. I am attempting...
more »

2017-11-09 13:11 (0) Answers

Arrays: conditionally mapping elements

I work with Redux and it often happens to me to write reducers with expressions like this one: return users.map(user => user.id !== selectedUserID ? user : { ... user, removed: false } ); The intent should be clear enough: modify ju...
more »

2017-11-09 11:11 (4) Answers

Can Excel's INDEX function return array?

If the data in the range A1:A4 is as follows: Apple Banana Orange Strawberry Then INDEX can be used to individually return any value from that list, e.g. = INDEX(A1:A4,3) Would return Orange. Is there a similar Excel functions or combination o...
more »

2017-11-08 20:11 (3) Answers

Array of structures of function pointers C

I'm trying to initialize an array of structures containing pointer on function : typedef struct struct_actioncommand { char *action; void (*command)(my_type); } type_actioncommand; To initialize each pointer with its function name I'm usin...
more »

2017-11-08 18:11 (1) Answers

C parsing a huge int array from a string

I'm trying to solve some simple problem. There is an input file equal.in. It consists of two lines: first one contains the number N of numbers in next line. Second line contains N numbers separated by single space. N is not greater than 3 * 10^5, eac...
more »

2017-11-08 17:11 (2) Answers

List of List of List slicing in Python

I have simulated 10000 scenarios for 4 variables during 120 months. Hence, I have a scenarios list of lists of lists on which to get and element I would have to use scenarios[1][1][1], for example, and this would give me a float. I want to slice t...
more »

2017-11-08 00:11 (4) Answers

2D array function only passing in 1 Value

I have a program that takes in a pyramid of people with weight values and is supposed to use a recursive function to add the weight of the two people that the person is supporting (if the person is on an edge of a pyramid they only are supporting one...
more »

2017-11-07 20:11 (1) Answers

swift: average consecutive positive number

We have an array, for example: let numbers = [-1.0,1.0,3.0,4.0,-1.0,-2.0,2.0] We know how to get maximum consecutive positive number: let pos = numbers.map({ () -> (Double) -> Int in var c = 0; return { c = $0 > 0 ? c + 1 : 0; return c ...
more »

2017-11-07 15:11 (2) Answers

how to change the JSON format

here I am getting my result, is not an expected format in javascript. How i can do this ? is the any solution for to get my expected format. Please guide me to change my result format what I expected, using javascript and nodejs. ...
more »

2017-11-07 07:11 (2) Answers

Shifting Objects Up in an Array

I'm creating a program that creates an array of objects in random positions in an array size 8. Once created, I need them to sort so that all the objects in the array are shifted up to the top, so no gaps exist between them. I'm almost there, but I c...
more »

2017-11-07 07:11 (4) Answers

Get length of array without using length

In a completely contrived problem on exercism.io, I'm tasked to come up with a way to get the length/size of an array without using any enumerable methods. I originally simply had: arr = [1,3,4] ctr = 0 while arr[ctr] ctr += 1 end ctr...
more »

2017-11-07 03:11 (2) Answers

Combination of all rows in two numpy arrays

I have two arrays, for example with shape (3,2) and the other with shape (10,7). I want all combinations of the two arrays such that I end up with a 9 column array. In other words, I want all combinations of each row of the first array with the rows ...
more »

2017-11-06 19:11 (3) Answers

Why do all arrays in java implement serializable?

The JLS specifies that "Every array type implements the interfaces Cloneable and java.io.Serializable." (JLS 10.8). Therefore an array of an unserializable class (e. g.: Object) is serializable, possibly risking run-time exceptions when used imprope...
more »

2017-11-06 09:11 (1) Answers

How to index a Julia array

I am having trouble understanding what seems like an inconsistent behavior in Julia. X = reshape(1:100, 10, 10) b = [1 5 9] X[2, :][b] # returns the correct array X[2, :][1 5 9] # throws an error Can someone explain why using the variable b works...
more »

2017-11-06 04:11 (2) Answers

JMeter - need to loop through the array

I am using JSON Path Extractor and I am getting back an array: DeedIDs=["5411ab7ccbda71fb38f5adf9","5411ab7dcbda71fb38f5adfa","55d7000dfbffa917247e09bf","5411ab7acbda71fb38f5adf4","5411ab79cbda71fb38f5adf3","5408b9e2cbda7138f4452129","5408b9e2cbda71...
more »

2017-11-05 15:11 (3) Answers