arrays

How to find repeating sequence of characters in given array

my problem is to find the repeating sequence of characters in the given array. simply, to identify the pattern in which the characters are appearing. example: for the examples in the above image the output for the First array should be "JAMESON" Second array should be "RON" Third array should be "SHAMIL" Fourth ar...

Fast multiplication of values in an array

Is there a fast way to multiply values of a float array in C++, to optimize this function (where count is a multiple of 4): void multiply(float* values, float factor, int count) { for(int i=0; i < count; i++) { *value *= factor; value++; } } A solution must work on Mac OS X and Windows, Intel and non-Intel....

How do I make a Perl "array of arrays of hashes"?

I think what I need is an Array of Array of Hash, but I have no idea how to make that. Can Perl do that? And if so, how would the code look like? ...

How to split text value into array with words in C#?

Is it possible to save value of txtSearche in array splitted into seperate words? txtSearche = "put returns between paragraphs"; something like this: StringBuilder sb = new StringBuilder(txtSearche); array1 = sb[1] = put array2 = sb[2] = returns array3 = sb[3] array4 = sb[4] array5 = sb[5] how to do it correct? ...

PHP - check if one or more array field exist

Hi I have a array like this: array('prefix1_field' => 34, 'prefix1_anotherfield' => 345, 'prefix1_andanotherfield' => 565, 'anotherprefix_field' => 34, 'anotherprefix_anotherfield' => 345, 'anotherprefix_andanotherfield' => 565, 'prefix3_anotherprefix_field' => 34, // <- 'anotherprefix' here should...

Any way to insert an anonymous array into a collection?

I've found plenty of entries here that say someFunc(new int[]{1,2,3}); works for calling methods and being used in a for/each loop. //====== How about for assignment into a collection? I've tried this: ArrayList<int[]> data = new ArrayList<int[]>(); data.add(new int[]{21, 19629}); and I get "identifier expected" and "illegal st...

i want to display the value from the array displayed below, how to write a syntax in PHP to get the result display?

Hi I want to display the value from the array displayed below, how to write a syntax in PHP to get the result display? This is how I got the below array Now my requirement is to get the value of "osCsid", please help me out... echo "<pre>"; var_dump($_SESSION["navigation"]); object(navigationHistory)#2 (2) { ["path"]=> ...

How can I pass a Delphi array of integers to a Prism DLL?

I've read and successfully tried the answer to How can I pass a Delphi string to a Prism DLL?, but wondered if it was possible to use a similar method to pass a Delphi array of integers (static or dynamic) to a Prism DLL. ...

How do I map unique values from a multi-level array to a hash of value=>array?

I have an array that looks something like this: [[100, "one"], [101, "one"], [102, "one"], [103, "two"], [104, "three"], [105, "three"]] What I would like to do is create an array of hashes that looks like this [{"one" => [100,101,102]}, {"two" => [103]}, {"three" => [104,105]}] The number portion will always be unique, the ...

Regex split into array of pieces

I was wondering how could I split this string {{MENU}}<li><a href="{{LINK}}" title="{{TITLE}}"><span>{{TITLE}}</span></a></li>{{/MENU}} Into array of: array( "<li><a href=\"", "{{LINK}}", "\" title=\"", "{{TITLE}}", "\"><span>", "{{TITLE}}", "</span></a></li>" ) It also should work with more differen...

C++ superclass Array yet access subclass methods?

i have an accounts class from that i have 3 types of accounts savings, credit, and homeloan. i created a binary search tree to hold all the accounts as type account how do i now access the methods of the subclasses depending on the type of object? have resolved all errors with syntax and codeing but this. been racking my head for 2 d...

Divide array of objects by common parameters in Ruby

I have an array of objects @objects and would like to split this into an array of arrays based on a parameter, ending up with an array where each entry is an array of objects all of which have object.property the same. @objects = [obj1, obj2, obj3, obj4, obj5] obj1.property = a obj2.property = a obj3.property = b obj4.property = b obj...

preg_replace /e and array

why this code does not work ? $mx['foo'] = "vvv"; $string = "foo is foobar, baz is widgets"; echo preg_replace("/(foo)/ei", "$mx[('\\1')]", $string ); the output must like this vvv is vvvbar, baz is widgets ...

How to array_merge a dynamic array based on one of it's value similarity

Good day, I am retrieving information from various websites using cURL and various parsing techniques. I made the code so I can, if desired, add additional websites I scan information from. The information retrieved is as follow : (Please note that the information may be inaccurate and may not reflect real price/name) Array ( [web...

C++ Program Apparently Printing Memory Address instead of Array

#include <iostream> using namespace std; int main(){ int findMax(int *); const int MAX = 100; int values[MAX]; char ivals[256]; // Get the space-separated values from user input. cin.getline(ivals, 256, '0'); char *helper; // Clean input array and transfer it to values. for(int i = 0; i < (MAX) && iv...

How do you create an array to store regex string matches in java?

I'm trying to take a file that store data of this form: Name=”Biscuit” LatinName=”Retrieverus Aurum” ImageFilename=”Biscuit.png” DNA=”ITAYATYITITIAAYI” and read it with a regex to locate the useful information; namely, the fields and their contents. I have created the regex already, but I can only seem to get one match at any give...

Default copy assignment with array members

I've got a class definition similar to the following: class UUID { public: // Using implicit copy assignment operator private: unsigned char buffer[16]; }; I've just had a unit test fail on me that was verifying that copy assignment worked properly. To my surprise, one byte in the middle of the buffer[] array was copied ...

Compiler Error C2106 when trying to simulate a vector

I'm trying to write a fake vector for my class assignment, and I currently get an error in the member function pushBack. The compiler doesn't seem to like incrementing the SIZE variable which holds the number of elements in the "vector". Is there something I might need to fix? Your assistance would be highly appreciated for helping me wi...

Pointers's pointer c++ char intialization

I'm with a doubt In initialization of this in C++: char** A_Function() { char** charList = new char*[2]; charList[0] = "abcde"; charList[1] = "fghij"; return charList; } There's no problem "on compiling this code", but I'm not sure about the behaviour. 1 - the char list: char* is on heap ok? 2 - the charList[n_positio...

jquery, array and dynamically add & delete text input

I have a situation here where I need to be able to add, delete and reset the passenger name list dynamically, with maximum 10 passengers. Below is the code for html interface: <div id="add_passenger"> <br> <input type="button" id="add_pax" name="add_pax" value="Add Passenger Name" /> <input type="button" id="del_pax" name="del_pax" val...