arrays

Updating text on JFrame depending on ActionListener

This is a result of ActionListener. Depending on what he chooses in the Combo Box it returns a price. I just want it as a simple $39.99. Nothing more. I have the packageIndex = packageChoice.getSelectedIndex(); All the prices are in an array: String[] prices = {"49.99, 39.99, 34.99, 99.99"} Now I need to know how to pull the pr...

Implicit array casting in C#

Hi, I have the following classes with an implicit cast operator defined: class A { ... } class B { private A m_a; public B(A a) { this.m_a = a; } public static implicit operator B(A a) { return new B(a); } } Now, I can implicitly cast A to B. But why can't I implicitly cast A[] to B[...

For each result in MySQL query, push to array (complicated)

Okay, here's what I'm trying to do. I am running a MySQL query for the most recent posts. For each of the returned rows, I need to push the ID of the row to an array, then within that ID in the array, I need to add more data from the rows. A multi-dimensional array. Here's my code thus far. $query = "SELECT * FROM posts ORDER BY id DES...

Basics of working with Arrays in Java

How do you: 1. Initialize (create) an Array. 2. Push a String value into it. 3. Push another String value into it. 4. Dump it to get its contents. ...

PHP: Find element with certain property value in array

I'm sure there is an easy way to do this, but I can't think of it right now. Is there an array function or something that lets me search through an array and find the item that has a certain property value? For example: $people = array( array( 'name' => 'Alice', 'age' => 25, ), array( 'name' => 'Waldo', 'age' => 89...

Access Violation reading elements of an array

I've written my own code to parse an .obj model file - essentially just ASCII text. The file gets parsed and stored in the class correctly according to my tests. I can read back the values (from data members) just fine in the loading function. The problem occurs when I try to read back the values in my main rendering loop. There is an a...

iterating through an array

Iterating though an array isn’t a problem but what if I only wanted to incremented only when the method is called? Im not even sure if this would work but is there an easier way of doing this int counter; string[] myArray = {"foo", "bar", "something", "else", "here"}; private string GetNext() { string myValue ...

Objective-C Array/List Question

What is the best practice, even in general programming, when you have an undefined, possibly infinite, amount of items that you need in an array but don't have defined bounds. Can you define an endless array in objective c that you can keep pushing items onto, like other lanaguages have a list item. Thanks for any help. ...

jQuery Grouping Similar Items w/ Object Literal

So I have this structure setup: <ul> <li>http://www.youtube.com/watch?v=dw1Vh9Yzryo&lt;/li&gt; (Vid1) <li>http://www.youtube.com/watch?v=bOF3o8B292U&lt;/li&gt; (Vid2) <li>http://www.youtube.com/watch?v=yAY4vNJd7A8&lt;/li&gt; (Vid3) <li>http://www.youtube.com/watch?v=yAY4vNJd7A8&lt;/li&gt; <li>http://www.youtube.com/w...

Obtaining the min and max of a two-dimensional array using LINQ

How would you obtain the min and max of a two-dimensional array using LINQ? And to be clear, I mean the min/max of the all items in the array (not the min/max of a particular dimension). Or am I just going to have to loop through the old fashioned way? ...

C programming, why does this large array declaration produce a segmentation fault?

This code produces a segmentation fault during the array declaration. I'm confused as to why this happens. I intentionally selected 2000000000 as a value because it is below 2^31 and can fit into an integer variable. int main() { int nums_size = 2000000000; int nums[nums_size]; int i; for(i = 0; i < nums_size; i++) ...

PHP array taking up too much memory

I have a multidimensional array. The array itself is fine. My problem is that the script takes up monster amounts of memory, and since I'm running this on my MAMP install on my iBook G4, my computer freezes up. Below is the full script. $query = "SELECT * FROM posts ORDER BY id DESC LIMIT 10"; $result = mysql_query($query); $posts = ar...

How to display records below form on submission in php without the use of database?

How to make the use of hidden variables as array for consecutive submission of data so that they can be used to display the records list. I have a form with 4 text fields and a file upload field.. as i submit he form it should get appended to the list which needs to be displayed below the form, such that these values are NOT stored in t...

get all fields value from mysql using php

hi i want to know how to get all fields value search by array. i have array that s my table is id content 1 zahr 2 hai . . . and so on $a = {2,3,4,5,43,32}; i have to take the contents by this id(from array "a"). i know, i can use "for" loop for getting each element from mysql. but i would like to use ...

"EXC_BAD_ACCESS: Unable to restore previously selected frame" Error, Array size?

Hi there, I have an algorithm for creating the sieve of Eratosthenes and pulling primes from it. It lets you enter a max value for the sieve and the algorithm gives you the primes below that value and stores these in a c-style array. Problem: Everything works fine with values up to 500.000, however when I enter a large value -while run...

Powershell Select-Object from array not working

I am trying to seperate values in an array so i can pass them to another function. Am using the select-Object function within a for loop to go through each line and separate the timestamp and value fields. However, it doesn't matter what i do the below code only displays the first select-object variable for each line. The second sele...

Classic ASP comparison of comma separated lists

Hello, I have two comma separated lists:- 36,189,47,183,65,50 65,50,189,47 The question is how to compare the two in classic ASP in order to identify and return any values that exist in list 1 but that don't exist in list 2 bearing in mind that associative arrays aren't available. E.g., in the above example I would need the return...

How to push values into an array along with incrementing the array index while inserting?

I have a an array I want, whenenever i submit my form the post value get inserted into that array, every time with new incremented index.. How can I do that? And yes submited page is redirected to itself... ...

PHP: remove element from associative array?

if i have an array like array("key1" => "value1", "key2" => "value2", ...) how would i go about removing a certain key-value pair, given the key? thanks! ...

[Python] Best strategy for dealing with incomplete lines of data from a file.

I use the following block of code to read lines out of a file 'f' into a nested list: for data in f: clean_data = data.rstrip() data = clean_data.split('\t') t += [data[0]] strmat += [data[1:]] Sometimes, however, the data is incomplete and a row may look like this: ['955.159', '62.8168', '', '', '', '', '', ''...