arrays

PHP / HTML - re organize array

Hi I have a array with ID values like this [2,34,7,46,16,19 ...] etc each ID points to more data which I display with html like: <ul> <li> content from 2 content from 34 content from 7 </li> <li> content from 46 content from 16 content from 19 </li> ... notice that in this case there are 3 entries ...

Extracting semi-similar items from an array in c#

Hey all, here is my problem I have the following array (for example) string[] arr = new[] { "s_0001", "s_0002", "s_0003", "sa_0004", "sa_0005", "sab_0006", "sab_0007" }; I want to do something that gives the following output s_0001 sa_0004 sab_0006 I've tried everything but no luck! this will be the first step in a long project a...

DataTable type of array binding in cf.net

I would like to make a (very lightweight) 2-way binding datastore. Values must be accessed via names. I was thinking of using 2 arrays: public class MyBindingDatastore{ public string[] _names = new string[]{"Field1", "Field2", "Field3"} public object[] _values = new object[]{ DateTime.Now, "MyValue", 1} } First array is used t...

array gets wiped out

I have a situation where I am writing commands to a command buffer. When it is time for a command in the command buffer to be executed, the command is processed and sent out the UART to another subsystem. When the command is processed, the data that needs to be sent out the UART is stored in a queue and a flag is raised. Then shortly aft...

Finding a value inside a nested array having only a string with the keys

Hi, I have one array that contains some settings that looks like basically like this: $defaults = array( 'variable' => 'value', 'thearray' => array( 'foo' => 'bar' 'myvar' => array('morevars' => 'morevalues'); ); ); On another file, i get a string with the first level key a...

How to initialize an array constant specifying desired indexes

Hello StackOverflowers, What I just want is to initialize a string[] array constant by specifying not only the values, but the indexes they will be attached to. For example, on: private static readonly string[] Pets = new string[] {"Bulldog", "GreyHound"}; I would like to state that BullDog corresponds to index 29 and GreyHound to 5 ...

Making outputs from an array in Matlab?

I have an array of 20 items long and I would like to make them an output so I can input it into another program. pos = [0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5,] I would like to use this as inputs for another program function [lowest1, lowest2, highest1, highest2, pos(1), pos(2),... pos(20)] ...

Algorithm for determining if strided arrays overlap?

In the library I'm working on, we have data sets (which may be subsets of other data sets) that are distributed in memory in three-dimensional rectangular strided arrays. That is, an array A can be subscripted as A(i,j,k), where each index ranges from zero to some upper bound, and the location of each element in memory is given by: A(i...

Array Filtering with multiple key-value lookups in PHP

I'm using a wordpress plugin for advanced form design/logic/processing, and one of it's (biggest) downsides is the awkward way it provides form data. Data is given in an array with two or three items for each field. if it's a hidden field: $$$n => id - where n is the field's order in the form, and NAME is the name/id. id => value - ...

Sort day/month array in Javascript

Hi guys, I'm trying to sort an Array of dates from latest to oldest, and unfortunately list.sort (by default) only sorts the first number. My array looks like this: var MyArray = ["13 Jun", "09 Jun", "25 Aug", "30 Jun", "13 Aug"]; I tried to make a function for the .sort to reference, but the whole process is somewhat confusing to me...

How can I return an array of strings in an ANSI C program?

How can I return an array of strings in an ANSI C program? For example: #include<stdio.h> #define SIZE 10 char ** ReturnStringArray() { //How to do this? } main() { int i=0; //How to do here??? char str ** = ReturnStringArray(); for(i=0 ; i<SIZE ; i++) { printf("%s", str[i]); } } ...

mysql: how to collect the array data?

hi all. I have a mysql code that needs to be improved because of my limited knowledge. i am new in php-mysql.I have data arrays at my DB and I want to show data such as: Date Model Qty Name 2010-08-23 boo 2 Steve 2010-08-24 boo 1 Steve 2010-08-25 boo ...

JavaScript array of arrays

i have a JavaScript array of string arrays: array1; array2 ; array3 which i need to break and then access the individual array. how can i do that? ...

What's the best way to update the input names when dynamically adding them to a form?

I'm trynig to come up with a clean and efficient way of handling form input names when dynamically adding more to the POST array. For example, if I have the following form: <fieldset> <input type="text" name="users-0.firstname" /> <input type="text" name="users-0.lastname" /> </fieldset> I then click an 'addmore' button which d...

What is the fastest way to convert html table to php array ?

are there build in functions in latest versions of php specially designed to aid in this task ? ...

php - sort from the end to the beginning

hi, i have a text (text.txt) file like this: shir beer geer deer i have also a php page with that source: <?php foreach (glob("*.txt") as $filename) { $file = $filename; $contents = file($file); $reverse = array_reverse($file, true); $string = implode("<br>" , $contents); echo $string; echo "<br></br>"; } ...

php arrays one array from two

I have a two arrays: $ids: Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 8 ) $ranks: Array ( [0] => Rank1 [1] => Rank2 [2] => Rank3 [3] => Rank5 [4] => NoName ) How can I create an array from these two, like this array('1'=>'Rank1','2'=>'Rank2','3'=>'Rank3','4'=>'Rank5','8'=>'Noname'...

Using MySQL's IN statement in Java

I have to find out if there are entries in a table that also exist in a list I have in Java. The logical solution would be "SELECT column FROM table WHERE column IN (?)" and then set ? to the array I have in Java, but setArray asks for a java.sql.Array and I'm not really sure how to obtain one and if it really is what I am looking for. ...

Sending an Array from DLL - VC++

hello, I have written a dll in VC++. I wanted to ask if it is possible for a method in a dll to return an array? And would that array returned, be compatible with any language that is using the DLL? As-In compatible with C#, Java...etc. I would be glad if I could get some leads in to it. thank you. ...

How do I initialize values in a hash without a loop?

I am trying to figure out a way to initialize a hash without having to go through a loop. I was hoping to use slices for that, but it doesn't seem to produce the expected results. Consider the following code: #!/usr/bin/perl use Data::Dumper; my %hash = (); $hash{currency_symbol} = 'BRL'; $hash{currency_name} = 'Real'; print Dumper(%h...