arrays

refer to an element of JSON (Javascript) object.

How do I refer to an element of JSON (Javascript) object. exampe: alert(homes.Agents[1].name); <script> var homes = [ { "Agents" : { "name" : "Bob Barker", "name" : "Mona Mayflower" }, "Listings" : [ { "h_id": "3", "city": "Dallas", "state": "TX", ...

Flex: Forcing an array to contain only a specific class?

I'm trying to create a class that contains an array. However i want to require that the items in the array are themselves of a specific class. Im told there is some sort of tag you can add to do this, but for the life of me i cannot find what it is. What i hope for is something like: public class myClass{ public var foo:String; ...

Best practice when converting DataColumn values to an array of strings?

Best practice when converting DataColumn values to an array of strings? [Edit] All values for certain DataColumn for all DataTable rows to be converted to an array of string? ...

Circular Linked List in Cocoa

Is there something similar to a circular linked list available in Cocoa? I know that an NSArray is ordered - but I don't think I can use 'nextItem' or 'previousItem' - correct? Furthermore, I need the nextItem of the last item to be the first item. I could add my own nextItem and previousItem methods, but I'm surprised if Apple have...

Returning column names from a mySQL table using PHP

Can't figure this out for the life of me. Trying to return the column names from the clients securities table, then return the result as an array. Can anybody point out where I'm getting off track? mysql_select_db("HandlerProject", $con); //Selects database $selectcols = "SELECT * FROM ".$clientname."securitiestable"; //sel...

List-Array Error?

I was working on a project which required pulling down and parsing a .html page from a server, then parsing it for content. I searched a string for two values as a unit test, then saved each of them to a List, then compared them to a manually created String[]. The code is below: SiteGrabber.java: //some imports import java.util.ArrayLi...

PHP array vs PHP Constant?

I am curious, is there any performance gain, like using less memory or resources in PHP for: 50 different setting variables saved into array like this $config['facebook_api_secret'] = 'value here'; Or 50 different setting variables saved into a Constant like this define('facebook_api_secret', 'value here'); ...

extending AS3's Array access operators to 'wrap' out-of-bound index values

I'd really like to be able to make Flash's array access syntax 'wrap' over the array's bounds. Lengthy explanation - var array:Array = ['a','b','c','d','e','f']; To keep things simple, the first index is 0, and its value is the first letter, 'a'. To get that value, we'd do this - array[0]; // returns 'a' As long as the index you'...

would you use an array or a custom-made class for simple data manipulation? (ruby)

I can do bit of coding in ruby. I just touched objects and I am not so object literate, I mean I do not think in objects yet :-) I have data that I scrape from the forum on regular basis. I need fields like author, date posted, title, category, number of views, etc etc = array in my point of view. Then I want to be able to these ...

How to convert array to list without .= in PHP?

I have the following array outputs. Array ( [day] => 17 [eventContent] => event 1 of 17th [eventTitle] => 17th event 1 ) Array ( [day] => 19 [eventContent] => event 1 of 19th [eventTitle] => 19th event 1 ) Array ( [day] => 05 [eventContent] => event 1 of 5th [eventTitle] => 5th event 1 ) Array ( ...

Why does this PHP function call work only once?

Hi, I've wrote a simple array, and I would use it to print an html list option set, with a selected element. My problem starts if I try to print multiple lists in my page, because only the first list is printed correctly, why? <?php $units = array ( '0' => 'Units', 'kJ' => 'Kilojoule: kJ', 'g' => 'Grams: g', 'mg' => 'Milligrams: mg', ...

How to pull out data from nested array in PHP?

This is a follow up question from here. But question is different. I have the following array outputs. Array $events Array ( [0] => Array ( [day] => 17 [eventContent] => event 1 of 17th [eventTitle] => 17th event 1 ) [1] => Array ( [day] => 19 ...

How to filter an array in Java?

How can I filter an array in Java? I have an array of objects, for example cars: Class: public class Car{ public int doors; public Car(int d){ this.doors = d; } } Use: Car [] cars = new Cars[4]; cars[0] = new Car(3); cars[1] = new Car(2); cars[2] = new Car(4); cars[3] = new Car(6); Now I want to filter the arr...

Array as private member of class.

I am trying to create a class which has a private member that is an array. I do not know the size of the array and will not until the value is passed into the constructor. What is the best way to go about defining the class constructor as well as the definition in the .h file to allow for this variable size of the array? ...

How does this PHP know which array key/values to use?

Below is part of a PHP database class someone else wrote, I have removed about 80% of it's code, all the un-related code to my question has been removed and just the amount remains that allows me to test this class without actually hitting a real database. This class has a couple methods that let you set a key and value it then turns ...

reset a char *array[size] contents

Say I have declared char *array[size] in my program and put some strings in it. If I assign something again to them, they don't replace the previous contents but they keep on appending on the previous contents. How do I correctly clear/reset all of its contents? void function(char* action) { const int myMainArrSize = 3; char *myM...

Exploding and replacing one array field

So, I have an array that, for unrelated reasons, has one imploded field in itself. Now, I'm interested in exploding the string in that field, and replacing that field with the results of the blast. I kinda-sorta have a working solution here, but it looks clunky, and I'm interested in something more efficient. Or at least aesthetically pl...

GetType() on Array item? (c#)

I have an initialised array, that may or may not contain more than 0 items. Lets call it 'a', Calling GetType on a will obviously return a type of Array. Is it possible to get the type of the items the array contains? Obviously a[0].GetType() would work, but then the array could be empty and cause a null reference exception. ...

Using Large Arrays in VB.NET

I want to extract large amounts of data from Excel, manipulate it and put it back. I have found the best way to do this is to extract the data from an Excel Range in to a large array, change the contents on the array and write it back to the Excel Range. I am now rewriting the application using VB.NET 2008/2010 and wish to take advantag...

iPhone dev question help forming array

Hi guys I've spent this morning searching google for this, but I just can't get what I want how i want it. I am creating a custom table view cell, with different icons down the side, in a sectioned table view. My problem is that I am having trouble reading these images from an array. I can do it like below, but can someone please help m...