Questions tagged [arrays]

An array is an ordered 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 which is specific to a programming language, tag the question with the programming language being used.

Filter by
Sorted by
Tagged with
-1
votes
0answers
7 views

How to map nested JSON in react using multiple map function?

I have this json data, and I am not able to correctly map it with the nested loop it has within itself. These are routes, and each route has some items. I need to display this in a table, whilst ...
0
votes
0answers
11 views

using sizeof function to find array's size(example code) [duplicate]

I wrote a code to practice c++. but it doesn't return the size of the array. where is my problem? #include <iostream> #include <conio.h> using namespace std; namespace vari { int ...
0
votes
0answers
7 views

How to send ajax post array to mvc controller in vb.net

My javascript code; <script> $(document).on('click', '.Send', function () { var a = []; $(".k_sure").each(function () { var a_array= a.push($(this).val()); ...
0
votes
0answers
4 views

Advice on reading multiple text files into an array with Ruby

I'm currently writing out a program in Ruby, which I'm fairly new at, and it requires multiple text files to be pushed into an array line by line. I am currently unable to actually test my code since ...
0
votes
2answers
40 views

Down casting an array of Int[] into an array of Byte[]

Is there a simple way to downcast an array of integers into an array of bytes? Essentially, I would like to do the following thing (which does not work as is): int[] myIntArray = new int[20]; byte[]...
-1
votes
1answer
23 views

Generate random number using generalized extreme value distribution

Please how I can generated 100 randum values using the generalized extreme value (gev) distribution and the Weibull min distribution in python or R. I used this command for the gev in python: import ...
-1
votes
1answer
40 views

Swift - Iterating array of dictionaries

I want to iterate array of dictionary but it gives error that "Value of type 'Any' has no subscripts". I just followed answer provide in link Here is the array of dictionaries in debug mode: Here ...
0
votes
1answer
27 views

Outputing query result stored in a Multi dimentional array ( getting Array to string conversion)

I am performing a select query from the database and store the result into an array like so: $res[] = $row;. Then in my view i get: Notice: Array to string conversion in C:\xampp\htdocs ... In my ...
1
vote
2answers
28 views

Convert kebab-case to camelCase - Javascript

Say I have a function that transforms kebab-case to camelCase: camelize("my-kebab-string") == 'myKebabString'; I'm almost there, but my code outputs the first letter with uppercase too: function ...
-1
votes
0answers
15 views

int[] does not contain a defincation for 'Concat' and no accessible extension method 'Concat' [duplicate]

.Concat flagging on below code...why is this happening?... attempting to join and sort two arrays and have successfully used .Concat before. just upgraded to VS 2017 have anything to do with it? ...
0
votes
3answers
48 views

Generating combination of arrays from JSON response [duplicate]

I have this below response Response const result = [ { Id: "1", Char1: "a; b; c", Char2: "d; e; f" } ]; Currently I am generating output like below from my below JS code Id,Char1,...
0
votes
2answers
38 views

Getting “java.lang.ArrayIndexOutOfBoundsException” exception while trying to find duplicate number from an array [duplicate]

Getting java.lang.ArrayIndexOutOfBoundsException while trying to find duplicate number in an array in Java. Here is the code: public class FindDuplicateNumberInArray { public static void main(...
-3
votes
2answers
45 views

Object destructing using ES6

I have this nested object that contains also an array. result:{ "a": [{ "b": { "c": 1, "d": 2, "e": 3 }, "f": 0 }] } How can I destructure ...
1
vote
3answers
73 views

C programming pointers and array

#include<stdio.h> int main() { //int *a={5641,5,98}; char *s="this is a character array"; printf("%s",s); } This method of INITIALIZING array works for character array but fails for ...
1
vote
1answer
43 views

Get static value from changing Array

I'm creating a game with P5.js and regular javascript. I have falling objects (in an array) that, when collided with the mouse, return to the top of the screen. I want to add a score number at the ...
0
votes
2answers
53 views

i am unable to pass array as function parameter.how i can solve?

I am working on a window form application and making a function pass an array as function parameter as shown below: void foobar(int[] foo, string[] bar) { } //calling foobar(new {1, 2,3}, new {"a", ...
0
votes
1answer
28 views

Get the index of a button (while pressing) which is in an array

I have saved some buttons in an array: buttons = [] labels.append(tk.Label(fr2, text="", pady=15)) labels.append(tk.Label(fr3, text="", pady=15)) Later I access to a table of a database and loop ...
0
votes
1answer
16 views

Why is [[GetPrototypeOf]] an Invariant of a Javascript Proxy?

One application for a Javascript Proxy object is to reduce network traffic by sending data over the wire as an array of arrays, along with an object listing the field names and index of each field (ie....
0
votes
1answer
46 views

Only last item of array is replaced [duplicate]

I need to replace variables for the body of an email. If the name of the variables exists in the variableNames array, then it must be replaced. But the problem is that only the last one that ...
3
votes
1answer
32 views

Array formula with MATCH gives no result when source table has only one row

The following array formula results in #N/A when the source table has one row, but will result in 1 (which is OK) when the table has more than 1 row (even if there are two rows of which one is empty). ...
-1
votes
1answer
39 views

How can I get a specific value in this PHP array?

I'm setting up a Cloudinary listing of uploaded videos and I want to get the metadata of that video. I have a print_r($result): <pre> Cloudinary\Api\Response Object ( [rate_limit_reset_at]...
-1
votes
3answers
46 views

My for Loop only outputs the last result, can I change this? [on hold]

So I'm trying to understand for loops a bit more but im wondering if there's a way to return each iteration of the loop rather than just the end result? I know I could just list the items separately ...
0
votes
1answer
63 views

How to Output Subarray?

I have a problem to output subarray values properly. I use Codestar Framework to create options. Here is my options code: array( 'id' => 'rows', 'type' => 'group', 'title' =&...
-4
votes
2answers
51 views

Java - Array with n matrix and multiply all matrix [on hold]

I have an array of matrices. In this array I have n matrices (for example: 15), and I want to multiply all matrices (the multiplication order is irrelevant). What is the best way to do this? I have ...
0
votes
2answers
60 views

Accessing JSON value with unique named subarrays

I want to sort a JSON array based on time value in a subarray with the key names of the subarrays being named uniquely. I'm searching for the method to access key, value update_time of every element ...
-5
votes
1answer
44 views

How to convert object to data of property in array [on hold]

This is my data [ {'TOM': ['a','b']}, {'JANE': ['a','c']}, {'MICKY': ['d']}, [ How can I convert this data to the array like this [ { name:'TOM', ans:['a','b'] }, { name:'JANE', ans:['a'...
0
votes
0answers
24 views

combining switch loops to concatenate the result

Please forgive my noob-ness. So, i figured out how to create two separate switch loops, in order to access two separate values. My trouble now, is that I don't know how to write a function that ...
0
votes
2answers
50 views

Find an empty array and modify json

Can you give a hint/guidance on the function call section checkAndFixNullArray. I am checking the input json for any empty array(siblings in this example). If any empty array output json should spit ...
0
votes
1answer
68 views

How to change int16 array to vector<float>

I am setting up a new ASR server. Audio data is coming from a client, the audio data format is an int16 array (PCM data), and it should be changed to a vector<float> before ASR server engine. I ...
-2
votes
0answers
52 views

Adding key value pairs into a defined object [duplicate]

I want to add additional data into an array containing multiple objects. I need to be able to find a vehicle and add additional key-value pairs to it. I have searched to the end of the earth for ...
-1
votes
2answers
47 views

when trying to construct an Array of ints with a template for a Array class, Error: Why is the array type 'int [5]' is not assignable,

When trying to build an array with a template, I get an error when implementing a default constructor for the Array class template. int main() { Array<int,5> arrayOfFiveInts; return 0; }...
0
votes
1answer
34 views

VBA, alternative code for this “x = Array()”

Dim x As Variant Dim b As Variant x = Array() b = x my point here is I want to transfer an array with ubound(-1). but it throws error when I'm passing x to b. Can you help explain how I can sort ...
-1
votes
2answers
43 views

ruby array separate “duplicates” [on hold]

I have this Array of words with a mix of caps and non-caps letters (and number sometimes ) : my_array = ['ZV2', '4Q3', 'abDc', 'zQ2', 'Def', '4q3', 'Abdc', 'ABDC', 'def', 'zv2', 'DeF', 'zV2', 'DEF'...
0
votes
2answers
28 views

How can I reshape ndarray, especially easy way ro (25,25) to (1,1)?

I try to make batch set for training and after made small example with (25,25) ndarray, but batch need only (60000) sample not the (60000, 25, 25) so I realized i have to reshape each of image, 25*25,...
-1
votes
3answers
47 views

How to sort an array of associative arrays by “gender” value?

I have an array of arrays: $students= array( array("name"=>"...", "gender"=>"male"), array("name"=>"...", "gender"=>"female"), array("name"=>"...", "gender"=>"female"), array("name"=...
0
votes
0answers
35 views

How to access sub index values in an array list

Preface : I am trying to get customer data using a webservice. I am having issues with storing the data into an array. Where this array will be passed to a text writer method. Issue: I am adding ...
0
votes
0answers
42 views

How can I show this table on php? [on hold]

The problem consist of two parts. First, I have a few tables and I need to make a database with them. I have already made the database, but I am not sure about it. This is the script I made in Mysql ...
0
votes
0answers
6 views

ion-tags to save value in array

I want an array to save the tags in page by using ion-tag-input. <ion-row *ngSwitchCase="'keywords'" padding> <ion-col col-12> <h6>Product keywords</h6> ...
0
votes
1answer
64 views

Array becoming empty after getting out of a for loop

I'm learning to program in Java for Android Studio. I'm working with a Parse.com query downloading information. I store the information inside an array of a costume object called MyData. When I'm ...
0
votes
0answers
24 views

I`m doing a to do application on javascript, but when I add one more to do comes the value undefined

Im having a problem to get the value that the user had input Im doing this app that its a list of todos but I`m getting undefined as I add elements to the array I`m getting like: Fazer cafe Estudar ...
-1
votes
0answers
33 views

howto loop recursivly object of obejcts in JavaScript?

I have a big object with several objects. Lets say: const listofObjects = { firstComment: "I am a comment", fistListofObjectsInsideArrays: [ { firstObjectinList: [ { one: "...
0
votes
2answers
67 views

Which Ruby methods to loop through numbers actually create the array and which do not?

For example, given n, which may be 1000000 or 100000000, to find out 0 ^ 1 ^ 2 ^ 3 ^ ... ^ n there can be several ways: p (0..n).inject(:^) p 0.upto(n).inject(:^) p (n+1).times.inject(:^) (is ...
2
votes
3answers
53 views

Is using arr.push causing my program to crash?

Hello you wonderful people of the stackoverflow community. I'm stuck on a HW problem that I hope you can help me with. // 5. Write the code that would make this test pass. // describe("multTwo", () ...
0
votes
1answer
23 views

How to deeply transfer grandchildren to become children in array of objects? [on hold]

I have an array with structure like this: item - child - grandchild - great-grandchild - ... item - child - grandchild - great-grandchild - ... items could have unknown depth ...
4
votes
2answers
76 views

cast an C++ array to a vector

Here is the code I found on Leetcode. However I cannot make sense of the following two lines, especially *(&a + 1). And the results show a copy of the array a. Could anyone give some explanation ...
-2
votes
1answer
21 views

How to wait for all superagent calls to complete before reaching the end of the function

I am trying to make multiple api calls which are dynamically created from some input, the issue is that the method ends prior to the completion of all Ajax calls. I need to trigger an additional ...
-3
votes
0answers
28 views

insert array data mysql php [on hold]

[insert array data php and mysql <?php ini_set ( "soap.wsdl_cache_enabled", "0" ); if (! $_POST) { } $PIN = 'AvJcrqDrsaGu71di4tpt'; $wsdl_url = "https://pec.shaparak.ir/NewIPGServices/...
-1
votes
2answers
53 views

C# Edit previous array in List [duplicate]

Helly to everybody, I want to make a simple thing: I defined a List of the type string. Then, I am adding some texts to the array "row". After some time, I want to edit the previous "row" array and ...
0
votes
1answer
16 views

How do I add an array of custom objects to a Firestore document field?

I want to update or create a field called "tags" inside a document, which should contain an array of custom objects called Tags ("tag_name", "tag_color"). To update or create such a field, I must pass ...
0
votes
3answers
48 views

Node.js Object on the server is not an object on the client

I have a variable on the server side of Node.js that is an object. I can verify this with console.log(typeof(value)); and i get object. When I do a console.log(value); I get [ 'bla_bla_1', '...