arrays

actionscript array with index and key

What would be the best way to create an array that can have an index and a key at the same time ? i mean something like this index | key | value 0 | "myItem" | "Some value" 1 | "anotherItem" | "Some other value" 2 | "blabla" | "Bla Bla" I know i can create a normal Array/Vector and then...

[PHP] Array key as string and number

How to make arrays in which the key is number and string. <?php $array = array ( 'test' => 'thing', 'blah' => 'things' ); echo $array[0]; // thing echo $array[1]; // things echo $array['test']; // thing echo $array['blah']; // things ?> ...

address of array ptr equal to to it's value ?

Possible Duplicate: C: How come an arrays address is equal to its value? SA In C I tried to print the address of the pointer of an array. int a[3] = {0,1,2}; printf("\n%p",a); printf("\n%p",(&a)); the 2 statement prints the same value why?thanks in advance ...

unreadable output with var_dump on xampp windows

Hello I'm having some issue with var_dump.i'm using xampp 1.7.3 on windows. I think in previous version i could output a variable with var_dump without print "<pre>" print "</pre>" firebug is not installed on my firefox and i'm not using xdebug. Formally i have even red colored and nicely formatted output.Now it's completly unre...

New to programming, don't get 2D/3D arrays

Hey everyone, I'm basically new to programming. I've decided to try and get started with C (not C++ or C#) and so far I've been doing pretty well. I managed to get far as two-dimensional arrays before I started to falter. While I think I broadly understand 2D integer arrays, I certainly don't understand 3D string arrays. I'm learning by...

jquery check checkboxes based on php array

Hi All I have a php array containing the mysql values of checkboxes, which has been selected previously. I am trying to do an edit page of sorts which will show the already selected checkboxes, but seem to be having issues with it. I've tried different ways but can't seem to get it working. Here's my php array of previously selected ch...

Selecting a range of items inside an array in C#

Hi, I would like to select a range of items in an array of items. For example I have an array of 1000 items, and i would like to "extract" items 100 to 200 and put them in another array. Can you help me how this can be done? ...

C# Function returning two values

Hi, I would like to have a function in which I will input an array and as a result i need another array and an integer value. Is this possible? Example: private int[] FunctionName (int[] InputArray) { //some function made here int intResult = xxxxx int[] array = xxxxx return intResult; //but here i need also to pass t...

Associative array with mixed (numerical and string) indices?

How would one implement a dynamic associative array that could take any number of mixed indices (integers, strings, or both)? I aim to simulate structures by providing, for example, people[3].location as syntactical sugar for people[3, "location"]. How would you recommend representing this kind of array internally? By the way, I am usi...

(Beginner's question) Echoing through an array in PHP, only adding a comma based on certain conditions

Hi folks, So this is pretty basic, I know! Sorry, just one of those days. I've got an array of tags collected from a database. There could be any number of tags in this array. However, I only want to output 4. So I currently have this code: $iteration = 0; foreach ($tagarray as $tag) { ?> <div class="tagbutton listv"> <span><?php ech...

Problem sorting array with decimal numbers

Hello I'm trying to sort a simple array which only contains a few decimal numbers. e.g: ( [0] => 0.05 [1] => 0.076 [2] => 0.092 ) using this: $stuff = sort ($comparison); However when I use the php sort, asort ect functions, instead of getting a sorted array, I get the number 1. Very confusing! Any help? ...

PHP: find key position in multidimensional array

Possible Duplicate: PHP: get keys of independent arrays Hello. I have a multi-dimensional array. I want a function that finds the position of the given array key (all my array keys are strings) and then returns the position of the key as an array. E.g: $arr = array ( 'fruit' => array( 'apples' => array(), ...

Loading an Array Image item using the formatted NSString

I want to load an image from an array and set the view to display this image. The current code isnt loading anything, just a gray image full screen. myView.image = [UIImage imageNamed:[names objectAtIndex:r]] If I have a counter r, which I use to access the index. How could it be done to load an image as such myView.image = [UIImage...

Logical vs Numerical array in MATLAB

I am comparing two binary arrays. I have an array where values can either be one or zero, one if the values are the same and zero if they are not. Please note I am doing other stuff beyond checking, so we don't need to get into vectorization or the nature of the code. What is more efficient, using a numerical array or a logical array in...

Why do vector indices in R start with 1, instead of 0?

What is the reason that vector indices in R start with 1, instead of the usual 0? Example: > arr<-c(10,20) > arr[0] numeric(0) > arr[1] [1] 10 > arr[2] [1] 20 Is it just that they want to store extra information about the vector and didn't know where to store it except as the vector's first element? ...

Does memcpy work for large arrays in structures?

I have a structure that has a dynamic array in it. I have defined two of these structures. I fill the array in the first structure, then use a line like memcpy(R->v, A->v, A->n*sizeof(double) where v is the array that has been dynamically allocated, and n is the number of entries. R and A are the same type if that matters. The probl...

How to add to SortedSet items from an Array?

I have a SortedSet defined this way: SortedSet<RatedMessage> messageCollection = new TreeSet<RatedMessage>(new Comp()); and I have an array of RatedMessage[] I had to use the array as the set misses the serialization feature, now I need to construct it back. Is there a quick way to add all the items from the array to the set again?...

Return Array in ActionScript 3.0 (Flash and Air)

Hey guys, I'm trying to get the name of every files from a specific folder into an array, but I get this error and I can't find why... this may be a stupid question but whatever. TypeError: Error #1009: Cannot access a property or method of a null object reference. Here's my code: import flash.filesystem.File; function getFileLis...

Sorting an Array Reference to Hashes

After executing these lines in Perl: my $data = `curl '$url'`; my $pets = XMLin($data)->(pets); I have an array reference that contains references to hashes: $VAR1 = [ { 'title' => 'cat', 'count' => '210' }, { 'title' => 'dog', 'count' => '210' } ] In Perl, how do I sort the h...

Declaring and initializing arrays in C

Is there a way to declare first and then initialize an array in C? So far I have been initializing an array like this: int myArray[SIZE] = {1,2,3,4....}; But I need to do something like this int myArray[SIZE]; myArray = {1,2,3,4....}; ...