arrays

how to use $.makeArray() with jQuery

Can anyone explain me how to do this, jquery's api is really lacking on this. What is wrong in the following code? var arr = $(value).filter(function() { return $(this).is("TD"); } ).html(); alert(arr[1]); I just want to grab the innerHTML/text of the td and put it in an array ...

Google Maps API v3 For loop Trouble

Maybe I'm going completely off track with what I'm trying to do, but I'm tempted just to go back to version 2 because I got that working easily (but I would like to be mobile-friendly). I'm trying to generate a few markers, and to save code, I've put the marker generation into a for loop, which loops through an array of markers (there a...

initializing char arrays in a way similar to initializing string literals

Suppose I've following initialization of a char array: char charArray[]={'h','e','l','l','o',' ','w','o','r','l','d'}; and I also have following initialization of a string literal: char stringLiteral[]="hello world"; The only difference between contents of first array and second string is that second string's got a null charact...

How do you map an array in php?

I have two array K = {"a", "b", "b"}; V = {"1", "2", "3"}; from these two array I want to got the result like this $display = "a: 1; b: 2; c: 3;" echo $display; output "a: 1; b: 2; c: 3;" Anybody here please give me the idea? thanks ...

Getting multiple index value from array

Hi all, i have created a string array from A-Z, which will contain index from 0-25. Then i have a textbox and when i enter text into the textbox, how can i get the index number of the array associated with the text i entered? For example, i enter "AB" into the textbox, the index return should be 0 and 1. The code below only able to r...

iPhone OpenGLES Plotting Problem

I started off with the default OGLES iPhone project, then I changed the Orthographic view to: float Left = -backingWidth/2; float Right = backingWidth/2; float Up = -backingHeight/2; float Down = backingHeight/2; glOrthof(Left, Right, Up, Down, -1.0f, 1.0f); so when I make the Vertices array I can assign the XY values of a grid withou...

Why is this array selection causing such a glitchy phenomenon?

I was loading a image in openGl with the Glaux library when I came across a very strange phenomenon with a array. Some example of what I tried and if they succeeded or not are below. The curFreeId variable is global. The extra variables I created to test with are local to the function. Since when does this effect the flow of code. ...

Java Applet - ArrayIndexOutOfBoundsException

OK so I have this applet which lets a player move his 32x32 character between tiles ... and anytime he is on the edge of the map then MOVES anywhere else... I get an ArrayIndexOutOfBounds exception. Also, when this happens, the character can walk through blocked tiles! However, this only happens on the east and south edges but on the sou...

Python list initialization (by ref problem)

I have some simple code that represents a graph using a square boolean matrix where rows/columns are nodes and true represents an undirected link between two nodes. I am initializing this matrix with False values and then setting the value to True where a link exists. I believe the way I am initializing the list is causing a single boo...

PHP, Array of Arrays vs Array of Objects

I'm in the process of creating a PHP data structure based on some data I'm fetching from somewhere. If I would encode this information in some standard container, like XML or JSON, I would use this structure: [ {'name': 'Lupin', 'age': '13'}, {'name': 'Igor', 'age': '24'}, ... ]; However I'm a bit unsure what to use in PHP ( Array o...

Why does array.slice behave differently for (length, n)

If I have an array a: a[a.length] returns nil. Good. a[a.length, x] returns []. Good. a[a.length+x, y] returns nil. Inconsistent with 2. While this behavior is documented, it seems odd. Can anybody explain the reasons behind this design? ...

How do I represent used space in 2d?

I have fixed area 2d space filled with rectangles. I'd like to move the rectangles around, add new ones, remove some, but not allow them to overlap. If all of the rects are the same height and width (50x50px), what data structure should I use to store their position and what space they are using and what lookup method should I use agains...

PHP array collect

I have alphabet array 24 character: "A B C D E F G H I J K L M N O P Q R S T U V W X" I want collect all case with: 3 unique characters. First case: ABC, DEF, GHI, JKL, MNO, PQR, STU, VWX ...

Convert Jagged array to several one-dimensional arrays.

Hi all , I wonder if there's a way to convert jagged array , say [3][] into three one-dimensional arrays ? ...

define variable size on array in local memory, using CUDA

Is it somewhat possible to make a list, array, something in a device function with the size of the list/array beeing a parameter in the call… or a global variable that's initialized at call time? I would like something like one of these list to work: unsigned int size1; __device__ void function(int size2) { int list1[size1]; ...

php sqlite_fetch_array corrupted results

Hi, I started trying to use sqlite to host small websites and on my own personal server, I ran into a glich which kind of spoils the whole idea. I have a very simple test example, on a two row table in a sqlite 2.x database, I am being hosted with 5.2.12, I have also tried with the PDO sqlite3 database, the problem is this. The "users...

How to pass a double array to a function in C?

I have been trying to solve this problem the whole day: How do I pass a double array to a function? Here is an example: int matrix[5][2] = { {1,2}, {3,4}, {5,6}, {7,8}, {9,10} }; And I wish to pass this matrix to function named eval_matrix, void eval_matrix(int ?) { ... } I can't figure out what should be in place of ? Can a...

iPhone Objective-C cant use 'new' to allocate?!

I'm creating a Game of Life program for the iPhone and I want to be able to store previous states of the game in a large array, if I take the C approach and each "Grid" is a structure consisting of two ints for X, Y and a BOOL *array where I malloc the memory proportional to X*Y times the size of the BOOL value I can create 1000 of these...

Java: One constructor or method that will accept array or set or list or ...?

In Java is there anyway to have one constructor that will accept an array or a collection? I have been fiddling with this for a while but I don't think it is possible. I would like to be able to initialize MyClass, like this: MyClass c = new MyClass({"rat", "Dog", "Cat"}); And like this: LinkedList <String> l = new <String> Link...

How can I use an array-initializer syntax for a custom vector class?

I have a class roughly designed as such: class Vector3 { float X; float Y; float Z; public Vector3(float x, float y, float z) { this.X = x; this.Y = y; this.Z = z; } } I have other classes implementing it as properties, for example: class Entity { Vector3 Position { get; set; } } ...