arrays

How to access class members from an array of class variables?

I want to use PHP's reflection features to retrieve a list of parameter names from a method. I have a class like this: class TestClass { public function method($id, $person, $someotherparam) { return; } } I can get the list using code like this: $r = new ReflectionClass('TestClass'); $methods = $r->getMethods(); for...

tcl dual array correspondance

I just found myself in a position where I have two arrays in TCL/TK. I'm given $W_Array and $P_Array I need to traverse through one array not knowing what the size of each one is before hand, and execute a command only when there is a value for both arrays. Yes the array lengths could be different. What is the best way of doing this?...

Writing to a character array that is a member of a struct

Hello, this is my first time posting a question here - I've searched for ones that are similar, but none came up that I found. Here is the snippet from my header: #define LINE_LEN_MAX 256 typedef struct line_description { char buffer[LINE_LEN_MAX + 1]; [...] } line; And here is the snippet from my main function: int main(in...

C++, what is a good way to hash array data?

hello I have a curious problem and I am brainstorming possible solutions. The problem is such: I have a number of inputs (up to several thousand different ones), which basically differ in two-three arrays (arrays are a different size generaly, from size one up to couple thousand elements long). the functions which process arrays take s...

php merging two arrays into one

hi, I have two arrays that need to be merged together and trying to figure out the correct way of doing it. this is the first array Array ( [IndividualOutmsg] => Array ( [0] => Array ( [user_id] => 3 [number] => 414566765 ...

PHP - lookup array contents with dot syntax

Does anybody see anything wrong with the following function? (Edit: no, I don't think anything is wrong, I am just double-checking since this will be inserted into a very common code path.) function getNestedVar(&$context, $name) { if (strstr($name, '.') === FALSE) { return $context[$name]; } else { $pieces = exp...

How to use Vector as DataSource ?

Hi, I wanna use this vector as DataSource for my Jtable.There is 4 Column here (ADI,SOYADI,BABA ADI, ANA ADI). ResultSet is adding every row to vector named _kisivector.This is my DataSource.But i dont wanna get whole records at start.I wanna get only 5 records from this vector.Than there will be 2 button , back and forward.When i click...

Remove zero values from a PHP array

I have a normal array like this Array ( [0] => 0 [1] => 150 [2] => 0 [3] => 100 [4] => 0 [5] => 100 [6] => 0 [7] => 100 [8] => 50 [9] => 100 [10] => 0 [11] => 100 [12] => 0 [13] => 100 [14] => 0 [15] => 100 [16] => 0 [17] => 100 [18] => 0 [19] => 100 [20...

Sorting an NSArray

I have an NSArray as follows: NSArray *directoryContent = [[NSFileManager defaultManager] directoryContentsAtPath:filePath]; The files at filePath are: 11.thm, 12.thm, 13.thm,...,Text_21.thm, Text_22.thm, Text_23.thm,... I would like to sort the NSArray in the order: 13.thm, 12.thm, 11.thm,..., Text_23.thm, Text_22.thm, Te...

Symmetric Difference of Two Arrays

I have two NSArrays of Movie objects called DVD and VHS. I'd like to find the symmetric difference of these arrays. I want to know which Movies are in VHS buy not in DVD, and which Movies are in DVD but not VHS. Can anyone tell me if there is a fast algorithm to solve it (preferably in C or Objective-C)? Is it faster/easier to solve if...

how to create a loop in a function with another function?

Thanks for the help guys ...

Android - How to populate Content Provider only once on App install?

I have a database in my application that is used as a ContentProvider. It holds settings values for the application, and when I install the application I want it to add a hardcoded set of values just once. This is how I am trying to do it at the minute. if(settings.size()<= 0){ Settings s = new Settings("voipusernameTa", "xxxxxxxx...

Converting php array of arrays into single array

I have an array whose values are all arrays of a specific format that looks like this: Array ( [0] => Array ( [username] => John ) [1] => Array ( [username] => Joe ) [2] => Array ( [username] => Jake ) ) and I...

Array indexing starting at a number not 0 in c

Is it possible to start an array at an index not zero...I.E. you have an array a[35], of 35 elements, now I want to index at say starting 100, so the numbers would be a[100], a[101], ... a[134], is that possible? I'm attempting to generate a "memory map" for a board and I'll have one array called SRAM[10000] and another called BRAM[5000...

how to pass array to stored procedure using OCI calls

When I try to pass an array of numbers to a stored procedure, the stored procedure is not able to get the array contents. Array.count = 0 in the stored procedure! The stored procedure is pretty simple. It just has to insert the parameters into a table. code looks like : TYPE arr_parmid IS TABLE OF testtable.UNID%TYPE INDEX BY BINARY_IN...

Array of strings in groovy

In ruby, there is a indiom to create a array of strings like this: names = %w( lucas Fred Mary ) Is there something like that in groovy? ...

How do you dynamically access attributes of a JSON Object

I have a two level JSON object EX: var regexDefs = { "alpha": { "regex" : /^[A-Z]+$/, "errMsg" : "Alpha Only" } } I want to do something akin to searching an array for a key. (using jQuery's inArray) var key = "alpha"; alert($.inArray(key,regexDefs)); if the key is in the array then I want to ...

Counter in Flash and Tweener as3

My scrolling counter is not displaying 1-9...only “zeros” every ten intervals. It plays, but the code is unfinished at line 37 in NumbersView.as. Notice Tweener is used to display the sprites. How do I finish this? WHAT I'M TESTING "NumbersView.as" loop error, onComplete, missing argument or function - Tweener code, line 37? - for loop,...

Runtime array bounds checking with g++

Is there any way to do array bounds checking with g++? Valgrind can't detect overflows on arrays allocated on the stack. Additionally, the argument -fbounds-checking is only implemented for gcc (according to http://www.lrde.epita.fr/~akim/ccmp/doc/bounds-checking.html). Ideally, the source code shouldn't be modified in any way. ...

"System.NullReferenceException" when trying to fill array

This is my code: Public UserBookings() As String If dr.Read() Then Dim intCounter As Integer intCounter = 0 While dr.Read() UserBookings(intCounter) = dr(0) intCounter = intCounter + 1 End While Return UserBookings Else Return False End If But I get t...