Creating A New API - Use A Single Array Or Multiple Arrays?
Jan 8, 2011
I have a choice when creating a new API that I would like other peoples opinions on. Do I use a single Array or Multiple arrays such as: array[1][1] = "ID[56]NAME[Hello World]START[10]"; OR
ID[1][1] = 56;
Name[1][1] = "Hello World";
Start[1][1] = 20;
The API is used for animations so is very heavy work, but would using around 15 multidimensional arrays be too much and a single one be preferable???
View 2 Replies
ADVERTISEMENT
Oct 20, 2010
I am working on creating a JSON feed that is later being used with Arshaw's fullCalendar, which I am integrating into Expression Engine CMS. Currently I am doing the following, and all works well.
<?php $ms_title_array = array(); ?>
<?php $ms_start_date = array(); ?>
<?php $ms_due_date = array(); ?>
[code]....
What I am curious about is I am trying to create another array set that is pulling new information from a different source. Is it possible to use the json_encode(); method to encode two separate variables?If not, is there a way I can create the event variable and store both the information you see in the while loop with information that I would store into a new while loop? I'm a little stumped
View 3 Replies
View Related
Feb 15, 2006
How would I put 2 strings like this into 2 separate arrays like my
examples below?
Div10,Div11|Div2,Div3,Div8,Div4,Div12,Div1,Div5|Di v3,Div5,Div9
France|Germany|Norway
var DivOrder = new
Array("Div10,Div11","Div2,Div3,Div8,Div4,Div12,Div1","Div3,Div5,Div9");
var DivNames = new Array("France", "Germany", "Norway");
View 5 Replies
View Related
Jul 21, 2011
is this correct
var mid = math.floor((0 + array.length)/2)
from here you could use array.slice to divide the array into two equal sized arrays?
View 6 Replies
View Related
Jan 21, 2011
Modifying my code:
I have this C# code that is connecting to database and creating a array(list)
Code:
I'm trying to pass it to a javascript function so I can then pass it to a silverlight page so I was able to create this easy javascript that show a aleart box on startup of the list(array)
Code:
But I want to do something like this and can't get it:
Code:
View 2 Replies
View Related
Jun 29, 2010
i am facing problem with JQuery Scrollable menu, i am trying to placing 2 scrollable panels on a single asp.net page. When there is one panel every thing works fine but when i copy and paste the code so my web page contains two panels vertically, the thing doesn't work, the tow panels just hanged!!
[Code]...
View 2 Replies
View Related
Mar 28, 2009
I've been given two arrays:
arr1 = [1,8,9,12]
arr2 = [2,3,10,11,13]
My task was to merge the two arrays into a third array. Done, no problem, merged then sorted a new array. I understand there is a way to merge the two without using "merge" then "sort" functions. My reference material doesn't go into it, and I can't find an example of how this would work. I think there would be a way to do it using a for loop and then "push", but I could be way off.
Can anyone tell me how they could see merging two without using the merge then sort? And what would be the advantage to doing it this alternate way as opposed to using merge? Is there a case where it would be preferable? I'm so new at this that I can't fathom doing anything other than merge.
View 22 Replies
View Related
Mar 27, 2010
(the "code" below is pseudo code, just to get the idea across)
Here's what I currently have:
var bill = new array[20];
var sam = new array[20];
var nancy = new array[20];
var Oscar = new array[20];
I'm assigning objects to them (ie Oscar[5] = new objLabel() This seems like a kluge, however. Here's what I'd like (again, pseudo-code)
var Objects = {bill:null; sam:null; nancy:null; Oscar:null};
var theObject = new Array of Objects[20];
// yes: i know that's wrong... and that's the part I'm having trouble with
so that I can do something like:
[Code]....
Just seems to me that keeping a single array of multiple objects is likely to be less error-prone than multiple arrays of single objects... But I don't have the syntax right... or can it be done in JS? If it's doable, would someone be kind enough to show me how to declare and access that example?
View 2 Replies
View Related
Feb 14, 2011
Multiple CountDown using Arrays ?
View 2 Replies
View Related
Nov 8, 2010
I was having some trouble with 2D arrays (or array of arrays). Essentially, the array has 100 rows, with two columns. The first column of every row holds a name, and the second holds a sales amount. With the use of a do while loop, the user can continuously add up to 100 names and sales amounts. After all the information the user wishes to add is stored into the 2D array I'm attempting to pass that very same 2D array as a parameter to a function called printRow as can be seen in the code below: Note: the function call and the actual function are found in two separate javascripts.
[Code]...
View 17 Replies
View Related
Jun 8, 2011
I am trying to make a JavaScript chat-bot
I was using this to answer a month questions and it worked fine for what is the month after
DatesA=new Array("january,February","february,March","march,April","april,May","may,June","june,July","july,August","august,September","september,October","october,November","november,December","december,January");
[Code]....
The bot correctly answers for x y and z . It then answers V for all other letters, digits and short words
What is the letter before cow
answer: V
View 2 Replies
View Related
Apr 10, 2011
I'm have some javascript objects with arrays that should be transferred as php array.Its posted by ajax httpRequest.How can I return php array, from the javascript?
View 4 Replies
View Related
Aug 3, 2009
I'm a JS beginner and I find looping through arrays with for/in is very easy. Yet I find lots of code examples where array length is used instead of for/in and I'm thinking to myself, why do it this (somewhat) hard(er) way?
View 11 Replies
View Related
Jun 11, 2009
Is
fibonacciArray = [20];
fibonacciArray[0,1] = (1,1);
Possible?
I know I can do:
fibonacciArray = [20];
fibonacciArray[0] = 1
fibonacciArray[1] = 1
But the former requires less typing
View 3 Replies
View Related
Jun 19, 2001
I am trying to pass an (Global) array of variables to a number of functions in javascript but they are not being recognised. As follows:
<Head>
<Script>
var nutherVariable ="Whatever"
arrayset1 = newArray(n1)
arrayset1[0] ="XXXXXX"
arrayset1[2] ="XXXXXX"
etc
arrayset2 = newArray(n2)
arrayset2[0] ="yyyyyyy"
arrayset2[2] ="yyyyyyy"
etc
function doSomthing(arrayset1, arrayset2, nutherVariable){
document.theForm.txtBox.value=arrayset1[n] + arrayset2[n];
<!-- No output to form textfield unless array defined within function-->
}
</Script>
</Head>
<Body>
Passes and recieves variables to/from function(s) via Form
</Body
I think what I am asking is what is the syntax to do this.
View 2 Replies
View Related
May 7, 2011
I have a single form on a single page with some js that is supposed to take the first and last name entered and add them to the select list. There seems to be some kind of communication stop between the js and html, because nothing happening.
Here is the code:
<script language="javascript" type="text/javascript">
/* <[CDATA[ */
function Member (){
this.lastName = "";
this.firstName = "";
this.position = "";
this.phone = "";
this.email = ""; .....
View 1 Replies
View Related
Mar 15, 2010
I am looking for a way to add multiple items with a single URL to my shopping cart.
View 3 Replies
View Related
Mar 15, 2010
I am looking for a way to add multiple items with a single URL to my shopping cart. Is this possible?
View 4 Replies
View Related
Mar 9, 2011
i have a form with arrays, I want to sum different arrays and display the total in a array field in the form itself.i have this code
<form>
do {
$x++;
[code]....
View 14 Replies
View Related
May 18, 2009
I am trying to develop a small web based inventory programme. In the programme, after orders are placed for supply of an item, the materials are to be recieved by the stores. For this a "goods received page" is used. On start the page loads items as per the purchase order in the database. Javascript is used to calculate the cost of each item and total cost of all items. since the number of items vary from order to order I use the following code to load the page. ( PHP is used in the server side).
<input type='text' size='10' name ='rqty[]' value='1.000' align='right' onchange="recalculate()">
<input type='text' size='10' name ='rqty[]' value='2.000' align='right' onchange="recalculate()">
[Code]....
My problem is that the above will work whenever there are two or more items and the variable qty is actually an array. But it does not work when there is only one item. In other words, it does not recognises a single element array. value of rsize is returned as undefined. Splitting the loading process with seperate naming for single items as rqty and multiple items as rqty[] is not possible as option to be given to delete items from a multiple item page. This may end up in a single item page eve n when there are multiple items at load time.
View 6 Replies
View Related
Jul 20, 2005
I have a JSP page with several forms on it. Some of these forms are
generated dynamically, and each of them submits some information to a
database.
Handling one form is easy, as I can simply make the form post to
itself, and handle the
data using a single bean. Since I have multiple forms, I now have a
problem. Several of the forms on the page handle the same type of data
(same input names), and a 'setproperty *' call for each of the form
beans would change data in several beasn, not just the form/bean that
sent the data.
I am attempting to write a separate JSP with a single bean that
handles a form submission. However, I'm not sure how to make this page
go back to the referring page from which the data was submitted.
View 1 Replies
View Related
Jan 16, 2010
I have developed one project and in that i have taken two css now i want to add jquery effects in that, But my display is not properely adjusted and extra enlargement is done so how i can add jquery in my php project without affecting another effect? And one more thing where i can get the jquery effect codes?
View 1 Replies
View Related
Jan 19, 2010
How to use multiple .js files in a single web page??Is it possible to use both external .js file and inbuilt java script functions in a single page?
View 1 Replies
View Related
Feb 4, 2010
I'm having a problem with one of my Labs and My TA is not answering emails.I need to make a button, that when you click it, turns the bgColor blue, when you click it twice, it turns bgColor yellow, and a third time turns it orange.The tricky part is, I need to use an internal CSS style sheet for the color, and a function for the javascript.Here is what I have so far, but I'm completely stuck.
<html>
<head>
<style type="text/css" media="all">
[code]....
View 4 Replies
View Related
Feb 11, 2010
I have this script which is set to generate random anagrams of my name in rotation which works fine, but I can't work out how to put multiple instances of it on one page.
The code is:
And i'm calling the function using:
View 3 Replies
View Related
Apr 19, 2010
I was just wondering if it's recommended to have all your javascript contained in a single unified block or if it's okay to have them spread out across the document? I find the second approach ensuring JS is located near code that is directly associated increases readability, but I'm worried it may have a negative effect on performance, however minor.
View 3 Replies
View Related