arrays

How do I shift items in an array in C#?

Let's say that I have an array of strings like this: 1, 2, 3, 4, 5, 6, 7, 8 and I want to shift the elements of the array such that The first element always remains fixed Only the remaining elements get shifted like so ... The last element in the array becomes the 2nd element and is shifted through the array with each pass. Pass ...

PHP: SimpleXML and Arrays

When I run this code: foreach($xml->movie as $movie) { if(isset($movie->photos)) { foreach ($movie->photos as $photo) { echo $photo."&nbsp;"; } echo "<hr/>"; } } I get nice output of the actual data, e.g. a row looks like 06397001.jpg 06397002.jpg 06397003.jpg 06397004.jpg 06397005.jpg But when I throw it in an array, it includes a...

C++ Static array vs. Dynamic array?

What is the difference between a static array and a dynamic array in C++? I have to do an assignment for my class and it says not to use static arrays, only dynamic arrays. I've looked in the book and online, but I don't seem to understand. I thought static was created at compile time and dynamic at runtime, but I might be mistaken th...

Easiest way to pass a javascript array or its values to a servlet using jQuery's ajax() function

I have a Javascript array. I want to pass it's data to a servlet using the ajax() method of jQuery. What is the easiest way to do this. The index values i.e. the i in array[i] are not in order, they are numbers that have meaning themselves, hence I cannot simply loop through and create a GET queryString, or so I believe. Maybe I should...

How do I check if a (javascript) array value is empty or null

Will this work for testing whether a value at position "index" exists or not, or is there a better way: if(arrayName[index]==""){ // do stuff } ...

Deriving arrays in mathematics

So I found some similarities between arrays and set notation while learning about sets and sequences in precalc e.g. set notation: {a | cond } = { a1, a2, a3, a4, ..., an} given that n is the domain (or index) of the array, a subset of Natural numbers (or unsigned integer). Most programming languages would provide similar methods to arra...

Sort an array by a child array's value in PHP

I have an array composed of arrays. I want to sort the parent array by a property of the child arrays. Here's an example array(2) { [0]=> array(3) { [0]=> string(6) "105945" [1]=> string(10) "First name" [2]=> float(0.080878465391) } [1]=> array(3) { [0]=> string(6) "109145" [1]=> stri...

Javascript array value is undefined ... how do I test for that

I am trying to test to see whether a Javascript variable is undefined. You will see that I am not expecting the value of predQuery[preId] to be 'undefined' if I don't first get an alert saying "its unbelievable". But I often do, so I am guessing that my statement predQuery[preId]=='undefined') is not matching the undefined elements...

how to clear an array

Dears, I have a global variable int[]. I want to clear its data and fill it again in a loop. What should I do in C#? Thank you ...

Getting ListView values into a string array?

I have a ListView control set up in details mode, and on a button press I would like to retrieve all column values from that row in the ListView. This is my code so far: Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim items As ListView.SelectedListViewItemCollection = ...

How to sort a multi-dimensional array by a 4th level value in PHP

I have an array which is converted from an XML response. What I need to do is sort the array ascending alphabetically using the 'COMPANY' value. I have attempted to use array_multisort, but I'm having no luck at all. Any help would be greatly appreciated. Here is the array: array(1) { ["DATASOURCE"]=> array(1) { ["MEMBER"]=> ...

changing a table to array

I have a temp table which I fill and clear it in a loop in my code. becouse of using database, it takes musch time. I want to change it to an array to run my app quicker. here is my table columns: ID ( int) , Type (string ), Amount (int) reson : I have a loop which is repeated 700 times! I have some tables tu have store my data. now...

Objects array with numpy

hi there, are there any way to create an object form any class inside a numpy array?. Something like: a = zeros(4) for i in range(4): a[i]=Register() Thanks ...

Create all word variations of 2 character arrays

I have 2 collections of caracter string ex: List<string> one = new List<string>; one.Add("a"); one.Add("b"); one.Add("c"); List<string> two = new List<string>; two.Add("x"); two.Add("y"); two.Add("z"); What i would like to do is create a list of all the variations of words that can be created from this. But i only want to create 4 c...

PHP CHECKBOX Array Issue

I have a list of checkboxes like you would see in most email clients (You tick a box press delete then it deletes an email). <input type="checkbox" value="yes" name="box[]" /> The problem stands here ... print_r($_POST['box']);//Returns nothing at all ... var_dump($_POST['box']);// returns null... I was reading something about regi...

Populating PHP list() with values in an array.

Hi, I have an array: $arr = array('foo', 'bar', 'bash', 'monkey', 'badger'); I want to have the elements in that array appear as the variables in my list(): list($foo, $bar, $bash, $monkey, $badger) = $data; Without actually specifying the variables, I tried; list(implode(",$", $arr)) = $data; and list(extract($arr)) = $data; B...

PHP: Remove the first and last item of the array

Hi, Suppose I have this array: $array = array('10', '20', '30.30', '40', '50'); Questions: What is the fastest/easiest way to remove the first item from the above array? What is the fastest/easiest way to remove the last item from the above array? So the resulting array contains only these values: '20' '30.30' '40' ...

Plist array , cannot change dictonaries inside

i have a plist that's at its root an array with dictonaries inside it. i load a plist from my recourses as an NSMutableArray. [NSMutableArray arrayWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Filters" ofType:@"plist"]] i store it into nsuserdefault because it has to be persistent between startups. [[NSUserDefaults sta...

how to create a one-dimensional dynamic array in c#?

noob question on c#: how to create a one-dimensional dynamic array? And how to change it later? thanks. ...

Array Undefined index error (notice) in PHP

I have this function: function coin_matrix($test, $revs) { $coin = array(); for ($i = 0; $i < count($test); $i++) { foreach ($revs as $j => $rev) { foreach ($revs as $k => $rev) { if ($j != $k && $test[$i][$j] != null && $test[$i][$k] != null) { ...