arrays

how to declare a two dimensional array of string type in objective c?

hey! i am new in objective c. i am trying to learn objective c. i would like to know how to declare two dimensional array of string type in objective c. ...

VB.Net Initialising an array on the fly

I wrote this - very simple - function, and then wondered does VB have some pre-built functionality to do this, but couldn't find anything specific. Private Shared Function MakeArray(Of T)(ByVal ParamArray args() As T) As T() Return args End Function Not so much to be used like Dim someNames() as string = MakeArray("Hans", "Luke",...

C#: GetHashCode override of object containing generic array

I have a class that contains the following two properties: public int Id { get; private set; } public T[] Values { get; private set; } I have made it IEquatable<T> and overriden the object.Equals like this: public override bool Equals(object obj) { return Equals(obj as SimpleTableRow<T>); } publi...

is there a way to treat a c# static array like an ArrayList?

I have code that uses Arrays and, unfortunately, I can't change their types. If I could, I'd use ArrayLists or something simliar to do what I need to do, but I can't. Basically, I'm looking for the best approach to adding and removing objects from a static array. For adding an item to the array on the fly, i have to create a new array...

Retrieve and store elements (according to conditions) from an array.

Given an array of 81 elements (meant to represent a 9x9 grid) how can I go over each element, grabbing the three around it and then performing an operation on those, then continuing to the next three of each row, column, or submatrix. Look below or at a sudoku grid to see the layout. define COL(n) ((n) % 9) define ROW(n) ((n)...

Removing an element from an Array (Java)

Is there any fast (and nice looking) way to remove an element from an array in Java? ...

Passing a list of numbers to a function in C++ without building array first?

I'm trying to build a function that accepts an array in the following manner: int inCommon = findCommon({54,56,2,10}, 4); int findCommon(int nums[], int len){ for(int i=0; i<len; i++) cout<<nums[i]<<endl; return 1; } Note, that's not actually what my function does, but I do loop through the array. I'm just trying to determine if...

List of Structs or Dataset in C#?

I have some data I want to work with. Two string and two numbers and I have say 8000 rows of data. Is a dataset the best option here to use, or could I use a struct and have a list of structs? Would there be much performance difference between the list and the dataset? ...

PHP Notice: Undefined index when looping array...

Hi, I'm looping a two-dimensional array like this: if (!empty($aka)) { foreach ($aka as $ak) { if($ak["lang"]=="es") { $sptitle=$ak["title"]; } } } Pretty simple. If the array ($aka) is not empty I loop trough it and when it finds that the "lang" index is equal to "es" I just save the "title" value for that index in $sptitle....

What is the best practice for readonly lists in NHibernate

Hello, Domain Model I am working on has root aggregate and child entities. Something like the following code: class Order { IList<OrderLine> Lines {get;set;} } class OrderLine { } Now I want my Order to control lines. Something like that: class Order { OrderLine[] Lines {get;} void AddLine(OrderLine line); } At this tim...

Arrays in Objective-C

If you want to use an array of characters/badguys is it better to have one array of badguy objects and each object have properties like Badguy1: color=blue, health=80. Then you loop through your array of characters and pull that information.... OR is it better to have multiple small arrays like character array, color array, health array ...

Need a php script diagnosis for a small snippet of code

Hi, Can somebody tell me what I am doing wrong really? I am going nuts, the following code works perfect on localhost/WIN and when I try it on the webhost/linux it gives warnings: $lines = file('english.php'); foreach($lines as $line) { $matches=array(); if (preg_match('/DEFINE\(\'(.*?)\',\s*\'(.*)\'\);/i', $line, $matches)) { ...

How to Rotate a 2D Array of Integers

I am programming a Tetris clone and in my game I store my tetromino blocks as 4x4 arrays of blocks. I now need to be able to rotate the integer positions in the arrays so that I get a rotated tetris block. I cannot simply rotate the texture because all my collision detection, etc has been designed to work with the 2D array. The game is w...

Strange temporary array corruption

I am attempting to create a permutation, and I receive this strange error when I finish my problem: Stack around the variable "temp" was corrupted the segment of the variable is within a nested for loop: for(int i = 0 ; i < str_length ; i++) { for(int j = 0 ; j < str_length ; j++) { char temp[1]; temp[1] = text[i]; text[i] =...

Redim is only removing data, not removing nodes.

So I am quite confused. I have a public string() array defined, and each time a timer_tick event gets triggered, I loop through the array and visit web pages contained in the array. for i = 0 to UrlList.Count - 1 ' Do stuff WebBrowser.Navigate(urllist(i)) While WeBbrowser.ReadyState <> WebBrowserReadyState.Complete Applica...

Smarty: How to reference to the associative array index

Array $imagelist: Array ( [additional] => Array ( [count] => 2 [image] => Array ( [nokia_e61_1.jpg] => Array ( [name_body] => nokia_e61_1 [name_ext] => jpg ) [nokia_e61_2.jpg] => Array ( [name_body] => nokia_e61_2 [name_ext] => jpg ) [nokia_e61_3.jpg] =>...

[PHP] Sort a multi-dimensional array

Hi! I need to sort a multi-dimensional array which represents filesystem structure: Array ( [dir1] => Array ( [dir2] => Array ( [dir3] => Array ( [dir4] => Array ( ...

How to declare the size of an array at runtime in C?

I basically want to the C of equivalent of this (well, just the part with the array, I don't need the class and string parsing and all that): public class Example { static int[] foo; public static void main(String[] args) { int size = Integer.parseInt(args[0]); foo = new int[size]; // This part } } Pardon my ...

Type mismatch on an Array assignment in ASP

Its been a while since I've worked with ASP, but I'm getting a Type mismatch error on what seems to be a simple assignment statement. Can anyone shed some light on why this might be happening. This works, but when I try to foreach an unassigned Questions block I get an Object not a collection error Class Survey public ID public Ti...

Elegant technique to move items from one array to another

Context: A card game; I want to deal out cards from a deck to each player in the game, in a clean way. This is what I had in mind: public static CardGame.IGame DealAll(this CardGame.IGame objThis, CardGame.Card[] cards) { if (objThis.Players.Length > 0) { for (int i = 0; i < cards.Length; i++) ...