arrays

JNI SetDoubleArrayRegion problem

Hello, I've tried looking at a bunch of forums, and despite a lot of tweaking and reanalyzing, I'm a little stuck. I'm trying to return a jdoubleArray via the JNI from my C++ code, but the values I seem to be entering don't seem to be carrying through. Here's the code. jdoubleArray ret = env->NewDoubleArray(2); jdouble* rotatio...

finding array index based on value

I'm trying to find the index based on the value stored within it. This would normally be easy, but the array I'm working with is highly nested. Each index 0,1,2 has fields f1,f2,f3 . I'm trying to find which index 0,1,2 has in its f2 field the value this stored in it. In this case, it's index 0. So that's the output I'm looking for. Is...

jQuery, JSON, searching, etc.

I've got a mass of values in a JSON file containing the names of venues and their contact information along with a description. I'd like to generate a table listing the contents of the JSON file on my page. I'm hoping to create a live search function that removes each entry that is no longer relevant with eachkeyUpdetected. The JSON [ ...

PHP - Multi line random array.

Say we have an array like this with 1 being two values and 2 being two values and 3, etc $language = array ( "1"=>array ( "Hola", "Spanish" ), "2"=>array ( "Fáilte", "Irish" ), "3"=>array ( "Yasou", "Greek" ) ); How would I randomly select ONLY 1 of 3 arrays an...

How to assign a value to a variable in Flash (AS3)?

Using targetCurrent -- I am able to get the name of the MovieClip a user clicks on. On function toggleClick there is a trace statement that says: trace("movieClip Instance Name = " + e.currentTarget); OUTPUT Window: movieClip Instance Name = [object Comp] Based on what a user clicks on -- there will be a value associated to the Mo...

Taking strings as input into an array of pointers to strings and displaying them

I intend to store strings into an array of pointers to strings and then display them as follows : char *directions[3]; for(i=0;i<3;i++) scanf("%s",directions[i]); for(i=0;i<3;i++) printf("%s",directions[i]); but when i run this code ,it gives me segmetation fault ,could someone please correct me? ...

Finding frequent sequence of numbers in an array

Array (3, 5, 1, 3, 5, 48, 4, 7, 13, 55, 65, 4, 7, 13, 32) the frequent sequence of numbers will be (3, 5) f=2 + (4, 7, 13) f=2 any Algorithm or Pseudo code to find that ? Update(1): if (7, 13) also occurrence it will be included in the longest one by update its frequency so (4, 7, 13) f=3 and so on... Update(2): in case of (1,2,...

How to print array of integers into console quickly?

I have an array of integers a = [1,2,3,4] When I do a.join Ruby internally calls the to_s method 4 times, which is too slow for my needs. What is the fastest method to output an big array of integers to console? I mean: a = [1,2,3,4........,1,2,3,9], should be: 1234........1239 ...

How can I return a pointer to an element inside an array of structs ?

What am I doing wrong here ? /* * Consider the following pseudo code ! */ typedef struct foobar { unsigned char id, count; struct foobar *child; } foobar; foobar root = (foobar *) malloc( sizeof(struct foobar) ); root->child = (foobar *) malloc( sizeof(struct foobar) ); root->count++; root->child[0].id = 1; root->count++; r...

Define dynamic JSON-Array

Hey, i've got a new problem. I know how i have to define a static JSON-Array, but now i must make this dynamic so i could add items with a loop. this is the static version: $json = array(array('field' => 'name', 'value' => $name), array('field' => 'nummer', 'value' => $numbers));...

Adding an imageview to a layer

I'm sure this is simple but I am trying to add an array of images to a layer. Here is what I have so far: // Create the fish layer fishLayer = [CALayer layer]; //fish = [UIImageView imageNamed:@"Fish.png"]; fish.animationImages = [NSArray arrayWithObjects: [UIImage imageNamed:@"swim01.png"], [UIImage imageNamed:@"sw...

how to convert an XML into an array in asp.net

Hello All, i need to convert an XML into an array using asp.net. I tried searching on the web but couldn't find the proper solution. Can someone please help me with this Thanks, Alloi ...

PHP does not recognize CSS and stuff

Problems Project1.php does not show: CSS, thumbs and sidebar navegation I do not know what is wrong with it? Site Structure: giving | - - css | - - footer.inc.php | - - header.inc.php | - - index.php | - - portfolio | - - print | - - images.inc.php | - - img ...

name an array with a variable (PHP)

I have a script i am writing. it parses through a list of scanned (barcoded) items and pulls data about the items. It also needs to count how many times each item was scanned. The part number is called $partselect. Ideally, I would like to store them in an array called $count with the format of $count[$part] = (number of times it's been ...

Preferred kind of array for storing iPhone favorite items?

I am using the following array to add an object that was previously created to the favorite array: NSMutableArray *favorites = [NSMutableArray addObject:[myList objectAtIndex:1]]; However, this code keeps crashing at runtime. I think this is not the best way to implement an array that can save and delete items; is there a better way t...

PHP Random numbers

Hello, I would like to draw a random number from the interval 1,49 but I would like to add a number as an exception ( let's say 44 ) , I cannot use round(rand(1,49)) .So I decided to make an array of 49 numbers ( 1-49) , unset[$aray[44]] and apply array_rand Now I want to draw a number from the interval [$left,49] , how can I do that u...

Javascript shorthand way to duplicate strings

I have this code in a function, and want to shorten it - it applies the same style to every item in an array. document.getElementById(divsArray[0]).style.visibility='hidden'; document.getElementById(divsArray[1]).style.visibility='hidden'; document.getElementById(divsArray[2]).style.visibility='hidden'; document.getElementB...

Convert list to array

Hello, I have functon that convert list in array: void* list_to_array(SList* list) { int i; int array_size = list_get_length(list); void* array[array_size]; for (i = 0; i < array_size; i++) { array[i] = list_get_n_data(list,i); } return *array; } But when i try to test it: int* a = (int*)l...

How to get total number of variables in an array in Javascript?

Hey all, Google wasn't my friend on this one... maybe I wasn't searching for the right terms. I have a javascript array randomTagLine[0], randomTagLine[1], etc. How do I get the total number of variables in the array? For instance, I can physically see there are 23, but I need to pull that out via JS code... Thanks in advance.. EDIT ...

Can't turn array into a string error

I have a simple call JSON.parse(Panda.get("/videos/#{self.panda_video_id}/encodings.json")) Which returns : can't convert Array into String This is because the Panda.get("/videos/#(self.panda_video_id}/encodings.json") call returns an array in the new Panda 1.0.0 gem. I also tried : JSON.parse(Panda.get("/videos/#{self.panda_vi...