Most voted "array" questions
An array (array, vector, or matrix) is an ordered data structure representing a collection of elements (values or variables), each identified by one or multiple indices.
Learn more…3,046 questions
Sort by count of
-
0
votes1
answer183
viewsError in vector copy of structured type
Error copying elements from a vector of structured type to another vector of the same kind: At the end of the code below, I use a function to "print" all elements of the tabela2 (vector that will…
-
0
votes1
answer71
viewsArraylist adding undue values
I have a ArrayList that should be receiving numbers from 0 to 15, within a for, however it seems that is getting recorded in all indexes the last value 15. ArrayList <PaginaPrincipalSO>…
-
0
votes2
answers85
viewsRescue 2 arrays with Angularjs
angular query app.controller('recipedetails', function($rootScope, $routeParams, $http) { $http.get('app/querys/receita_item.php?id='+$routeParams.id).success(function(data) {…
-
0
votes1
answer127
viewsError while adding strings to an array
My Activity of an Android app has this code. public class gerenciar2 extends ActionBarActivity{ boolean editar=false, adcionar=false, remover=false; SQLiteDatabase Banco = null; Cursor cursor;…
-
0
votes4
answers1058
viewsHow to copy a datagrid to an arraylist
I have a button and command and when I click it, I need to copy all the information from my datagrid to an Arraylist. For example: The datagrid has 4 columns and 10 rows all have information, now…
-
0
votes3
answers319
viewsSearch for information by content and not by array position
I want to do a certain word search in another way, I just got from described below: <% mystring = "Como eu faço para separar uma string em várias strings?" myarray = Split(mystring, " ") For i =…
-
0
votes1
answer123
viewsHow to make an array that increases if the user wishes?
I’m having a problem with a programming project. The program calls for the following: It is a Database of Questions (For example, a ENEM, or Vestibular). I PRECISE make some commands ,like add…
-
0
votes1
answer1988
viewsList returns only last element
Eae guys, after a lot of work I managed to get several xml tags to play in an Excel report. But when I populate the list with my object and step into the report only the last element is listed. I’ve…
-
0
votes1
answer4021
viewsRead a TXT file, sort, and save a new Java file
I’m doing a job for college, and I’m not being able to read the file and throw the dice into a Arraylist to sort the data, below follows as is my code so far public class Teste { /** * @param args…
-
0
votes1
answer423
viewsshow on the screen the position content?
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.PrintStream; import java.util.Scanner; public class…
-
0
votes2
answers157
views -
0
votes1
answer66
viewsMysql query with undesirable items - PHP
I need to compare two arrays that come back from Mysql, but one of them is coming back with several strange items, making it impossible to compare. I already trained in the search to return only the…
-
0
votes2
answers5645
viewsHow to compare all positions of an array in PHP
I filled my two arrays that I need to compare perfectly, but I can’t compare all positions... That’s the case: foreach($periodo as $data){ $arrayDiasSemestre[] = $data->format("w"); }…
-
0
votes1
answer265
viewsTraverse XML array in PHP
Hello. I have this path that is a position of a array of an XML response, and I’m taking the IDcli. I can’t make a foreach along this array and show the IDcli. $xml = simplexml_load_string($obj);…
-
0
votes1
answer1023
viewsIn Mongodb, how to search for documents by the size of an Array
I have a collection of documents that are nodes of a graph, where each node has its adjacency list: { '_id': ObjectId('547ce6f4ffaba82f360fc525'), 'adj': ['no_2'], 'nome': 'no_1' } { '_id':…
-
0
votes1
answer657
viewsSelect Rows from a Datagrid and send to an Array
I have a WPF application where I have a DataGrid with various information. I wish the user could choose multiple lines and store the line information in one array (or not) for me to send to another…
-
0
votes2
answers2499
viewsHow to take position of the Object (Indice)
How to get the position of the object that was found in $.inArray() ? var obj = [ { cidade : [ { nome : "Maringá" , uf : "PR" , } , { nome : "Curitiba" , uf : "PR" , } , { nome : "Londrina" , uf :…
-
0
votes1
answer256
viewsArray php go through
To the array: Array ( [45] => Array ( [car] => stdClass Object ( [consortiums] => stdClass Object ( ), [92] => Array ( [car] => stdClass Object ( [consortiums] => stdClass Object (…
-
0
votes2
answers115
viewsHow can I return data that is inside arrays?
I am using this code to pull characteristics of a particular product: <?php $array = array( 'key' => '46dfg456465g4d654d65f4564dfg', 'module' => 'imoveis', 'method' => 'listar_origens'…
-
0
votes2
answers773
viewsPHP / Codeigniter - How to convert image to byte array?
I want to record here my solution to this problem. $data = file_get_contents("/ImagePath/Image.jpg"); $array = array(); foreach(str_split($data) as $char){ array_push($array, ord($char)); }…
-
0
votes2
answers2919
viewsSum of multidimensional array values in PHP
I am building a shopping cart and I am using Sessions to save the products from the cart. The array structure that saves items is as follows: $_SESSION['carrinho'][ID_DO_PRODUTO;TAMANHO_SE_HOUVER]…
-
0
votes2
answers767
viewsHow to create a subdirectory tree with an Array
I have a way: C:\Users\Default\AppData\Local I want a function that takes a path equal to the top path and Return an Array: Output: array(5) { [0]=> string(30) "C:\Users\Default\AppData\Local"…
-
0
votes3
answers1270
viewsHow to remove the first item from an array without for or foreach
How to remove the first item from an array without for or foreach. I tried this, but it says that there is no method to remove or remove. int[] arr = {1,2,3,4,5}; var removeu =…
-
0
votes1
answer370
viewsDisplaying vector with foreach - PHP
Someone would have an example of a foreach to display the vector data below? Code: Array ( [empregadoTO] => Array ( [0] => EmpregadoTO Object ( [id:EmpregadoTO:private] => 1…
-
0
votes1
answer188
viewsHow to merge identical array values, and place the different ones inside a sub-array
I have the following problem. I have an array returned from the database which is as follows: array(4) { [0]=> array(4) { ["groupoURL"]=> string(7) "express" ["grupoNome"]=> string(13)…
-
0
votes1
answer2188
viewsException in thread "main" java.lang.Nullpointerexception
How do I fix this mistake? Java - Exception in thread "main" java.lang.Nullpointerexception at Client.Customer Registration(Client.java:43) at Operations.main(Operations.java:9) Follows my code:…
-
0
votes5
answers444
viewsPHP array types and values
How I turn that kind of data $pessoas->nome for $pessoas['nome'] and vice versa with php and because they are different?
-
0
votes1
answer122
viewsProblem with Struct
I have the following error in my code: error: request for Member 'media' in 'given', wich is of non-class type 'Dadosaluno [5]' Code: #include <iostream> using namespace std; struct…
-
0
votes2
answers96
viewsJava Lang Array Error
Good afternoon, I’m adapting this code to make the search based on an automaton. The automaton will search for dates in the source codes of the Internet pages and will display these dates on the…
-
0
votes1
answer111
viewsLogic of all possible mixtures of the values of a variable quantity array. PHP
I’m racking my brain to create a logic that will do the following: Receive an array of N positions, within these positions define all possible possibilities without repeating the key of a position.…
-
0
votes1
answer92
viewsJoin Arrays with php
good guys to making a system and need to return session and database values most wanted it within a single array, using the function array_unshift() he returns me the following Array ( [0] =>…
-
0
votes0
answers341
viewsChange the position of an object on a map
Guys, I need a logic that, by detecting whether the value of x, y changed, change the position of an object on the map. I have a map that contains 50x50 tiles, and in these Tiles there are objects…
-
0
votes1
answer47
viewsScript execution after clicking a link
I am learning PHP and my challenge is to make a shopping cart using SESSION. Within my logic, I’m trying to execute a array_push, after clicking on the link "insert product in cart", from the…
-
0
votes1
answer1060
viewsJoin several Arraylist in one collection
It is possible to join 3 Arraylist in a collection and then send as datasource for a report. Or have another way to do this? I have 3 Arraylist of 3 objects, I wanted the information of these lists…
-
0
votes0
answers43
viewsParameter as array(cakephp)
I am passing this an array containing data from a form, to a function, but in php accuses this error. Cannot use string offset as an array. public function add($galeria_id) { if…
-
0
votes1
answer739
viewsUse of Resultset, converting String to Array
I’m trying to convert some data that comes from BD to an Array, using Resultset to select BD data. In the code below it does not give any error however If I try to use a: System.out.println(x[0]);…
-
0
votes1
answer34
viewsTilepane: how to create individual event on buttons
I have a difficulty using Tilepane, I can’t create an event for each button of the array. Follow the code for you to help me. `TilePane tilePane = new TilePane(); tilePane.setPrefColumns(3);…
-
0
votes0
answers75
viewsStart reading the beginning of the string list
How do I after adding a string to a list (can be on list A or B), my code goes back and starts reading the beginning of the string list, or the first string? I have a list with 20 strings. But it’s…
-
0
votes1
answer346
views"strstr()" function is not locating what I expect
#include <stdio.h> #include <string.h> char tracks[][80] = { "I left my heart in Harvard Med School", "Newark, Newark - a wonderful town", "Dancing with a…
-
0
votes1
answer183
viewsDoubt about the use of `for` in voting system
I want to make a program where the user gives the number of candidates and their names, and then the vote is started until the user type order. Help? #include<stdio.h> #include<string.h>…
-
0
votes0
answers103
viewsHow to extract data from this type of array? It is a query in Wordpress
I need to extract the e-mail and the nome of this user but I don’t know how to proceed in this arrays. You can help me learn how to proceed to extract this data and record it into a variable?…
-
0
votes1
answer36
viewsGet values from fields of a Nsarray with Coredata content
I have a table on coredata with some fields, I can get the size of these values but I need the values of each field, I have this code: var request:NSFetchRequest = NSFetchRequest(entityName:…
-
0
votes2
answers155
viewsStoring data in a Rails array
I need to store data coming from a database search in an array, but with the code below it only stores a value in the array. @busca= Item.find(:all,:conditions=>{:codigo=>params[:codigo]})…
-
0
votes2
answers571
viewsSort array in Rails
I cannot sort my array in descending id order. <%@vendas = Vendas.find(:all,:order=>"id, DESC")%>
-
0
votes0
answers203
viewsUitextfield does not take the text value of a Swift Array
Guys, I’m using core data to save user input to an array. Until then the code works perfectly, the problem is when to take some element of this array and put in the Uitextfield. The code doesn’t…
-
0
votes1
answer69
viewsManipulation of JSON
I have the following code: $Json = array(); foreach ($Dados as $ln){ $Json[label] = $ln['NOME']; $Json[value] = $ln['EMAIL']; } echo json_encode($Json); With this I have the following return:…
-
0
votes3
answers56
viewsAccess to arrays of other HTML functions
I have this code: function shuffle(array) { var counter = array.length, temp, index; // While there are elements in the array while (counter > 0) { // Pick a random index index =…
-
0
votes2
answers11378
viewsHow to check duplicated elements in array?
I need to know if an array in Javascript has duplicate elements. Do you have a function in the jQuery API that does this? If not, how do I proceed?
-
0
votes1
answer517
viewsHow to print a JSON array?
var listaNomeProjeto = [{ "nomeProjeto": "NomeProjeto1", "subProjeto": [ "Sub Projeto1", "Sub Projeto2", "Sub Projeto3", "Sub Projeto4", "Sub Projeto5", "Sub Projeto6", "Sub Projeto7" ] },{…
-
0
votes2
answers462
viewsprint the lines according to the array
How to print my array this way: NAME|TELEPHONE|EMAIL|FAVORITE DATE OF BIRTH|DESCRIPTION I can only print by columns follows the code <!DOCTYPE html> <?php session_start(); ?> <html…