multidimensional

Most elegant way to check for equality in size of sub-arrays in multidimensional array?

(can you tell I'm learning Ruby today? :)) I want to determine if the multidimensional array I'm working with is a 'rectangle'--i.e., the rows are the same size. Here's what I'm doing, which works but feels clunky. if @myArray[0].size != @myArray[[email protected]].size raise "This array is not a rectangle." end Basically, I'm check...

Is it always necessary to create Dim tables?

I have a fact table that will have a column which will hold one of two values (occupied/vacant). Is it necessary to create a Dim table for this? ...

[PHP] Sort a multi-dimensional array

Hi! I need to sort a multi-dimensional array which represents filesystem structure: Array ( [dir1] => Array ( [dir2] => Array ( [dir3] => Array ( [dir4] => Array ( ...

Finding neighbours in a two-dimensional array

Is there an easy way of finding of finding the neighbours (that is, the eight elements around an element) of an element in a two-dimensional array? Short of just subtracting and adding to the index in different combinations, like this: array[i-1][i] array[i-1][i-1] array[i][i-1] array[i+1][i] ... And so on. ...

linear simulation of multidimensional array

I know how to simulate a 2d array in a linear array using [x + y * width] as a linear index. I can extend this to 3d arrays: [x + y * width + z * width * height]. Is there a general formula for N-dimensional array? I'm looking for a language-agnostic answer. ...

PHP: sort array by half-hour intervals

I have a very specific problem here. I have a multi-dimensional array that I want to sort first by half-hour time intervals, second by dates. The function array_multisort will not meet my requirements. Example: I want: array(array("time"=>"12:15", "date"=>"2009-03-24"), array("time"=>"12:10", "date"=>"20...

how to return two dimensional char array c++ ?

i ve created two dimensional array inside a function, i want to return that array, and pass it somewhere to other function.. char *createBoard( ){ char board[16][10]; int j =0;int i = 0; for(i=0; i<16;i++){ for( j=0;j<10;j++){ board[i][j]=(char)201; } } return board; } but this keeps giving m...

How do I add a multidimensional array (AoA) to Excel using Perl?

I want to add my data stored in 2x2 dimension array in Excel using Perl. I know how to open and add simple data. This I can do using for loop. But how can I do it elegantly? This is what I am trying to do $sheet->Range("A1:B"."$size")->{Value} = @$data; or @data; ...

How to Initialize a Multidimensional Char Array in C?

I'm trying to convert some code from C# to C so that it can be burnt onto a microcontroller. Could someone please tell me how I would convert a two dimensional string array in C# into something in C? My C# code looks like this: string[,] DirectionPosition = {{"00", "10", "", "01", ""}, {"01", "...

Dynamic Multidimensional array

I need a multidimensional array of chars that is dynamic in only one dimension... I have to store a pair of strings with a length of 10 (or less) chars each, but with a variable number of "pairs". My idea was this char (*instrucao)[2][10]; Which gives me a pointer to a 2x10 array of chars, but this is not working properly when i do s...

How can I store a Perl array in an array?

I want to be able to place an array into an array. For example, I may have an array like this: my @array1 = ("element 1","element 2","element 3"); Then I have another array my $array_ref = ["this will", "go between", "element 1 and 2"]; I want to place $array_ref into the first so that the first array looks like this: ("element 1"...

Are textual fields ever allowed in fact tables?

Are there any cases where I can have a textual field such as a description in a fact table? I currently have a fact table of meeting events (grain: row per meeting) with a number of dimensions such as date, client, location etc. I need to put the meeting subject in the fact table. Is this ok even though it is not a measure (I have not s...

Multidimensional arrays using integers and strings

I am trying to setup a basic error checking system where it will catch shell errors run by a system call. execute_command is a webmin function that runs a system call and then sets an error message to its 4th parameter. I basically call execute_command_error("adduser test"), knowing that I already have a user called test created and base...

How can I use a string to get a value from a multi dimensional array?

Say this is my string $string = 'product[0][1][0]'; How could I use that string alone to actually get the value from an array as if I had used this: echo $array['product'][0][1][0] I've messed around with preg_match_all with this regex (/\[([0-9]+)\]/), but I am unable to come up with something satisfactory. Any ideas? Thanks in a...

Block user from moving anywhere

I have made a game which is nearly identical to Popcap's Atomica. (http://www.popcap.com/gamepopup.php?theGame=atomica) It's almost finished, except for one important function; blocking the user from moving spheres anywhere. Like, if there is a wall of other spheres in between the sphere the user is trying to move, and the field it is t...

AS3 Object Filtering

Ok. so I'm working on an app that retrieves items from a db and builds a gallery. I've done this a ton of times, and it should be simple. I'm running into problems, because in this gallery, I get results from a db that includes both image files, and other files. Let's just say I can't change anything but the flash, so I need to detect i...

SSAS 2008 Dimension Wizard and the Date Template

Hi! Does anyone know how to use the Date Template with the BIDS 2008, SSAS Project, Dimension Wizard? I keep getting an error - rightly so, I suppose - "Dimension not generated because it is bound to a time binding" (after having selected Generate a non-time table in the data source, in order to get to the Date template). I am trying t...

determining the distance between points in n-dimensions

Hey, I am building a mySQL table listing points in n-dimensions, each dimension being indexed. Given any point in the n-dimensional system, I would like to be able to output all of the other points in order of their distance from the chosen point. A simple solution would be to calculate distances from each point using the pythagorean ...

cakePHP: How to create a form for a 2D/multidimentional table?

Hi, I need to create a form in CakePHP to allow users enter data(numbers) into the cells shown on the table below. The input screen needs look like the table shown below. The users should be able to select any cell they want to enter/update the value, then type in the value, click submit and submit the value/s. Each "Metric section ...

TM1 API for LinqToEntities

IBM Cognos TM1 is a multidimensional database that my company thinks is the latest and greatest. I've been to the classes and, sure, it is nice for analysis. Of course the finance people in my company only see the Excel Add-In or Excel-like website and think "that's all I need for a data entry application!" My response is "I thought you ...