arrays

A List of varying types?

Id' like to create a list of data that will be passed from method to method, however I can't use a struct because the data that will be contained in this list will vary depending on the input. For example if (x == 1) { a = 1 b = true c = 42 d = "hello" } if (x == 2) { a = 2 b = 'g' c = "sup" } I believe my o...

Multiple Variables into 1 in a URL

I am looking to have a list of arguments passed across in an a URL. $url['key1']=1; $url['key2']=2; $url['key3']=3; $url['key4']=4; $url['key5']=5; $url['key6']=6; $url['key7']=7; Please Note I am trying to pass this in the URL in 1 GET variable. I know this would be better done by ?key1=1&key2=2&key3=3...etc but for reasons that are ...

Array.Copy vs Buffer.BlockCopy

Array.Copy and Buffer.BlockCopy both do the same thing, but BlockCopy is aimed at fast byte-level primitive array copying, whereas Copy is the general-purpose implementation. My question is - under what circumstances should you use BlockCopy? Should you use it at any time when you are copying primitive type arrays, or should you only use...

Why do I get a StackOverflowException when I specify the size of an INTEGER array to be 200,000,000?

200,000,000 is much less than the maximum 32-bit INTEGER, 2,147,483,647. ...

passing JavaScript array of long to code behind?

I have returned object from signature device and when i make quick watch on it, it told me that its an array of long and when i pass it to web method in my code behind (vb.net) it gives me nothing. i need some help.. note: i'm using an activeX to capture the signature from the device. this is javascript code : function OnSave() { ...

Jagged PowerShell array is losing a dimension when only one element exists

I have the following PowerShell function that works well for any input except for 1. If I pass it an input of 1 it will return an array with two elements 1,1 instead of a single element which is itself an array of two elements (1,1). Any ideas how I can make PowerShell return a jagged array with one element that is itself an array? fu...

Match a string to a value in an array and return the id of that value in JavaScript

Lets say I have the following array in JavaScript: var skins = new Array('Light', 'Medium', 'Dark'); How would I go about checking to see what ID in that array (0, 1, or 2) has a matching value to a string I give it. So for example, if I look at a string of 'Medium', I should be returned the ID 1. ...

What is the Maximum Size that an Array can hold?

In C# 2008, what is the Maximum Size that an Array can hold? ...

Removing duplicate values from a PowerShell array

How can I remove duplicates from a PowerShell array. $a = @(1,2,3,4,5,5,6,7,8,9,0,0) ...

How do I create a mutable array of CGImageRefs?

I want to keep a mutable collection of CGImageRefs. Do I need to wrap them in NSValue, and if so how do I wrap and unwrap them properly? Can I get away with using a C array? If so how do I construct it and how do I add elements to it later? Is it significantly more costly to use UIImages instead of CGImageRefs as the elements of the coll...

Combine two arrays on a key?

If I wanted to associate items from one array with another array via identical values, eg. items.group_id -> groups.group_id, is there an array function to do that neatly? =) I have two arrays: $items = array( [0] => array( 'group_id' => 456, 'item_id' => 123, ...

Fastest way to get a random value from a string array in C#?

What's the fastest way to get a random value from a string array in C# on the .net 2.0 framework? I figured they might have had this: string[] fileLines = File.ReadAllLines(filePath); fileLines.GetRandomValue(); Yes, I know GetRandomValue() is not an actual method, is there something similar that's more or less equally short and sweet...

Flash: How to change a text fields' textFormat on the fly/per action in AS3?

Hi :) my question today is how to change a textFormat on a textfield. I have a textFormat that has white text and one that has green text, on a button rollover I need to swap that textFormat on my textField to one that has green text. The textFields are getting their .text data from an Array to complicate things... Arrays, Text Forma...

Why do arrays support IList?

The IList interface requires an Add method. Arrays implement this function but it simply throws a NotImplementedException. This seems like very bad design to me. What were the designers thinking when they did this? ...

Compile error when adding ActionListener to Array created GUI

I had a huge file for creating this GUI and I have shortened by using arrays. I am trying to add an ActionListener when the arrays are being added and I am getting this error /tmp/jc_3531/GUI.java:60: addActionListener(java.awt.event.ActionListener) in javax.swing.AbstractButton cannot be applied to (GUI) nButtons[c].addActionList...

How to convert array to SimpleXML in PHP

I was wondering if anyone knew how to convert an array to a Simplexml object in PHP. Thanks ...

C pointer array scope and function calls

I have this situation: { float foo[10]; for (int i = 0; i < 10; i++) { foo[i] = 1.0f; } object.function1(foo); // stores the float pointer to a const void* member of object } object.function2(); // uses the stored void pointer Are the contents of the float pointer unknown in the second function call? It seems ...

What is it called when you use object... as a parameter?

I have noticed in Java that you can have a function with object... as a parameter and then method will take any number of objects as a parameter and treat it as an array. What is this called? I have been trying to search for it but it seems ... is ignored by search engines. I seem to remember printf in C does the same thing. Thanks. ...

finding kth largest element in an array implemented bag

we have a collection of comparable held in a bag and have to find the kth largest element. I copied to a hashSet to remove duplicates then converted the hash set to an array to be sorted and consequently the kth element accessed. its compiling but fails the testing, and I can't figure out whats wrong. any ideas? public E kth(int K){ ...

Add different delimiters in javascript toString()..??

Hi, normally JavaScript’s toString() method returns the array in a comma seperated value like this var myArray = [ 'zero', 'one', 'two', 'three', 'four', 'five' ]; var result = myArray .toString(); And it returns the output like this zero,one,two,three,four,five. But I have a requirement to represent the result in this format zero...