arrays

C# adding string elements of 4 different string arrays with each other

Hello. I need an advice about how to create new string array from 4 different string arrays: We have 4 string arrays: string[] arr1 = new string [] {"a1","a2","a3"..., "a30"}; string[] arr2 = new string [] {"d10","d11","d12","d13","d14","d15"}; string[] arr3 = new string [] {"f1","f2","f3"...,"f20"}; string[] arr4 = new stri...

Optimizing for speed - 4 dimensional array lookup in C

I have a fitness function that is scoring the values on an int array based on data that lies on a 4D array. The profiler says this function is using 80% of CPU time (it needs to be called several million times). I can't seem to optimize it further (if it's even possible). Here is the function: unsigned int lookup_array[26][26][26][26]; ...

java: Read text file and store the info in an array using scanner class

Hi, I have a text file include Student Grades like Kim $ 40 $ 45 Jack $ 35 $ 40 I'm trying to read this data from the text file and store the information into an array list using Scanner Class could any one guied me to write the code correctly ? Here is what I have so far import java.io.*; import java.util.*; public class ReadStu...

Extracting the most duplicate value from an array in JavaScript (with jQuery)

I have several array to deal with. I need to extract the most duplicate value from each array. From [3, 7, 7, 7], I need to find the value 7. Each array size is 4. For now, I don't have to think about when the most duplicate values are more than one such as [3, 7, 7, 7]. All the values are a number. I looked around the web. I found se...

How to check if an array value exists

How can I check this: $something = array('say' => 'bla', 'say' => 'omg'); How can I check if the $something['say'] has the value of 'bla' or 'omg' Best Regards, ...

Filtering a PHP array containing dates into a yearly summary

I'm looking at a way to create a summary of transactions within a certain month based on the contents of a PHP array. Intended outcome (excusing layout): ------------------------------------------- | December 2009 | 12 | | January 2010 | 02 | | February 2010 | 47 | | Mar...

php getting unique values of a multidimensional array

Possible Duplicate: php multi-dimensional array remove duplicate I have an array like this: $a = array ( 0 => array ( 'value' => 'America', ), 1 => array ( 'value' => 'England', ), 2 => array ( 'value' => 'Australia', ), 3 => array ( 'value' => 'America', ), 4 => array ( 'value' => 'England', ), ...

Array's index and argc signedness

Hello, The C standard (5.1.2.2.1 Program startup) says: The function called at program startup is named main. [...] It shall be defined with a return type of int and with no parameters: int main(void) { /* ... */ } or with two parameters [...] : int main(int argc, char *argv[]) { /* ... */ } And later says: Th...

Easy - Read a file into a array

So I have a .dat file that just holds a list of names, each name is on a new line. I am having a day of complete mental blanks but how would I go about getting those names out of the file and puting them into a array. Thanks for any help ...

Array increment operator

Could any one please tell me the meaning of "++" with array in the following code in Java: int [ ] arr = new int[ 4 ]; for(int i = 0; i < arr.length; i++){ arr[ i ] = i + 1; System.out.println(arr[ i ]++); } what is arr[ i ]++ meaning in above code, and why we can't do like: arr[ i ]++ = i + 1; ...

Android which button index from array was pressed

How do I set up a OnClickListener to simply tell me which index button was pressed from an array of buttons. I can change text and color of these buttons using the array. I set them up like this. TButton[1] = (Button)findViewById(R.id.Button01); TButton[2] = (Button)findViewById(R.id.Button02); TButton[3] = (Button)findViewById(R...

How to overwrite an array of char pointers with a larger list of char pointers?

My function is being passed a struct containing, among other things, a NULL terminated array of pointers to words making up a command with arguments. I'm performing a glob match on the list of arguments, to expand them into a full list of files, then I want to replace the passed argument array with the new expanded one. The globbing is...

How can I pull a Google Doc spreadsheet into a PHP array?

Is it possible for me to access a Google Docs spreadsheet (possibly as a CSV file?) and build that into a PHP array? ...

C# wrapper for array of three pointers

I'm currently working on a C# wrapper to work with Dallmeier Common API light. See previous posting: http://stackoverflow.com/questions/2430089/c-wrapper-and-callbacks I've got pretty much everything 'wrapped' but I'm stuck on wrapping a callback which contains an array of three pointers & an array integers: dlm_setYUVDataCllback in...

Problem with Global Array in PHP

Hi guys,, need some help pls.. i have a PHP code here that lets a user send a message to multiple recipients using the "phonebook" (from database) as the main list. I used an array to temporarily hold all the desired recipients for the current user. So I have a two box, with each for displaying. The user will clicks the name from the p...

adding array values

Array ( [0] => Array ( [datas] => Array ( [name] => lorem [id] => 1 [type] => t1 [due_type] => Q1 [t1] => 1 [t2] => 1 [t3] => 1 ) ) [1] => Array ( [datas] => Array ...

Finding and marking the largest of three values in a two dimensional array

I am working on a display screen for our office, and I can't seem to think of a good way to find the largest numerical value in a set of data in a two dimensional array. I've looked at using max() and also asort() but they don't seem to cope with a two dimensional array. I'm returning my data through our mysql class, so the rows are ret...

getting values of multiple selectboxes via jquery

I want to fill an array in javascript that takes all the values out of different selectboxes with the same name so for example if i have a html like this: <select name="selectbox[]"> <option value="value1">text1</option> <option value="value2">text2</option> </select> <select name="selectbox[]"> <option value="value1">text1</option> <...

Switch two items in associative array PHP

Example: $arr = array('apple'=>'sweet','grapefruit'=>'bitter','pear'=>'tasty','banana'=>'yellow'); I want to switch the positions of grapefruit and pear, so the array will become 'apple'=>'sweet','pear'=>'tasty','grapefruit'=>'bitter','banana'=>'yellow') I know the keys and values of the elements I want to switch, is there an eas...

C++ expected constant expression

#include <iostream> #include <fstream> #include <cmath> #include <math.h> #include <iomanip> using std::ifstream; using namespace std; int main (void) { int count=0; float sum=0; float maximum=-1000000; float sumOfX; float sumOfY; int size; int negativeY=0; int positiveX=0; int negativeX=0; ifstream points; //the points to be imported ...