Swift Set Array custom sort

I have Contact model and I want to sort by [firstLetter, fullName] into [section,row] for UITableView in this way "FAVORITES" at startIndex, "#" at endIndex and between them are sorted letters. For example: ["A", "C", "E", "#", "FAVORITES"] into ["FA...
more »

2017-06-21 19:06 (2) Answers

Numpy Array Subtraction

How would I go about comparing two different numpy arrays to create a third array? I want to write a loop that goes through two arrays and prints a new array "c" with only the values that are not in a or b For example say I have a = [1,2,3,4] b =...
more »

2017-06-21 18:06 (1) Answers

How to get number of arrays in a JSON object

Below is my JSON. I want to get number and name of array(s) in this object. This is dynamically created so I don't know about its number and name(s). Here are 2 Arrays in this example, named Table and Table1. "{ "Table": [ { ...
more »

2017-06-21 14:06 (3) Answers

ReactJs pass props dynamically from array

I'm using srcSet for changing my images at a certain width. This also works fine but I would like to set the image path/source dynamically instead of hardcoding the values in my source code. Does anyone have any suggestions how I could do this? For ...
more »

2017-06-21 14:06 (2) Answers

Sort by date the column in datatable

I'm using jsf2.2 primefaces 6.0 and i'm trying to sort the datatable column by date as presented in the figure: I used sortBy" attribute in order to sort the date column but nothing happend. If there is a working solution on primefaces component "...
more »

2017-06-21 14:06 (2) Answers

PHP sort array by number in filename

I am working on a photo gallery that automatically sorts the photos based on the numbers of the file name. I have the following code: //calculate and sort $totaal = 0; if($handle_thumbs = opendir('thumbs')){ $files_thumbs = array(); while(...
more »

2017-06-20 20:06 (3) Answers

returning numpy arrays via pybind11

I have a C++ function computing a large tensor which I would like to return to Python as a NumPy array via pybind11. From the documentation of pybind11, it seems like using STL unique_ptr is desirable. In the following example, the commented out ...
more »

2017-06-20 19:06 (1) Answers

python numpy array indexing

I think I understand the indexing of array in python/numpy correctly. But today I met a problem as follows: I have a 6-d array e.g. A and A.shape = (11,1,9,1,5,7). Then I use the indexing as follows: B = A[:,0,0,0,[3,4,2],0] and B.shape = (11,3...
more »

2017-06-20 17:06 (1) Answers

Move every other value from array into a new array

I have two one-dimensional arrays, a and b. a has values and b is empty. The length of a is an even number. I'd like to remove every other value from a and move them to b, in the same order as they were placed in a. var a = [1, 2, 3, 4, 5, 6], b = [...
more »

2017-06-20 16:06 (4) Answers

Sort multidimensional array by key of set of array

I'm looking for a solution to sort by key a multi dimensional array, the point is that I can sort a set of array with multidimensional that has no custom key ID and the array is in set, but this array contains custom key and I need to sort by date: ...
more »

2017-06-20 16:06 (1) Answers

VBA: Create an array of class module

I'm trying to create an array of my custom class, but it gives me this error: Run-time error '91': Object variable or With block variable not set Here is my code so far: Sub DBM_Format() Dim coreWS As Worksheet Dim WS As Worksheet Dim ...
more »

2017-06-19 15:06 (2) Answers

Reduce not removing correct array item

Edit 1 Shortened the code to removeContentNew(i) { var contents = this.state.templateContent; contents.splice(i, 1); this.setState({ templateContent: contents }); } It might have something to do with this: componentDidMount() {...
more »

2017-06-19 13:06 (2) Answers

Multiple sort in JavaScript

I have an array of objects like this:- var arr = [ {total : 20, name: David}, {total : 10, name: Joe}, {total : 15, name: Tracy}, {total : 20, name: Joel}, {total : 15, name: Michael}, {total : 10, name: Arnold}, {total : 15, name: Paul}, ] I need...
more »

2017-06-19 07:06 (8) Answers

(numpy array) Binary to Decimal Python-3.x

I am using python-3.x, and I am trying to convert a list of a numpy array "Binary's" to decimal numbers, as I know I need to convert these Binary's first to Strings then I can convert them to Decimal ex: 1.Binary = 101011111 >>> 2.String= '101011111...
more »

2017-06-18 21:06 (1) Answers