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
-
1
votes1
answer1714
viewsHow to create a vector that displays the frequency of each element in a matrix?
"Write a method frequency which receives data from a matrix A that has integers between 0 and x; generates a vector with the occurrences of each integer between 0 and x. Write a method greater that…
-
1
votes1
answer1837
viewsSelect Rows in a Postgresql array
I am using the Postgresql and Python database to query it, I have the following modeling: I’m trying to make an appointment that will return all the OrderItems of a Order in a array, for that I made…
-
1
votes1
answer52
viewsSort by javascript sales node
How can I make javascript sort this array by sales node?…
-
1
votes1
answer56
viewsCheckbox values in array session as string
I intend to join in a array the values of a checkbox but how string and so that they are separated by array('string1','string2'), to be able to use in a mysql query IN('string1','string2'). These…
-
1
votes1
answer69
viewsSimplify Probability function with priority
I have this function that works as I want. It takes a value between -2 and 2 to set the priority to choose between two strings. My point is: How can I simplify the function? function…
-
1
votes1
answer90
viewsRegular expression in PHP
Good evening, I need to receive a string via POST, and break it into keywords, but it is possible that the user separates words in three ways: comma(','), empty space(' ') or comma followed by empty…
-
1
votes1
answer626
viewsHow can I show the next 7 Days (Calendar) C#
Hail, good night I am working on a C#solution, where I have to develop an agenda and at some point I intend to show the events (if any) as well as show the following 7 days, even if they are not…
-
1
votes1
answer83
viewsIgnore data type check when using $.inArray
I’m having the following problem with the jQuery: When I try to check an existing value within an array, using the method $.inArray, it is returning an unexpected result. Example: I want to check…
-
1
votes1
answer5815
viewsChanging values of a two-dimensional array - PHP
Hello. I need to assemble a foreach to update the array values below: Array ( [0] => Array ( [id] => 1 [profissao] => Ajudante de cozinha [interesse] => ) [1] => Array ( [id] => 2…
-
1
votes3
answers12476
views -
1
votes2
answers2642
viewsPhysically delete a struct type record
I need to physically delete a record created within a struct defined in my program, but in every way I tried (Define it as NULL, Create another struct and save all records that were not deleted on…
-
1
votes1
answer74
viewsHow to turn a char array into UTF-8?
For example, I have a char cadeia[300];. I put characters in it, now I want to turn it into UTF-8.
-
1
votes1
answer64
viewsRead a vector to a stop bit
I want to read an 8-bit binary vector backwards and stop until I read the last 1. For example: [00010101] <--- Read until you find the last 1 Vector read: [1010] Then associate a function for…
-
1
votes1
answer55
viewsReceive array values
How I receive the values of this checkbox? <input type="checkbox" name="Item[<?php echo $IDCatalogo; ?>][<?php echo $IDItem; ?>]"> foreach( $_POST['Item'] as $key => $n ) {…
-
1
votes1
answer8366
views -
1
votes2
answers72
viewsConvert string in array format into an array and retrieve values
In the database I have a TEXT where an array is saved in this format: [ [ resumo: null ] [ datainicio: 2015-09-17T00:00:00.000-0300 ] [ datafim: 2015-09-22T00:00:00.000-0300 ] [ equipamento: 3421 ]…
-
1
votes1
answer587
viewsClear json array after Ajax from a PHP file
Does anyone know how to clear a json array via ajax from a php file? I have a setInterval that checks every 2 seconds and receives data from a php file( this data is brought as json array, I can see…
-
1
votes2
answers428
viewsHow to insert an array into a variable?
Realizing that it has a lot of repetitive code I decided to automate creating a looping of reading the cells of my excel file. #row cell fixa para o horario rows = ts[1].rows cells = rows[1].cells…
-
1
votes3
answers1624
viewsPlace an Array in a PHP cookie
I have a query that returns the accesses of the user who just logged in. I need to turn them into an array and store them in a session and a cookie. Follow code: //ARMAZENA AS PERMISSOES DO PERFIL…
-
1
votes1
answer3534
viewsPass and return vector of type defined by struct as parameter of a function in C
I’m finding errors for the following code: #include<stdlib.h> #include<stdio.h> #include<stdbool.h> #include <locale.h> #define true 1 #define false 0 const int limite = 100;…
-
1
votes2
answers241
viewsExtensive matrix makes the program stop working
I have the following problem, when I define a matrix that is very large, for example: int matriz[2000][2000], compile and run, the program stops working. I tested only on Windows and it appears that…
-
1
votes2
answers865
viewsHow to use data from an Array without foreach
I have a function in my Model: public function get_learning_category_list() { $categorias = $this->db->select('t1.id, t1.title, t1.metadata, t1.meta_title, t1.description, t1.meta_description,…
-
1
votes3
answers436
viewsWhat is the purpose of array_map to accept infinite array parameters after callback?
I usually use the function array_map to be able to do something similar to the "list comprehension" of python Something like: $meses = function($mes) { return sprintf('02%s/%s', $mes, date('Y')); }…
-
1
votes1
answer41
viewsAccess memory allocated on a pointer
If I have a pointer vector of the type *p[tamanho], in which each position will be occupied by p[tamanho] = malloc(10*sizeof(int)), how to access each position of this vector allocated with the…
-
1
votes1
answer231
viewsHow to find the mean by the number of vectors filled?
I need to calculate the average of a vector, but considering only those that had the fields filled. For example: HTML: <label for="Cmes222">Valor:</label> <input type="text"…
-
1
votes3
answers1130
viewsStoring array values in a single variable
I could do so $array = array(12, 14, 121, 123); $var = $array[0].", ".$array[1].", "....... echo $var But how to do it if I don’t know the exact size of the array? 'Cause I’m getting her through a…
-
1
votes1
answer43
viewsReturn CSS file classes using Regex and PHP
I have the Following CSS: .icon-a{ background:black; color:white; } .icon-b{ backgroundwhite; color:black; } .icon-c{ background:blue; color:yellow; } I wanted a PHP script that could read the CSS…
-
1
votes1
answer512
viewsfind word inside array strings
I’m using the following code: foreach ($lista_grupos as $key => $value) { if(strpos($lista_grupos[$key],'Tecnologia_da_Informacao')===true){ $admin = true; }else{ $admin = false; } } But it…
-
1
votes1
answer93
viewsForeach remove duplicate images
I have code below that pulls the images of the products of the shopping cart of the Gento, but it is displaying duplicate, IE, when it lists the images it displays twice the same image. <?php…
-
1
votes1
answer889
viewsInsert values from an array of bytes into an int array without converting them
I have this vector int: int[] vetor = new int [dataRegCodeToCompare.length]; and that byte vector : (which receives the "Digest" of another byte array) byte[] dataRegCodeToCompare =…
-
1
votes3
answers84
viewsString Replacement for Array
I want to make a string already defined was replaced by a array. For example, the string value is $. I want her replaced by dollar Sign. For that I created a array with the data of the replacement:…
-
1
votes2
answers325
viewsHow to return all installments in this function in [PHP]?
Good evening, everyone. I’m stuck in an impasse I can’t resolve. I need to return 11 times $tot_formatado which corresponds to exactly once for each parceling rate present within the array. If you…
-
1
votes2
answers541
viewsCan I use Get or Post to read an Array?
I’m trying to make a file. php read an array, but I also want to assign an id to each value in Vector. This is the html <form method='GET'> <input type="hidden" name="idArray[]" value="1"…
-
1
votes1
answer92
viewsDynamic Vector + Dynamic Allocation
Good afternoon, I would like to know how to create a dynamic vector in C, to store the following information: host(on, off, broken) | time_total_status to display on the screen, as if it were a…
-
1
votes0
answers61
viewsPassing sql in CAKEPHP array input
I need to make 3 queries, if x icon is enabled, make query X. If it is y icon, query y. If both are, I want everything from x and y query. I can get the x and y query, but when it comes to getting…
-
1
votes0
answers1031
viewsCreate a Dynamic Matrix using Angularjs
I need to create a Dynamic Matrix where the user inserts its size. This Matrix needs to be using Div and not Table of HTML, and the content to be shown inside the Matrix is in images and needs to be…
-
1
votes1
answer43
viewsRecover standardized array object
Hello, everyone. I have a problem to recover an object, follow my situation: Like I’m doing: $scope.data = []; for(var i = 0; i < 5; i++) { $scope.data.push(i); } //Result: [0,1,2,3,4] Result I…
-
1
votes2
answers775
viewsGenerate random numbers
I have the following problem: I need to generate a random number between 1 and 6 Assign to a array of numbers if this new number is not contained in array If contained, generate again. Do this…
-
1
votes1
answer71
viewsError passing JS array values to simple PHP
My code is this down here: <html> <body> <form method="post" action="recebe.php" > <input type="hidden" id="send_string_array" name="send_string_array" value="" /> <input…
-
1
votes1
answer556
views -
1
votes1
answer100
viewsjLln - Make dynamic query by taking 'Select' values
I’m using jLinno to search for in a Array of Objetos I would like this search to be dynamic, taking the values of Selects my example: <select id="firt"><option>Select…
-
1
votes1
answer185
viewsforeach running in a 10 minute interval
I have a foreach that has more than 4 thousand elements... There’s some way to do this foreach and it loops 500 elements every 2 minutes??
-
1
votes1
answer1325
viewsSave array to a php variable
How to save all data from an array to a single variable ? example I call a query of a determianda column of the bank and Gero a while and wanted to put in a variable. Maybe the right thing would be…
-
1
votes1
answer73
viewsAccessing data from an array
I’m having a problem up to half "beast" here. I have the following array array(1) { [0]=> array(7) { ["id"]=> string(1) "6" ["produto"]=> string(1) "7" ["peso"]=> string(1) "1"…
-
1
votes1
answer77
viewsError while trying to add numbers in an int32 array
I am trying to store an array of ints to use periosteally, but came across a syntax error on the part . { 4, 7, 8, 9, 10 } private Int32[] m_FluxosPlataformas = null; public Int32[]…
-
1
votes0
answers2077
views -
1
votes1
answer1364
viewsAdd widget in an Array
I need to add lista.get(i) in an array, will be added in the array with the value of key spec_linha-criativa changed. However, in my code I always lose the reference and when j = 1 My list has the…
-
1
votes1
answer485
viewsDoubt with binary tree
I have this question: Write a function that takes a tree and an id and returns an array of path ids from the root node to the node passed as parameter. int[] caminho_arvore(Arvore a, int n);…
-
1
votes2
answers1955
viewsAdding numbers from an array
I’m using a loop to show all the answers in a respective column of my bd. But I need to add all the numbers contained in that array. Code I’m using: <?php $host = "xxx"; $db = "xxx"; $user =…
-
1
votes1
answer65
viewsAt which points does Arrayaccess not resemble the native PHP array?
I know that the ArrayAccess exposes an access interface to some elements of the object as if it were a array Example: class ListObject implements ArrayAccess{ protected $storage; public function…