arrays

Help with declaring C++ structure, with a float array as one of its members.

I was wondering if anyone could spot what is wrong with my structure declaration and use. At the moment I have a structure and wish to store float array as one of it's members. My code: struct Player{ float x[12]; float y[12]; float red,green,blue; float r_leg, l_leg; int poly[3]; bool up,down; }; I then tried filling the struct: f...

Sending an Array into a PL/SQL Procedure

I have created a Web Service to send in a bunch of information to a PL/SQL procedure, however one of them is a array. What type do I use for this? I also want to put that array into a cursor after it comes in. ...

Animate text from array

I have this code that is supposed to take an array with some words, and apply the tweens to them, one by one, with a specified timeout. I think I have to make an empty movieclip out of them and then animate them with a foreach loop with a timeout, but I'm lost in how I would do that exactly. This is where I'm at: var array:Array = new ...

What is the fastest way to compare two byte arrays?

I am trying to compare two long bytearrays in vb.net and have run into a snag. Comparing two 50 meg files takes almost two mins so I'm clearly doing something wrong. I'm on an x64 machine with tons of memory so there are no issues there. Here is the code that I'm using at the moment and would like to change. _Bytes and item.Bytes ar ...

PHP and MYSQLi - Bind parameters using loop and store in array?

Hi, It will be easier to explain with the next code (It's wrong, by the way): $selectGenre_sql = 'SELECT genreID FROM genres WHERE dbGenre = ?'; if ($stmt->prepare($selectGenre_sql)) { // bind the query parameters $stmt->bind_param('s', $genre); // bind the results to variables $stmt->bind_result($genres); // execute the ...

Objective C Boolean Array

I need to utilize an array of booleans in objective-c. I've got it mostly set up, but the compiler throws a warning at the following statement: [updated_users replaceObjectAtIndex:index withObject:YES]; This is, I'm sure, because YES is simply not an object; it's a primitive. Regardless, I need to do this, and would greatly appreciate...

How to extend array's in C#

I have to do an exercise using arrays. The user must enter 3 input (each time, information about items) and the inputs will be inserted in the array Then i must to display the array. The difficulty i face is that i don't know how to increase the array's length without changing the information within it and how to allow the user to ent...

objective-c setter 2d-array

Hi, i want to initialize a 2d array.. but my code doesn`t work, can somebody tell me what is wrong? Thanks Chris @interface Map : NSObject { int mapData[8][8]; } @property(readwrite) int** mapData; @end @implementation Map @synthesize **mapData; (Error: Syntax before *) - (id)initWithMap:(int[8][8])map { for (int i=0; i...

Delphi - Accessing data from dynamic array that is populated from an untyped Pointer

Hi im using Delphi 2009 not that it has a large affect on what im doing i think I would run into the same if i was still on 2007. I have a scsi call that outputs data to a pointer (wrong way of looking at it but i have trouble explaining that). Originally i used Move to populate a Static Array of Byte with the data that came back, but ...

C# conversion from List[T] to array of T (T[])

Is there a short way of converting a strongly typed System.Collection.Generic.List to an array of the same type, eg: List to MyClass[]? By short i mean one method call, or at least shorter than: MyClass[] myArray = new MyClass[list.Count]; int i = 0; foreach (MyClass myClass in list) { myArray[i] = myClass; } ...

object[] from ReadOnlyCollection<T>

I have an object that I ended up with via a reflection call: object readOnlyCollectionObject = propertyInfo.GetValue(someEntity, null); I know this object is a generic ReadOnlycollection. It could be a ReadOnlyCollection<Cat>, ReadOnlyCollection<Dog>, etc. For argument sake, lets just say it is a ReadOnlyCollection<T>. Even though a D...

Compare two arrays of primitives in Java?

I know about Arrays.deepEquals(Object[], Object[]) but this doesn't work for primitive types (due limitations of arrays and autoboxing, see this related post). With that in mind, is this the most efficient approach? boolean byteArrayEquals(byte[] a, byte[] b) { if (a == null && b == null) return true; if (a == null || ...

clearing a char array c

Hello, I thought by setting the first element to a null would clear the entire contents of a char array. char my_custom_data[40] = "Hello!"; my_custom_data[0] = '\0'; However, this only sets the first element to null. or my_custom_data[0] = 0; rather than use memset, I thought the 2 examples above should clear all the data. Many...

NSMutableArray add new methods

Hello, After some research i found a piece of code which shows how to expand NSMutableArray functionality to use 2d arrays easily. http://www.seattlexcoders.org/shared/Mutable%202D%20Array/ How would my declaration statement of this special NSMutableArray look like? With the following #import "ZNMutable2DArray.h" @interface MainView...

How to copy the contents of std::vector to c-style static array,safely ?

I need to manipulate data in fixed array involving mid insertion. Rather than using memcpy,etc. I want to use vector. I have problem when I want to copy the vector elements back to the c-style array. Here's the code: void tryvector() { using namespace std; const int MAX_SIZE=16; BYTE myarr[MAX_SIZE]={0xb0,0x45,0x47,0xba,0x11...

How would I sort through an array of structs?

I have a struct containing song data: public struct uLib { public string Path; public string Artist; public string Title; public string Album; public string Length; } My library consists of an array of this uLib. How would I sort this array by say Artist? Is there a native sort functio...

Mis-indexed char[] arrays in Visual Studio 2005

I'm at a loss to explain what seems to be mis-addressing within the char[] arrays of a C++ class I've inherited. I'm using Visual Studio 2005 and have narrowed the problem down to this: MyClass.h: class MyClass { public: MyClass(); virtual ~MyClass(); void Reset(); // More member functions. . . char m_szString[128]; // Mo...

Getting rid of null/empty string values in a C# array

I have a program where an array gets its data using string.Split(char[] delimiter). (using ';' as delimiter.) Some of the values, though, are null. I.e. the string has parts where there is no data so it does something like this: 1 ;2 ; ; 3; This leads to my array having null values. How do I get rid of them? ...

How can I generate all permutations of an array in Perl?

What's the best (elegant, simple, efficient) way to generate all n! permutations of an array in perl? For example, if I have an array @arr = (0, 1, 2), I want to output all permutations: 0 1 2 0 2 1 1 0 2 1 2 0 2 0 1 2 1 0 It should probably be a function that returns an iterator (lazy/delayed evaluation because n! can become so impo...

How can i store the attributes of an xml node in an array of strings?

I have a project where i click on an xmlnode in the treeview and its attributes get displayed in the listbox. Now my backend contains the logic to store the attributes(name and value) of that clicked xml node in an array and return it as a string to my front end class in the treev_AfterSelect. How can i do it? ...