arrays

How can I pass an array from PHP to Actionscript 3/Flash?

Here's what I have in PHP: for ($i = 0; $i < 355; $i++) { echo "vote"; echo "$i"; echo "=$votesArray[$i]"; if($i != 354) { echo "&"; } } Which should send data to Flash that looks something like "vote0=2&vote1=5&..." and so on. Here is the Actionscript 3 side: var i:int; for (i = 0; i < 355; i++) { ...

Remove Commas in a string and insert each comma-separated value into a string

How would I do this? To bring it into some better context, I'm having a value from an XML attribute and I want each individual value to be added to an array of strings and each of those values is separated by commas ...

Coordinates system (PHP an array)

I have point A(x,y) and B(x,y). they listed as array (a => array(x,y), b => array(x,y)) How get lenght between point A and B. Please help in php. :) ...

how do i check all elements of an array are the same?

ie, verify $a[0]=1; $a[0]=1; $a[0]=1; $a[0]=1; $a[0]=1; $a[0]=1; $a[0]=1; $a[0]=1; but not $a[0]=1; $a[0]=2; $a[0]=1; $a[0]=1; $a[0]=1; $a[0]=1; $a[0]=1; $a[0]=1; thanks :) ...

Expected segmentation fault, as soon as assigning a value to index 1?

Hello, In the code snippet, I expected a segmentation fault as soon as trying to assign a value to count[1]. However the code continues and executes the second for-loop, only indicating a segmentation fault when the program terminates. #include <stdio.h> int main() { int count[1]; int i; for(i = 0; i < 100; i...

Comparing arrays in vala.

I just tried the following in vala, and the assertion fails. int[] x = {1,2}; int[] y = {1,2}; assert( x == y ); I suppose Vala compares the memory locations of x and y instead of the content of the arrays. Is there an easy way to compare two arrays without having to loop though them in vala? ...

How to sort an array of objects(Points) in Java?

Hi, So I wanna sort an array of Points using the built in sorting method, by a specific coordinate, say x. How can I do this? Heres a sample code: Point A[] = new Point[10]; // ... Initialize etc. Arrays.sort(A, x-coordinate); Is there a built-in comparator for x-coordinates in Point Class? If not, how can I create one and use it. An...

Getting compiler error while using array constants in the constructor.

public class Sonnet29 implements Poem { private String[] poem; public Sonnet29() { poem = { "foo", "bar" , "baz"}; } @Override public void recite() { //... } } Line poem = { "foo", "bar" , "baz"}; is giving compilation error. Any specific reason why this is not allowed? How do I initialize a Stri...

How to store data to MySQL for array input

Hope my question is correct to the post. <form action="process.php?id=<?php echo intval($order['id']);?>" method="post"> <ul> <?php $sd = 'SELECT * FROM download WHERE pid IN ('.$order['pid'].') ORDER BY pid ASC'; // pid IN (3,4,5) $qd = $db->rq($sd); $no = 1; while($download = $db->fetch($qd)) { ?> <li> <?php echo $no...

What is the best way to free browser memory when working with large arrays in javascript?

This is how I have things setup: container.html database1.js (contains large array called database1) database2.js (contains large array called database2) Here's a sample of the array (shortened from 6000+ rows to 2): var database1=[[ "2010-01-03 07:45","2010-01-03 11:00","534","A","","","","","Installed washing machine","0","1",...

Random array special

how make special random array. i have array(1=>35,2=>25,3=>40). how make possibility that array show special elements. Ex. If i want get 100 elements from array. it will be 35/100 +-10 - must bee 1 element, 25/100 +-10 = must be 2 element, 40/100 +-10 - must be 3 element. Elements must be random, but most elements +-10. i know its pos...

[java] Looking to count frequency of #'s of 2D array output and assign it to a 1D array.

Need to put the frequency of each number occurrence into a 1D array and output the result. The 2D to 1D part is throwing me off, I'm not terribly comfortable with arrays yet. public static void main( String[] args ){ int matrix [][]=new int[20][2]; for (int row=0;row<matrix.length;row++){ for (int column=0;column<matrix[row]...

[java] Making non-graphical Histogram from array values.

Via the starPrint method I need to make the frequency of each number populated in the array display in a histogram as such: 1=3*** 2=4**** 3=7******* and so on. It needs the number of stars populated that are equal to the frequency of the number appearing! At the moment I'm getting the number of asterisks of the length of the array. ...

javascript arrays on gmaps

hi everbody, i'm newbie in javascript so, in this example exists the geometrycontrols.js (for global controls) and markercontrol.js (for marker controls) my problem is identify the arrays where "data" is saved... at the reference i see a savedata function but i have no idea how work with this function... on the other side, in test.h...

Join Two Arrays in ColdFusion

Is there a built-in way to join two arrays in ColdFusion, similar to JavaScript's array.concat()? ...

[java] Populating an Array after a nested loop.

Under the addRolls method I need to populate the nums array with the frequency of the 'total' variable numbers. These method adds the two dice rolls together properly and stores it in the 'total' variable but I cannot seem to properly throw them into an array that does the frequency such as the method above it - indFreq. In case that'...

Simple Javascript array initialization not working in Chrome

I am trying to do something really simple - initialize an array in Javascript. And it's not working in Google Chrome. Here is the code: status = []; for(i=0; i < 8; i++) status[i]=false; alert(status.length); //It says 0 when it should say 8 What gives? ...

accessing dynamicly generated array names using square brakets in an object...

object, contains 'array1'. $Obj -> array1 [12]; // works fine. however, dynamically generating that array name - you can't use square brackets... $var = 'array1'; $Obj -> $var [ 12] ; // nothing. no error, but no result. I had to do $ar = $Obj -> $var ; // copy out array $ar [12] ; // get value in array. note: $Obj -> $$var ...

How to eliminate warning for passing multidimensional array as const multidimensional array?

Hi, given the following code: /* signatures */ int getParams(char params[MAX_PARAM_LEN][MAX_LINE_LEN]); int getVersion(const char params[MAX_PARAM_LEN][MAX_LINE_LEN], const char* tagName ); /* initializing */ char params[MAX_PARAM_LEN][MAX_LINE_LEN] = {}; /* getting parameters */ paramCount = getParams(params); /* OK, p...

PHP: Split array of strings into multi-demensional array

I have an array of timezones: $timezones = array( 'Africa/Abidjan', 'Africa/Accra', ... 'America/Argentina/Buenos_Aires', 'America/Argentina/Catamarca', ... 'Pacific/Wallis', 'UTC', ); How can I easiest split this array so that I get one like this: $timezones = array( 'Africa' => array('Abidjan', '...