arrays

return a pointer to a pointer array

I am having trouble freeing a pointer in a pointer array (values). typedef struct MyStruct{ char** values; }MyStruct; In C, I create dynamic array. JSDictionary **array = (JSDictionary **)malloc(sizeof(JSDictionary *) * numRows); The resultSet should be an array of JSDictionary pointers. I create the struct like: JSDictionary * ...

Flattening mixed lists in Python (containing iterables and noniterables)

Possible Duplicate: Flatten (an irregular) list of lists in Python How would I go about flattening a list in Python that contains both iterables and noniterables, such as [1, [2, 3, 4], 5, [6]]? The result should be [1,2,3,4,5,6], and lists of lists of lists (etc.) are certain never to occur. I have tried using itertools.chai...

ActionScript 3: how to create a array or list like: array["name1"] = "hello" (just like you can do in PHP)

hello, in PHP i am used to create a array with using names as keys like array["something1"] = "output1"; array["something2"] = "output2"; array["something3"] = "output3"; and then use foreach to let them print or do other things with it like foreach ($array as $key => $value) { echo "$key = $value"; } is there something similar po...

Using array_key_exists with preg_match

Hi, I'm trying to determine if a match, or matches exist within an array based on a pattern, an example of the array: Array ( [author_id] => 1 [channel_id] => 1 [site_id] => 1 [entry_id] => 6 [url_title] => test_title_with_file2 [title] => Test Title with file [field_id_1_directory] => 1 [field_id_4_dir...

int array size changes

Possible Duplicate: Sizeof an array in the C programming language? Why is the size of my int array changing when passed into a function? I have this in my main: int numbers[1]; numbers[0] = 1; printf("numbers size %i", sizeof(numbers)); printSize(numbers); return 0; and this is the printSize method void printSize(int numb...

Java : convert List of Bytes to array of bytes

Hi All, Trying to solve what should be a simple problem. Got a list of Bytes, want to convert it at the end of a function to an array of bytes. final List<Byte> pdu = new ArrayList<Byte>(); .... return pdu.toArray(new byte[pdu.size()]);; compiler doesn't like syntax on my toArray. How to fix this? ...

How does Array.GetLength(dimension) in C# actually work?

When using Array.GetLength(dimension) in C#, does the size of the array actually get calculated each time it is called, or is the size cached/stored and that value just gets accessed? What I really want to know is if setting a local variable to the length of the dimension of an array would add any efficiency if used inside a big loop or...

How can I speed up array generations in python?

I'm thinking I need to use numpy or some other library to fill these arrays fast enough but I don't know much about it. Right now this operation takes about 1 second on a quad-core Intel PC, but I need it to be as fast as possible. Any help is greatly appreciated. Thanks! import cv class TestClass: def __init__(self): w = 960 ...

Manipulate and loop through nested PHP arrays

Ok... I hate array's... I dont understand them and dont like working with them... but im working on a project where I have no control of the data I am pulling, but need a way to sort it into a format I can manipulate... So, the data looks something like this: $arr = Array ( [1] => Array ( [December] => a date here [December (2)] => a ...

Array in Objective C (iPhone)

Hello, I want to ask about the NSArray in objective C. I want to create a dynamic array as I don't know about the size of the array. And I also want to insert some of the data to the array. However, I don't know how to decl, init and insert the element in to the array. The following is the C++ version. I want to create a empty array A...

Check Arrays with different keys?

How do i check if a specific array key exist and how to compare them? 1. Array looks like this. [33] => Array ( [211] =>objectr ( [name] => Test [id]=> 211 ) ) [23] => Array ...

MATLAB - concatenating items within a cell array

Hi, I have a cell array: X = {1x2} {1x2} X{1} = '' A X{1 2} = 10 113 I wish to concatenate the sub cells in such a way that Y = 10 113A Thanks, S :-) ...

Array not populating correctly

Hi I am using the following code to populate an array: $number = count ($quantitys); $count = "0"; while ($count < $number) { $ref[$count] = postcodeUnknown ($prefix, $postcodes[$count]); $count = $count +1; } postcodeUnknown returns the first row from a mysql query, using a table prefix and an element ...

PHP, print_r($_SESSION) doesn't show its content ?

hi, I want to see the content of the the array $_SESSION with the command print_r($_SESSION) but what I get is just the following output: Array () what am I missing ? thanks ...

Iterating over jQuery $(this).attr('class').split(" ") gives odd results

Hello, I've got a page where I'm trying to fetch arrays of classes for lots of divs which share a common class. For example: <div class="common lorem ipsum"></div> <div class="common dolor sit"></div> <div class="common hello world"></div> I want to fetch each common class div and get an Array of it's classes. At the moment, I'm doi...

PHP: How to convert array to XML with support to attributes (DOMi ?)

I'm using DOMi ( http://domi.sourceforge.net ) to create XML from arrays. But I don't know how to create attributes in these XML (in arrays, so these attributes appear in the XML). How can I construct these arrays so I can get some tags with attributes after the convertion? Thank you! ...

what is the proper way to delete a pointer in an array?

//the setup tiles = new Tile **[num_bands]; for( int i = 0 ; i < num_bands ; i++ ) tiles[i] = new Tile *[num_spokes]; for(int i=0; i < num_bands; i++){ for(int ii=0; ii < num_spokes; ii++){ tiles[i][ii] = 0; } } //the problem delete tiles[1][1]; When I delete a tile, tiles[1][1] still holds an address. I thought ...

Index was outside the bounds of the array

I am getting "Index was outside the bounds of the array." error when using this code: Dim RandomA As String = "aAÀàÁâÄäÅåĀāĂ㥹ǞǟǺǻÃãÄ" TextBox1.Text = TextBox1.Text.Replace("a", RandomA((Int(Rnd() * RandomA.Count)) - 1)) I fail to see how the (random) index can be out of bounds? ...

how to find length of array class in ruby

$param=k.chomp.split("\t") how to find the lenght of $param thats is having class array. actully when i m writing puts $param.class i got the o/p like Array. now how to find the length of this array plzz help me i tried with $param.length but its not working ...

NSScanner to separate sentence into words (Objective C)

I have a string "So: lets make some noise!" and I would like it to be displayed one word at a time on the screen. How can I go about this? NSScanners? I am new to objective C and really need some help... thank you! for example. the first word i see is "So:" the second word i see is "Lets"...with the last word being "noise!" It must be c...