arrays

Javascript function programming — receiving elaborate parameters

I'm writing a Javascript function that would manipulate an array written on-the-fly and sent as a parameter. The function is written as follows: function returnJourney(animation,clean){ var properties = {}; // loads of other inane stuff for(i in animation[0]) properties[animation[0][i]] = animation[0].i; // heaps more i...

How to process a large post array in PHP where item names are all different and not known in advance?

I have a PHP page that queries a DB to populate a form for the user to modify the data and submit. The query returns a number of rows which contain 3 items: ImageID ImageName ImageDescription The PHP page titles each box in the form with a generic name and appends the ImageID to it. Ie: ImageID_03 ImageName_34 ImageDescription_22 ...

save input from text file to array

How to save text file content to different arrays? my text file content is like this; 12 14 16 18 13 17 14 18 10 23 pic1 pic2 pic3 pic4 pic5 pic6 pic7 pic8 pic9 pic10 left right top left right right top top left right 100 200 300 400 500 600 700 800 900 1000 how can I save each line into different array? e.g. line 1 will be saved in...

Poplate html drop down box

EDIT: THANKS - I MANAGED IT IN THE END SHOULD HAVE TRIED FOR LONGER BEFORE POSTING SORRY how do you populate a drop down html box within a form, but populate it with values from a php array for example <form name="mname" action="index.php" method="post"> <select name='values'> <option> </option> <option> </option> </form> i can d...

array insert in db

Hi, How best to put the array (100 or more length) in the database (MySQL)? I do not want multiple access to the database because it is so loaded. So my solution is as follows: string insert = "INSERT INTO programs (name, id) VALUES "; for(int i = 0; i < name.Length; i++) { if (i != 0) { ...

Ruby - Call method passing values of array as each parameter

I'm currently stuck on this problem. I've hooked into the method_missing function in a class I've made. When a function is called that doesn't exist, I want to call another function I know exists, passing the args array as all of the parameters to the second function. Does anyone know a way to do this? For example, I'd like to do som...

Flex: changing value in an array where elements are objects

Example: var arr_1:Array = new Array(); arr_1.push({sdate:"2010-02-02",status:"New"}); arr_1.push({sdate:"2010-02-03",status:"New"}); arr_1.push({sdate:"2010-02-04",status:"New"}); arr_1.push({sdate:"2010-02-05",status:"New"}); How can i change element number 3 status to: "Old", without removing it. just update the status value?? ...

AS3 - Searching An Array for the items that contains a particular word when each item is a paragraph long.

Hi, bit new to AS3 so forgive me if this is a bit of a straight forward question. Ive created an array, and each item in the array is a description of something, about 20 words long, I want to search the array, and return each item that contains a particular word. All the other tutorials Ive found are based on looping through to searc...

weird result with c# winForms array of Lists

so I'm trying to store values in an array of Lists in C# winForms. In the for loop in which I make the sql statment, everything works fine: the message box outputs a different medication name each time. for (int i = 0; i < numberOfMeds; i++) { queryStr = "select * from biological where medication_name = '" + med_names[i] + "' and pati...

How do you removing a cycle of integers (e.g. 1-2-3-1) from an array

If you have an array of integers, such as 1 2 5 4 3 2 1 5 9 What is the best way in C, to remove cycles of integers from an array. i.e. above, 1-2-5-4-3-2-1 is a cycle and should be removed to be left with just 1 5 9. How can I do this? Thanks!! ...

C# Reading and Writing a Char[] to and from a Byte[] - Updated with Solution

Hi, I have a byte array of around 10,000 bytes which is basically a blob from delphi that contains char, string, double and arrays of various types. This need to be read in and updated via C#. I've created a very basic reader that gets the byte array from the db and converts the bytes to the relevant object type when accessing the pro...

Arrays multiplication

How to write arrayt multiplication (multiplicating two matrieces ie 3x3) of arrays of known size in c++ ? What will be the difference using pointers and reference ? ...

Fill a array with List data

How can I fill a array with the data provided by one List? For example, I have a List with Strings: List l = new ArrayList<String>(); l.add("a"); l.add("b"); l.add("c"); then I want to copy this data into a String array: String[] array = ? ...

Convert a nested array into a flat array with PHP

Hello all, I'm trying to create a generic database mapping class with PHP. Collecting the data through my functions is going well, but as expected I'm retrieving a nested set. A print_r of my received array looks like: Array ( [table] => Session [columns] => Array ( [0] => `Session`.`ID` AS `Session_ID` ...

[].include?(:test) return nil [RoR]

Having the strange problem that [].include?(:test) returns nil instead of expected false. The whole thing only happens when running the app (i see it in rubymine debug mode), not in irb or rails console. I tested following [].include?(:test) # nil [].include?(:test).nil? # nil [].class # Array Seems as if include? is overwritten so...

LINQ - array property contains element from another array

I have a object (product), with a property of type 'array' e.g. product.tags = {"tag1","tag2","tag9"} I have an array of input tags to filter on. ... but this is not quite working: List<string> filterTags = new List<string>() { "tag1", "tag3" }; var matches = from p in products where p.Tags.Contains(filterTags) select p; Any re...

how can i sort one array with 2 child using fork() in c

example some array {2,8,9,10,21,32,1,6,3...} first child take (data size / 2) and sort second chile take (data size / 2) and sort after combine 2 child data and give us a sorted full data, is it possible with some algorithms? ...

How do I make these inputs relate to each other?

I have a series of checkbox inputs and corresponding text area inputs to allow specification of quantity. Here's what the two fields look like when the item is static (i.e. only 1): <input type="checkbox" name="measure[checked][]" value="<?=$item->id?>"> <input type="hidden" name="measure[quantity][]" value="1" /> Here's what the inp...

Sorting a file with 55K rows and varying Columns

Hi I want to find a programmatic solution using C++. I have a 900 files each of 27MB size. (just to inform about the enormity ). Each file has 55K rows and Varying columns. But the header indicates the columns I want to sort the rows in an order w.r.t to a Column Value. I wrote the sorting algorithm for this (definitely my newbie at...

array iteration strstr in c

I was wondering if it's safe to do the following iteration to find the first occurrence of str within the array or if there is a better way. Thanks #include <stdio.h> #include <string.h> const char * list[] = {"One","Two","Three","Four","Five"}; char *c(char * str) { int i; for (i = 0; i < 5; i++) { if (strstr(str, li...