arrays

Can I shift the objects in a NSMutableArray without creating a temporary array?

I thought I had it with, void shiftArray(NSMutableArray *mutableArray, NSUInteger shift) { for (NSUInteger i = 0; i < [mutableArray count]; i++) { NSUInteger newIndex = (i + shift) % [mutableArray count]; [mutableArray exchangeObjectAtIndex:i withObjectAtIndex:newIndex]; } } which turns 0,1,2,3,4 into 0,2,3,4,1 when I shift by o...

modify values of elements of an array in gdb for C++

Hi Just wonder how to modify the values of multiple elements of an array under gdb for C++? Thanks and regards! ...

Javascript Counting Array of Objects

I am been having trouble counting the number of objects in this array in server-side javascript. Below is a JSON object which was parsed out using the array that I am trying to count. NOTE: The object is in object form, not JSON string form. JSON Object: [{"dataSymbol":"21135103","isHoliday":false,"isIPO":false,"lastTradeTime":400...

How to add a string to a string[] array? There's no .Add function. :S

private string[] ColeccionDeCortes(string Path) { DirectoryInfo X = new DirectoryInfo(Path); FileInfo[] listaDeArchivos = X.GetFiles(); string[] Coleccion; foreach (FileInfo FI in listaDeArchivos) { //Add the FI.Name to the Coleccion[] array, ...

how to implement Multidimention array

Hi, I want to use a multidimensional array. Can any one explain how to use that in an iPhone app? I'm new to Objective-C. Here's what I'm trying to do: I am spliting the main string on the basis of seprator and storing in an array. replacing some content of this array's each elements with new substrings and new values are storing ...

How to create a dynamic array of single as a property in a class

I'm currently creating a class to write and read arrays Opening a file, closing a file all works well. Also, I'm able to write an array towards a bin file. But returning an array from the class is a bridge to far. So far, ther're 2 issues where I'm not able to work around 1) in the public section function ReadArrFromFile : ar...

[PHP] How to convert all keys in a multi-dimenional array to snake_case?

I am trying to convert the keys of a multi-dimensional array from CamelCase to snake_case, with the added complication that some keys have an exclamation mark that I'd like removed. For example: $array = array( '!AccountNumber' => '00000000', 'Address' => array( '!Line1' => '10 High Street', '!line2' => 'London')); I woul...

How to Find Dimension of a Multiple Dimension Array in C

I declared a 2-dimensional array like this: char *array[][3] = { {"a", "b", "c"}, {"d", "e", "f"}, {"u", "v", "w"}, {"x", "y", "z"}}; How do I find out the first dimension? ...

Is there a software that helps configure structured strings?

I'm using a JavaScript component that takes a 2D array as an input. There is a particular format to it, and I basically need to develop grid GUI to help configure such a string, instead of having to type it manually. [ [0,"Chart","linear"], [2,"3D",false], [1,"Labels",["Student","Business","Professional","Retired"]] ] Any ideas ...

Performance penalty for using C++ vector instead of C array.

Is there a performance penalty for working with a vector from the standard library in C++ instead of arrays in C? ...

Javascript - Fastest way of copying an array portion into another

I need to copy FAST a portion of an array into another, replacing it's old values. No range checkings needed. Number of items to copy: 16384 The array only contains integers benchmark code: http://codebase.es/test/copytest.htm This is my approach: var i = 0x4000>>5; // loops count var j = 0x4000; // write start index var k...

Mystery type mismatch while dealing with ASP

Hey everyone, I've never developed in ASP in my life, but a client wants some additional functionality in one of his really terrible ASP programs extended. I've tried to pick up as much as I can in a short period of time, but I'm running into a mystery bug here. When I unit-test this code on my local system, it works fine. On their w...

array to Zend_Db_Table_Row zend framework

Hi, is there a way of automatic converting from array to Zend_Db_Table_Row or Zend_Db_Table_Rowset? Form Zend_Db_Table_Row you can get the array with toArray(), but I was wondering if there exits anything like opposite of that? Till now I have been implementing a function fill($data) which took the array and than set the atributes of Z...

Representing a 2D array as a 1D array

Possible Duplicates: Implementing a matrix, which is more efficient - using an Array of Arrays (2D) or a 1D array? Performance of 2-dimensional array vs 1-dimensional array I was looking at one of my buddy's molecular dynamics code bases the other day and he had represented some 2D data as a 1D array. So rather than having to...

MATLAB excluding data outside 1 standard deviation

I'm inexperienced with MATLAB, so sorry for the newbie question: I've got a large vector (905350 elements) storing a whole bunch of data in it. I have the standard deviation and mean, and now I want to cut out all the data points that are above/below one standard deviation from the mean. I just have no clue how. From what I gather I hav...

Auto increase php numbers on different lines 0100, 0200 etc.

Right now im running something based on time and including files. This is a long file and seems unnecessary. What I want to do is auto increment the times for the 24 times i call code. current style coding: if($time >= "0000" && $time < "0100") { include("1.php"); } elseif($time >= "0200" && $time < "0300") { include("2.php"); Is th...

Creating an array of zero width and zero height!?

I have an assignment from my programming class, which is very poorly worded... The following line really stumps me. We're creating a class called FloatArray, which contains an array (arr, which is just a pointer to a bunch of floats). The default constructor FloatArray(); should create array of zero width and zero height. I have ...

How do I order an array of floating point numbers using a criteria other than size, using LINQ?

For example, I have an array of floating point numbers: float[] numbers = new float[] { 1, 34, 65, 23, 56, 8, 5, 3, 234 }; If I use: Array.Sort(numbers); Then the array is sorted by the size of the number. I want to sort the numbers by another criteria, so element A should go before element B if f(A) < f(B), rather than the usual ...

mysql_list_tables into foreach array?

Is it possible to list my tables into a foreach array? current code. $browsers = array ("site1", "site2", "site3"); foreach($browsers as $browser) { $domain = $browser; include ('code.php'); } ...

How to use a List of arrays in Java?

I want to declare a List<int[]> or Map<int[],Boolean> but it's very difficult because arrays in Java doesn't implement the equals() method. If two arrays a and b are equal, a.equals(b) returns false. Although java.util.Arrays.equals() compares arrays for equality, how do I get a List to use that method for comparison instead of the scre...