arrays

dynamic 2d array in java using Arraylist

I found some problem in creating dynamic 2d array with arraylist,The original code is tediously long to read so i am giving a simple code here,the problem is same in both the cases: import java.util.*; class test{ public static void main(String args[]){ Integer test[]=new Integer[3]; ArrayList<Integer[]> al=new ArrayList<Inte...

PHP array comparison

How to compare 2 arrays with each other? For example i have array("a", "b", "c") and array("a", "c", "b") It would return true when they're compared. But if one of the letters if not found in one of them it would return false. Order is not important. ...

set array to hold images verses text, flash actionscript

Hi, the following flash actionscript below stores letters and numbers into an array and displays them randomly in a flash movie as "falling text" down the screen. I'd like to modify this script so I can have the array store multiple images verses letters and numbers. source: http://www.flashcomponents.net/tutorials/letter_and_number_r...

Wrong or Right ? While loops.

Heya guys, now ive never done this method before and i just tried it to see if it would work and it works like a dream. Usually people tend to do this way. $tags = array(); while($row = $statement->FetchObject()) { $tags[] = $row; } but would it be faster or just less code if i done it this way. $tags = array(); while($tags[] =...

Accessing later index in array using enumerate(array) Python

hey guys, how would you access an array from array[n] in an array of 100 floats in this for loop (i need the enumerate): for index,value in enumerate(array): #do stuff with array[n] n=n+1 im trying to make it so that it operates in a smaller and smaller space each iteration.. thanks ...

Jquery: Turn 3 arrays in to different objects with different IDs

I've been fooling around with a very minimalistic jquery admin area menu. The thing is I want jQuery to build 3 equal menus with different ID's. I managed to do this by creating a function and call it 3 times with different variables, but I'd like to ask my first question on this lovely community: What is the most minimalistic and effic...

List set index c#

Hey there, I am using a List construct to handle the sequence in which images are drawn in "OnPaint". Now if my images are re-ordered (e.g. "brought to front" or "..to back"), I'd need to reposition them in my List. I have trouble doing so, because List doesn't support a method similar to setIndex(). So what I am trying to do is basica...

Is my use of Timer and TimerTask creating a concurrency problem

Ive create a game and the portion of the program I am having a problem is modeled with a slightly modified MVC model. For the controller I use a TimerTask to run 60 times a second. Controller(){ timer = new Timer();// timer.schedule(tt,1000,1000/60); } TimerTask tt = new TimerTask() {//Controller member variable public void...

How can I order an array by the amount of times each object appears in a join table in RoR?

I'm doing a search on a model, like this: search_results = Note.description_like("test string") So I've got an array of notes. I want to order them by the frequency that the note_id appears in a join table I have, note_categories. How can I do this? ...

PHP data array variable not defined in view

I am using codeIgniter and I am trying to pass an array of data. I have written like this: $data['username']="Dumbo"; I also wrote this: $data['shouts']=$this->Musers->getShout(); // retrieve data from table Then I write: $this->load->view("welcome_message", $data); In view page, I wrote: <?php echo $username; foreach ($...

How to get hierarchy path of an element in an Array

I always want to get the exact path of an element in an array. Example array: array(a=>'aaa', 'b'=> array ('bbb1', 'bbb2' => array('bbb3', 'bbb4'))); So, for reaching to 'bbb4', I need to go through (b => bbb2 => bbb4). How to get this path in multidimensional array? ...

Why does changing an entire Array row create odd behavior?

Simply put. Why did this make my code malfunction after awhile. //Color[][] colorArr = new Color[Width][Height](); private void shiftRowsDown(int row) { for (int i = row; i > 0; i--) { colorArr[i] = colorArr[i - 1];//<--This in particular } for (int col = 0; col < colorArr[0].length; col++) { colorA...

Are LINQ .Last, .Skip, etc. methods optimized for arrays or List<T>?

I'm wondering if LINQ methods like .Last and .Skip are optimized for arrays, List and the such. E.g. for an array I could do _array[_array.Length] to get the last element. Does _array.Last() actually enumerate through all elements and then return the last or is there actually some optimization built in? Might have to forgo fluency for p...

creating arrays dynamically in perl

Hi All, I want to create arrays dynamically based on the user input. e.x. If user gives input as 3 then 3 arrays should be created with the name @message1 @message2 @message3. How to do it in perl. Thanks Senthil kumar. ...

oracle pl/sql arrays

i have some numbers which i want to store in an array. how will i declare array and assign value to it in oracle pl/sql?? ...

Convert from List<double[]> to double[,]

Is there an one-liner (no looping) that converts List<double[]> to double[,]? ...

ASP.net equivalent of ASP's rs.getRows()

In classic ASP, you can dump a recordset into an array using getRows(). This is a lot faster way of looping results, and frees up the recordset earlier. Is there an equivalent in ASP.net (c#?). I've had a look on google and all I can find is a bunch of ugly while loops that dump the rows in an array list, is there a nicer way of doing...

Properties exposing array elements in C#

I want to create a property in C# that sets or returns an individual member of an array. Currently, I have this: private string[] myProperty; public string MyProperty[int idx] { get { if (myProperty == null) myProperty = new String[2]; return myProperty[idx]; } set { myProperty[i...

I am trying to create an array of objects inside a header file which is failing (Starting C++ Programmer)

EDITED BELOW FOR UPDATES!!! Thank you for the help, please by all means point out ALL mistakes , I don't care if it sounds rude or mean or whatever, emo junk. Just give it to me straight so I can understand what is going wrong. Hi everyone! I am a rookie C++ programmer trying to learn and gain some IRL exp for C++. I am attempting the...

VBA. Array for search or replace

Need to found any symbol of array. For example: replace(string,[a,b,c,e,f,g],"a1b2c3d4e567"); result = "1234567" How do it ? ...