arrays

Help with lambda expression

Hi, I have a string array Array1 and a string array A2. I want to combine these in a 3rd array A3 but excluding duplicate values. Can this be done through lambda expressions or only through iterating through the array and checking array.Contains()? Thanks. ...

Multiple file uploader $_POST issue

I have the following form that uses some jQuery to allow an array of files to be submitted: <form enctype="multipart/form-data" action="index.php" method="post" > <input type="file" class="multi" name="test[]" /> <input type="submit" value="submit" name="submit" /> </form> When I use method="get" I get the following URL when submitt...

Unknown error in array initilization

I was trying to make a Intel 8080 CPU emulator (then I'd like to emulate Space Invaders, which use it). I coded nearly complete implementation of this CPU (thanks to MAME and Tickle project (mostly) ;) ) except undocument instructions (0x08, 0x10, 0x18, 0x20, 0x28, 0x30, 0x38, 0x0CB, 0x0D9, 0x0DD, 0x0ED, 0x0FD). I've have only problems...

JavaScript Array Initialisation in Simple JavaScript Inheritance

I'm currently working on some code based on John Resig -Simple JavaScript Inheritance. And i'm having some trouble with the initialization of arrays. If i put an array as an attribute for an object and don't initialize the array during the call of init(), all the modification made to the array like push, unshift will affect further crea...

Is it possible to loop input into an array without setting how big the array is in C#?

It's probably a really basic question, but I can't find the answer anywhere. I'm trying to loop through the input and put the results into an array using C#. From what I read the array has to have the number of elements set first. Is there a way to just loop through and have the array number of elements dependent on the number of input...

What is the best way to create a sub array from an exisiting array in C++?

OK, I am trying to get a sub array from an existing array and I'm just not sure how to do it. In my example I have a very large array, but I want to create an array from the last 5 elements of the array. An example of what I am talking about would be: int array1 = {1,2,3,...99,100}; int array2[5] = array1+95; I know this isn't correc...

How do I reverse an int array in Java?

How do I reverse an int array in Java? Is this a correct method? for(int i = 0; i < validData.length; i++) { int temp = validData[i]; validData[i] = validData[validData.length - i - 1]; validData[validData.length - i - 1] = temp; } ...

send array to php from javascript?

i want to send a javascript array to php using jquery ajax. $.post("controllers/ajaxcalls/users.php", { links: links }); where the second 'links' is a javascript array. when i've got this array: '1' ... '1' => "comment1" '2' => "link1" '3' => "link2" '4' => "link3" '2' ... '1' => "comment2" '2' => "link4"...

Most efficient, safe way of dealing with a large number of $_REQUEST variables in php

I have a form that submits a large number of inputs... <input type="hidden" name="searchTag_happy" value="0" /> <input type="hidden" name="searchTag_sad" value="0" /> <input type="hidden" name="searchTag_ambivalent" value="0" /> etc . . . The value attributes for these inputs can be either "0" or "1". I would like to use this informa...

javascript array to php

i want to send a javascript array to php using jquery ajax. $.post("controllers/ajaxcalls/users.php", { links: links }); where the second 'links' is a javascript array. when i've got this array: '1' ... '1' => "comment1" '2' => "link1" '3' => "link2" '4' => "link3" '2' ... '1' => "comment2" '2' => "link4"...

+ operator for array in PHP?

$test = array('hi'); $test += array('test','oh'); var_dump($test); What does + mean for array in PHP? ...

How to merge subarray in PHP most easily?

$arr[] = array('A','B'); $arr[] = array('C','B'); ... I need to get the merged result of all sub array of $arr . And for duplicated entries,should fetch only one. ...

Newbie C Array question over functions.

Hi all, I bought a C book called "The C (ANSI C) PROGRAMMING LANGUAGE" to try and teach myself, well C. Anyhow, the book includes a lot of examples and practices to follow across the chapters, which is nice. Anyhow, the code below is my answer to the books "count the longest line type of program", the authors are using a for-loop in th...

What to replace in this C Puzzle ?

Now this is a silly puzzle I got from some exam paper,sadly I am unable to figure it out from last 15 minutes. #include <stdio.h> int main(void){ /* <something> */ putchar(*(wer[1]+1)); return 0; } What should we replace in place of something in order to get the output e.Now we know putchar takes a int as argumen...

Large VBScript array yields 'Out of Memory' error

In Classic ASP (VBScript), if I try to create a large 2-dimensinal array, I get an "Out of Memory" error. For example, this DIM xxx : xxx = 10000 DIM yyy : yyy = 10000 REDIM aaa(xxx, yyy) Response.End yeilds this Microsoft VBScript runtime error '800a0007' Out of memory Is their another data structure I can use that will work, o...

Safely convert user-provided array string into PHP array?

Users need to be able to enter a PHP array of parameters. Currently, they see a text area where they are expected to enter PHP code that defines an array: <textarea name="foo"> $bar = array( 'key' => 'value' ); </textarea> I get the value of the text area as, for instance, the string $_GET['foo']. How can I parse this so that I can...

mysql data from calendar check if booked

I have a database with reservations for items. All reservations have an: ID , item ID, personWhoBookedId, time_from (unixtime) , time-to(unixtime). I like to display a day per day time schedual from hour to hour, and colour the timethat an item is booked and display the personWhoBookedID on that timeframe. like: room1: 5:00 - 6:00: ...

Why isn't this model returning any values?

I'm trying to build VERY basic model->controller->view structure with CodeIgniter. I'd rather use models (and model functions, more importantly) and controllers than executing queries within each view. First off, here's the model: class Leads extends Model { function Leads() { parent::Model(); } function fetch...

Disappear the arrays generated with mysql_fetch_array() after use?

I have a typical database query: $query = mysql_query('SELECT titulo,referencia FROM cursos WHERE tipo=1 AND estado=1'); and I can convert it in an array and print the data: while ($results=mysql_fetch_array($query)): ?> echo $results['referencia']; // and so... endwhile; but in some cases I need to print the same data in another p...

MooTools: How to tell if object is array?

Is there a shortcut in MooTools for telling if an object is an object or an array? ...