arrays

Create Multi-Dimensional Array With Algorithm Using Data in Single-Dimensional Array

I have an single-dimensional array of PHP objects. Each object has two attributes, one attribute is the object's unique ID and the other is the unique ID of another object in the array that is its parent. For example: array(3) { [0]=> object(stdClass)#1 (2) { ["ID"]=> int(1) ["parentID"]=> int(0) } [1]=> object...

C# - Not saving right in Array - why will it save the first one but not the rest?

This is a homework problem - so I would appreciate if you could tell me what I am doing wrong and how to fix it, resp. how to optimize my programing techniques :). Thanks! I built this to save the employee in the array - it will save the first one right but when it saves the others it shows up blank - right out of the constructor. Why...

Binary Search Tree Array Imp. C++

Hello, I'm just having trouble with Inserting into the array...And having the children branch off from the root, or "parent".. I've been trying to insert data into an array based implementation of a BST: BST::BST(int capacity) : items(new item[capacity]), size(0) { // define the constructor to the BST Class. } void BST::insert (...

Variably modified array at file scope

I want to create a constant static array to be used throughout my Objective-C implementation file similar to something like this at the top level of my ".m" file: static const int NUM_TYPES = 4; static int types[NUM_TYPES] = { 1, 2, 3, 4 }; I plan on using NUM_TYPES later on in the file so I wanted to put it in a variable. ...

Java, Page through array

Test[] array = new Test[3]; array[0] = new RowBoat("Wood", "Oars", 10); array[1] = new PowerBoat("Fiberglass", "Outboard", 35); array[2] = new SailBoat("Composite", "Sail", 40); I have the above array and I need to display the results to a swing GUI with a next button that will display the first index values, and when ...

weird Array.ConvertAll

[StructLayout(LayoutKind.Sequential)] public struct RecognizeResult { /// float public float similarity; /// char* [MarshalAs(UnmanagedType.LPStr)] public StringBuilder fileName; } RecognizeResult[] results = new RecognizeResult[50]; Array.ConvertAll(results, r => r.fileName = ne...

How do you get a data value associated with a specific col,row from a 2-d array in java?

here is the code I have written in java I think it is right. I am just not sure what to set result to? I want to return the element associated with the specific row column public int getElement(int row,int col){ int result = 0; if(((row>=1) && (row <=rowArray.length))&&((col>=1) && (col <=colArray.length))){ result = ??...

VBA: How to perform an action on specific elements of an array

In VBA for PowerPoint, as far as I understand, this code gets only the first shape in the active window and nudges it: Set oShape = oSlide.Shapes(1) oShape.Left = oShape.Left + 5 And if I wanted to nudge all the shapes, I would use a loop for this. But how can I get and nudge only certain shapes, based on their number? For exampl...

Wrapping dynamic array into STL/Boost container?

I need to wrap a dynamically allocated array(from a = new double[100] for example) into std::vector(preferably) without copying the array. This restriction is imposed by that the array I want to wrap is mmaped from a file, so just doing vector(a, a+size) will double the memory usage. Is any tricks to do that? ...

Policies Array Class-Design wrapper

Hi, i want to write an wrapper for different Array Classes with different Policies. For example: typedef ArrayType<useValArray,StdAllocator> Array; // one global assignment I want to use the class like a blitz++ Array for example: Array<double,2> x(2,2); //maps the Array to an Valarray or to a Blitz++ Array Array<double,2> x2(5,...

PHP Array selecting results

Hi all, If I have the following array: $Unmanaged = array( array('name' => 'SD2005', 'speed' => '1000', 'size' => 'desk', 'uplink' => 'no'), array('name' => 'SD2008', 'speed' => '1000', 'size' => 'desk', 'uplink' => 'no'), array('name' => 'SR2016', 'speed' => '1000', 'size' => 'rack', 'uplink' => 'no'), a...

Flex RemoteObject: Arrays with same values reference same memory

If I send remote data from Zend_Amf to Flex, if two array properties on the object have the same data values they are deserialized at the remote end with the same memory storage. Example: AS3 object: Snippet: [RemoteClass(alias="TestVO")] public class TestVO { public var test1:Array; public var test2:Array; } When this receives ...

Assigning an array element to a variable with the same name?

I'd like to be able to extract some array elements, assign each of them to a variable and then unset these elements in the array. Let's say I have $myarray = array ( "one" => "eins", "two" => "zwei" , "three" => "drei") ; I want a function suck("one",$myarray)as a result the same as if I did manually: $one = "eins" ; unset($myarray...

How to update a postgresql array column with spring JdbcTemplate?

Hi, I'm using Spring JdbcTemplate, and I'm stuck at the point where I have a query that updates a column that is actually an array of int. The database is postgres 8.3.7. This is the code I'm using : public int setUsersArray(int idUser, int idDevice, Collection<Integer> ids) { int update = -666; int[] tipi = new int[3]; tipi[0] = j...

storing a TextBox value(in a html page) in php array variable which is then stored in a session

Hi, I am totally new to coding and i would need some help regarding this question of mine. the question is that, I have around 5 html pages.I am trying to walk the user through each phase and thats the reason i have diffent page for entering the info.Each html page has certain text fields.For ex Page1:lastname,firstname,mi... Page2:ad...

What is the best way to combine several arrays into one single array

Hey, I was trying to combine several arrays of type double into one single array, what is the best way to do it? Thanks! ...

In Place rotation C++ Practice

Hello, I have a working rotating function going for my "items" int array. The code below gets it done, except that im transferring values out unnecessarily. Im trying to acheive the "inplace" rotation. What I mean by that is where the ptrs would increment or decrement instead of grabbing values out of the array..By which I need to "up" ...

In Perl, how can I get the fields in this CSV string into an array without spaces?

Hi, if I have a string, say: my $string = "A, B,C, D , E "; How can I put this into an array in Perl without the leading and trailing spaces? So what I want is only a single letter in each array element. What I currently do is this: my @groups = split /,\s*/, $string; But this is obviously not enough, as the trailing spaces are st...

how to make a spiral galaxy image based on data points?

I'm trying to plot points from a very large array into an image using Ruby. Such that the array items are represented by a point or dot of the appropriate colour, and the dots together form the shape. Since the dots are from the array they are not random in colour or location to each other, so I'm confused how to begin. I want to even...

How do I incrementally build and tear down a JavaScript object?

I need a user to be able to perform these actions: Click an "Add" button. This will add a JavaScript object to either an array, or another JavaScript object. Click a dynamic "Remove" button. This will remove the JavaScript object from the array, or object, whose ID matches the button click. Submit the complete array, or object, of des...