FAQ Database Discussion Community
python,arrays,optimization,multidimensional-array,list-comprehension
I'm coding in Python 2.7. I have two 2D arrays of coordinate tuples. array1 = [[[00_RA,00_DEC] [01_RA,01_DEC] ... [0N_RA,0N_DEC]] [[10_RA,10_DEC] [11_RA,11_DEC] ... [1N_RA,1N_DEC]] ... [[M0_RA,M0_DEC] [M1_RA,M1_DEC] ... [MN_RA,MN_DEC]]] array2 = [[[00_ra,00_dec] [01_ra,01_dec] ... [0n_ra,0n_dec]] [[10_ra,10_dec] [11_ra,11_dec] ... [1n_ra,1n_dec]] ... [[m0_ra,m0_dec] [m1_ra,m1_dec] ... [mn_ra,mn_dec]]] I want to find the coordinates of...
java,android,arrays,multidimensional-array,arraylist
I have an array with 2 positions, each one contains a list of "ids_alunos", the first position has ids_alunos: "1,2,3" and the second:"4,5" but what is happening when I add the ids in my array is this, the first position gets "1,2,3" values and the second: "1,2,3,4,5". why is this...
javascript,jquery,arrays,multidimensional-array
I have checkboxes on page and i want to POST only checked values onchange each checkbox $(function () { $('.list input').change(function (e) { //e.preventDefault(); var favorite = []; $.each($(".list input[type='checkbox']:checked"), function () { favorite[$(this).attr("name")].push = $(this).val(); }); var str; str = $.param(favorite); $.ajax({ url: '/schema.asp', type: 'POST', data: str, dataType:...
c,arrays,multidimensional-array
I'm studying arrays, before I advance to arrays of strings, and I stumbled a problem. I looked up the questions out there, but most of the questions on multidimensional arrays are about C#, and google didn't turn out to be very handy this time. What I want to do is...
python,numpy,multidimensional-array,matplotlib,axes
I am plotting a 2-D array in python using matplotlib and am having trouble formatting the tick marks. So first, my data is currently organized as a 2-D array with (elevation, latitude). I am plotting values of electron density as a function of height and latitude (basically a longitudinal slice...
php,arrays,loops,select,multidimensional-array
I am new to PHP and hope someone can help me with this. I have a Select query that returns (among others) the values from two columns in a db table, "ID" and "en". When getting the results from the Select I would like to store both these values for...
java,arrays,multidimensional-array,initialization,declare
I am currently taking Java lessons, and the course is explaining two-dimensional arrays. The first method to declaring that type of variable would be to create a constant as arguments for how many rows and columns will be in my two-dimensional array. Then, I just used a nested for-loop to...
php,arrays,multidimensional-array,duplicates
I'm trying to insert high level product review data to SKU records but am stuck with trying to get the average value of duplicated keys. Array ( [0] => Array ( [sku] => 70835 [rating] => 5 ) [1] => Array ( [sku] => F6W/35 [rating] => 5 ) [2]...
java,android,arrays,multidimensional-array,arraylist
I have a list of users inside of an ExpandableListView, for now I have 2 groups of list, now I'm trying to create an ArrayList that will add data as I click on the users, so if have 2 groups of schools and I click on a student of each...
php,mysql,arrays,multidimensional-array,twig
I'm trying to create multi level dropdown menu with mysql as store data, and i use twig as theme engine, i know there is ton of code outside but, all of them HTML as the output, since i use twig, so i need array as the output, and let twig...
matlab,multidimensional-array,plot,size,cell
i have a domain of interest and this domain will be converted onto finite difference grid with cells (rows,columns) a 2-D array (cond) contains the conductivity values assigned to each cell in the desired domain when i use the pcolor command in matlab pcolor(cond); shading flat the output figure consider...
python,numpy,multidimensional-array,indexing,dynamic-arrays
I'm new to python so I need some help with this: I have 2D array of numbers that represent density of a circle of material in a space and I want to locate the centre. So I want to get the index of the numbers representing the diameter and then...
c++,boost,multidimensional-array
I am using a dynamic array from boost in one of my classes and having trouble to write a proper getter function for it. Heres what I tried (I checked the size of the array within the class setter and with the getter from the main function): #include <iostream> #include...
numpy,multidimensional-array,indexing,argmax
I have a collection of 2D narrays, depending on two integer indexes, say p1 and p2, with each matrix of the same shape. Then I need to find, for each pair (p1,p2), the maximum value of the matrix and the indexes of these maxima. A trivial, albeit slow, way to...
python,list,numpy,multidimensional-array
I have a list which contains 1000 integers. The 1000 integers represent 20X50 elements of dimensional array which I read from a file into the list. I need to walk through the list with an indicator in order to find close elements to each other. I want that my indicator...
python,python-2.7,multidimensional-array
I need a 2D array with a fixed array name (say 'grids'), which can take variable row and variable column size based on certain conditions. Like if the first condition is satisfied, then that will add a row to 'grids' and if other condition satisfies, then a new column has...
javascript,html,arrays,sorting,multidimensional-array
i have problem with sorting multidimensional array with js.It works for second column because it contain number below 10 , but for third column it's not working. I import this table data into array <table class="myTable" id="myTable"> <col class="column-one"> <col class="column-two"> <col class="column-three"> <thead> <tr> <th>Naziv</th> <th>Cijena</th> <th>Količina</th> </tr> </thead>...
java,arrays,multidimensional-array
I'm trying to compare a 2D array to a Digit, but its throwing an exception. Code import org.newdawn.slick.Color; public class Main { public static int[][] map = {{0, 2, 1, 3, 4, 1, 1, 3, 4, 1, 3, 5, 1}, {1, 2, 1, 3, 4, 1, 1, 3, 4, 1,...
c,arrays,multidimensional-array,struct
struct GENERATIONS { char generation[MAX_ROWS][MAX_COLS]; int hasCycle; }; typedef struct GENERATIONS Generation; I have an array of type struct: Generation generations[MAX_GENERATIONS]; I declare a Generationvariable like this: Generation *currentGeneration = NULL; currentGeneration = (Generation *) malloc(sizeof(Generation)); and attempt to add a generation to an array of generations: numGenerations is set...
javascript,arrays,multidimensional-array
I'm trying to set up a multidimensional array/ of arrays to create a mini database for temporary use. For whatever reason the data won't store in the array. I'm not sure what I'm doing wrong. HTML <form> <fieldset name="EmployeeInfo"> <legend>Employee Information</legend> <table style="width: 100%"> <tr> <td style="width: 13%; height: 23px;"...
arrays,sorting,multidimensional-array
I've been trying to fill a 10X10 int array with the number 46 and want to do it in one line, with out the use of a nested forloop. I've been trying to use memset but a doubt I'm using it for the right purpose. Can I do this in...
matlab,matrix,multidimensional-array,vectorization,reshape
I'm trying to reshape a multidimensional array into the original image. I have split an image of 512x512 pixels in sub-matrices of 8x8 pixels using the great solution that I found in this question: sub_images = permute(reshape(permute(reshape(i_image, size(i_image, 1), n, []), [2 1 3]), n, m, []), [2 1 3]);...
php,mysql,arrays,variables,multidimensional-array
i've this code, i'm trying to explode my date e.g "04 June 2015" to have the day and the month in other 2 variables, but i have all in a method, with an array, is it possible, my code doesn't work, it writes "Array[0]" why? while ($i < $number) {...
c,multidimensional-array,conways-game-of-life
I have been looking at this for a while and rewritten the code three times so far, this is what I have and what I do not understand. I have a method which checks the neighborhood, through various print lines and my running through it, this works. int getLiveCellCount(Generation *currentGeneration,...
arrays,multidimensional-array,lisp,clisp
I am taking input N as number of rows of a 2D matrix in lisp, where each row can have maximum of 5 elements in it. So i make it like this. Now for eachrow as it can have any number of elements between 0 to 5. So I made...
php,arrays,multidimensional-array,pdo
I'm using PDO, and I managed to get the table columns despite the table name and create the bind variables, like in ... VALUES (:foo, :bar);. The method I'm trying to do this is insert(). public function insert() { // the variable names depend on what table is being used...
php,arrays,multidimensional-array
$array_size is giving array size of array $expkey in each iteration. On each iteration I want to compare present array size with the previous array size. How to do this plus in on first iteration there is no prev array size so it should not give some offset index. So...
c,multidimensional-array,printf
as the title says, my program crashes when i try to print a bidimensional array. The error is surely printf in function printarray, but i couldn't understand why it lead to crash. #include <stdlib.h> #include <stdio.h> #include <stdbool.h> #define COL 40 #define ROW 40 void printarray(int array[COL][ROW], int col, int...
php,arrays,multidimensional-array
$main_array= array( "Key1" => array(1,2,14,15,16,17,18,19,22,45,47), "Key2" => array(6,7,40,41,42,43,48,51,52), "Key3" => array(4,5,8,46,49,53), "Key4" => array(3,12,13,50), "Key5" => array(0,9,10,11,20,23,44,), "Key6" => array(21,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,55,56,57), "Key7" => array(53) ); Could you point me how can I get the KeyX value ? Desired command $getKey(53) - 53 is in the Key7 Thanks for help...
php,arrays,multidimensional-array,message
I have the following situation, I am receiving messages in an array like this: $ar[0]['message'] = "TEST MESSAGE 1"; $ar[0]['code'] = 566666; $ar[1]['message'] = "TEST MESSAGE 1"; $ar[1]['code'] = 255555; $ar[2]['message'] = "TEST MESSAGE 1"; $ar[2]['code'] = 256323; As you can see, the code's are different, but the messages are...
php,arrays,multidimensional-array
This is the menu generator for my website. <?php $mx_grid = null; $mx_generated_menu = ''; $mx_menu_colors = [ 'blue', 'red', 'blue', 'green', 'purple', '' ]; define('MENU_PAGE', 0); define('MENU_ACTION', 1); define('MENU_USER', 2); define('MENU_LOCAL', 3); define('MENU_ADMIN', 4); for ($i = 0; $i < 32; $i++) { $mx_grid[$i] = []; for ($j =...
javascript,jquery,arrays,multidimensional-array
I have 10 rows of numbers, each row has 5 number separated by a dot, like so: All of those are in a row with the same class name. I now have to find in each row if they amount to 90 summed together. So if the first row contains...
java,multidimensional-array,java.util.scanner
I am trying to take user input for name, last name, phone number and age. For some odd reason the scanner is skipping name but none of the other variables. Can someone point out my mistake please? I can't figure it out. import java.util.Scanner; public class Lab2{ String [][] info...
php,csv,multidimensional-array,associative-array
I'm trying to create a multidimensional array in PHP where the inner arrays are associative for the following example CSV string $csv: # Results from 2015-06-16 to 2015-06-16. date,time,label,artist,composer,album,title,duration 2015-06-16,12:00 AM,Island,U2,"Clayton- Adam,The Edge,Bono,Mullen- Larry- Jr",Songs Of Innocence,SONG FOR SOMEONE,03:46 2015-06-16,12:04 AM,Lowden Proud,"Fearing & White, Andy White, Stephen Fearing","White- Andy,Fearing- Stephen",Tea...
ios,objective-c,multidimensional-array,uiimageview
I'm working in Xcode 6 on tiling the iPhone background with many UIImageViews and I'd like to know if this is the most efficient solution. I know one simple solution would be to create image views in the storyboard and cover the entire screen with them manually. I'd like to...
c++,c++11,vector,multidimensional-array
I have: vector<string> myVector = {0}; myVector.push_back("first"); myVector.push_back("second"); char *list[] = ???? I want it to be initialized like if I was doing this char *list[] = { "first", "second", NULL }; I know I can start allocating memory based on the size and of the vector and the size...
php,arrays,multidimensional-array
I have array: Array ( [5] => Array ( [0] => 19 [1] => 18 ) [6] => Array ( [0] => 28 ) ) And I'm trying to delete element by value using my function: function removeElementWithValue($obj, $delete_value){ if (!empty($obj->field)) { foreach($obj->field as $key =>$value){ if (!empty($value)) { foreach($value...
c,arrays,loops,for-loop,multidimensional-array
I'am trying to write a program for converting the given string in cross manner(i.e Diagonal from left-right and from right-left). If the string length is even it returns a message else arrange it in a cross form. The code is: #include<stdio.h> #include<string.h> int main() { char str[50]; char str2[50][50]; int...
javascript,arrays,angularjs,multidimensional-array
I searched a lot, but I could not get a satisfactory answer on the net. In javascript, how do I add an array into another multidimensional array at a particular position based on a key value? finalArray = []; //final result to be stored here for(var i=0; i<5; ++i) {...
ruby-on-rails,arrays,ruby,multidimensional-array
I need an array that gives me @idea.id sorted by @idea.created_at.month For example: [[1,2,3], [4,5,6], [7,8,9], [], [], [], [], [], [], [], [], []] where ids 1, 2, and 3 have @idea.created_at.month = 1 and so on through month = 12. @ideas_by_month = Array.new(12){Array.new} @ideas.each do |idea| month =...
javascript,arrays,object,multidimensional-array,fill
I am trying to wrap my head around javascript objects and arrays. I attempted to fill and access an object as following: obj_keys = [1,2,3,4,5,6,7]; o = {}; $.each(obj_keys, function(k, v){ o[v] = []; for(var c; c < 10; c++){ o[v][c] = []; o[v][c].push([11,12,13,14]); } }); console.log(o); Object { 1:...
arrays,multidimensional-array,vhdl
I need to use multidimensional arrays to represent matrices in my design. I have tried the two available options: Declaring array of arrays type t11 is array (0 to c1_r2) of std_logic_vector(31 downto 0); type t1 is array (0 to r1) of t11; --r1*c1_r2 matrix Multidimensional arrays. type matrix is...
php,arrays,multidimensional-array
I'd changed, the data in this line. $fileConv = $_GET['file']; // It retrieves data to add. $file = intval($fileConv); // Conversion $ArrayNotes = array ( 0 => array ('titre' => 'aaa','ref' => 'aaa','date' => 'aaa','like' => aaa,'url' => 'aaa'), 1 => array ('titre' => 'aaa1','ref' => 'aaa1','date' => 'aaa1','like' =>...
angularjs,multidimensional-array,angularjs-scope,angularjs-ng-repeat
My scope data: $scope.data = "category": [{ "name": "cat1", "behaviour": "normal", "selected": 0, "values": [{ "label": "define", "count": 6 }] }, { "name": "cat2", "behaviour": "normal", "selected": 0, "values": [{ "label": "type", "count": 6 }] }, { "name": "Company", "behaviour": "multi-select", "selected": 0, "values": [{ "label": "VW", "count": 4 },...
php,mysql,arrays,multidimensional-array,comparison
I have a user table. I have 2 DATETIME per row that I'm looking at. I will look at $lastLog date and $lastReceived (for last received lead) and determine which is newer and that becomes their $eligibleTime. We will then look for the oldest $eligibleTime to select which user should...
javascript,json,object,multidimensional-array
I want to define a two-dimensional object, but I do not succeed. var b = [1,2,3,4,5,6,7,8]; var a = {}; var c = ["baslik","resim","icerik","links"]; for(i=0;i<2;i++){ for(s=0;s<4;s++){ a[c[s]]=b[s]; } } document.writeln(JSON.stringify(a)); Output: {"baslik":1,"resim":2,"icerik":3,"links":4} I want this output: {"baslik":1,"resim":2,"icerik":3,"links":4}, {"baslik":5,"resim":6,"icerik":7,"links":8} ...
php,arrays,multidimensional-array
print_r($size); is Array ( [0] => 2 ) Array ( [0] => 2 [1] => 1 ) Array ( [0] => 2 [1] => 1 [2] => 5 ) print_r($tag1); is Array ( [0] => ew-language ) Array ( [0] => ew-language [1] => global ) Array ( [0] =>...
php,arrays,json,multidimensional-array
I try to return a multidimensional array of dates and revenues each date as JSon array in order to display a chart in my panel dashboard. Unfortunately the chart makes some problem, when I don't hardcode my JSon Array, thus I am debugging it right now and I wonder why...
php,arrays,sorting,multidimensional-array
I have two arrays stored in an array. They have the same number of values and are aligned: $matrix['label1'] $matrix['label2'] I want to apply alphabetical sorting to $matrix['label1'] and move the contents of $matrix['label1'] in the same pattern. Here is an example of input and output. $matrix['label1'] = ['b','c','a'] $matrix['label2']...
python,matrix,multidimensional-array,indices
I convert a list of integers to a two dimensinal array like this: data = numpy.array( l ) shape = ( 10, 30 ) data = data.reshape( shape ) I try to get the indices x,y of the matrix of the values that are bigger than some threshold and lower...
php,arrays,multidimensional-array
I'm struggling with the appropriate logic to compare the following arrays: $a = [ "ip" => [ "1.2.3.4", "4.3.2.1", ], "domain" => [ "example.com", "another.domain", ], ]; $b = [ [ "id"=> 136589, "metaname" => "ip", "metavalue" => "1.2.3.4", ], [ "id"=> 136590, "metaname" => "domain", "metavalue" => "example.com", ],...
php,jquery,ajax,json,multidimensional-array
There might be an idiotic mistake in my code, but I just haven't found the answer yet. I'm using JSON data from http://rata.digitraffic.fi/api/v1/live-trains/[trainnumber] which is an external site. My objective is to get data from array inside JSON array to a simple HTML table, in this case stationShortCode, type, commercialTrack...
php,arrays,multidimensional-array
I have an array that looks like this. I'm looking at condensing this down into a simpler array (see below) how would I go about this? array(1552) { [0]=> array(2) { [0]=> string(4) "3792" [1]=> string(2) "99" } [1]=> array(2) { [0]=> string(4) "3792" [1]=> string(3) "100" } [2]=> array(2)...
ios,arrays,swift,multidimensional-array,set
I'm fairly new to coding in and I usually find answers already on here. However on this occasion I've been trying to find a method in swift that will allow me to identify pairs of numbers, in another array of unpaired numbers within another array for example in the image...
javascript,arrays,multidimensional-array,underscore.js
I have a 3D array with objects inside: [ [{ id: 1 }, { id: 2 }], [{ id: 3 }], [{ id: 3 }, { id: 4 }] ] How to flatten it including removing duplicated id parameter? [{ id: 1 }, { id: 2 }, { id: 3...
arrays,scala,multidimensional-array,n-dimensional
I was looking into multi-dimensional Arrays in Scala and came across some easy ways to create multi-dimensional Arrays. Namely: val my3DimensionalArray = Array.ofDim[Int](3,4,5) //array with dimensions 3 x 4 x 5 Or even val myFilledArray = Array.fill[Int](3,4,5)(0) //Array of same dimension filled with 0's However this only works for 1...
php,multidimensional-array,foreach,youtube
I'm trying to get a Youtube channel's information (channel name, description, thumbnail, etc) with the following PHP: $json_file3 = file_get_contents($query); $jfo3 = json_decode($json_file3,true); foreach($jfo3 as $lv1) { foreach($lv1 as $lv2) { $yt_id = $lv2['id']; $display_name = $lv2['snippet']['title']; $description = nl2br($lv2['snippet']['description']); $yt_thumbnail = $lv2['snippet']['thumbnails']['high']['url']; } } And this is a sample...
javascript,performance,object,multidimensional-array
After searching for something similar here, it was not clear to me how to create an object with different levels of rows like the following example: Example: Object = { 1 : { name : bob , dinner : pizza }, 2 : { name : john , dinner :...
c,pointers,multidimensional-array,crash,copy
I have fullNames, which is a 2D array that has sorted full names in it and I want to copy its content into sortedNames, which is a 2D array that exists out side of this function. (I get ***sortedNames as a parameter). I dynamically allocated this array, but the copying...
php,arrays,multidimensional-array
I have two multi-dimensional arrays. I need to concatenate the two without loosing any values which have the same key and different values. Here is the scenario: Array1 ( [0] => 11 [2] => 12 [3] => 13 [4] => ( [0] => 100 [1] => 200 ) [5] =>...
javascript,arrays,multidimensional-array,lodash
I have two collections. var a = [ {unique_id: "001", state: "CO"}, {unique_id: "001", state: "TX"}, {unique_id: "001", state: "CC"}, {unique_id: "002", state: "CC"}, {unique_id: "002", state: "NY"} ] And var b = [ {unique_id: "001", states:[]}, {unique_id: "002", states:[]} ] And I want to get: var b = [...
php,arrays,multidimensional-array
I have user a plugin to upload files every thing is working fine know I have to save that uploaded file name into database I need to access the file name when I do print_r() function ; $files = $data['data']; print_r($files); I get Array ( [files] => Array ( [0]...
python,c++,arrays,multidimensional-array
I'm implementing an translating a Python code to C++, however I want to place a Multidimensional array at another Multidimensional array index. The values of first array should be copied to specific index of other 2D array. Here's my Python Code: var2 = "121" a = [None for x in...
vb.net,multidimensional-array,arraylist
Friends I have a serious issue at present and Honestly I have no idea as to why this isn't working as expected. I am more a custom to C# than VB can anyone help with the following Code Example Please note that the String is passed from other classes and...
c,arrays,multidimensional-array,initialization,compiler-warnings
I am trying to initialize a 2D array of user defined type to zero by using following line, qmf_t X_hybrid_left[32][32] = {{0}}; Where qmf_t is a user defined type. Here I get the compiler warning, warning: missing braces around initializer [-Wmissing-braces]" But if I use, qmf_t X_hybrid_left[32][32] = {{{0}}};, i.e....
matlab,matrix,multidimensional-array,scalar
I'm having problems multiplying specific values within my multidimensional matrix by a scalar. My matrix has the following dimension: size(comDatabe) = 5 10 3 397 10 The third dimension is an x-y-z coordinate frame. Something went wrong and now my y-axis is defined upside down for one subject (#8 out...
c,arrays,multidimensional-array
I'm trying to understand pointers in C and I think I have an okay grasp so far. I am trying to make sense of arrays and how they are passed to functions. It is my understanding that when passing an array to a function it is passed by reference and...
javascript,arrays,multidimensional-array
I have this multidimensional array and I need to merge the fields that are equal and sum the sum values var data = [ [ {field: 123, sum: 100}, {field: 345, sum: 98} ],[ {field: 123, sum: 12}, {field: 345, sum: 20} ] ]; So from this array I need...
c#,arrays,multidimensional-array
I need to fill a two dimensional array in a following way: Rectangular matrix filled with zeros with a triangle of ones (its top is in the middle of first row and the lower vertices of the triangle are in the first and the last element of the last row)....
javascript,jquery,arrays,multidimensional-array
I have a Multi-Dimension Array filled with products. I'm trying to filter my products by passing a bunch of values and then put the resulting products into a new array. Here's what i'm trying to accomplish: products = [['A','2','F','123'],['A','2','G','234'],['B','2','K','231']]; related = []; filter1 = 'A'; filter2 = '2'; filter3 =...
.net,vb.net,multidimensional-array
I'm trying to create a function that essentially returns an array with the following structure: (String, String, Integer) At first, I was using a SortedList(Of String, SortedList(Of String,Integer)), but it seems like a huge waste since I don't need an array for the latter of the data. Now I'm thinking...
php,arrays,multidimensional-array
I have a multidimensional array $elements where I need to fill it with values from the array $ratings. The array $ratings is built so the first value will fit into the first slot in elements, the next in the second and so on. $elements 4 => array:3 [▼ 2 =>...
ruby-on-rails,arrays,ruby,multidimensional-array
seating_arrangement [ [:first, :second, :none], [:first, :none, :second], [:second, :second, :first], ] I need to copy this array into new array. I tried to do it by following code: class Simulator @@current_state def initialize(seating_arrangement) @@current_state = seating_arrangement.dup end But whenever I am making any changes to seating_arrangement current_state changes automatically....
php,arrays,checkbox,multidimensional-array
i want to fetch multiple textbox values corresponding to the checkbox selected... we can select one or multiple checkboxes at a time and on button click the output i need is like this: suppose my array is like this: array1('first','second','third'); array2('a','b','c','d','e','f','g','h','i') . and output i need is:- first,a,b,c second,d,e,f third,g,h,i...
php,arrays,multidimensional-array,associative-array
I am creating a set of arrays with the following loop: $assessmentArr = explode("&", $assessmentData); foreach($assessmentArr as $data) { $fullArr = explode("_", $data); // Break down to only archetype and value $resultArr = explode("=", $fullArr[2]); //print_r($resultArr); } Which produces the following results: Array ( [0] => community-support [1] => 24...
php,arrays,multidimensional-array
I have an array setup like so: Array ( [0] => Array ( [value1] => John Doe [value2] => Father [value3] => [value4] => http://www.website.my.com [value5] => [value6] => ) [1] => Array ( [value1] => Jane Doe [value2] => Mother [value3] => [value4] => http://www.website.my.com [value5] => [value6] =>...
javascript,angularjs,multidimensional-array,angularjs-ng-repeat,ng-repeat
I have an object in this format, I am trying to print it as a table. [{categoryName: "category1", value:[{name:"item1.1"}{name:"item1.2"},...]}, {categoryName: "category2", value:[{name:"item2.1"},...]},...] So, categaory name should be the header and values under it should be subheaders, as in the colspan of categoryname should be equal to number of values in...
python,numpy,multidimensional-array,subsetting
I have looked into documentations and also other question in here, but seems I have not got the hang of subsetting in numpy arrays yet. I have a numpy array, and for the sake of argument, let it be defined as follows: import numpy as np a = np.arange(100) a.shape...
php,arrays,multidimensional-array
Assume I have this array (the real one is much bigger indeed): Array ( [CD000000001] => Array ( [0] => Array ( [periodo] => 10/2010 [incasso] => 15000.00 [spesa] => 0.00 ) [1] => Array ( [periodo] => 03/2013 [incasso] => 0.00 [spesa] => 280.00 ) ) [CD000000002] => Array...
javascript,jquery,arrays,multidimensional-array
At the moment I have this object: obj = [object{id: 1, name: test, parentID: 3}, object{id:1, name: another, parentID: 5}, object{id:2, name:something, parentID: 1}]. Ultimately I want an object structured in a different manner. So that it is object, but if my identifier is 1, it has a collection of...
c,multidimensional-array,stack
General Background I had a need for a character array that contained a dynamic number of character arrays based on the number of files located in a specific folder. I was able to accomplish this by initializing char (*FullPathNames)[MAX_FILENAME_AND_PATHNAME_LENGTH] and then using FullPathNames = malloc( sizeof(*FullPathNames) * NumOfFiles * MAX_FILENAME_AND_PATHNAME_LENGTH...
c,multidimensional-array
void IspisMatriceUDatoteku(int red, int stupac, int *matrica) { FILE *f; char imeDatoteke[50]; printf("\nUnesite ime datoteke :"); scanf("%s", imeDatoteke); f = fopen(imeDatoteke, "w"); if(NULL == f) printf("Nevalja!!!\n"); else { for(int i=0; i<red; i++) { for(int j=0; j<stupac; j++) { fflush(f); fprintf(f, "%d ", matrica[i*stupac+j]); } fprintf(f ,"\n"); } } } int...
php,arrays,multidimensional-array
I am working on a function which fetch data from three table based on Left outer join, is as follows:- public function get_full_category_history($id) { $id = mysqli_real_escape_string($this->_con,$id); if (isset($id) && $id != "") { $query = "SELECT qz_categories.id as category_id, qz_categories.name as category_name, qz_quizzes.id as quiz_id, qz_quizzes.name as quiz_name, qz_questions.id...
c++,arrays,oop,multidimensional-array
I have an error when compiling my code, with multidimensional array. C:\Users\Tobi13\Desktop\Projet C++\Code\Test\Test111\map.hpp|17|error: declaration of 'levelchargement' as multidimensional array must have bounds for all dimensions except the first| And I don't understand at all. I have searched on the internet but I didn't found anything. The code of map.hpp class...
python,arrays,multidimensional-array,flask,jinja2
Within my Flask index.html template I wish to create a 2 dimensional array within a for loop. The for loop works perfectly fine but trying to 'set' an array that's multidimensional is not working. For example, one of the many things I've tried is: {% set matrix = [[] for...
r,multidimensional-array,data.frame
I like to define an 3D-array of data.frame(A,B,C,...) so that I can do for (x in 1:4) for (y in 1:5) for (z in 1:5) { m[x,y,z]$A <- dnorm(1) m[x,y,z]$B <- dnorm(1) m[x,y,z]$C <- dnorm(1) } it would be ok too, if I get a data.frame(x,y,z,A,B,C) with x,y,z ids and...
c++,multidimensional-array
I'm trying to double each number in 2D arrays. For example the values in array1 would become {2,4,6}{4,8,12}{6,12,18}. The problem is that my code doubles the only the first number. Can someone give me some direction on what to do? #include <iostream> #include <iomanip> using namespace std; const int N...
arrays,multidimensional-array,vb6,lazarus,fpc
I wonder how to decode a three-dimensional dynamic array of a custom type written to a binary file in VB6. The custom type is defined as follows: Type XYByte X As Byte Y As Byte End Type It represents two coordinates of a contact point. The three-dimensional array represents pre-computed...
php,arrays,multidimensional-array,substring
I have a 2-dimensional PHP array containing strings ($fulltable) which I'm trying to fit into the datables grid (https://www.datatables.net/). Sometimes some of the strings are really long. I'd like to truncate each string to lets say to 75 charachters, which will make the fields more manageable on display. Is there...
php,arrays,multidimensional-array
I'm trying to get sum and average of visitors from the following multi-dimensional array : Array([visitors] => Array( [2015-06-12] => Array([0] => Array([value] => 29)) [2015-06-11] => Array([0] => Array([value] => 55)) ... )) I cannot manage to find a way to get the results i need as i get...
jquery,arrays,serialization,multidimensional-array
I have a drag and drop system, and each dropped item receives three data-attributes. data-id data-order data-content Now I should put these attributes into a multidimensional array. It should look like this: data-order = "0" [data-id = "1", data-content = "blabla"]; data-order = "1" [data-id = "2", data-content = "another...
python,r,matrix,multidimensional-array,corners
There's probably a name for the algorithm I want, but I'm not sure how to find it. I have lots of 96-well plates like this: 1 2 3 4 5 6 7 8 9 10 11 12 ------------------------------------ A | X O O O O O O O O O...
node.js,multidimensional-array,underscore.js
I'm trying to sort the "num" of the children in the array which I've first nested: _ = require('underscore'); _.nst = require('underscore.nest'); var data = [ {'name' : 'name 1', 'num' : 40}, {'name' : 'name 1', 'num' : 20}, {'name' : 'name 2', 'num' : 10}, {'name' : 'name...
codeigniter,multidimensional-array
On my codeigniter project my callback is not working as would like with my multidimensional array post I am trying on my callback set message $key['image'] to display correct value of the multidimensional array post. But when I var dump it returns NULL On my set rules the multidimensional array...
arrays,swift,dictionary,multidimensional-array
I have this declaration so far: var meals : [String : Array<String>] meals = ["Option1": ["01-01-2015","05-02-2015"], "Option2": ["05-01-2015","10-04-2015"], "Option3": ["03-02-2015", "07-07-2015"]] I would like to do something like this, but I don't know how to declare the meals variable: meals = ["Option1": ["01-01-2015","05-02-2015"], 2 "Option2": ["05-01-2015","10-04-2015"], 2 "Option3": ["03-02-2015", "07-07-2015",...
c++,arrays,multidimensional-array,initialization
I am trying to initialize a multidimensional array in batches and can't seem to make it work or find an example! The dimensions I am working with are big enough that I don't want to specify them by hand! More precisely : int test[5][192]; for(int i = 0; i <...
javascript,arrays,sorting,multidimensional-array
I have an array in JavaScript. var array = [[12,3],[10,2],[8,1],[12,3],[7,1],[6,1],[4,1],[10,2],[12,3]] I would like to sort this array by the second value in descending order. The expected output is [[12,3],[12,3],[12,3],[10,2][10,2],[8,1],[7,1],[6,1],[4,1] I've tried array.sort(function(array) { return array[1] - array[1] } Unfortunately, that didn't work. Sorting single-dimensional arrays is easy but I'm not...
php,arrays,multidimensional-array
I'm trying to add an element to the beginning of a multidimensional array, but for some reason it's not recognizing the array I initialized as an array, even though I initialized it as an array. Please take a look: test.php $array = array(); <---initialize an array; array_unshift($array[0] , 'name'); <---add...
python,arrays,numpy,multidimensional-array
In Matlab, I can do the following: X = randn(25,25,25); size(X(:,:)) ans = 25 625 I often find myself wanting to quickly collapse the trailing dimensions of an array, and do not know how to do this in numpy. I know I can do this: In [22]: x = np.random.randn(25,25,25)...
arrays,ruby,multidimensional-array
I need to find the closest values from a set multidimensional arrays, here is the example: a = [[a,b,1,2,3],[a,b,5,6,7],[a,b,8,9,10],[c,d,1,2,9],[c,d,1,7,8]] I want to search the value closest to 1.8 from the overall arrays that contain the same elements in the first 2 index. My expected result is this: a = [[a,b,1,2,3],[c,d,1,2,9]]...