arrays

How to make my own while Loop just like Wordpress Loop?

Hi all programmer... im new here and new in PHP too.. Just wondering how to make my own flexible loop just like in Wordpress... Note im not talking about wordpress.. I want to implement it on myown PHP application... let's look back in WP, there is a code something like this: while (have_post() : thepost())// .. bla bla... echo the_t...

Help with simple javascript php/js array

Can someone please tell me what's wrong with this code? Basically what I am doing is creating a php array for some GET variables. Then, I create a js array from that php array and pass it to a js function. The problem is that the function is not being called. I don't get to see the "hi" alert pop up. <script type="text/javascript"> fun...

Softball C++ question: How to compare two arrays for equality?

I am trying to compare two int arrays, element by element, to check for equality. I can't seem to get this to work. Basic pointer resources also welcome. Thank you! int *ints; ints = new int[10]; bool arrayEqual(const Object& obj) { bool eql = true; for(int i=0; i<10; ++i) { if(*ints[i] != obj.ints[i]) eql = ...

JS: Math.random for array

Learning JS this week. Is it possible to use Math.random to return a random value in an array? Does that value be a string and still work? ...

Trying to send an array from jquery to PHP function

I'm loading an array in my javascript. I need to send this array, in some format, to the PHP script that I'm going to call. In my example below, gSelectedMeds is my array. The value "count" will tell the PHP script how many "meds" items to expect to receive. I'm having trouble getting the data from the array into an format that I can sen...

Checking whether an element in inside an array, using D?

We have a char and a char[]. What would be the most efficient (or, failing that, just simplest) way of finding out whether the char is located inside of char[]? The language used is D. Thanks! ...

JS: Inserting value from array into special output

So I have this special output: dAmn_Raw('send chat:Sandbox\n\nmsg main\n\nthismessage'); I have a variable: myvariable that equals a random value from an array I made. I'd like this random value to show up in chat through this output, but I can't include it in the output line of code. How would I got about writing something that repl...

Declaring a non static const array as class member

How can we declare a non static const array as an attribute to class. Following code produces compilation error (“'Test::x' : member could not be initialized”)? class Test { public: const int x[10]; public: Test() { } }; ...

What is the memory layout of a Delphi dynamic array of dynamic array of X?

I am trying to call a procedure in a Delphi DLL from C#. The procedure expects the caller to preallocate and input an array of array of TSomeRecord, of which it will then manipulate the TSomeRecord elements as a means of returning results. So, I need to hand-craft Delphi dynamic arrays of arrays of X. Now, I have found here that a dynami...

Mapping Java ArrayList<CustomClass> and Flex ArrayCollection

Hello Community! I'm currently trying to map a java ArrayList with a Flex ArrayCollection, through LCDS. My Flex application does call the Java method that returns the ArrayList, but I haven't managed to retrieve the ArrayList to display it in a DataGrid, on Flex side. JavaSide: I have 2 classes: - Jco_test.java: it contains the meth...

Random shuffling of an array in Android ?

I need to randomly shuffle the following Array in Android : int[] solutionArray = {1, 2, 3, 4, 5, 6, 6, 5, 4, 3, 2, 1}; Is there any function in the SDK to do that ? Txs. ...

Array with 500 numbers to make quick toplist template

I need to make an array in php that will output an html table so I can grab the source. ##id:1## ##site:1## ##id:2## ##site:2## etc. 500 times over. ...

Add an item to a string[] array

Hi, I have class that has a property that is of type string[]. I need to create another array item, do I have to reset the size and copy all the previous items over? ...

JavaScript: sorting collection, which is not an array

I have a collection of objects in JavaScript like this: Object collection = new Object(); collection[123] = new Item(); //another object collection[425] = new Item(); collection[2134] = new Item(); //etc. etc. //TODO: sort items I would like to sort this collection according to the properties of the Item objects in collection. Ther...

What is the Perlish way to iterate from item n to the end of an array?

The problem is that I have n command-line arguments. There are always going to be at least 2, however the maximum number is unbounded. The first argument specifies a mode of operation and the second is a file to process. The 3rd through nth are the things to do to the file (which might be none, since the user might just want to clean the...

How do I shift an array of items up by 4 places in Javascript

Hi, How do I shift an array of items up by 4 places in Javascript? I have the following string array: var array1 = ["t0","t1","t2","t3","t4","t5"]; I need a function convert "array1" to result in: // Note how "t0" moves to the fourth position for example var array2 = ["t3","t4","t5","t0","t1","t2"]; Thanks in advance. ...

Creating a polygon shape from a 2d tile array

I have a 2D array which just contains boolean values showing if there is a tile at that point in the array or not. This works as follows, say if array[5,6] is true then there is a tile at the co-ordinate (5,6). The shape described by the array is a connected polygon possibly with holes inside of it. Essentially all i need is a list of v...

Getting index number in Java

How can you get the index number in Java? Example which is not working class masi { public static void main( String[] args ) { char[] list = {'m', 'e', 'y'}; // should print 1 System.out.println( list[] == "e" ); ...

Store an int in a char array?

Hey SO, This should be easy for all you C hackers out there :D Anyways, I want to store a 4-byte int in a char array... such that the first 4 locations of the char array are the 4 bytes of the int. Then, I want to pull the int back out of the array... Also, bonus points if someone can give me code for doing this in a loop... IE writi...

JavaScript Array reflection

how to loop through JavaScript Array member functions, the following code doesn't work :( for (var i in Array.prototype){ alert(i) } //show nothing for (var i in []){ alert(i) } // show nothing ...