Skip to main content

Questions tagged [arrays]

An array is an ordered linear data structure consisting of a collection of elements (values, variables, or references), each identified by one or more indexes. When asking about specific variants of arrays, use these related tags instead: [vector], [arraylist], [matrix]. When using this tag, in a question that is specific to a programming language, tag the question with the programming language being used.

arrays
1 vote
2 answers
37 views

How to count values from a column with JSON content?

I have a table with singers and each singer can be linked to many musical styles. Musical Styles are in a TEXT column, but the content of the column has JSON format. I want to count the number of ...
-2 votes
0 answers
20 views

How do relationships not cause infinite loops?

So I'm still learning SwiftData and the one thing I cannot get my head around is how relationships don't cause infinite loops. For example, using SwiftData, if you want to list all the films an actor ...
2 votes
2 answers
3k views

How to return a const char * from a C/C++ function?

I have the following C++ function that reads a string from the flash memory and returns it. I want to avoid using the String class because this is on an Arduino and I've been advised that the String ...
0 votes
1 answer
65 views

R create an array result of cutting (seq) of a data frame

I'm not comfortable with array manipulation (and English writing, sorry ..) I have this data frame (aa): aa<-data.frame(replicate(10,sample(0:17,30,rep=TRUE))) > aa X1 X2 X3 X4 X5 X6 X7 X8 ...
1 vote
2 answers
75 views

C++: array types and new

I'm learning C++. The following program looks nice and generic: typedef some_type T; int main() { T* p = new T; } And it indeed works for non-array types like int, etc. However, if I try typedef ...
4 votes
2 answers
12k views

How to insert a variable in to a multiline (backtick) string in Go?

I am trying to insert a variable in to a string that I pass in to a byte array. What I want is something like this: myLocation := "foobar123" rawJSON := []byte(`{ "level": &...
6 votes
8 answers
21k views

create a grid array in JavaScript

I want to setup a grid containing m * n objects. This grid got a width of m rows and n columns. I tried this code first let map = [][]; // Create an array that takes a x and y index function ...
1 vote
2 answers
2k views

How can I separate csh array elements with something other than a space?

In a csh script I'm working on I need to have array elements containing spaces, so I need to separate those elements with something other than a space, like a comma. For example, I would like to ...
1 vote
1 answer
4k views

type hinting an array

Consider the following minimal example: from array import array def foo(arr: array) -> None: print(arr) I have a function which takes an array argument. My project is statically typed and ...
0 votes
0 answers
76 views

append to a javascript array from a vb.net timer

I am not best javascript coder but I am familiar with passing an array to javascript from vb.net, but I now have a requirement to append to a javascript array from a vb.net where timer updates some ...
33 votes
6 answers
108k views

How to return a 2D array from a function in C?

I am a Ruby programmer who has ended up developing a code generate for C. Its like asking a Limo to tow a 1960s truck. Any way. Here is what I thought should work but doesnt work. float[][] pixels() ...
14 votes
4 answers
7k views

Extract elements from numpy array, that are not in list of indexes

I want to do something similar to what was asked here NumPy array, change the values that are NOT in a list of indices, but not quite the same. Consider a numpy array: > a = np.array([0.2, 5.6, ...
1 vote
1 answer
50 views

Filter multideminsional array in PHP so that if certain values are duplicated in sub-arrays the redundant ones are unset [closed]

In an application, redundant but non-identical arrays are being returned. I'd like to remove the redundant arrays from the multidimensional array. Though the issue could possibly be solved closer to ...
1 vote
4 answers
2k views

Split Javascript array elements into chunks at designated indexes

I have an array like so const arr = [3,6,9,12,18,21,24,27,33,36]; I want the array arr split into chunks at 12, 21 and 33. That is at the index 3, 5, and 8. I want to produce another array chunks ...
0 votes
4 answers
735 views

Scraping the contents of a javascript variable to a PHP variable?

I have scraped some javascript (using simple_html_dom) and this is what I've come up with... Contents of $MyScrape <script type="text/javascript"> var initialInfo = [ [ [29, 30, '...

15 30 50 per page
1
2 3 4 5
27852