arrays

RESOLVED: Puting textboxes in to a TextBox[] array

im trying to create a loop to avoid copy pasting these lines 30 times. the names is sum1 to sum30 br1txt1 to br30txt1 br1txt2 to br30txt2 // decimal sum30 = decimal.Parse(br30txt1.Text) + decimal.Parse(br30txt2.Text); // sumTxt30.Text = sum30.ToString(); but the error im geting is that the textbox array seems to try to put...

passing arrays as url parameter

hi, what is the best way that i can pass an array as a url parameter? i was thinking if this is possible: $aValues = array(); $url = 'http://www.example.com?aParam='.$aValues; or how about this: $url = 'http://www.example.com?aParam[]='.$aValues; Ive read examples, but i find it messy: $url = 'http://www.example.com?aParam[]=va...

Conditional counting in Python

Hello there, not sure this was asked before, but I couldn't find an obvious answer. I'm trying to count the number of elements in a list that are equal to a certain value. The problem is that these elements are not of a built-in type. So if I have class A: def __init__(self, a, b): self.a = a self.b = b stuff = [] ...

Multi-Dimension length array reflection java

How do I find the length of a multi-dimensional array with reflection on java? ...

How to count duplicates in Ruby Arrays

How do you count duplicates in a ruby array? For example, if my array had three a's, how could I count that ...

How to store int[] array in application Settings

Hi, I'm creating a simple windows Forms application using C# express 2008. I'm an experienced C++ developer, but I am pretty much brand new to C# and .NET. I'm currently storing some of my simple application settings using the settings designer and code like this: // Store setting Properties.Settings.Default.TargetLocation = txtLoca...

How to write a single dimension array to a file in php a.k.a. file_put_contents vs fopen+fwrite

Data: $data = array('Alice', 'Bob', 'Carol', 'David', 'Elizabeth', 'Frank'); Method A: file_put_contents('filename.ext', implode("\n", $data) ); Method 2: $fp = fopen('filename.ext', 'w'); foreach($data as $name) { fwrite($fp, $name . "\n"); } fclose($fp); Does one method have any significant penalties over the other? A...

C# Building An Array with Button Entries.

I have a set of buttons that I want to add into an array so that they are ordered. The buttons I have are: Monday0700Button Monday0730Button Monday0800Button Monday0830Button and so on. How do I add a button into an array, and have them ordered, so that I can use this order later on for different uses. Thanks. ...

std vector + default allocator + direct array access?

If I create a std::vector with the default allocator like this: vector<int> myVec = vector<int>(); myVec.push_back(3); myVec.push_back(5); myVec.push_back(8); Does the vector then store the actual data internally into an array of int? Is it possible to get a pointer to this array and iterate directly over it using this pointer? ...

How to get values in an array this way with PHP?

From: $arr = array(array('key1'=>'A',...),array('key1'=>'B',...)); to: array('A','B',..); ...

Java .getText vs. Hard Coded String not returning the same results

I am completely stumped with this one . . . If I call the function below with the following: Search(SearchTextField.getText()); // (Fiberglass was entered) Search("Fiberglass"); // hardcoded I get the following results: Fiberglass 10 Not Here Fiberglass 10 String found! Same String is passed with the same length, different results...

Reading files and deleting repeated letters

Hello! So my goal is to make a function that has a partially filled array of characters as a formal parameter and deletes all repeated letters from the array. So I just need to read a .txt file with it's contents as something like "11 A B C a b c a A g g t " and have the program spit back out "A B C a b c g t" As of now my program spits...

How to return all result rows resulting from a SQL statement execution to the page where the AJAX request came from

How to fetch all result rows in MySQL+PHP? You know, if I use mysql_fetch_assoc() , it only returns one result row as an associative array. I am using AJAX to fetch the data in a MySQL table. $result=mysql_query("select * from questions where announcementid='$taskid'")or die(mysql_error()); How to return the value of $result which i...

javascript object arrays

I need to migrate a code in java to javascript. In java, I am maintaining a hashmap with key = string and value = arraylist of objects I need to implement the same in javascript: this.hashMap = new Hash(); this.hashMapArrayList =[]; ... var hashMapDataSet = new HashMapDataSet(id1,name1,type1); this.hashMapArrayList[0] = hashMapDataSet;...

Parsing every element of an array as an integer

I have a string which I need to split into an array and then perform mathematical functions on each element of the array. Currently I am doing something like this. (Actually, I am doing nothing like this, but this is a very simple example to explain my question! var stringBits = theString.split('/'); var result = parseInt(stringBits[0...

How to read all values in an array returned by a PHP file using AJAX?

I am using AJAX to fetch a multidimensional array, so a multidimensional array is returned to AJAX, how can I deal with the data with AJAX? I need to read all values in the multidimensional array. I use the following code to return the array to AJAX. $resultset=array(); while($row=mysql_fetch_assoc($result)) { $resultset[]=$row; } p...

Initialising arrays in C++

Everywhere I look there are people who argue vociferously that uninitialised variables are bad and I certainly agree and understand why - however; my question is, are there occasions when you would not want to do this? For example, take the code: char arrBuffer[1024] = { '\0' }; Does NULLing the entire array create a performance impa...

C -multidimensional array causes Segmentation Fault (GCC)

Why if I change the size of one of the dimensionality of an array I get a run-time Error: "Segmentation Fault?". Example: #include <stdio.h> #define DIM 8 int main(int argc, char **argv) { int a[3][3][3][3][3][3][3][3][3][3][DIM], b; a[1][1][1][1][1][1][1][1][1][1][1] = 2; b=a[1][1][1][1][1][1][1][1][1][1][1]; p...

Using jQuery to compare two arrays

Hi all, I have two arrays of JavaScript Objects that I'd like to compare to see if they are the same. The objects may not (and most likely will not) be in the same order in each array. Each array shouldn't have any more than 10 objects. I thought jQuery might have an elegant solution to this problem, but I wasn't able to find much onlin...

ObservableCollection turns into an Array after transported using WCF

I got a class called "Board" and one of its property's is an ObservableCollection. When i send the ObservableCollection through WCF (from server to client) end call it from my proxy, it's turned into an Array, which is no good for me. Can i keep the ObservableCollection after being sent, or do i have to kick the Array till it becomes an...