arrays

Does array resizing invoke the GC?

Hi, I looked into the implementation of Array.Resize() and noticed that a new array is created and returned. I'm aiming for zero memory allocation during gameplay and so I need to avoid creating any new reference types. Does resizing an array trigger the Garbage Collector on the previous array? I'm creating my own 2D array resizer, but ...

Getting an union of two arrays in jQuery

Say I have an array of [34,35,45,48,49] and another array of [48,55]. How can I get a resulting array of [34,35,45,48,49,55]? ...

Merging overlapping ranges in PHP arrays?

I have an array in the following format: array( 0 => array(1, 5), 1 => array(4, 8), 2 => array(19, 24), 3 => array(6, 9), 4 => array(11, 17), ); Where each item is a X-to-Y range. What I would like to merge the overlapping ranges in the array, to get something more like this: array( 0 => array(1, 9), // 1-5, 4-8 and 6-9 a...

Using an Array of Ranges in VBA - Excel

Does VBA support using an array of range variables? dim rangeArray() as range dim count as integer dim i as integer count = 3 redim rangeArray(1 to count) for i = 1 to count msgbox rangeArray(i).cells(1,1).value next I can't get it to work in this type of application. I want to store a series of ranges in a certain order as a "ma...

Checkbox array $_POST[data] from multipart/form-data?

I am stumped. (But then I'm no expert programmer!) I had modified a working form to include an upload script but now that it's using enctype="multipart/form-data" I can no longer seem to get at the checkbox array $_POST data. It sees it as an array, which is good I guess, but I haven't managed to do anything with it. So right now mysql...

Unable to access array member - UPDATED

I have a PHP function that returns an array. This is the output of print_r($myArray): Array ( [id] => 8166 [customer_id] => 73 [nickname] => AnnieB [name] => Anastasia Beaverhausen [email] => [email protected] [phone] => 555-555-5555 [company] => Annie B's [address1] => 123 Main Street [address2] => Apartment 555 [city] => Chi...

ruby narray concatenation

Given say 2x3 and mx3 arrays (I have used NArray): how to construct a (2+m)x3 array, the concatenation of each. + or << do not keep the elements properly aligned. e.g. a = [[1,2,3],[4,5,6]] b = [[1,2,3,4],[5,6,7,8]] # should be concatenated as: # [[1,2,3,1,2,3,4],[4,5,6,5,6,7,8]] Thanks. ...

Objective C --- Array is readable in a (void) function but not an (IBAction)

Hey all, I have an array that holds all of the .aif file paths in my app, which I found by using mainBundle and resources. This array needs to be passed down through 2 view controllers to reach where it is actually used. The problem is, it either crashes or logs something totally wrong. When I debug I get an EXC_BAD_ACCESS note at the c...

Php concatenation of arrays.

I have the next array($columsData): Array ( [avatar] => Array ( [title] => Avatar [sort] => [no_html_escape] => 1 ) [title] => Array ( [title] => Title [sort] => ) ) And how can i make this array like this: Array ( [id] => Array ...

append items to an array with a macro, in C

Hi, i have an array (C language) that should be initialized at compile time. For example: DECLARE_CMD(f1, arg); DECLARE_CMD(f2, arg); The DECLARE_CMD is called from multiple files. I want this to be preprocessed in. my_func_type my_funcs [] = { &f1, &f2 } It is possible, with a macro, to append items to an static array? I...

split array values when there is a comma

hi i'm able to split a string into an array $array = preg_split("/[\s]*[,][\s]*/", $category); RESULT Array ( [0] => jquery[1] => bla[2] => bla); but now i have a database with a row holding all by categories ("cat1, 2, 3, ..") - multiple records have similar categories- so in order to create a quick "category" menu i'm using th...

C# String Array Replace Last Element

Hi, i have a String Array which comes from a splitted String string[] newName= oldName.Split('\\'); newName.Last().Replace(newName.Last(), handover); Why doesnt this replaces my last element in the Array? last() comes from using linq regards ...

Perl Arrays and grep

I think its more a charachters, anyway, I have a text file, consisted of something like that: COMPANY NAME City Addresss, Address number Email phone number and so on... (it repeats itself, but with different data...), lets assume thing text is now in $strting variable. I want to have an array (@row), for exa...

A better php array_merge

Hi, I am looking to do this a better way without the need to hardcode the integers for $justPrices[$i]: $pricesResult = array_merge($justPrices[0], $justPrices[1], $justPrices[2], $justPrices[3]); $justPrices is a multidimensional array, containing 4 'bands' of prices within each array. The data for $justPrices being for example: Ar...

doctrine - DQL query for getting specific columns from the table

Hi! I had created the following table method in order to extract some specific table columns to allow later comparison to values stored on arrays: public function findAllComposedExcelColumns() { $q = Doctrine_Query::create() ->select('p.branch_code, p.state_id, p.state_description, p.account, p.client_name') ->fro...

When is it appropriate to use a cell array vs. a struct in Matlab?

If I want to store some strings or matrices of different sizes in a single variable, I can think of two options: I could make a struct array and have one of the fields hold the data, structArray(structIndex).structField or I could use a cell array, cellArray{cellIndex} but is there a general rule-of-thumb of when to use which data ...

How to write multiple arrays in plist in iPhone?

Hi friends, I have ten arrays in my application. I want to write those array values into the (document s directory)plist. Is possible to put 10 arrays into the one plist?.Else i will create separate plist for each arrays. Which one is possible to implement my application?. Please guide me and give some sample links. Thanks ...

Php Sorting a multi-dimensional array by field name

Hello I have tried adapting this code to use to sort a multidimensional array on a named key/field. The field is an integer what I need to sort smallest to biggest. function myCmp($a, $b) { return strcmp($a["days"], $b["days"]); } uasort($myArray, "myCmp"); This sorts the arrays as I need but in the wrong order. At the moment it ...

How can I get a key => value out of this foursquare hash?

Here is what it looks like: { "groups" => [ { "venues" => [ { "city" => "Madrid", "address" => "Camino de Perales, s/n", "name" => "Caja Mágica", "stats" => {"herenow"=>"0"}, "geolong" => -3.6894333, "primarycategory" => { "iconurl" => "http://foursquare.com...

How to get the C pointer array length?

Is there any method like the Java can .length from a C point array? Thank you. ...