arrays

How to clear an array in Visual C#

I have an array of ints. They start out with 0, then they get filled with some values. Then I want to set all the values back to 0 so that I can use it again, or else just delete the whole array so that I can redeclare it and start with an array of all 0s. ...

How to find if a value is in an array in Visual C#

If I have an array of ints, and I want to quickly check if a certain int value is in that array, is there a method to do that? ...

C# arrays: finding custom minimal element

How do I specify a custom code for comparison when finding a minimal element in my Array? For example, I have two arrays: int[] a = new int[] {3, 6, 8}; int[] b = new int[] {9, -2, 5}; I want to figure out, what would be the minimal ratio of the elements with respective indexes (i.e. find minimum of 3/9, 6/(-2) and 8/5) and then retu...

How can I access the values from `Series.Values` (Excel Chart)

I am using the Microsoft.Office.Interop.Excel namespace and I am creating a chart. At a certain moment, I want to retrieve the values of a certain series. On MSDN it says that a Series object has a property Values. This returns either a Range object or an array of values, I assume an object[]. In my code I have the following statement: ...

dynamic formation of array with incremental depth in PHP

I want to use a function to recursively scan a folder, and assign the contents of each scan to an array. It's simple enough to recurse through each successive index in the array using either next() or foreach - but how to dynamically add a layer of depth to the array (without hard coding it into the function) is giving me problems. Her...

Javascript - How to access Arrays of Records

I have an array comprising records v = [{stringA, stringB, arr[{stringC,stringD}] When I try to extract the value of stringA and stringB, Javascript returns {Object, Object} I am trying to use strX = v[4].arr[2].stringC; (this approach works when extracting stringA and stringB, but not when extracting stringC) Please, does an...

Bind ItemsControl with ItemsSource to the array index

Hi I want to bind an ItemsControl to an array of object, using ItemsSource and DataTemplate. And I want to show the index of each item. Like Customer 1: Name: xxxx Age:888 Customer 2: Name: yyy Age: 7777 ...

How to read till end of file in MATLAB?

I have a file a.txt: 03,17.406199 05,14.580129 07,13.904058 11,14.685388 15,14.062603 20,14.364573 25,18.035175 30,21.681789 50,22.662820 The number of rows in the file are not known. I want to read the file and store 3 5 7 11 15 20 30 50 in one array and the float values in another. How do I read in a file when the length of dat...

How to add an element To Array

Hmm.. thats realy different problem I fetch $links from db linke this $links = $db->GetAll("SELECT * FROM {$tables['link']['name']} WHERE STATUS = '2' AND CATEGORY_ID = ".$db->qstr($id)." {$feat_where} {$expire_where} ORDER BY {$sort_cols[$sort]} {$sort_ord[$sort]} {$limit}"); The array looks like this array(28) { ["ID"]=> str...

How to declare a two dimensional array most easily in PHP?

Like : declare int d[0..m, 0..n] ...

How to get the maximum of more than 2 numbers in Visual C#?

I have an array of five numbers and an array of 2 numbers. How would I find out the largest number among these 7 numbers? Is there a method that can make things easier? ...

How to get the second highest number in an array in Visual C#?

I have an array of ints. I want to get the second highest number in that array. Is there an easy way to do this? ...

How to easily order an array from largest to smallest in Visual C#?

I have a small array of ints. I want to reorder the array from largest to smallest. Is there a method to do this? ...

How to sort an array of objects in Visual C#?

I have an object that has two members that are both integer values. I made an array of these objects. Each objects values are filled with random integers. I want to sort the array of objects according to the first member value. How would I do this? ...

Sql results into php array.

Hi, I would like to create an array (in php) from sql results like this: We have the sql-table "Posts" which stores the Name and the Message.Example: Name | Message John | Hello Nick | nice day George | Good bye John | where What i want is to output the names of people who have posted a message but dont display...

Reading values from file stream and storing them into a variable size array - OpenGL and C

Hi, I am trying to read the following file (The comments are not there in the original): Tetra.tri 4 4 // tot number of vertexes & tot number of triangles 0.693361 0.693361 0.693361 // vertex coordinates 0.693361 -0.693361 -0.693361 -0.693361 -0.693361 0.693361 -0.693361 0.693361 -0.693361 3 1 2 3 // triangles to display (the 3...

How to retain array in javascript?

Here's some code that has two arrays(np and op), one a copy of the other However, when I modify the copy, the original is also modified! take a look: <script type="text/javascript"> var op=new Array(0, 0); var np=op; np[1]=2; document.write(op+"<br>") document.write(np) </script> Is there any way to retain the original and modify the...

PHP Array to List

How do I go from this multidimensional array: Array ( [Camden Town] => Array ( [0] => La Dominican [1] => A Lounge ) [Coastal] => Array ( [0] => Royal Hotel ) [Como] => Array ( [0] => Casa Producto [1] => Casa Wow ) [Florence] => Array ( [0] => Florenciana Hotel ) ) to this <ul> Camden Tow...

Getting javascript to search an array within an array

I have the following javascript to loop through an array of records, and alert the number of matches found within the array, for each field: mymusic=[{title:"a",artist:"b",artwork:"c",tracks:[{tracktitle:"d",trackmp3:"e"}]}]; tracksArray=[]; trackTitles=[]; var albumScore=0; var artistScore=0; var tracksScore=0; stringToSearchFor="...

Passing a pointer to a char array to a function

I have a pointer to my char array like this. unsigned char *recvBuf; recvBuf = (unsigned char *)malloc(sizeof(char)*RECVBUF); I then pass that to a function defined as void setHeader(MyHeader *myHeader, unsigned char *buffer) Which copies the first 12 bytes into a struct Then I try and pass it to another function later on ...