Hi there
I am wondering if anyone could suggest the best approach to computing the mean / standard deviation of a large number of relatively small but differently sized arrays in CUDA?
The parallel reduction example in the SDK works on a single very large array and it seems the size is conveniently a multiple of the number of threads p...
I am accessing an external PHP server feed (not a real link):
$raw = file_get_contents('http://www.domain.com/getResults.php');
that returns data in the following context:
<pre>Array
(
[RequestResult] => Array
(
[Response] => Success
[Value] => 100
[Name] => Abracadabra
...
I'm just learning Ruby so apologies if this is too newbie for around here, but I can't work this out from the pickaxe book (probably just not reading carefully enough).
Anyway, if I have an array like so
arr = [1,2,3,4,5]
and I want to, say, multiply each value in the array by 3, I have worked out that doing the following
arr.each {|...
using binarySearch never returns the right index =/
int j = Arrays.binarySearch(keys,key);
where keys is type String[] and key is type String
I read something about needing to sort the Array but how do I even do that if that is the case?
I wish #java was smarter =/ <-- read:simpler
Given all this I really just need to know:
How d...
I have an array like this:
array(
0 => array("src" => "foo-21.gif"),
1 => array("src" => "bar-short.gif"),
2 => array("src" => "baz-1.gif"),
3 => array("src" => "whatever.gif"),
4 => array("src" => "some-long.gif"),
5 => array("src" => "xyz.gif"),
);
The value in the src element can be anything.
However t...
If i have a variable $num = 50 how can i put numbers 1-50 into an array?
(50 is an example.. i wont know how many questions)
...
Can I choose some elements in an array and shuffle it in PHP?
You know, when you use
shuffle(array)
, It shuffles all elements in an array, but I just want to shuffle some elements in an array while keep other elements unchanged, how to do it?
...
array array_splice ( array &$input , int $offset [, int $length = 0 [, mixed $replacement ]] )
Why is there an & before $input?
...
In my program I have a few structs and a char array that I want to send as a single entity over UDP.
I am struggling to think of a good way to do this.
My first thought was to create a structure which contains everything I want to send but it would be of the wrong type for using sendto()
How would I store the two structs and a char ar...
I am trying to make a remove method that works on an array implementation of a list.
Can I set the the duplicate element to null to remove it? Assuming that the list is in order.
ArrayList a = new ArrayList[];
public void removeduplicates(){
for(a[i].equals(a[i+1]){
a[i+1] = null;
}
a[i+1] = a[i];
}
...
I came across the following code:
var f = function () {
var args = Array.prototype.slice.call(arguments).splice(1);
// some more code
};
Basically, the result in args is an array that is a copy of the arguments without its first element.
But what I can't understand exactly is why f's arguments (which is an object that holds...
Below is the code:
$result=mysql_query("select * from choices where a_id='$taskid'")or die(mysql_error());
print_r($result);
I get "Resource id #4", any idea?
After I added
while($row=mysql_fetch_assoc($result))
{ print_r($row); }
I just got []
What's wrong?
...
I was looking for something over the web when I came across this question. Have no idea of how to solve it. Help me out please.
Suppose we have an array
a1,a2,... ,an, b1,b2,..., bn
How to change this array to
a1,b1,a2,b2, ..., an,bn in O(n) time and in O(1) space.
...
1) I want to save case 1 value to an array. Return this array and pass it to a function. The code become case 2, but no result come out, where is the problem?
2) In function display_urls, i want to echo both $url and $category. What should i do in IF condition or add another line of code?
function display_urls($url_array)
{
echo "";
...
Below is the code:
function swap(&$a, &$b)
{
list($a, $b) = array($b, $a);
}
for ($i=0; count($resultset);$i++)
{
for($j=1;$j<5;$j++)
{
$k = rand(1, 4);
swap($resultset[$i]["option".$j],$resultset[$i]["option".$k]);
}
}
It is a two-dimensional array from a MySQL query, I want to shuffle the values ...
If i have an array of short unsigned ints.
Would shifting array[k+1] left by 8 bits, put 8 bits into the lower half of array[k+1]?
Or do they simply drop off as they have gone outside of the allocated space for the element?
...
Hi all,
This question is in C++.
I am trying to dynamically allocate an array of pointers to objects.
I know I can use a vector container but the point of the exercise is not to...
Here is the code:
void HealthClub::AddHealthClubDevice ( char* HealthClubDeviceName )
{ //We added NumberOfDevices as ...
I'd like to pass a multi-dimensional array to a constructor like so:
constructor TMyClass.Create(MyParameter: array of array of Integer);
begin
LocalField := MyParameter;
end;
Where LocalField is an array of array of Integer.
However the above code won't compile ('Identifier expected but ARRAY found'). Could somebody explain to me ...
Hi,
I'm trying to write a matrix into a text file.
In order to do that I'd like to know how to write an array into a line in the text file.
I'll give an example:
int [] array = {1 2 3 4};
I want to have this array in text file in the format:
1 2 3 4
and not in the format:
1
2
3
4
Can you help me with that?
Thanks a lot
...
Given two arrays as parameters (x and y) and find the starting index where the first occurrence of y in x. I am wondering what the simplest or the fatest implementation would be.
Example:
when x = {1,2,4,2,3,4,5,6}
y = {2,3}
result
starting index should be 3
Updated: since my code is crap I removed it from the question...