hello, does anybody know how could I get the TWO most largest values from the third column on the following array?
$ar = array(array(1, 1, 7.50, 'Hello'),
array(1, 2, 18.90, 'Hello'),
array(3, 5, 11.50, 'Hello'),
array(2, 4, 15.90, 'Hello'));
Output should be:
15.90
18.90
Thanks...
I am experimenting with calling delegate functions from a delegate array. I've been able to create the array of delegates, but how do I call the delegate?
public delegate void pd();
public static class MyClass
{
static void p1()
{
//...
}
static void p2 ()
{
//...
}
//...
static pd[]...
Hi all,
Let's make this very easy. What I want:
@array = qw/one two one/;
my @duplicates = duplicate(@array);
print "@duplicates"; # This should now print 'one'.
Thanks =)
...
I should preface this by saying I'm working on a pocket PC app and the data files live on sd cards.
I have an app that has to create an array of size x.
malloc is failing every time.
I've got a 1 gig file on a 4 gig card.
I've got 64 megs of onboard memory (ram/data/application/os)
I can't process the data because the array I need ...
In C++ I'd like to do something like:
int n = get_int_from_user();
char* matrix = new char[n][n];
matrix[0][0] = 'c';
//...
matrix[n][n] = 'a';
delete [][] matrix;
but of course this doesn't work. What is the best way to do something similar? I've seen some solutions to this but they seem pretty messy.
...
Hey!
Is there any way to check if a given index of an array exists?
I am trying to set numerical index but something like 1, 5, 6,10. And so I want to see if these indexes already exist and if they do just increase another counter.
I normally work with php but I am trying to do this in c++, so basically I am trying to ask if there is a...
If I've got an array of values that are basically zerofilled string representations of various numbers and another array of integers, will array_intersect() still match elements of different types?
For example, would this work:
$arrayOne = array('0003', '0004', '0005');
$arrayTwo = array(4, 5, 6);
$intersect = array_intersect($arrayOn...
How do you draw the following dynamic 3D array with OpenGL glDrawPixels()?
You can find the documentation here: http://opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/drawpixels.html
float ***array3d;
void InitScreenArray()
{
int i, j;
int screenX = scene.camera.vres;
int screenY = scene.camera.hres;
arra...
How have you explained nested arrays to a programmer. I'm thinking someone that has an entry level understanding of programming, but is trying to do more complicated coding.
The array with array works, but they can't quite get their mind around the idea.
Edit: example of a nested array:
array(
'array1' => array(
'key1' => ...
A PHP array can have arrays for its elements. And those arrays can have arrays and so on and so forth. Is there a way to find out the maximum nesting that exists in a PHP array? An example would be a function that returns 1 if the initial array does not have arrays as elements, 2 if at least one element is an array, and so on.
...
I have a multidimensional array. I need to search it for a specific range of values, edit those values and return the edited data.
Example array:
array(3) {
["first"]=>
array(1) {
[0]=>
string(4) "baz1"
}
["second"]=>
array(1) {
[0]=>
string(4) "foo1"
}
["third"]=>
array(1) {
[0]=>
string(4) "foo...
function array_value_from_key($array,$key)
{
return !empty($array[$key]) ? $array[$key] : null;
}
The reason I ask is because I have a class function that returns an array.
Instead of having to do
$myArray = myClass::giveMeArray();
$myValue = $myArray[$myKey];
I'd like to do something along the lines of
$myValue = array_value...
Hi,
Is there any performance difference between the for loops for primitive array?
Assume
double[] doubleArray = new double[300000];
for (double var: doubleArray)
someComplexCalculation(var);
or
for ( int i = 0, y = doubleArray.length; i < y; i++)
someComplexCalculation(doubleArray[i]);
Test result
I actually went and...
I need to see if a string value matches with an object value, but why won't this work?
public int countPacks(String flavour) {
int counter = 0;
for(int index = 0; index < packets.size(); index++) {
if (packets.equals(flavour)) {
counter ++;
}
else {
System.out.println("Yo...
Is there an efficient way to take a subset of a C# array and pass it to another peice of code (without modifying the original array)? I use CUDA.net which has a function which copies an array to the GPU. I would like to e.g. pass the function a 10th of the array and thus copy each 10th of the array to the GPU seperately (for pipelining p...
I've got this python dictionary "mydict", containing arrays, here's what it looks like :
mydict = dict(
one=['foo', 'bar', 'foobar', 'barfoo', 'example'],
two=['bar', 'example', 'foobar'],
three=['foo', 'example'])
i'd like to replace all the occurrences of "example" by "someotherword".
While I can already think of a f...
Why is the generic.list slower than array?
...
How can I find out the number of dimensions in an array in Classic ASP ( VBScript ) .
I am being passed an Array with multiple dimensions but I only want to look at the last. Seems easy in other languages.
...
I am modifying some code and came across a declaration that I am having trouble understanding:
int *arr[3][4] = {0};
What exactly is this pointing to? Is it a matrix where every element is a pointer? Or is it pointing to a matrix of size [3][4]?
Thanks
...
I have just noticed that a multidimensional array in C#, does not implement IEnumerable<T>, while it does implement IEnumerable. For single-dimensional arrays, both IEnumerable<T> and IEnumerable is implemented.
Why this difference ? If a multi-dimensional array is IEnumerable, surely it should also implement the generic version ? I no...