arrays

String array logic question with java I/O.

Hello, I have problem. I need to read a line like this from a file: 5 Chair 12.49 EDIT: I want to be able to have more lines of data. I need to separate each word/number into different data types. First one is an int, second is a String, third is a double. Then I need to have them formatted like this: Item: Chair Price: $12.49 Quantit...

Add items to js array with UpdatePanel

I'm creating a javascript array in an overridden PageLoad() event on a class that I'm including inside my UpdatePanel using something like this: Page.ClientScript.RegisterArrayDeclaration("myArray", "'one','two','three'"); I have a button I'm using to "Post Back" (with ajax since it's in an update panel) that then shows a specified nu...

php - How do I fix this illegal offset type error

I'm getting "illegal offset type" error for every iteration of this code. Here's the code in case anyone can help: $s = array(); for($i=0;$i<20;$i++){ $source = $xml->entry[$i]->source; $s[$source] += 1; } print_r($s) Any ideas. Thanks in advance. ...

[FLEX 3] Placing images into a Collage Canvas

I've got an array of different sized images. I want to place these images on a canvas in a sort of automated collage. Does anyone have an idea of how to work the logic behind this concept? All my images have heights divisible by 36 pixels and widths divisible by 9 pixels. They have mouseDown functions that allow you to drag and drop. ...

Is there a method in java that can take 2 numbers and give you the numbers that are in between them(Ranges)?

I read in a file with a few numbers using a scanner, and then split them using the split method. My main issue is if there is a method that can just give me ranges, probably in the math class. The numbers are currently in an array, and I wanna move those numbers and there ranges into a two-dimensional array. Could anyone give me some tip...

error C2059: syntax error : ']', i cant figure out why this coming up in c++

void display_totals(); int exam1[100][3];// array that can hold 100 numbers for 1st column int exam2[100][3];// array that can hold 100 numbers for 2nd column int exam3[100][3];// array that can hold 100 numbers for 3rd column int main() { int go,go2,go3; go=read_file_in_array; go2= calculate_total(exam1[],exam2[],exam3[]); ...

Parsing a complicated array with GetJSON Jquery

TLDR: Started with this question simplified it after got some of it working and continuing it here. I need to 'GET' the JSON array Format it correctly and for each within the array place it in the corresponding DIV. ?? It works. This is a followup from this question to simplify and continue. I need to some complicated JSON data f...

Accessing 2D array and passing string to label.text

Hi. I'm trying to create 2D array and initialize it with NSStrings. When I try to copy content of a cell from the array to a label.text, the application crashes. NSMutableArray *array = [NSMutableArray arrayWithCapacity:0]; [array addObject:[NSMutableArray arrayWithObjects: [NSArray arrayWithObjects: @"0-0", @"0-1",...

Alternative to array_shift function

Ok, I need keys to be preserved within this array and I just want to shift the 1st element from this array. Actually I know that the first key of this array will always be 1 when I do this: // Sort it by 1st group and 1st layout. ksort($disabled_sections); foreach($disabled_sections as &$grouplayout) ksort($grouplayout); ...

Echo certain value from smarty array

Hi, So currently I have an array with smarty.. {foreach from=$_sequences key=k item=v} Name => {$v.menu} Type => {$v.type} Step => {$v.pri} Data =>{$v.data} {/foreach} which gives me: Name => Test Type => Audio Step => 1 Data => audio1 Name => Test2 Type => Audio Step => 2 D...

[PHP Array] - Sorting data and print out in alphabetic order

Hi all, I got an array which contains some data like this: $arrs = Array("ABC_efg", "@@zzAG", "@$abc", "ABC_abc") I was trying to print the data out in this way (Printing in alphabetic order): [String begins with character A] ABC_abc ABC_efg [String begins with character other than A to Z] @$abc @@zzAG I don't know how to do it. ...

ArrayCollection error in Flex does not accept single XML nodes - alternatives?

hello, i get this error when i retrieve an XML that only has 1 node (no repeating nodes) and i try to store in an ArrayCollection. -When I have MORE than 1 "name" nodes...i do NOT get an error. TypeError: Error #1034: Type Coercion failed: cannot convert "XXXXXX" to mx.collections.ArrayCollection. this error occurs as the line of code...

Merging multiple array then sorting by array value count

Hi, Please help me, i need to merge multiple arrays then sorting it by array value count. Below is the problem: $array1 = array("abc", "def", "ghi", "jkl", "mno"); $array2 = array("mno", "jkl", "mno", "ghi", "pqr", "stu"); $array3 = array_merge($array1, $array2); $array4 = ??? print_r($array4); I want the returns of $array4 like thi...

float** allocation limit + serialized struct problem. Need advice!

basically im getting an allocation limit error/warning when i create a float** array. the function i am calling to fill the float** retrieves data from a struct loaded from a file. The function works fine when i use one object but when i load 2 objects into memory i get the limit error. I am pretty sure this is to do with byte alignment ...

Odd behaviour with PHP's in_array function.

I have a function that checks multiple form items and returns either boolean(true) if the check passed or the name of the check that was run if it didn't pass. I built the function to run multiple checks at once, so it will return an array of these results (one result for each check that was run). When I run the function, I get this arra...

How do I shrink a matrix using an array mask in MATLAB?

This seems to be a very common problem of mine: data = [1 2 3; 4 5 6]; mask = [true false true]; mask = repmat(mask, 2, 1); data(mask) ==> [1; 4; 3; 6] What I wanted was [1 3; 4 6]. Yes I can just reshape it to the right size, but that seems the wrong way to do it. Is there a better way? Why doesn't data(mask) return a matrix whe...

php - How do I convert a string to an associative array of its keywords

take this string as an example: "will see you in London tomorrow and Kent the day after tomorrow". How would I convert this to an associative array that contains the keywords as keys, whilst preferably missing out the common words, like this: Array ( [tomorrow] => 2 [London] => 1 [Kent] => 1) Any help greatly appreciated. ...

C++ STL: Array vs Vector: Raw element accessing performance

I'm building an interpreter and as I'm aiming for raw speed this time, every clock cycle matters for me in this (raw) case. Do you have any experience or information what of the both is faster: Vector or Array? All what matters is the speed I can access an element (opcode receiving), I don't care about inserting, allocation, sorting, et...

Is there anything like deal() for normal MATLAB arrays?

When dealing with cell arrays, I can use the deal() function to assign cells to output variables, such as: [a, b, c] = deal(myCell{:}); or just: [a, b, c] = myCell{:}; I would like to do the same thing for a simple array, such as: myArray = [1, 2, 3]; [a, b, c] = deal(myArray(:)); But this doesn't work. What's the alternative? ...

How to create multiple arrays from 2? (actionscript, flash)

so I have array like ParamsArray {a,b,a,a,...b} (so i have 2 kinds of parameters in this array - a and b) (here I have N strings) and another array - DataArray {data1,data2,...dataN} (different strings) (here I have N strings) Now I created 2 new arrays ArrayA and ArrayB and I wanta want to feel arra ArrayA with all data (strings) fr...