## Why is the dtype shown (even if it's the native one) when using floor division with NumPy?

Normally the dtype is hidden when it's equivalent to the native type: >>> import numpy as np >>> np.arange(5) array([0, 1, 2, 3, 4]) >>> np.arange(5).dtype dtype('int32') >>> np.arange(5) + 3 array([3, 4, 5, 6, 7...
more »

## PSObject Array of Arrays Return Powershell Read Individual Items/Rows

I am using one Function to call another and returning a PSObject array or multiple arrays (I think). The return after each looped object is a set of values. The data in \$a in Function Test2 is below but it's count is 3, meaning three objects or array...
more »

## Writing a comparable for an Arrays.Sort of Points

I have this code : import java.awt.Point; import java.util.Arrays; public class Haupt { // creates an array of anz Point objects public static Point[] generatePointArray(int anz) { Point[] pa = new Point[anz]; for(int i = 0...
more »

## Fastest way to count rows in array that match some condition in Julia

In Julia, I have an array of Booleans like this: 3×5 Array{Bool,2}: true false true false true true true true true false false false true true false Except I have far more than three rows. What's the fastest/best way to coun...
more »

## Merge two arrays with same keys or associate

I would like to create some kind of epg for website from this. As i have no experience, it is unfortunately hard for me I have two arrays Array ( [0] => Array ( num] => 1 [name] => name 1 [epg_channel_id] =&g...
more »

## MATLAB function to return part of an array before a zero

I'm trying to create a function that receives an array and returns the part of the array before a zero. For instance, [12, -4, 5, 32, 0, 4, 1, -8] would return [12, -4, 5, 32], and if the array contains no zero, return the whole array. Here's what I...
more »

## C# save time for later checks on a list

as always i need your help! Inside a foreach of a string array (containing cryptocurrency ticker names like "XRP", "SC", "XMR" and so on) i have a statement where i need to test if the value of a decimal is above 100. If this is true then i need to ...
more »

## A free() needed after malloc on mcu (even when the array/pointer is always in use)?

Alright, I am quit the beginner at C, so I might not understand everything yet, so here I go: We need to program a stm32f0 using c without any hal libraries. For an exercise we needed to change the example usart code from sequential to interrupt dri...
more »

## Storing string in arrays in ruby

I am attempting to write a method that changes one string to another one letter at a time. However, I never noticed in ruby that if you push a string variable to an array it seems to push the address of the string variable and not the string. def mu...
more »

## Codility: longest set within array

I took a test for a company recently in Codility which really puzzeled me, I would like to hear your ideas about it, the statement is the following: A zero- indexed array A consisting of N different integers is given. The array contains all integers...
more »

## C# actionresult filter using array or list

I feel like I am either close or way way off. Stumbling though MVC5 C# webapp, have read some great help given however I just can't seem to find the exact syntax that gets me a result. In my controller I am trying to filter my results based on a co...
more »

## Elegant way to complete a parallel operation on two arrays of unequal lengths

I want to write a function in numba that runs a math operation on 2 arrays, and accommodate for when both arrays don't have the same element count. So for example: lets say I want a function that adds each element of array a to the elements of array...
more »

## Ruby: iterate and nest hashes on condition

I have two arrays of hashes like this: h1=[{id:1, item:1, from: DateTime.new(2017,9,4,6,0,0,'+0300'), to: DateTime.new(2017,9,4,17,59,59,'+0300'), value:10}, {id:1, item:2, from: DateTime.new(2017,9,4,18,0,0,'+0300'), to: DateTime.new(2017,9,4,2...
more »

## Sort lists in a nested list based on the argsort of the 0th list

What's the neatest way to sort a nest of list based on the first list in the list? before sort >>> list_of_things = [[100,300,200],[t,u,v]] after sort >>> [[100,200,300],[t,v,u]] So far using search I've located an index I ca...
more »

## Prevent transposing array when using Java LinkedList in MATLAB

I am using MATLAB R2015a. When using a Java LinkedList in MATLAB environment, adding row vectors and then retrieving them appears to transpose them into column vectors. For example, import java.util.LinkedList x = [285 252 100 67] y = [280 ...
more »

## Guard scanf from reading too many characters with a define?

Usually I use a define for the size of a string, but when I use scanf(), I want to guard the function from reading too many characters (and reserve space for the null-terminator). I was wondering whether I could do this using my define, instead of a ...
more »

## How do I insert a string on an array from the strings.xml file

How do I insert a string on an array from the strings.xml file, if I enter the following error I get the error getText(R.string.home) Error: Cannot resolve method 'getText(int)' static String[] titles ={"Home", "Profile", "Setti...
more »

## Ruby: multidimensional array to one-dimensional rows

In Ruby, how do I go from this: [ 1, ["green", "blue", "black"], [ ["1", "2"], ["3"], ["4", "5"] ] ] to this? [ [1, "green", "1"], [1, "green", "2"], [1, "blue", "3"], [1, "black", "4"], [1, "black", "5"], ] I tried .zip but w...
more »

## return matrix on C

Here is my code below. #include <stdio.h> #define _USE_MATH_DEFINES #include <math.h> void rot(int angle); static double R[3][3]={0}; int main(void) { int angle = 30; rot(angle); int i, j = 0; for (i = 0; i < 3;i++) ...
more »

## Why ++(*p) is not giving l-value required error?

#include <stdio.h> int main() { int arr[] = {1, 2, 3, 4, 5}; int *p = arr; ++*p; p += 2; printf("%d", *p); return 0; } Why is this code not giving any compile time error,My doubt is ++*p is evaluated as ++(*p) and *p w...
more »

## Grouping objects inside nested javascript arrays

I have the following array, which has an object holding nested arrays that in turn have objects of their own: var list = [{ one: [{key: 1, value: 'eng1'}, {key: 2, value: 'eng2'}], two: [{key: 1, value: 'esp1'}, {key: 2, value: 'esp2'}] }]; ...
more »

## Creating arrays for permutations within a subsection of a list

So I have a list: a 25 b 18 c 18 d 18 e 14 f 14 g 12 ... and so on For each number that matches, I have to get every permutation of the identifier. The lists I would need from my example would be as follows: abcdefg abdcefg acbdefg acdbefg adbcef...
more »

## How to create an array of pointers to objects in Matlab?

I'm writing a Matlab script where I have a bunch of objects of a same self defined class, say A, B and C. Then I have a function that work on any of the 2 objects, like func(A,B). Now I want to pick an object, say A, and then func(A,x) through all ...
more »

## Is there a way to create a non-null array from a range?

In Java a simple array can be created by using a traditional for loop: ImageButton[] buttons = new ImageButton[count]; for (int i = 0; i < count; i++) { buttons[i] = view.findViewById(BUTTON_IDS[i]); } A simple conversion to Kotlin yields t...
more »

## Filter for JSON files that contain part of an array

I have a function that allows me to filter out certain JSON files using another JSON object as filter. See code: public Map<String, Entry<JsonObject, Long>> loadFilter(Coll<?> coll, JsonObject filter){ // Create Ret Map<...
more »

## check if property value exist before push item

Below is my sample code that pushes into VacanciesWithSavedSearches array by checking if the item does not already exist. if (\$scope.VacanciesWithSavedSearches.indexOf(value) == -1) { \$scope.VacanciesWithSavedSearches.push({ ...
more »

## C/C++: How does int array[10]={0} work?

I am wondering how does int array[10]={0} really work? Does it go all the way through the entire array like this? for(int i=0;i<10;i++) array[i]=0; Or is it more efficient? ...
more »

## How to convert an array into a hierarchical array

I have some data which is var currentData = [ {'ticket':'CAP', 'child':'CT-1'}, {'ticket':'CAP', 'child':'CT-2'}, {'ticket':'CT-1', 'child':'CT-1-A'}, {'ticket':'CT-1', 'child':'CT-1-B'} ]; The data is flat and I need to convert it...
more »

## Iterate over hash, and take values until some total sum limit is reached

I have two arrays of hashes that look something like this: h1=[{id:1, item:1, value:10}, {id:1, item:2, value:3}] h2=[{id:1, item_a:1, value:5},{id:2, item_a:1, value:7},{id:3, item_a:1, value:10}, {id:4, item_b:2, value:1},{id:5, item_b:2,...
more »

## Generating a LOT of unique tokens in Ruby

I needed to generate a lot of unique codes, for two lists of codes, that cannot match with each other and be unique codes. It has to be seven characters in length. BUT I'm not satisfied with my final solution, that I had to let run all night. I wo...
more »

## Find wrapped array entry that is not empty

I´m new with spark. My problem is that I have to find in a list, these which are not empty. When I use the filter function is not null, than I get also every row. My program code looks like that: ... val csc=new CassandraSQLContext(sc) val rdd...
more »

## Why is True printed with leading whitespace in numpy array

I noticed that in NumPy 1.13.1, when a dtype=np.bool_ array is printed the True values always have a leading whitespace. >>> import numpy as np >>> np.asarray([1, 0, 1, 1, 0], dtype=np.bool_) array([ True, False, True, True, Fals...
more »

## I don't understand why my array produces output I can't use

I am trying to create list of computers which I can work on using Get-Computer. Here are two ways to create the list. I don’t understand why they are different or how I can get the results of the two methods to have the same value. My code is: ...
more »

## Are the elements present after a designator initializes elements in strictly increasing manner?

Here, I have initialized array like this : #include <stdio.h> int main() { int a[10] = {1, 2, 3, [7] = 4, 8, 9}; printf("a[7] = %d\na[8] = %d\na[9] = %d\n", a[7], a[8], a[9]); return 0; } Output : a[7] = 4 a[8] = 8 a[9] = 9...
more »