arrays

How to use textures and arrays in CUDA?

Steps for using textures and arrays in CUDA? ...

C++ vector of char array

I am trying to write a program that has a vector of char arrays and am have some problems. char test [] = { 'a', 'b', 'c', 'd', 'e' }; vector<char[]> v; v.push_back(test); Sorry this has to be a char array because I need to be able to generate lists of chars as I am trying to get an output something like. a a a b a c a d a e b a b...

php in_array() not matching

The first array is called $related_docs and the second on is $all_docs. I'm trying to match the "1" value in the first array with the "1" value in the second array. Array ( [0] => 1 ) Array ( [0] => Array ( [id] => 1 [type_name] => bla1 ) [1] => Array ( [id] =...

Change the array KEY to a value from sub array

Hello, This is the set of result from my database print_r($plan); Array ( [0] => Array ( [id] => 2 [subscr_unit] => D [subscr_period] => [subscr_fee] => ) [1] => Array ( [id] => 3 [subscr_unit] => M,Y [subscr_period] =...

One question about array without default constructor in C++

From previous post, I learnt that for there are two ways, at least, to declare an array without default constructors. Like this class Foo{ public: Foo(int i) {} }; Foo f[5] = {1,2,3,4,5}; Foo f[5] = {Foo(1), Foo(2), Foo(3), Foo(4), Foo(5)}; I also learnt that the first one will construct the object using the parameter...

Get value of inputs with Jquery

I have 100 inputs with name - table[]. How to get their value with jQuery,like $_POST['table'] ,as I do in PHP. I tryed Code: $("input[name='table[]']").each(function() { document.write($(this).val()); }); but I want to get them as an array. ...

How do I find out if a value is in an array in C?

What's the equivalent of php's in_array or IList.Contains in C#.net. I'm a C n00b but I know very little is buit-in. If I have to do this myself, what's the best way? iterate over the array and test each value? ...

Stop ArrayOutOfBoundsException from halting program execution in Java

Im am currently developing an automated "test" class (running several individual tests on other classes in the same package). The aim of the test file is to show whether each test either passed or failed. Some of the files being tested are not written correctly creating an ArrayOutOfBoundsException when running the test, that produces my...

Android: Populating a listview with array items

I'm new to Android and I think I'm trying to do something really basic: I have a 5 strings in my Array (say 'One', 'Two', ...). I want to add these 5 strings to my list view in my listactivity. My List: <ListView android:id="@+id/android:list" android:layout_width="wrap_content" android:layout_height="wrap_content"/...

How to optimize working with array in the following code in javascript?

Is there a way to make the following code faster? It's becoming too slow, when length of array is more than 1000 records, especially in IE6. dbusers = data.split(";"); $("#users").html(""); for (i = 0; i < dbusers.length; i++) { if ($("#username").val() != "") { if (dbusers[i].indexOf($("#username").val()) != -1) { ...

Try-Catch-Throw in the same Java class

Is it possible to catch a method in the current class the try-catch block is running on? for example: public static void arrayOutOfBoundsException(){ System.out.println("Array out of bounds"); } ..... public static void doingSomething(){ try { if(something[i] >= something_else); } catch (arrayOut...

Jquery: Adding multiple values to textboxes (round two)

I don't think I explained myself as best I could last time, so I'm going to give it another shot. From the following code: <div id="addons" class="grid_12 omega"> <div class="addon"> <span><input type="checkbox" name="addon_1" value="addon_1"></span> <span class="title">Title 1 here</span> <span class="cost"...

Trouble outputting full list of numbers using innerHTML

Hi, the following is code to create a sequential list of numbers from 1 to 10. I'd like to take this list and output in the div "pagination" using innerHTML. However, when I execute the script, the only thing that is outputted is the number 10. When I overwrite the page using document.write instead, it outputs the whole list. Can som...

How to store a table of equivalent values in C# for optimal use in my example?

ENVIRONMENT: C# I have a table of equivalent values, like this: CHEVR = CHEVROLET MERCE = MERCEDES ALFA = ALFA ROMEO [...] I have this data in a tab delimited file. I also have a table with about 15M rows, which contains informations about car parts. One of these is the first row from the equivalent values table (CHEVR, MERCE, ALFA,...

Remove Parent in PHP Multidimensional Array

What's the best way to remove the parent of a matched key in an Multidimensional Array? For example, let's assume we have the following array and I want to find "[text] = a" and then delete its parent array [0]... (array) Array ( [0] => Array ( [text] => a [height] => 30 ) [1] => Array ( [text] => k...

How To Shift Array Elements to right and replace the shifted index with string in Visual C++

VISUAL C++ Question Hi, I have array of 3 elements and I want to shift its elements to the right and replace the shifted index cell with "SHIFTED" string and this should loop until all the cells has "SHIFTED" string. For example: int a[x]={0,1,2}; Initial index and elements Order: [0]=0 [1]=1 [2]=2 should become in the: 1st l...

UITableView search and arrays !

Hi all ! need some help In my app i have a NavigationController, in it i set a UIViewController with the delegates : UITableViewDelegate, UITableViewController and UISearchBarDelegate. I set my table view using an array, i set an another array to do search. When a row is selected, i push a viewController, i use my ChangeProductText...

Any reason PHP don't iterate array by reference?

$arr = array(array(array())); foreach($arr as $subarr) { $subarr[] = 1; } var_dump($arr); Output: array(1) { [0]=> array(1) { [0]=> array(0) { } } } But for object,it's reference: class testclass { } $arr = array(new testclass()); foreach($arr as $subarr) { $subarr->new = 1; } var_dump($arr); Output: array(1...

How can I create an array/list of dictionaries in python?

I have a dictionary as follows: {'A':0,'C':0,'G':0,'T':0} I want to create an array with many dictionaries in it, as follows: [{'A':0,'C':0,'G':0,'T':0},{'A':0,'C':0,'G':0,'T':0},{'A':0,'C':0,'G':0,'T':0},{'A':0,'C':0,'G':0,'T':0},...] This is my code: weightMatrix = [] for k in range(motifWidth): weightMatrix[k] = {'A':0,'C':0,...

Is it possible to use array_shift() in PHP and get the key?

I have a list of files in an array where the filename is the key and the value is the last modified date in seconds. They are sorted from oldest to newest. The files are glob()'d in, and then sorted this way using asort($fileNameToLastModified, SORT_NUMERIC); I use array_shift() to get the oldest file. Unfortunately, it seems to be ...