Sorting an array and keeping original index

I am trying to make a program that will sort the array but keep track of their original indexes. I don't want to change the original array so I copied it into list[][]. public static void main(String[] args) { int array[] = {17, 10, 8, 13,...
more »

2017-02-22 19:02 (3) Answers

How to sort of string array

I am working on ruby on rails and i am new here as well ruby on rails. I am working on one project and find some issue of sorting an array of string which contains images name. I have tried many algorithm which i know doesn't help me. When i call ser...
more »

2017-02-22 14:02 (3) Answers

exclude enumeration of each field in PHP array

This is how the object look like ! I want to exclude the enumeration of fields from array and keep only the specific key and value.Also, the final array must to be json type. $query="SELECT * FROM articles"; $rs=$connectLink->query($query); wh...
more »

2017-02-21 19:02 (0) Answers

Python array using numpy

I am confused about doing vectorization using numpy. In particular, I have a matrix of this form: of type <type 'list'> [[0.0, 0.0, 0.0, 0.0], [0.02, 0.04, 0.0325, 0.04], [1, 2, 3, 4]] How do I make it look like the following using numpy? ...
more »

2017-02-21 18:02 (3) Answers

usort of session array not outputting as expected

I have a grid of img squares that can be dragged into any order using the sortable library. Each img is a visual representation of a result from a mySQL db query that selects any image that shares an 'imageparent' identifier. The order they're presen...
more »

2017-02-21 12:02 (1) Answers

pdo bindParam with associative array

I am trying to bindParams with an associative array, looped through a foreach, but I dont get it to work somehow. I am getting this error: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens here...
more »

2017-02-21 12:02 (2) Answers

Map into another and compare node

I am with some doubts about iterate into a JS Object and some array functions in JavaScript. Let's say I have these variables: var json1 = "[{"id": 1, "name":"x"}, {"id": 2, "name":"y"}]"; var json2 = "[{"id": 1, "name":"x"}, {"id": 2, "name":"y"}, ...
more »

2017-02-20 19:02 (6) Answers

Setting Class Object Array Property

I'm trying to set a property of an object which is part of a class object array, for excel in VBA. The code looks like this: Dim myClass(5) as class1 Dim i as integer For i = 0 to 5 set myClass(i) = New class myClass(i).myProperty = "SomeV...
more »

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

loading complex numbers with numpy.loadtxt

I know that if I want to save and load arrays of complex numbers with numpy, I can use the method described here: How to save and load an array of complex numbers using numpy.savetxt? . Assume however, that someone did not know about this and saved...
more »

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

Swift Reduce - Add Int Values of Strings

I have an array ZZ of custom object A with property: String a1 I would like to add the a1 property of all the elements in the array and return an NSNumber value. Since the value a1 is a string, I will also have to cast it into a double on the go t...
more »

2017-02-20 16:02 (3) Answers

Search in array, not only unique values

I have a simple array containing Dutch city names: var cities = ['Amsterdam', 'Den Haag', 'Den Helder', 'Rotterdam', 'Utrecht', 'Groningen', 'Zoetermeer', 'Zwolle', 'Delft']; My code to search through this array looks like this: elems.searchFiel...
more »

2017-02-20 12:02 (4) Answers

Sorting by selection in an array c++

so my program should be able to take several numbers from the user until the last number is "999". Then, it should be able to print out an array having all the numbers entered sorted. I have to use sorting by selection (by comparing values in each in...
more »

2017-02-20 11:02 (0) Answers

Is it really a array sorting bug of chrome and ie?

I create a very simple array sorting script, it works on Firefox, but chrome and ie are giving me an unordered array. var arr = ["2017-02-17", "2017-02-17", "2017-02-16", "2017-02-15", "2017-02-16", "2017-02-15", "2017-02-14", "2017-02-16", "2017-02...
more »

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

Generic Array List issue with get method (Java)

So im creating a generic array list and im having an issue with the get method. I have it validating the index parameter but I also want it to not use the get method if a parameter that is entered is out of range. So if someone asks it to get a val...
more »

2017-02-20 02:02 (1) Answers

How to use dTree.js to make family trees

I am trying to use dTree.js as a way to display data made from simulating the breeding of rabbits, I am running into problems as I do not know how to make a js class that when converted to json works properly. This is all I have. function objNode(na...
more »

2017-02-19 21:02 (0) Answers