arrays

In Ada how do I initialise an array constant with a repeated number?

I need an array of 820 zeros for using with a mathematical function. In C I could just write the following and the compiler would fill the array: const float EMPTY_NUMBER_A[820] = { 0.0, }; However in Ada that isn't possible. I really don't want to hard code the 820 elements as 0.0. Is there a way to get the compiler to do it? typ...

Java: Bidimensional Array with methods/capabilities similar to ArrayList

I want to create an XY array of integers (or whatever type), but I want to use methods like "add", "remove", "contains", "indexOf" similar to ArrayList class. Is there any existing class with these capabilities? PS: I don't want to create an ArrayList of ArrayList ...

Best way to store 3 pieces of data as a single entry

For a game server, I want to record details when a player makes a kill, store this, and then at intervals update to a sql database. The part i'm interested in right now is the best method of storing the kill information. What i'd like to pass to the sql server on update would be {PlayerName, Kills, Deaths}, where the kills and deaths ar...

PHP : What is the better way to access object inside an array then what i got now ?

$jj_post is the array output debug via print_r. this variable is an array of object Array ( [0] => stdClass Object ( [ID] => 2571 ) ) i access the object property, ID, via code like this : $jj_post_id = $jj_post[0]; $jj_ID = $jj_post_id->ID; so, is there a better way, cause this is the only t...

Sorting a Multidimensional array...

I need to sort an array that can look like this: $array[4][0] = array('id' => 1, 'value' => 2); $array[3][2] = array('id' => 0, 'value' => 3); $array[4][1] = array('id' => 1, 'value' => 0); $array[1][3] = array('id' => 2, 'value' => 1); $array[1][1] = array('id' => 3, 'value' => 0); $array[3][0] = array('id' => 2, 'value' => 1); $array[...

Can't seem to get .Union to work (merging 2 array's together, exclude duplicates)

I want to combine two array's, excluding duplicates. I am using a custom class: public class ArcContact : IEquatable<ArcContact> { public String Text; public Boolean Equals(ArcContact other) { if (Object.ReferenceEquals(other, null)) return false; if (Object.ReferenceEquals(this, other)) return true; ...

Java: Is there any short combination to convert array of primitive to List & receive "printable" version ?

int[] arrc = new int[] {1, 2, 3}; System.out.println(new ArrayList(Arrays.asList(arrc))); prints address, but i desire to use toString as in ArrayList. Is it possible ? ...

foreach: how to iterate this

object(stdClass)[1] public 'inbox' => array 0 => object(stdClass)[2] public 'from' => string '55512351' (length=8) public 'date' => string '29/03/2010' (length=10) public 'time' => string '21:24:10' (length=8) public 'utcOffsetSeconds' => int 3600 public 're...

How to deserialize null array to null in c#?

Here is my class: public class Command { [XmlArray(IsNullable = true)] public List<Parameter> To { get; set; } } When I serialize an object of this class: var s = new XmlSerializer(typeof(Command)); s.Serialize(Console.Out, new Command()); it prints as expected (xml header and default MS namespaces are omitted): <Command><To...

Change array format in PHP.

I have an array like: Array ( [6] => Array ( [quantity] => 23 [orgId] => 6 [validity] => 20 ) [2] => Array ( [quantity] => 5 [orgId] => 2 [validity] => 2 ) [5] => Array ( [quantity] => 5 [...

how to sort a multidemensional array by an inner key

i have this enormous array that i am pulling from an API for BattleField Bad Company 2, and the soldier stats can be pulled as a multi dimensional array with an inner array for each soldier, however the API sormats it sorting the soldiers by name alphabetically, i want to sort them by rank (which is just another key within that soldiers ...

Any ideas on How to search a 2D array quickly?

I jave a 2D array like this, just like a matrix: {{1, 2, 4, 5, 3, 6}, {8, 3, 4, 4, 5, 2}, {8, 3, 4, 2, 6, 2}, //code skips... ... } (The Array is not sorted) I want to get all the "4" position, instead of searching the array one by one, and return the position, how can I search it faster / more efficient? thz in advance. ...

Converting array to Drupal format

Hi all, This statement gives me the value I want in Drupal (namely the last user role): global $user; return (end($user->roles)); however I need to convert it to this format: return array( 0 => array('value' => value for value), // You'll usually want to stop here. Provide more values // if you want your 'default value' to be ...

How do i make multiple url links show in array?

Im new to droid programming and i got a simple retrieve image from url working but confused on how to make it so i can load multiple images from my webpages url. Someone informed me change the drawable to string but not sure 100% how to do so here is most of my code so far: public class Gallery extends Activity { /** Called when the act...

jquery add to an array on click?

I'm confused regarding each() and .each()... I think I need to use both, but I'm not sure how... Basically, I have a series of checkboxes and when they're checked, I want to get the id of the closest table row and add it to an array that I can then serialize and pass to a function. So, the html looks like this: <tr id="t1"><td><in...

jQuery: getting text from a cell using the each function on checked checkboxes

I have a list of states, each with some data associated with it, displayed in a table, with a checkbox next to each state. I have it successfully computing the sum of input values of all checked states, but I need to store the additional data for each state in a 3D array so that I can display it later in the form's summary, showing the u...

Attempting to Convert Byte[] into Image... but is there platform issues involved

Greetings, Current, I'm attempting to develop an application that takes a Byte Array that is streamed to us from a Linux C language program across a TCPClient (stream) and reassemble it back into an image/jpg. The "sending" application was developed by a off-site developer who claims that the image reassembles back into an image withou...

Array Problem, need to sort via Keys

Ok, not really sure how to do this. I have values that are being outputted from a SQL query like so: $row[0] = array('lid' => 1, 'llayout' => 1, 'lposition' => 1, 'mid' => 1, 'mlayout' => 1, 'mposition' => 0); $row[1] = array('lid' => 2, 'llayout' => 1, 'lposition' => 0, 'mid' => 2, 'mlayout' => 1, 'mposition' => 0); $row[2] = array('l...

Strange code behaviour?

I have a C code in which I have a structure declaration which has an array of int[576] declared in it. For some reason, i had to remove this array from the structure, So I replaced this array with a pointer as int *ptr; declared some global array of same type, somewhere else in the code, and initialized this pointer by assigning the glo...

Place Query Results into Array then Implode?

Basically I pull an Id from table1, use that id to find a site id in table2, then need to use the site ids in an array, implode, and query table3 for site names. I cannot implode the array correctly first I got an error, then used a while loop. With the while loop the output simply says: Array $mysqli = mysqli_connect("server", "login"...