arrays

Arrays of strings in Managed C++

I'm trying to write an application in Managed C++, but I cannot work out how to declare an array of strings. String^ linet[]; throws an error 'System::String ^' : a native array cannot contain this managed type So I suppose there's a different way to do this for managed data types. What exactly is it? ...

How to detect array size in Java bytecode (FindBugs)

I'd like to find out about the size of an array being allocated by looking at the bytecode, if that information is known at compile time, of course. Background: I want to write a FindBugs detector (which looks at the compiled bytecode) and report certain occurences of array allocations. In order to filter out false positives I am not in...

c# how to equate the elements of two array

hi , i am trying to tally two arrays like myArray{a,b,c} and urArray{a,b,c,c} i wanted to check if both the elements have same elements ,for example in above condition the second array that is 'urArray' has an extra 'c' . and the code should be able to equate two sets of array if they have the same elements or not and the order of th...

Using an associative array as php function's input

Occasionally I'll write a PHP function with a single input, an associative array containing all of that function's inputs. This has benefits such as not having to remember the correct order of inputs, but I've also noticed it makes implementing changes to large codebases much easier; when I need to add another variable, and that variable...

string [,] and repeater

Hello How do I write out my array with a repeater? string[,] month = { {"Januari", "Februari", "Mars", "Apri", "Maj", "Juni", "Juli", "Agusti", "September", "November", "Oktober", "December"}, {"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"} }; Now I can use Container.Data...

Compare two lists or arrays of arbitrary length in C#; order is important

Say I have two lists or arrays of strings. For example: list 1: "a", "c", "b", "d", "f", "e" list 2: "a", "d", "e", "f", "h" List 1 and list 2 are of arbitrary lengths. List 1 may contain elements not in list 2, and visa versa. I'd like to know when items in list 1 are found in list 2, and more specifically I want to know when an i...

Most elegant way to get all subsets of an array in c#

given an array: [dog, cat, mouse] what the most elegant way to create: [,,] [,,mouse] [,cat,] [,cat,mouse] [dog,,] [dog,,mouse] [dog,cat,] [dog,cat,mouse] I need this to work for any sized array. This is essentially a binary counter, where array indices represent bits. This presumably lets me use some bitwise operation to count, but...

Defining a large array of size larger than a unsigned int limit.

Hello, I need to define an array statically (in a *.h) file of size 12884901888 like. unsigned char sram[12884901888]; //All of my code is C. Above declaration gives error and does not work. Because constants used in array declarations are unsigned int. But the constant i need to use (12884901888) is larger than the unsigned int lim...

Java Reflection isArray() always false

Hey anyone, I got a question about Java Reflections: I have to checkout, if a certain field of a class is an array. But my problem is: If i run isArray() on the attribute of the class directly, it works. But if I use it in the way below, it won"t work. I guess because the "real" array is in this Field class? Any idea how i get it to work...

How to set color array into another color arrays?

My below Codes gives me error:"Index was outside the bounds of the array." My Algorithms create Colorset arrays that's arrays dimention '16', But i need Second one 'colorSetLegend' that's dimensions:32 if you look below Bold codes that returns me error. Color[] colorSetLegend = new Color[32]; Color[] colorSet = { Color.Re...

iterating over unknown XML structure with PHP (DOM)

Hi all I want to write a function that parses a (theoretically) unknown XML data structure into an equivalent PHP array. Here is my sample XML: <?xml version="1.0" encoding="UTF-8"?> <content> <title>Sample Text</title> <introduction> <paragraph>This is some rudimentary text</paragraph> </introduction> <description> <paragra...

how to access form array fields with struts2

Hello friends, Currently I am working on one form which contains 2 buttons. Clicking on 1 button I am getting block of html fields as below. ` <table width="100%"> <tbody><tr> <td class="style4" width="12%" align="center">CODE<span class="style3"> </span></td> <td width="18%"><input name="c_code[]" value="" id="c_...

Converting an array of type T to an array of type I where T implements I in C#.

I am trying to accomplish something in C# that I do easily in Java. But having some trouble. I have an undefined number of arrays of objects of type T. A implements an interface I. I need an array of I at the end that is the sum of all values from all the arrays. Assume no arrays will contain the same values. This Java code works. Arra...

C# Multidimensional Arrays Like PHP

Hi Guys, I've been trying to do this for about 6 hours now and i'm stumped.. I want the equivalent of this in C#: $settings = array(); foreach(file('settings.txt') as $l) $settings[]=explode(',',$l); print $settings[0][2]; This is what i've got so far that doesn't work: string fileName = System.IO.Path.GetDirecto...

Why does @my_array = undef have an element?

@my_array = undef; if (@my_array ) { print 'TRUE'; } else { print 'FALSE'; } This will print TRUE Why does the array have an element ? ...

Take a sequence of elements from an array from i to j using C# and extension method

I have an Array<string>. I have to take all elements from i to j. How can I make this using an extension method? ...

What has higher performance used within large loops: .indexOf(str) or .match(regex)?

I have this array.prototype on my page and it seems to be sucking up a lot of processing time: Array.prototype.findInArray = function(searchStr) { var returnArray = false; for (i=0; i<this.length; i++) { if (typeof(searchStr) == 'function') { if (searchStr.test(this[i])) { if (!returnArray) { r...

Array to Active Record Model

Hi everyone! I want to show in a view the tasks for a day in concrete (today). these tasks have an estimated time that must sum 6 hours per day. in the model I have this method: def self.tasks_for_today total_time = 0 r = Array.new all(:conditions => "finished = 0").each do | t | total_time += t.estimated_time r << t if ...

C#: Cleanest way to divide a string array into N instances N items long

I know how to do this in an ugly way, but am wondering if there is a more elegant and succinct method. I have a string array of e-mail addresses. Assume the string array is of arbitrary length -- it could have a few items or it could have a great many items. I want to build another string consisting of say, 50 email addresses from the ...

How can I remove the first element of an array in Objective C?

In Objective C, is there a one-liner or something small to remove (shorten by one) and return the first element of an array, regardless of its index? ...