arrays

Missing Array element in UserControl XAML?

This is actually two questions in one: First, when you write your XAML and Intellisense fails to recognize the type you want to use (in my case, Array), what steps do you go through to figure out what's going on? I initially look over my XML namespaces to make sure that everything looks like it's in order. If it's a CLR type (not one ...

javascript save dynamic object in someplace for resuse byother methods later on!

i want to save javascript object in a place, so if selected row is getting trigger, i can use that row object again by different methods. maybe saving it in input hidden field can work? but not sure.. how would you do it? im trying to do following, but that dont work, obviously my code is wrong, but i want to show you, so you can maybe...

How to fill an array from file stream dynamically in C

I'm trying to combine words from characters which i'm reading from a file. The problem is in the combining the characters. The way I'm doing it is the following: char *charArr while( (readChar = fgetc(fp)) != EOF ){ charArr[i] = readChar; i++; } ...

Sizeof an array in the C programming language?

why isn't the size of an array sent as a parameter the same as within main? #include <stdio.h> void PrintSize(int p_someArray[10]); int main () { int myArray[10]; printf("%d\n", sizeof(myArray)); /* as expected 40 */ PrintSize(myArray);/* prints 4 not 40 */ } void PrintSize(int p_someArray[10]){ printf("%d\n", sizeof(...

dynamic array key additions (sucky title, i know)

precode: $keys = array('a', 'b', 'c', 'd'); $number = 10; code: eval('$array[\''.implode('\'][\'',$keys).'\'] = $number;'); result: Array ( [a] => Array ( [b] => Array ( [c] => Array ( [d] => 10 ) ) ) ) problem...

MATLAB Array Manipulation

I'm trying to insert multiple values into an array using a 'values' array and a 'counter' array. For example, if: a=[1,3,2,5] b=[2,2,1,3] I want the output of some function c=somefunction(a,b) to be c=[1,1,3,3,2,5,5,5] Where a(1) recurs b(1) number of times, a(2) recurs b(2) times, etc... Is there a built-in function in MATLAB ...

C Idioms and little known facts

Okay, I've seen many posts here about odd idioms and common practices in C that might not be initially intuitive. Perhaps a few examples are in order Elements in an array: #define ELEMENTS(x) (sizeof (x) / sizeof (*(x))) Odd array indexing: a[5] = 5[a] Single line if/else/while/for safe #defines #define FOO(X) do { f(X); g(X); } ...

Save PHP array to MySQL?

What is a good way to save an array of data to a single mysql field? Also once I query for that array in the mysql table, what is a good way to get it back into array form? Is serialize and unserialize the answer? ...

please tell what this php code is doing. (.net reference)

please tell me what is below code doing? is it creating array with two values or its creating to string index which will take value later? var $requiredValues=Array( 'MaxResponses', 'AvailableOnlyIndicator' ); ...

A quick and easy way to join array elements with a separator (the oposite of split) in Java

See Related .NET question I'm looking for a quick and easy way to do exactly the opposite of split Someith that will cause ["a","b","c"] to become "a,b,c" Iterating through an array requires either adding a condition (if this is not the last element, add the seperator) or using substring to remove the last seperator I'm sure there i...

Is it a god awful idea to generate lots of nested arrays in PHP?

I want to transform the 'values' array created by xml_parse_into_struct() into a bunch of nested arrays which I can walk recursively. This is for a very simple XML class which will hierarchically search the document like so: $xml_data = " <sometag> <someothertag> <somedata>foo</somedata> </someothertag> <someothertag...

Google Collections equivalent to Apache Commons Collections ArrayUtils.toObject and ArrayUtils.toPrimitive

Since everyone praises Google Collections (e.g. in here) How come I can't find the equivalent of ArrayUtils.toObject() and ArrayUtils.toPrimitive()? is it that unusable? did I miss it? ...

view multi-dimensional array values debugging in Visual C++

Hello, I'm trying to debug some C++ code but I can't see the values in a multi-dimensional array while debugging I have a dynamically allocated pointer (double **A). When I try to watch the value of this array I just get the first value, I can't see the remaining values. Any ideas? TIA ...

Basic ruby array code: Testing if an array has a specific integer

I'm trying to test if an array has a specific integer in it. Right now I'm using this test; def admin? current_user.role_ids == [1,2] || current_user.role_ids == [2] || current_user.role_ids == [1,2,5] end The code works, but I'd prefer to just test for the integer "2" rather than explicitly write out every possible combination...

What is the best way to store and retrieve an array in PHP/MySQL DB

Lets say I wanted to build an app that will pull url links from a database and show 50 on a page. I am just using links as an example. What if I had to store multiple values, an array into 1 mysql field for each link/record posted. If there is 5 items for every Link, I could have an array of 5 items on the page, a list of 5 items s...

How to process a large ActiveRecord result set in groups

I'm wondering if there is a way to take an array of ActiveRecord results (or any array, for that matter) and process it in groups of 25 or so. Something like this: User.all.each(25) do |group| # Some code that works with this group of 25 end I'm just looking to avoid doing multiple successive database queries. Thanks! ...

Array Manipulation

I have an array something like this.. [0] => english [1] => 85 [2] => mathematics [3] => 75 [4] => science [5] => 71 [6] => social [7] => 92 I want all values with even indexes to go as keys and all values odd indexes to go values. Like this [english] => 85, [mathematics] => 75 [science] => 71 [social] => 92 Is there any good funct...

Unable to cast from object array to a string array

This is my function. public Dictionary<string, string> ArrayToDictionaryConverter(object [] objArray) { string[] strArray = new string[objArray.Length]; strArray =(string[])objArray; Dictionary<string, string> dictionary = null; try { dictionary = new Dictionary<string, string>();...

JavaScript Array rotate()

I was wondering what was the most efficient way to rotate a JavaScript array. I came up with this solution, where a positive n rotates the array to the right, and a negative n to the left (-length < n < length) : Array.prototype.rotate = function( n ) { this.unshift( this.splice( n, this.length ) ) } Which can then be used this way...

gridview problem...part two

sorry for asking this question again but i didnt get much help on the last one (maybe due to the holidays or because my question was a bit confusing). im trying to load images from the "drawable folder" into a gridview. unlike the "hello android gridview" tutorial i dont know the name of the images being loaded into the gridview (as th...