» Home » array » Page 1
how to write function Max($array) which returns the maximum value contained in $array or some array nested within $array
Category : Programming Languages

Eg:


$array= array(array(141,151,161),2,3,array(101,202,array(303,606)));

output :606


View Replies


I need a single line array. I am using nested loops to push elements into the array. The array contains multipe lines
Category : Programming Languages

I am using perl to produce an array of elements arranged as a single, tab-delimited line. However, only a portion of my array is like this. Other parts get printed as separate lines.


Below is the relevant portion of the code.


It is a foreach loop that has three conditional for loops embedded in it. The push command is used four times at four dif


View Replies


How do I marshal nested lists as JSON using Jersey? I get an array of nulls or an array of one-element dictionaries containing an array
Category : Programming Languages

I'm working on a project which uses Jersey to convert objects to JSON. I'd like to be able to write out nested lists, like so:


{"data":[["one", "two", "three"], ["a", "b", "c"]]}

The object I'd like to convert first represented data as a <LinkedList<LinkedList<String>>>, and I figured Jersey would just do the right thing. The above was outpu


View Replies


Java version of c# Array.Copy(Array sourceArray, int sourceIndex, Array destinationArray, int destinationIndex, int length)
Category : C & C++ & C#

I'm trying to convert some C# code to Java and I came across a line that calls this method:


Array.Copy(
frames[row],
0,
concatenated,
row*frames[row].Length,
frames[row].Length);

The signature of the C# method looks like this:


Array.Copy(
Array sourceArray,
int sourceIndex,

View Replies


Adding element to new array using assign by addition, but original array value dynamically changes the new array elements too
Category : Network & Servers

First post, I've been researching this all day and I'm at my wits end! I have an array called $Global:CBCGroups that I want to contain the value of an ever-changing variable called $Global:CBCTempHolder. Whenever $Global:CBCTempHolder is changed, I want it to add it's contents to the array $Global:CBCGroups using += (ie:


$Global:CBCGroups += $Global:CBCTempHolder

View Replies


How to marshal float array from c# to c, and then edit array in c while having c# be able to reference the updated array instantly
Category : C & C++ & C#

I am not sure if this is possible, I don't know a whole lot about marshaling in c#, so please fill me in on my understanding of this if I am way off, or if this is possible at all.


But basically I have an array of floats in C#, in a C# based app. Every time this program cycles I need to do some very processor intensive heavy lifting on this array of floats. So I wanted to write this


View Replies


How to convert an object array into a custom type array (involving Array List)
Category : Programming Languages

What I am trying to do is to find the intersection of two sets using a custom type IntSet. The code is compiling fine, however when I run it, it throws an ArrayStoreException. From what I gather, the problem is trying to convert the object array into IntSet. Here is the code:


public IntSet[] intersection(Integer[] s1, Integer[] s2) {
Arrays.sort(s1);//sort arrays

View Replies


PHP - Search one associative array with an array of values, then create a new array with matching results
Category : Programming Languages

I have one associative array as follows:


{
"organizations":[
{
"name":"10sheet",
"owner_name":"Me"
},
{
"name":"12Gigs",
"owner_name":"Me"
},
"name":"24/7 Card",
"owner_name":"Me as well"
},
}

I want to search using the name field in this


View Replies


Comparing array of keys of associative array to integer indexed array
Category : Programming Languages

I have written the following code to check whether an array is associative or not


function is_associative( $arr ) {
$arr = array_keys( $arr );
return $arr != array_keys( $arr );
}

It returns true for arrays like:


array("a" => 5,"b" => 9);

and false for numeric arrays


But it doesn't r


View Replies


Java get an element from an array, edit it, then store it in another array, without altering the first array
Category : Programming Languages

I have encountered a problem in one of my Java projects, which causes bugs.
The problem sounds as following:


I have two arrays. Let's name them firstArray and secondArray. Object in this case is a seperate class created by me. It works, the array can be filled with objects of that type.


Object[] firstArray= new Object[];
Object[] secondArray = new Object[];<

View Replies


Next
2012 / 2017 Copyrights BigHow , All Rights Reserved .