arrays

Find Maximum Integer in Array ?

Hi All, I have two arrays, one is very large (more than million entries) and other array is small (less than 1000 entries), what would be the best approach to find maximum number out of all entries in arrays ? Thanks. ...

Java - Prepared statements and arrays

How can I handle an array in a prepared statement? i.e, I want to do a query and one of the parameters I get is an array of strings which I want to use in the query (Don't select rows that have a field that's in the array)? ...

How to expand an array dynamically in C++? {like in vector }

Lets say, i have int *p; p = new int[5]; for(int i=0;i<5;i++) *(p+i)=i; Now I want to add a 6th element to the array. How do I do it? ...

C Static Array Initialization - how verbose do I need to be?

To initialize an int array with all zeros, do I need to use: int foo[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; Or, will this work: int foo[10] = {0}; ...

How can I use MATLAB arrays as keys to the HashMap java objects?

The put function works fine but the get function does not. Apparently I don't know the trick. >> X = [ 1, 2, 3]; >> M = java.util.HashMap; >> M.put(X,1); >> M.get([1,2,3]) ans = [] I have searched and read many posts but could not find a solution to this problem. It would be great if someone can let me know the trick. ...

Linq to SQL Records where child ID in list

I have a site where I have a database of persons and each person can have multiple intrests which is handled through a one to many relationship between a persons table and an interests table. On the site I want to have a serach where you can have a multiple select box of interests and the user can pick as many as they want. What I want t...

Var-Args: Last named parameter not function or array?

This question is about vararg functions, and the last named parameter of them, before the ellipsis: void f(Type paramN, ...) { va_list ap; va_start(ap, paramN); va_end(ap); } I was reading in the C Standard, and found the following restriction for the va_start macro: The parameter parmN is the identifier of the rightmost para...

How to correctly reference multi-dimensional arrays?

I have the following array called "$order" (as printed out by "print_r"): stdClass Object ( [products] => Array ( [0] => stdClass Object ( [data] => Array ( [attributes] => Array ( [ID] => Array ( ...

JavaScript array element to string

i have a simple array and i want to generate string which include all the elements of the array, for example: The array is set as follow: array[0] = uri0 array[1] = uri1 array[2] = uri2 And the output string must be teststring = uri0,uri1,uri2 I've tried to make this following way (using for loop): var teststring = ""; teststrin...

Java : How to sort an array of floats in reverse order ?

I use the following lines to sort an array of floats in reverse order, but I got an error message, what's wrong ? float sortedData[]=new float[100]; ... Arrays.sort(sortedData,Collections.reverseOrder()); Error : cannot find symbol symbol : method sort(float[],java.util.Comparator) location: class java.util.Arrays Arrays.s...

use different string in function?

Hello Code Wizards, I am a total NOOB in programming (but this is only my second question on stackoverflow :-) ). By a foreach function I get 5 different string values for $Loncoord, $Latcoord, $gui; this I can see with the print_r in the code written below: "-5.68166666667","+24.6513888889","IMG_3308", But I now want to create 5 di...

PHP array searching question

I have arrays, some are multidimensional as well. I need a way to know if all the values are NULL. What would be the most efficient and effective way of determining if ALL values of an array (as well as the values of the arrays within that array) are NULL? So basically: search array, if all values are NULL, $flag = true EDIT: The value...

How can i use different string value's in one function ?

Hello evertbody, First i am a beginner in programming in general, i am trying to create a program for using gps locations from Lightroom on a map in googlemaps. When i use the print the strings below ti the screen i see 5 different value's, this is also what i want, but... I want to create also 5 different markers on the map this is d...

array_push() with key value pair

Hi, I have an existing array and I want to add a value to the array. Normally I would use array_push() to accomplish this but somehow it's not working. Here is my code: $data = array( "dog" => "cat" ); array_push($data['pussy'], 'wagon'); I don't simply want to add wagon to the array but also the key pussy so I can retrieve the ...

trim all strings in an array

i have a string that comes in like: string email = "[email protected], [email protected], [email protected]"; i want to split it into an array of strings if i do this: string[] emails = email.Split(','); i get spaces in front of each email address (after the first one) emails[0] = "[email protected]" emails[1] = " [email protected]" emails[2] = " [email protected]" what is the best...

iphone uiwebview array

i want to make an tabbed browser for the iphone.. how do i store uiwebviews in an array and open it with an button like in safari? ...

Arrays.binarySearch doesnt work like it should

I have string array [1, 2, 3] and i search for all of those numbers using Arrays.binarySearch, it find 1 and 2, but with 3 it returns -1. any idea why it works that way? what is better alternative to always working search in array/collection? ...

Javascript dynamic array of strings

Is there a way to create a dynamic array of strings on Javascript? What I mean is, on a page the user can enter one number or thirty numbers, then he/she presses the OK button and the next page shows the array in the same order as it was entered, one element at a time. Code is appreciated. Thanks ...

Turn string into multidimensional Array and then sort it by sub-value within the array

I have a string like this: event name|event description|event type|event date|event time|event details, event name|event description|event type|event date|event time|event details, event name|event description|event type|event date|event time|event details, event name|event description|event type|event date|event time|event details, Th...

how to pass array in php to ruby ?

how do i pass php array's to ruby script as an argument so that ruby script can read php's array. ? ...