arrays

Core-Data: NSLog output Does Not Show "Fields"

Hello, I don't understand the output of NSLog for the array returned by a NSFetchRequest. I'm reading my database and placing the contents in an array, looping through the array and then outputting the contents with NSLog. I don't quite understand the output in the log file. Code below: -(void)createXMLFeed{ //Fetch details from ...

Using a hash table to create an unlimited array

I am currently developing a programming language in C, and I want to allow users to create apparently "unlimited" arrays with numerical indices without sacrificing performance in the process. For example, table [1000000000] would ideally be creatable and accessible in an instant without the memory overhead of a table of 1,000,000,000 ite...

Invalid Rank Specifier (c# array)

I'm having a little trouble with an array I've defined. int[] levelData = new int[450] {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,...

How can I put PHP and HTML into a PHP array?

Hi, how can I make this not return an error of: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING . $day[$i++] = "<tr><?php if(isset($schedule['00:00'])) { ?><td style=\"width:32px\"><?php echo $schedule['00:00'] ?></td><?php } if(isset($schedule['02:00'])) { ?><td style...

Codeigniter - passing multiple data arrays to a view?

Hi, I am trying to populate a dropdown menu on an events page with a list of locations. What I wish to do is retrieve all names from a locations table, store them in an array in my event.php controller, pass this to a view which then lists all the locations in a dropdown menu. Here is the loop in my controller which retrieves the loca...

C++ Reorganizing an array to fill in the gaps?

I'm not sure if the word Reorganizing is the correct term, but its the only way I can describe what I'm looking for. If I have an array of say, Cats, like so: CAT *myCats[99]; myCats[0] = new CAT; myCats[1] = new CAT; myCats[2] = new CAT; myCats[3] = new CAT; myCats[4] = new CAT; myCats[5] = new CAT; At one point in time, lets say m...

will asp.net mvc model binder keep a posted array in the proper order?

Hello, so i've got an array of numbers that i'm posting to an asp.net mvc action that has a list(of integer) parameter and it all works great. my question is this: Is it safe to assume that the list(of integer) will have the numbers in the same order as they were in the array i posted? Thanks for your time! EDIT: The data being ...

which of the two practices is more efficient in Java?

I have an object array, I know that the elements are type String, say I need to access them many times. Practice 1: access the element by array index and cast it to String every time I need it. Practice 2: create local String instances and access each of the elements once. Which will run faster? If it's on a mobile device where memor...

Flash Remoting with Array of Objects and 2D Arrays

Hi again, I'd like to use AMFPHP and Flash Remoting to set up a system in which an array of objects on the Flash client gets checked against a mirrored array on the server. I've never used Remoting or AMF before, but I have worked on some projects that involved serialization, and I remember serializing an array of objects and arrays of...

How to "unlink" a Perl array reference from the referenced variable?

In Perl 5.10.1: #!/usr/bin/perl my @a = (1, 2, 3); my $b = \@a; print join('', @{$b}) . "\n"; @a = (6, 7, 8); print join('', @{$b}) . "\n"; This prints 123 then 678. However, I'd like to get 123 both times (i.e. reassigning the value of @a will not change the array that $b references). How can I do this? ...

Array in Monotouch NSUserDefaults

Does anyone know how to store an array in Monotouch NSUserDefaults? One possible method: NSUserDefaults.StandardUserDefaults["Array"] = new NSObject(); But how do I turn an array or list into an NSObject? ...

wchar_t pointer

What's wrong with this: wchar_t * t = new wchar_t; t = "Tony"; I thought I could use a wchar_t pointer as a string... ...

Odd array key/value variable assigning in CURL posting

Let's say I have an array, and I print it: print_r($myArray); Array ( [post] => 333434kj [test] => wOVvc [tytytyty] => xyzsalasjf ) This array gets assigned to a CURL Post: curl_setopt($ch, CURLOPT_POSTFIELDS, "field1=".$f1."&field2=".$f2."&something=True"); Since "field1" is equal to "post" and $f...

Why do emgu images have arrays with extra elements for height?

Just noticed something strange and wondered if there was a reason for it. I have a grayscale image in EmguCV (.net wrapper for openCV). If this image has C channels (1 for grayscale, 3 for RGB), a width of X pixels and a height of Y pixels, the data array is consistently of the form: [Y,X+2,C] Anyone know why? ...

Function that returns a pointer to const 2-d array (C++)

I'm an intermittent programmer and seem to have forgotten a lot of basics recently. I've created a class SimPars to hold several two-dimensional arrays; the one shown below is demPMFs. I'm going to pass a pointer to an instance of SimPars to other classes, and I want these classes to be able to read the arrays using SimPars accessor fun...

PHP - Inverse variable variables?

I'm using an array to store the names of other arrays which are dynamically generated elsewhere. I need to loop through the "names" array and access the contents of the "named" arrays. Something like this: $names = array("one", "two", "three"); $one = array("a", "b", "c"); $two = array("c", "d", "e"); $three = array("f", "g", "h"); fore...

PHP: populating a nested array from flat scalar values

PROBLEM I have a nested PHP array that I need to populate from flat scalar values. The problem is I cannot know ahead of time what the structure of the nested PHP array will be until I get the request to fill in the flat scalar values. EXAMPLE // example where we populate the array using standard PHP $person['contact_info']['fname']...

How to group array values to different levels in PHP?

$arr = array(25,41,120,...36); How to group values in $arr to specified integer range $start ~ $end ? For example , if the level range is 1~5(1,2,3,4,5), how can I specify a level for each element of $arr ? The only principle is that larger value should map to larger level, and should cover the entire level range as possible. UPDAT...

PHP constant string square bracket indexing

I'm trying to get a constant string and index it as if it was an array of characters (square bracket syntax). When I try this code it fails on the last line. define( 'CONSTANT_STRING','0123456789abcdef'); echo CONSTANT_STRING; // Works by itself :) $string = CONSTANT_STRING; echo $string[9]; // Also works by itself. echo strlen(CONSTAN...

How to write/read array to file in android

Hi, I am writing to file in android and read from the same file using the below code: //Write data on file FileOutputStream fOut = null; OutputStreamWriter osw = null; try { fOut = openFileOutput("gasettings.dat", MODE_PRIVATE); osw = new OutputStreamWriter(fOut); osw.write(data); osw.flus...