arrays

Java Array Index out of Bounds

OK so I seem to be getting an Array Index out of Bounds error in a part of my code. Specifically in lines 85-102... My code: http://www.sosos.pastebin.com/f0JQBWui I just want it to check for blocked tiles AHEAD of time that way my sprite doesn't move in the direction it can't. This exception only happens when I am on the RIGHT or BOTT...

JavaScript loops to store data in an array

I have a friend who has an assignment on arrays and because I lack experience in Javascript and she just needs some real quick help understanding how to implement a Javascript loop to store data in an array which converts a letter grade to a number. Can someone just guide her in a general direction? https://docs.google.com/fileview?id=...

Flatten array PHP 5 (not found solution in SOF search)

Assume I have arrays like: $arr['foo']['bar']['test'] = 'value'; $arr['noo']['boo'] = 'value'; $arr['goo'] = 'value'; $arr['hi'][] = 'value'; // $arr['hi'][0] $arr['hi'][] = 'value2'; // $arr['hi'][1] I need to convert this, to: $arr['foo[bar][test]'] = 'value'; $arr['noo[boo]'] = 'value'; $arr['goo'] = 'value'; $arr['hi[0]'] = 'valu...

create 3 dimensional array with different lengths

hi, I am a beginner of R. I want to create a 3 dimensional array but I can not define the length of each dimension. I am analysing students' marks of a class. there are 10 classes but it has different number of students. And "Grade" will be 100-90, 89-80, 79-70... until there will be any student who got the relevant marks. I was going t...

C++ get array key in constructor of array of a custom class/struct?

If I have a simple class like this: class MyClass { MyClass(){} ~MyClass(){} public: int myArrayKeyValue; }; And later, I create an array of these classes: MyClass testing[10]; How, in the constructor, would I access the array key so I can set the myArrayKeyValue appropriately for each element of the array? So that I...

iphone NSString Array

Hi, I declared NSString *dayinfield[43]; and fill it in -(void)DrawDemo { dayinfield[2] = @"hallo"; dayinfield[3] = @"test"; // also i can read it NSLog (@"show: %@",dayinfield[2]); //works fine } but when i like to read its content in another function (same class) -(void)ReadData { NSLog (@"show: %@",dayinfield[2]); // I get ...

Checking against any item in array being checked?

Hi, I need some help shortening this code and am just a little off. Here is original code: $("#MKDPT").change(function() { if ($("#MKDPT").is(":checked") && $("#AMX1N").is(":not(:checked)") || ("#ERXXN").is(":not(:checked)")) { alert(this.id); } }); I will be adding a lot more id's. Can I just create an array of t...

Character Array in C

When we define a character array as 'char name[10]', this indicate that the array 'name' can hold a string of length ten character. But in the program shown below the array name can hold more than ten characters. How is this possible? //print the name of a person. char name[10]; scanf("%s",name); printf("%s",name); Here if I e...

In php, how similar to an array can I make an object act? And how would I do that?

I know that by implementing iterable you can make an object able to be foreached over. I'd like to take it further and make an object react like an array would in as many places as possible where an array is called for. (The reason for this is because I'm selecting data from a database, and the statement object that results by default ...

Read a line containing (large) N reals to an array in Fortran

I've read() down past a header of an input file, and read the value of L on the way. Now I come to a line of L^2 consecutive reals, which I need to input to the elements of an allocatable array A(L,L). Trying character *100 :: buffer read (1,10) buffer 10 format(a(L*10)) results in Error: Syntax error in ...

Combining two input arrays into a single array to input into a database with PHP

I have a jQuery function that allows a user to create a list of links. By clicking on an "add row" link they create as many of these blocks (shown below) as they like which they can type the information into. <div class="links_row"> <input type="text" name="link_name[]"> <input type="text" name="link_url[]"> </div> I am post...

copy part of an array into another array

if i have: string[] myArray = . . . . which is an array with a length of 10. how can i create a new string array that is the 2nd to 10th elements of the first array without looping? ...

Make a multidimensional array through loop!

How can i make an array like below through a loop? The text will generated from database! $listofimages = array( array( 'titre' => 'PHP', 'texte' => 'PHP (sigle de PHP: Hypertext Preprocessor), est un langage de scripts (...)', 'image' => './images/php.gif' ), array( 'titre' => ...

String[] type property mapping on nhibernate...is possible?

Is possible mapping vector types on nhibernate? I have a property like this... string[] myDesc and I would map every vector value to a specific column of my table...for example: myDesc[0] --> myDbColumn01 myDesc[1] --> myDbColumn02 myDesc[2] --> myDbColumn03 ... Is there any way to do it? ...

Matching array keys

I have this array, Array ( [campaign_title] => adasdasdasddsad [campaign_keyword] => asdsadasdasdasdasd [introduction] => asdasdasdasdasdasdsa [campaign_headline] => Array ( [0] => asdasdasdasdasdasdad ) [article] => Array ( [0] => asdasdasdasdasdasdasdasdsadas ...

how can i access such a php array

i was trying to access this php array with no luck, i want to access the [icon] => icon.png Array ( [total] => 2 [total_grouped] => 2 [notifys] => Array ( [0] => Array ( [notifytype_id] => 12 [grouped] => 930 [icon] => icon.png [n_url] => wall_action.php?id=930 [desc] => 690706096 ...

Pushing mouse click location to an array in Javascript

Hey guys, I'm trying to push the coordinates of a mouse click on a particular element to the end of an array. This is what I have: IN THE HEAD: var seatsArray = []; IN THE BODY: var coordinates = document.getElementById("image"); coordinates.onclick = function(event) { seatsArray.push(offsetX, offsetY); } document.write("Seats ar...

Writing an array to a (server-side) text file.

Hey, So I've got my javascript array (var seatsArray = [];), let's say it has some contents. I want to write the contents of that array to a .txt file on the server when the user clicks a button. The text file will not already exist so it needs to be created. Also, if anyone knows how I could allow the user to specify the name of the t...

get cursor from array

Is it possible to get an android cursor from an array (either ArrayList or StringaArray)? ...

splice Object into nested Array code error

I am trying to replace an Object inside my nested array (colArray) by using splice, the object acts as my player and will need to maneuver around the Array it's in. The Problem is splice doesn't appear to be showing anything in return, it comes up with an error saying: Cannot access a property or method of a null object reference. Wha...