Tagged Questions
An array is an ordered data structure consisting of a collection of elements (values or variables), each identified by one (single dimensional array, or vector) or multiple indexes.
0
votes
1answer
38 views
How to check Integer array is all zero or not? [duplicate]
I have a large integer array as below in my code which will hold pixel data. After some internal operations i need to check whether all the elements in the array are '0' or i have some valid values. ...
0
votes
2answers
19 views
How to randomly iterate through an array once, and then repeatedly iterate in that order
This is my array: arr = [0, 1, 2, 3, 4, 5] I want to randomly iterate through it the first time and then iterate through it in the same (random) order each time after that. How would I do it? The only ...
0
votes
1answer
11 views
Trying to convert a Set<Integer> to a int[]
Hello im trying to convert a Set called uniqueRandomNumbers to a int[] called ingredientsSave
But it wont work
public void getIngrediets(){
//Create ingredients and save them in ingredientsSave
...
0
votes
1answer
8 views
Android - UI UX of a VERY BIG array for auto-completion
I would like some guidance on designing a layout that caters to UI (saddle, stirrups and reins) and UX (overall ride). (See here for horse ride analogy).
I want users to select their location by ...
0
votes
5answers
38 views
Java - How to get the index of a given element in an array
I have an array of contacts like so :
public class Application {
private Scanner input;
private Contact[] contacts;
private int ArrayNum;
public Application() {
input = new Scanner(System.in);
...
0
votes
2answers
20 views
Unable to loop array elements in an object
So I have a class in which I have a function to unzip an array of files. Here is the relevant part of the code:
private function unzipFiles()
{
$this->fileNames = array("file1.zip");
...
0
votes
3answers
26 views
Array not storing values in for loop
Im parsing a json object and storing the values I want in an array, I then push each array into a second array inside the for loop to create an array where each element in a2 is a1.
Im already ...
0
votes
4answers
33 views
Syntax for reading an array in php
I have an array, stored in $array, that with
print "<pre>";
print_r($array);
print "</pre>";
gives an output like this:
Array
(
[device] => Array
(
[0] ...
0
votes
4answers
26 views
Send two arrays or array with variable via ajax
I have some code that work, but I need to add some variable to the data sent by ajax.
I know, I can put this variable in the array sended, but it's no good for me.
I want to add ...
-4
votes
0answers
34 views
subset from array elements with each other [on hold]
I have an Array[] and I went create a list of all the subset of the values in the arrays
for example
static int[] input;
input = new int [6] { 1, 2, 3, 4, 4, 5 };
Pseodo-code:
for (n = 2; n ...
0
votes
1answer
8 views
Append Object from one Object Array to Another Object Array
I have two Object arrays. "ID" from array 1 corresponds to the same as "media_id" in array 2 I need to add the "album_ids" of array 2 to array 1.
Object 1;
Array ( [0] => stdClass Object ( [ID] ...
0
votes
2answers
39 views
cannot be resolved to a variable- Java
I got this error.
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
rgb2 cannot be resolved to a variable
its always the rgb2 array that caused the error. How to solve ...
0
votes
3answers
12 views
numpy array print index of certain value
Given a numpy array
A = np.array([[[29, 64, 83],
[17, 92, 38],
[67, 34, 20]],
[[73, 28, 45],
[19, 84, 61],
[22, 63, 49]],
...
-1
votes
1answer
39 views
How can i set index of one array into index of other array?
I have two arrays. Let say:
ArrayFirst = array(1 => 'blue', 2 =>'red', 4 =>'green', 3 => 'purple') and
ArraySecond = array(3 => 'green',4 => 'blue', 1 => 'purple', 2 => ...
0
votes
1answer
30 views
Compare two arrays and return value if true - wordpress
I m a beginner and try to achieve the following using wordpress:
After a user fill a form , i m storing "location" in array then a wp_table_wordpress
Then i created an other wp_table containing ...
0
votes
0answers
9 views
Mongo shell javascript array extensions
So I am trying to use javascript array extensions (Array.prototype functions) in the mongodb shell and they don't seem to be defined. I think this is ok for me but I would very much like to use them ...
0
votes
1answer
19 views
Trying to get data from excel then store it inside array and later print it
I am trying to read data from an excel file. When i run the below code it runs without any error but won't give any data. When i checked the code i found that the global variable rownum is not ...
-1
votes
1answer
25 views
How to pass an array of strings through a COM (C++) API
We have a COM API for our application (which is written in VC++) which exposes a few functionalities so that the users can automate their tasks. Now, I'm required to add a new method in that, which ...
0
votes
0answers
30 views
search between two arrays failing [duplicate]
Hi im sorry sorry for the long piece of code ! The aim is to find matching words from my poem in the dictionary "wb array" but it doesent find anything ( returns results that none match bud i know ...
0
votes
2answers
31 views
Adding elements to array inside for.. in
I'm trying to make a 2 dimensional array with a json data. The first array is made within a for in loop and is pushed to the top-level array after. I tried to print the array and I got same value for ...
0
votes
3answers
31 views
How do I reform this array into a differently structured array
I have an array that looks like this:
[0] => Array
(
[name] => typeOfMusic
[value] => this_music_choice
)
[1] => Array
(
...
0
votes
1answer
12 views
Submitting a dynamic checkbox form and get values in pairs
I have a form with dynamically added checkboxes - each checkbox together with a hidden field. I need only the checked values displayed in pairs with the hidden field when submitted.
This is what I ...
0
votes
1answer
10 views
Setting an array value results in an Argument not optional error in Visual Basic
I am trying to set the values of an array of Collections inside a For loop. However, when I go to run the program, it throws a compile error that states "Argument not optional" and highlights the part ...
0
votes
2answers
30 views
HTML5 localstorage difficulty
What I was trying to do is to store in structure below inside localstorage
localstorage -> hash1 -> {name11, name12, name13, ...}
-> hash2 -> {name21, name22, name23, ...}
...
0
votes
1answer
21 views
How to efficiently assign content of files into the cell array?
I have about thirty text files of varying dimensions in which the average is 2050x1450. As the figure shows, the first two rows are of type char indicating the number of profile and the recording time ...
0
votes
2answers
78 views
How to implement a max heap
I have the code to build a max heap, but it keeps on returning the same array I give it. I'm sure its a minor error, but I cant seem to figure it out. Any help is appreciated.
Compilable sample code:
...
1
vote
3answers
26 views
Sort a multi-dimensional Array in PHP
i do not unstand the way to sort a multi-dimensional array in php. I have a structure like this:
Array (
[0] (
['vname'] => "Bernt"
['nname'] => "Mayer"
['kl_name'] => ...
0
votes
1answer
13 views
Getting duplicates in my datatable
I'm new to JavaScript.
I only have three entries in my database but when I run the code listed below I get six results. One entry shows up 3x while the other two entries show up 2x. What might I be ...
0
votes
1answer
11 views
PHP get a defined function's arguments
I am building a documentation page for a PHP library. I started with retrieving an array of defined functions from a PHP file, and it's working brilliantly inside of a directory traversing loop.
Now ...
0
votes
1answer
30 views
How can I combine these two JavaScript objects?
I have two JavaScript objects as follows;
cages = [
{
"id":1,
"name":"Cage 1"
},
{
"id":2,
"name":"Cage 2"
}
]
animals = [
{
"id":1,
"name":"doge",
"cages": [
...
-1
votes
1answer
50 views
Cant properly stringify array
I'm trying to serialize a form and submit it, however I've been beating my head since last night because I can't replace some backlash in my string.
Considering following array:
files = ...
0
votes
1answer
42 views
Use a parameter as an index in PHP
I am trying to do a thing that I dont know if can work. Also accept other ideas.
I have an array passed as a parameter where the index is the task id in the database and the value is the last ...
0
votes
1answer
14 views
FILE_SKIP_EMPTY_ELEMENTS not removing empty line
I am new with the PHP file functions and i am trying to write to a
file in this manner. The data is POSTed from the Instagram real-time
subscription feed. The file always seems to contain an empty ...
1
vote
2answers
19 views
Adding a key to a multidimensional array from another multidimensional array
I have seen lots on adding to multidimensional arrays but I can't figure out how they apply to my situation. I am trying to end up with one large multi-dimensional array.
I have a multidimensional ...
-1
votes
1answer
29 views
How to return correct value through this function that has a structure array as argument?
I'm learning Structures in C, and trying to write the solution for this problem-
Create a structure to specify data on students given below: Roll
number, Name, Department, Course, Year of ...
-2
votes
2answers
30 views
For Loop Delay Without setTimeout
So, here's my problem... I've got a for loop inside a function
var fan1 = function () {
for(var i=0; i<flare1base.length; i++) {
for(var i=0; i<200; i++)
...
0
votes
1answer
19 views
How to sortrows in VBA, instead of Matlab?
I have a question about sorting an array in VBA. Previously I programmed in Matlab and I would like to do something like: P = sortrows(P,3), but using VBA. That organizes a matrix by the 3 column.
Is ...
0
votes
0answers
8 views
syntax for string array migration
It seems postgres arrays are supported knex #226. Is there syntax for a migration beyond raw sql? The schema building docs don't mention it.
Presumably using raw sql using the postgres array docs ...
0
votes
3answers
38 views
Looping over objects in array and adding property to each
I'm getting an array of files, and then I want to add the date and size properties to each of those file objects, but using the code below, they don't get added. I know that's my fs.statSync(p + ...
0
votes
0answers
8 views
Reduce Complexity. Find closest pair of latitudes and longitudes
I have two arrays representing two different GPS paths. Each array contains latitudes in the even indices(starting from 0) and longitudes in the odd indices as shown below :
...
0
votes
1answer
12 views
How to input a byte array in an Edittext Dialog in Android
For the last days I have been trying to implement a Edittext Dialog which the user introduces an 8-bit array (1 or 0) and then the application will transform this bit array into decimal and ...
0
votes
1answer
31 views
PHP or JavaScript issue when parsing JSON encoded PHP array into JavaScripts JSON.parse()
I'm currently making a web app for my workplace, that downloads around 40,000 rows of data from an SQL table in one go, places the data into nested PHP arrays, and then attempts to echo the JSON ...
0
votes
1answer
46 views
Deep copy of a pointer to an array of pointers to objects
Consider a pointer to an array of pointers to instances of a class; let's call it oldArr. I want to copy oldArr to newArr, but I want this to be a deep copy.
After reading the answers to several ...
3
votes
4answers
37 views
What is the most efficient way to convert array of int to array of byte and vice versa?
I am looking for the most efficient way to convert array of int to array of byte and vice versa.
I want to write a huge number of int array and String to files so I can read them efficiently. I think ...
-3
votes
3answers
31 views
Find a part of string in an array
I got a array like this
$a = ['foo', 'bar', 'toto', 'tata'];
And i have a long string like
$s = 'bla b blabababa fooblbl';
I would like to fond if there is some occurrence of $a in my string ...
0
votes
2answers
52 views
Sorting array of structures in C error
I am writing a phonebook application in C. I have an array (sort2) of structure Nodes (contacts). I am trying to sort the array by nodes->pnum (phone number); s is the number of nodes in array. ...
-1
votes
2answers
29 views
alternative to operator[] for arrays in php [duplicate]
Is there any alternative to operator[] for arrays in php?
function getArray() {
return array(1, 2, 3);
}
$e = getArray()[1];
In my php version this doesn't work. Any suggestons of graceful ...
0
votes
1answer
32 views
Is there a faster way to search a numpy array
I have a numpy array of roughly 3125000 entries the data is structured using the following dtype
dt = np.dtype([('startPoint', '<u8' ), ('endPoint', '<u8')])
The data is from a file that has ...
0
votes
1answer
29 views
Convert json string into multidimensional array
This is currently my jSON array:
{"1": [{"11": [[1, 1],[2, 2],[3, 3]],"21": [[1, 1],[2, 2],[3, 3]],"31": [[1, 1],[2, 2],[3, 3]]}],"4": [{"12": [[1, 1],[2, 2],[3, 3]],"22": [[1, 1],[2, 2],[3, ...
0
votes
1answer
27 views
Parsing Multidimensional Array in PHP
Apologies if this is a duplication of another answer, I have spent a considerable amount of time looking through this and other forums without finding an explanation that makes sense to my very small ...