arrays

convert string[] to int[]

Which is the fastest method for convert an string's array ["1","2","3"] in a int's array [1,2,3] in c#? thanks ...

how to perform Array Indexing in R Language

hey ppl, i am new to r language.. so i just want to know how array indexing is done in r language , i mean like sorting or any calcultaions that involve 2-d arrays. ...

Array is null after adding values

hi everyone. i parsing a XML file. when i adding values into array, the array still null, i don't know the reason. may be reason is that i using this array in two classes. there is .h files xmlparser.h #import <UIKit/UIKit.h> @class SightsTableViewController, Sight; @interface XMLParser : NSObject { NSMutableString *currentEle...

Create array with Set Extract in Cakephp with conditions

I have the following array: Array ( [0] => Array ( [id] => 4 [rate] => 82.50 [pounds] => 2 [ounces] => 3 [mailtype] => Package [country] => UNITED KINGDOM (GREAT BRITAIN) [svccommitments] => 1 - 3 business days [svcdescription] =>...

about sorting arrays in java

Hi I have 3 arrays (A,B,C) and A has its own integer 10,and C has its own integer 8 and B has its own integer 5 and how can I sort arrays with its integers and then return those arrays?? it means that you sort integers : 5,8,10 and I want to return their arrays : B,C,A how can I do this? please help me thanks ...

Double index in Perl, why is it so?

with @a=(6,3,5,7); @b=(@a[0..3])[2..3]; print @b; #print 57 but for @b=@a[0..3][2..3]; I get a syntax error. Could someone explain why? ...

PHP search array return key

i have an array that looks like this, I want to search for a saleref and get it to give me the key in PHP, i've tried using array_search but i get nothing back. Alternatively i just want to display the other values in the same array as the salesref searched if there's a better way. Array ( [xml] => Array ( ...

Java: CharBuffer "ignores" array offset?

Hello, everyone! Please help me understand the following: I create a CharBuffer using CharBuffer.wrapped(new char[12], 2, 10) (array, offset, length) so I would expect that the array is accessed with an offset of 2 and total (rest) length of 10. But arrayOffset() returns 0. What I want to understand (and can't figure out from JavaDoc)...

Dynamically populating 3D array in JavaScript

I am trying to populate a dynamic 3 dimensional array so I don't have to type it all out var o = { matrix: (function(n) { for (var x = 0; x < n; x ++) { for (var y = 0; y < n; y++) { for (var z = 0; z < n; z++) { this[x][y][z] = -1; } } } }).call(Array, 5), ... } The message I get is...

Find the item in an array that meets a specific criteria if there is one (Perl)?

Is there a Perl idiom for finding the item in an array that meets a specific criteria if there is one? my $match = 0; foreach(@list){ if (match_test($_)){ $result = $_; $match = 1; last; } } $match || die("No match."); say $result, " is a match."; The example seems a bit awkward. I expect Perl to have som...

Dll Import C++ to C# with Arrays

I've been given the assignment to port some library routines to C# so our other application developers can access it, but I don't know how to declare the variables so they come into the routine correctly. The problem is, when I step through reading the input in with the C++ code, I get all skewed values Attempt to use: double[] Par = ...

Passing row of static 2-d array to function in C++

This is a really elementary question. Nonetheless, I haven't found a solution after studying dozens of semi-relevant examples online. I have a two-dimensional array of doubles whose size is known at compile time: double demPMFs[ NUM_DEM_PARAMS ][ NUM_AGE_CATEGORIES ]. Array entries are populated by input files early in the program. I'd ...

How do I array push this 2-D array? (PHP)

In this codeigniter model, I am trying to push the category name of each product. I want the array to look like: Array ( [0] => Array ( [id] => 1 [name] => Game 1! [category_id] => 3 [category] => games //the category element is in the [0] array. ) [1] => Array ( ...

Replace names in text with links

I want to replace names in a text with a link to there profile. $text = "text with names in it (John) and Jacob."; $namesArray("John", "John Plummer", "Jacob", etc...); $LinksArray("<a href='/john_plom'>%s</a>", "<a href='/john_plom'>%s</a>", "<a href='/jacob_d'>%s</a>", etc..); //%s shout stay the the same as the input of the $text. ...

what is a byte[] array?

This could be a very simple CS question but I just still do not get what byte array is in the context of .net framework. I am familiar with standard definitions like array and byte and very familiar with EE concepts such as Byte. But I fail to connect it in terms of CS concepts. I see it used every where and I use it with out really unde...

CSS style #elements[1-10]

If I had 5 divs with ids "element1", "element2", etc..., is there a way to style an array of elements with something like: #elements[1-10]{ position:relative; } I know you guys probably think I'm nuts, but I'm dealing with some code that is auto generated and I would have to edit the core files of this cms which I don't want to do in...

Ruby on Rails: Submitting an array in a form

I have a model that has an attribute that is an Array. What's the proper way for me to populate that attribute from a form submission? I know having a form input with a field whose name includes brackets creates a hash from the input. Should I just be taking that and stepping through it in the controller to massage it into an array? Ex...

Would it be crazy to use a (serialized) array instead of a join table to link two database tables?

I'm using Ruby on Rails to develop a web application. I have a wiki article system as part of my project. As part of the wiki, articles can be linked to authors, and those links also need to be tracked by the revision system. Authors is an attribute of the Article as a whole, and not related to who enters particular Revision, and is a ...

[c] Array index efficiency (specifically, temporary vars)

I've read a fair amount of stuff about efficiency of array indices vs. pointers, and how it doesn't really matter unless you're doing something a lot. However, I am doing this a lot. The code in question has an array of structs. (Two different ones, for two different types actually, but whatever). Since my background is mostly in hig...

Extending Array in Actionscript 3 (Flex)

I'm trying to make a variation on Array for a very specific purpose. When I have the following: public class TileArray extends Array { // Intentionally empty - I get the error regardless } Why can't I do this? var tl:TileArray = [1,2,3]; despite the fact that I can do this var ar:Array = [1,2,3]; The error I receive is this: ...