Javascript autocloses HTML tags?

Why do these two functions give different results? var table1 = document.getElementById("table1"); var table2 = document.getElementById("table2"); var register = [ {att1: 1, att2: 2, att3: 3}, {att1: 4, att2: 5, att3: 6}, {att1: 7, ...
more »

2017-12-03 19:12 (2) Answers

combine array entries with every other entry

Sorry for the title as it looks like most of the other questions about combining arrays, but I don't know how to write it more specific. I need a PHP function, which combines the entries of one array (dynamic size from 1 to any) to strings in every ...
more »

2017-12-03 10:12 (3) Answers

Python list to tuple

I have this : (([75, 0], [100, 0], [100, 370]), ([75, 0], [100, 370], [75, 370])) that come from this : [(array([75, 0]), array([100, 0]), array([100, 370])), (array([75, 0]), array([100, 370]), array([ 75, 370]))] and I want to have : ...
more »

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

Sorting arrays (2D array) Need assistance

Basiclly what i am trying to do is for sort the values of a array input like uniteUnique([1, 3, 2], [5, 2, 1, 4], [2, 1]) into a sorted 2D array like [[1, 1, 1], [2, 2, 2], [4], [3], [5]]. The arrays don't have to be in number/ value order. The code ...
more »

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

Function in a function in java

Is there a way to use the first function in the second one to create a double array with random numbers? public static int[] build1(int size) { int[] arr = new int[size]; for (int i=0 ; i < arr.length ; i++) arr[i] = (int)(Math...
more »

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

Restructure complex nested array

I have an array like this: var my_array= [ [2, [[9, 10]]], [5, [[10, 11]]], [4, [[11, 9]]], [1, [[19, 2], [41, 10]]], [7, [[17, 3]]], [0, [[11, 4], [18, 5]]] ] The arrays in my_array includes another two arrays (the first i...
more »

2017-12-01 18:12 (3) Answers

Parse RegEx IP matches in Powershell array

I am trying to work out how to parse an array for IP addresses. I have already worked out how to resolve the IP to DNS Hostname so far I have this: Function Get-IP-Hostname { Param([string[]]$array) $array.length foreach ($element in $...
more »

2017-12-01 18:12 (3) Answers

.eq() out of order

I'm trying to select the 3rd element of a JQuery object, by using eq() method. But for some reason the 2nd and 3rd selections pop out in changed order: var selection = $("[name=input0], [name=input1], [name=input2], [name=input3]"); selection.eq(1);...
more »

2017-12-01 13:12 (2) Answers

Incrementing a StaticVector at an index

I want to increment a static array A at location i by x. If it was a mutable array, I would just do A[i] += x. But since it's StaticArray, I need to create a new one. However, if I new the size of A then I would do something like A = A + @SVector [0...
more »

2017-11-30 19:11 (2) Answers

Extract int value and string from string

I would like to use string class, to extract some information from the string. Given the string: <12,Apple>,<20,Orange>,<49,iPhone> I would like to let 12, 20, 49 to a int array. that means a[0] = 12, a[1] = 20, a[2] = 49. And let Apple, O...
more »

2017-11-30 04:11 (1) Answers

Ruby Search Array of Hashes and Arrays

I have an array of hashes which also include an array: machines = [{ 'name' => 'ldapserver1', 'ip' => '10.199.0.10', 'role' => ['server', 'initial'] }, { 'name' => 'ldapserver2', 'ip' => '10.199.0.11', 'role' ...
more »

2017-11-29 18:11 (3) Answers

Sort objects in array by key with lodash

Hi Stack Overflow community! I have the following test array: let test = [{ "searchQuery": "test", "resultsLoaded": -1, "offset": -1, "allResults": 10 }, { "metaData": { "type": "page-content", "image": true, ...
more »

2017-11-29 16:11 (4) Answers

Integer division in C with unsigned short

I feel like the bloodiest beginner - Why does the following not work: // declarations unsigned short currentAddr= 0x0000; unsigned short addr[20] = {1, 0}; // main addr[1] = (~currentAddr)/2+1; printf("addr[1] wert: %hu\n", addr[1]); // equals 1, ...
more »

2017-11-29 12:11 (4) Answers

Array size in C++

I made a code in which I had to take the size of an array as the user’s input and its elements too and print them. #include <iostream> using namespace std; //Compiler version g++ 6.3.0 int main() { int i; cout<<"\nenter t...
more »

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