Skip to main content
Filter by
Sorted by
Tagged with
3 votes
2 answers
2k views

Let's say I have a .NET Array of n number of dimensions. I would like to foreach through the elements and print out something like: [0, 0, 0] = 2 [0, 0, 1] = 32 And so on. I could write a loop ...
Jake Pearson's user avatar
  • 27.9k
21 votes
7 answers
61k views

Is there an easy way to iterate over an associative array of this structure in PHP: The array $searches has a numbered index, with between 4 and 5 associative parts. So I not only need to iterate ...
Thomas Owens's user avatar
34 votes
9 answers
28k views

The point of this question is to collect a list of examples of hashtable implementations using arrays in different languages. It would also be nice if someone could throw in a pretty detailed overview ...
mk.'s user avatar
  • 26.2k
12 votes
10 answers
9k views

I have two arrays of animals (for example). $array = array( array( 'id' => 1, 'name' => 'Cat', ), array( 'id' => 2, 'name' => 'Mouse', ) ); ...
AnnanFay's user avatar
  • 9,799
6 votes
9 answers
2k views

Which is better to use in PHP, a 2D array or a class? I've included an example of what I mean by this. // Using a class class someClass { public $name; public $height; public $weight; ...
Teifion's user avatar
  • 112k
4 votes
10 answers
1k views

I am working on a function to establish the entropy of a distribution. It uses a copula, if any are familiar with that. I need to sum up the values in the array based on which dimensions are "...
Ed.'s user avatar
  • 1,402
4 votes
3 answers
5k views

I have two arrays of System.Data.DataRow objects which I want to compare. The rows have two columns A and B. Column A is a key and I want to find out which rows have had their B column changed and ...
Magnus Lindhe's user avatar
40 votes
8 answers
81k views

I have a byte array in memory, read from a file. I would like to split the byte array at a certain point (index) without having to just create a new byte array and copy each byte at a time, ...
Keith Sirmons's user avatar
1 vote
5 answers
5k views

I am trying to build a function in C/C++ to sort an array and replace each value with its "score" or rank. It takes in a double pointer array to an array of ints, and sorts the double pointers based ...
Ed.'s user avatar
  • 1,402
52 votes
8 answers
20k views

Is it possible to actually make use of placement new in portable code when using it for arrays? It appears that the pointer you get back from new[] is not always the same as the address you pass in (...
James Sutherland's user avatar
6 votes
7 answers
17k views

I would like to sort an array in ascending order using C/C++. The outcome is an array containing element indexes. Each index is corespondent to the element location in the sorted array. Example Input: ...
Ed.'s user avatar
  • 1,402
12 votes
6 answers
685 views

I love list comprehensions in Python, because they concisely represent a transformation of a list. However, in other languages, I frequently find myself writing something along the lines of: foreach ...
pbh101's user avatar
  • 10.4k
50 votes
9 answers
20k views

In php, I often need to map a variable using an array ... but I can not seem to be able to do this in a one liner. c.f. example: // the following results in an error: echo array('a','b','c')[$key]; /...
Pierre Spring's user avatar
247 votes
29 answers
441k views

I have been working with a string[] array in C# that gets returned from a function call. I could possibly cast to a Generic collection, but I was wondering if there was a better way to do it, possibly ...
lomaxx's user avatar
  • 116k
177 votes
11 answers
246k views

I have an array in Perl: my @my_array = ("one","two","three","two","three"); How do I remove the duplicates from the array?
David's user avatar
  • 14.1k
28 votes
6 answers
15k views

I have a perl variable $results that gets returned from a service. The value is supposed to be an array, and $results should be an array reference. However, when the array has only one item in it, $...
Rudd Zwolinski's user avatar
42 votes
6 answers
89k views

In the code below For i = LBound(arr) To UBound(arr) What is the point in asking using LBound? Surely that is always 0.
Ronnie's user avatar
  • 8,137
58 votes
8 answers
16k views

I don't remember whether I was dreaming or not but I seem to recall there being a function which allowed something like, foo in iter_attr(array of python objects, attribute name) I've looked over ...
Brendan's user avatar
  • 19.6k
79 votes
9 answers
10k views

I have the following arrays: $artist = ["the roots", "michael jackson", "billy idol", "more", "and more", "and_YET_MORE"]; $count = [5, 3, 9,...
w-ll's user avatar
  • 3,925
97 votes
8 answers
12k views

How do I forcefully unload a ByteArray from memory using ActionScript 3? I have tried the following: // First non-working solution byteArray.length = 0; byteArray = new ByteArray(); // Second non-...
user avatar

1
8360 8361 8362 8363
8364