arrays

JQuery draggable update array after delete

I'm not sure of the best way to do this, I am certain that my JQuery is "clumsy" to say the least but it gets the first part of the job done. I am dragging "products" to a basket like this: $j('#basket').droppable({ accept: '.productsimg', drop: function(ev, ui) { $j(this).append(ui.draggable.clone()); $j("#basket .de...

What is the most efficient way of checking to see if an array of strings has any duplicates in .NET

I have a very, very large unsorted string array and i need to check to see if there are duplicates. What is the most efficient method of checking this? ...

PHP accessing a property of an object

Hi There, I have an object that looks like this when outputted via a print_r Array ( [178] => My_Model_Category Object ( [autoGenerateURLNameIfNotSupplied] => 1 [id] => 178 [name] => Just for Kids [date_created] => 2010-04-06 16:08:40 [last_updated] =...

How do I return an array of strings from a recursive function?

How do I return an array of strings from a recursive function? For example:: char ** jumble( char *jumbStr)//reccurring function { char *finalJumble[100]; ...code goes here...call jumble again..code goes here return finalJumble; } Thanks in advance. ...

how to add the selected item from a listbox to list <string> in c#

how to add the selected item from a listbox to list to get the username that are selected my code: List<String> lstitems = new List<String>(); foreach (string str in lstUserName.SelectedItem.Text) { lstitems.Add(str); } it show me error saying cannot convert char to string.... how ...

Rotate a 2D array in-place without using a new array - best C++ solution?

Dear Folks, One of my students asked me this kind of homework with C++ arrays. It seemed quite interesting for me, so, though I have solved this problem, I wanted to share my solution with you and know another variants and opinions. The problem is following: Problem It is given a 2D dynamic quadratic matrix (array) A(nxn). It is require...

accessing assocative array item by index

I want to access information in an associative array by index like so $arr = Array( ['mgm19'] => Array( ['override'] => 1 ) ); $override1 = $arr['mgm19']['override']; $override2 = $arr[0]['override']; but i get nothing from override2 why ? ...

How do I update a table from an array?

$query = "SELECT users FROM tabl ORDER BY RAND()"; $result = mysql_query ($query) or die ("Query '$query' failed with error message: \"" . mysql_error () . '"'); while ($row = mysql_fetch_array($result)) { $users[] = $row[0]; } $current = end($users); $partners = array(); foreach ($users as $user) { $partners[$user] = $...

a way to parse S3 data array

If, for example, I had array like this: array(34) { ["ahostel.lt/img/background.png"]=> array(4) { ["name"]=> string(29) "ahostel.lt/img/background.png" ["time"]=> int(1277819688) ["size"]=> int(36811) ["hash"]=> string(32) "2600e98e10aba543fb2637b701dec4f3" } ["ahostel.lt/img/body-navigation-bg.p...

if $a and $b are bothe arrays the what would be the result of $a+$b?

Possible Duplicate: + operator for array in PHP? if $a and $b are bothe arrays the what would be the result of $a+$b? ...

Deserialize an array of strings with DataContract

I have an xml schema with a type defined like this: <xs:complexType name="InteractiveWorkflowAddress"> <xs:sequence> <xs:element name="endpointAddresses" nillable="true" type="q1:ArrayOfstring" xmlns:q1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" /> <xs:element name="instanceId" type="ser:guid" />...

malloc in C, but use multi-dimensional array syntax

Is there any way to malloc a large array, but refer to it with 2D syntax? I want something like: int *memory = (int *)malloc(sizeof(int)*400*200); int MAGICVAR = ...; MAGICVAR[20][10] = 3; //sets the (200*20 + 10)th element UPDATE: This was important to mention: I just want to have one contiguous block of memory. I just don't want to...

Getting an int array in JNI

I've seen some questions on how to properly pass a C array into Java using JNI, but I have the reverse problem: How do I properly call an int array getter method in C using JNI. Specifically, I want to pass a BufferedImage instance into C and call the "public int[] getRGB()" method on this BufferedImage instance. My understanding is th...

May I take the address of the one-past-the-end element of an array ?

Possible Duplicate: Take the address of a one-past-the-end array element via subscript: legal by the C++ Standard or not? int array[10]; int* a = array + 10; // well-defined int* b = &array[10]; // not sure... Is the last line valid or not? ...

Set multi-dimensional array by key path from array values?

Sorry for the terrible title, best I could think of at the time! Say I have a 'path' array like so; array('this', 'is', 'the', 'path') What would be the most effective method to end up with the array below? array( 'this' => array( 'is' => array( 'the' => array( 'path' => array() ) ...

Whats the fasted way to extract an array of nested objects from an array of objects in Ruby ?>

I have an array of Elements, and each element has a property :image. I would like an array of :images, so whats the quickest and least expensive way to achieve this. Is it just iteration over the array and push each element into a new array, something like this: images = [] elements.each {|element| images << element.image} ...

Problem with type-casting array of strings in C

I am trying to read a large list of English words from a text file to array of strings. The number of words is 2016415, and maximum length of a word is 69 characters. If I define array like "char data[2016415][70]; " then I get stack overflow when I run the program. So I am trying to use calloc() instead, however I can't understand how...

php: check if an array has duplicates

I'm sure this is an extremely obvious question, and that there's a function that does exactly this, but I can't seem to find it. In PHP, I'd like to know if my array has duplicates in it, as efficiently as possible. I don't want to remove them like array_unique does, and I don't particularly want to run array_unique and compare it to the...

Adding an element to an array

I m reading data from a source as array. a[n] I need to add one more element to the array. Once i get the array, i create a new array with capacity n+1 and copy all the elements to the new array and put the new element as the last element of the array. I can do this. Is there a better way to do this? especially with Linq? ...

How to make a global array with variable number of elements?

Is it posible to declare a global array of a struct, and add elements dynamically to it? Thanks. ...