Hi,
I'd like to build a simple shopping cart using arrays. I need to display each unique item in the shopping cart aswell as the quantity of each item along side.
My initial cart array might look like this:
$cart=
array(
array(2003,100,"Table")
,array(2003,100,"Table")
,array(2003,100,"Table")
,array...
Okey, so this is my problem.
I have a page structure saved into a mysql db.
Like this:
Page 1
- SubPage 1.1
- - SubPage 1.1.1
- - - SubPage 1.1.1.1
- - - SubPage 1.1.1.2
- - SubPage 1.1.2
- SubPage 1.2
- SubPage 1.3
Page 2
Page 3
The structure can have endless pages and sub pages. All pages have a field called "url" and "childof". "ch...
No matter how I try, I can't seem to create a nice and clean algorithm for doing the following:
System.Array (or generic List) data of System.Object
System.Array (or generic List) xval of System.Object
System.Array (or generic List) idxs of System.Int32
xval and idxs contain the same number of elements and idxs contains no values les...
Hi, I have problem with array in nuSoap.
This is my simple WebService:
require_once("lib/nusoap.php");
$namespace = "http://localhost/test/";
// create a new soap server
$server = new soap_server();
// configure our WSDL
$server->configureWSDL("SimpleService");
// set our namespace
$server->wsdl->schemaTargetNamespace = $namespace;
$se...
I have a nested array in which I want to display a subset of results. For example, on the array below I want to loop through all the values in nested array[1].
Array
(
[0] => Array
(
[0] => one
[1] => Array
(
[0] => 1
[1] => 2
[2] => 3
)
)
[1] => Array
(
[...
I have an array of numbers, like: [1, 4, 7, 1, 2, 1, 3, 1, 4].
I would like to remove duplicate elements and sort the result, i.e. the required result is: [1, 2, 3, 4, 7].
Is there any built in Javascript/jQuery functions to do this, or I must write my own ?
...
Given a simple json document such as:
{ _id: 1234, messages: [...], otherfields: ... }
If two people open the document, and push a message onto the array, the first update will be clobbered by the second.
For types other than arrays, I'm ok with this.
In an rdbms this isn't an issue since the two messages are simply inserted into ...
In Bash, what is the simplest way to test if an array contains a certain value?
EDIT: with help from the answers and the comments, after some testing, I came up with this:
function contains() {
local n=$#
local value=${!n}
for ((i=1;i < $#;i++)) {
if [ "${!i}" == "${value}" ]; then
echo "y"
...
I have an XML file dynamically created from a database where each item has both an id and name. In the following syntax:
<item>
<id>1</id>
<name>FirstName</name>
</item>
... and so on ...
I am trying to use these values for a jQuery autocomplete, where the ID will be submitted via form when the name is selected from the autocom...
I'm working with C, but I think this is a more low level question that isn't language specific.
How does the program correctly grab the right data with array[0] or array[6] regardless of what type of data it holds? Does it store the length internally or have some sort of delimiter to look for?
...
Hi,
i use a UDP-socket for sending/receiving objects.
I serialize the objects into a byte array send it and receive it with a client.
But before i can receive i have to allocate a byte array. I must do it before and then handle the Socket.Receive()-methode the array.
But my objects have a variable length. How can i discover the array-si...
So I want to start and say I am new to Java programming. Here is my problem. I want to create a program that in essence cycles through an array of arrays. The arrays need to be variable lengths.
My first step is I start out with array of scores. Each array is connected to a specific users. These arrays will be of differing lengths depen...
I am getting a 'ArgumentError: array size too big' message with the following code:
MAX_NUMBER = 600_000_000
my_array = Array.new(MAX_NUMBER)
Question. What is the max value that the Array.new function takes in Ruby?
...
an extension method on a collection named MeasurementCollection checks if the property Template.Frequency (Enum) of each item has the same value.
public static bool IsQuantized(this MeasurementCollection items)
{
return (from i in items
select i.Template.Frequency)
.Distinct()
...
I need to print out a 3 by 3 matrix in C. I could think up of 3 different ways of doing it. Are all of them equally optimal or is one method better than the other?
Function 1: Passing an 2darray, using array subscripts
void printMatrix(int m[][3])
{
int i,j;
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf("%d\t",m[i][j]);
}
...
Let's say I have a tuple (1,2,3,4). What's the simple way to change it into Array?
I can do something like this,
array = []
for i in tuple:
array.append(i)
But I prefer something like x.toArray() or something.
...
Basically I have a collection of objects each implement a member of Type IValueCollection
public interface IValueCollection : IEnumerable<decimal>
{
decimal this[int index] { get; set; }
}
MeasurementCollection.Values is of type IValueCollection.
With the logic below I want to pivot a collection of IValueCollection and wrote the...
I am new to programming and Java and trying to write a program which takes two arrays as input and reports back their sum. I want to do this by creating a class which takes two arrays as constructor inputs and then creating a method that adds them together and a method which prints out this new sum array.
Here is my class:
public class...
I have a 2d array say, Array A[60][150] and have another array, Array B[60][150].
Now what I am trying to do is:
Given a point in Array A say x,y i want to access its neighbors to find similarity between the two elements. if they are similar then find its neighbors.
So right now i am using recursive function to do it. But its throws an ...
Hi I am trying to take two arrays and turn them into one 2 dimensional array. However, I keep getting an error:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2
at test5.sum(test5.java:12)
at test5.main(test5.java:38)
Here is my code:
public class test5 {
int [][] final23;
public int [][] sum(int [] x, ...