arrays

PHP Merge 2 mysql Results

Hi there I execute 2 query's on 2 diffrend servers with the same table structure. How can I merge the 2 Arrays in PHP? Thanks ...

Count Similar Array Keys

I have a POST request coming to one of my pages, here is a small segment: [shipCountry] => United States [status] => Accepted [sku1] => test [product1] => Test Product [quantity1] => 1 [price1] => 0.00 This request can be any size, and each products name and quantity's key would come across as "productN" and "quantityN", where N is an...

Are PowerShell Arrays just .NET Arrays?

I am creating an array of string objects in PowerShell which needs to be passed into an Xceed zip library method which expects a string[], but I get an error everytime. It makes me wonder if the PowerShell array is something other than a .NET array. Here is some code: $string_list = @() foreach($f in $file_list) { $string_list += $f.Fu...

Passing a PHP array in a SOAP call

So I am trying to include the following XML in my SOAP request: <Responses> <Response> <QuestionAnswerID>someint</QuestionAnswerID> <QuestionID>someint</QuestionID> </Response> <Response> <QuestionAnswerID>someint</QuestionAnswerID> <QuestionID>someint</QuestionID> </Response> </Responses>...

Initialize a pointer to a class with NULL values

I am tring to intialize an array of pointers to a NODE struct that I made struct Node{ int data; Node* next; }; the private member of my other class is declared as Node** buckets; It is currently initialised as buckets = new Node*[SIZE] Is there anyway to initialize the array so that its members point to NULL or some ot...

how is array(0) different from array()

$variable = array(0); $variable = array(); how are they different? ...

How to modify an HTML Select when the name is an array using Javascript

I have two html select objects named with the same name (they are arrays with different indexes). What I am trying to do, is if "off" is selected from the category[0] select element, I would like to disable the category[1] element. I have been trying to use document.getElementsByName() but am having no luck figuring out how to specific...

Passing a constant matrix

Referring to this question and especially the accepted answer of litb, I wonder why the gcc complain about this: void func(const int (*ip)[3]) { printf("Value: %d\n", ip[1][1]); } int main() { int i[3][3] = { {0, 1, 2} , {3, 4, 5}, {6, 7, 8} }; func(i); return 0; } If I eliminate the const the compiler keeps still. Di...

Class inheritance in Prototype.js and arrays

I'm using the Prototype.js (from www.prototypejs.org) library to create classes which are extended by subclasses. I'm having trouble using arrays within instances of these classes though. I've made an example to illustrate this: var SuperClass = Class.create({ initialize: function(id) { this.id = id; } }); var SubClass = C...

How can I iterate over a Perl array reference?

I have an array that is a member of an structure: $self->{myArray} = ["value1", "value2"]; And I'm trying to iterate over it using the following code: my @myArray = $self->{myArray}; foreach my $foo (@myArray){ #Do something with the using $foo ... } The problem is that the 'foreach' loop is executed only once (when I would...

Querying multiple tables and only returning a single array?

Hey all, I am wondering what the best way to do the following is: Query up to 5 tables (depends on user input) pull back the results and return a single array. Lets say I query table A and have the results stored as a result handle (return from the pg_query() fn), shall I go ahead and convert those to an array, and then continue append...

Having problems creating an array from XML data in Acrobat Javascript, please help if you can

I have a manually created array that already works example below: var PartsData = { 179: { ref:"", partNum: "201-2007-C00-00", descript: "System Monitor Card (Tracewell Only)", cage: "39764", qty: "1", SMR: "XBOZZ...

Create an array for simpleGallery (jquery plugin)

I am using the jquery plugin simplegallery (http://www.dynamicdrive.com/dynamicindex4/simplegallery.htm). out of the box it works like their documentation says. However I want to use it in a way that gets a dynamic list of random images from the server via an ajax call so that the list is different each time the page is loaded. On the se...

How can I force the type of an array when initialized in Scala?

Basically, I have an array like this: val base_length = Array( 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 0 ); And when scala sees it, it wants to do this: base_length: Array[Int] = Array(...) But I would prefer for it to do this: base_length: Array[Byte] =...

Algorithm to permute elements in Array

Consider the following scenario. I have an array of numbers: [ 1,2,3,4 ] If this array was joined i would have the number 1234. I want to swap the numbers around to achieve the clossest higher number. 1234 will become 1243, which will become 1324, which will become 1342 and so forth.. What algorithm would i need use to make this...

Find array key in php and change its value or contents?

Given a multi-dimensional array that you don't necessarily know the structure of; how would one search for a key by name and change or add to it's contents? The value of the key could be either a string or an array and the effects should be applied either way--I had looked at array_walk_recursive, but it ignores anything that contains an...

PHP Retrieve minimum and maximum values in a 2D associative array

I have an array in this format: Array ( [0] => Array ( [id] => 117 [name] => Networking [count] => 16 ) [1] => Array ( [id] => 188 [name] => FTP [count] => 23 ) [2] => Array ( [id] => 189 ...

PHP: append to value if the key already exist, if not add the key.

Hello, I am looking for a succinct way of doing this in PHP: given an array, if I add one key=>value pair to it, the routine should check whether the key already exist. If it doesn't exist, add to the array with the key=>value pair. If it does, then the value should be append to the value of the array. So, for example, if the initial ...

How do I save a Byte Array to a Database in vb.net

I have a byte array of a file and I need to save it into my database in a field that has been set aside of type image. However I have a problem my data access class takes a sql string and commits it to the database for example. "EXECUTE stored proc @parm1, @parm2, @parm3" However the problem is I cannot figure out how to transfer the ...

A better way to splice an arrray into an array in javascript

Is there a better way than this to splice an array into another array in javascript var string = 'theArray.splice('+start+', '+number+',"'+newItemsArray.join('","')+'");'; eval(string); ...