How to convert arrary ( many, 4) created in vbscript to that array type in javascript? Can anyone point out an example somewhere? I want to use it in the client side of the web page. Appreciate the help. C Chang

0 |

6/27/2003 7:35:31 PM

Hey can anyone help me convert a javascript array into a ruby array. Ive been struggling with this since friday to no avail. This is the function with the ajax.request call that is supposed to convert the array using JSON, but I keep getting a 422(Unprocessable Entity) error. Im not sure what is wrong. function test() { for(i=1;i<22;i++){ if (document.getElementById(i+'d').className == "selected"){ myArray.push(i); } } new Ajax.Request('/appointments/arr...

Rubies: Given [1, 2, 3, 4], what's the most Rubiesque way to get [[1, 2], [3, 4]]? I had figured a variation on Array#transpose would be available, but I can't find one! -- Phlip On Feb 4, 10:45 am, Phlip <phlip2...@gmail.com> wrote: > Rubies: > > Given [1, 2, 3, 4], what's the most Rubiesque way to get [[1, 2], [3, 4]]? > > I had figured a variation on Array#transpose would be available, but I can't > find one! > > -- > Phlip have a look at enum.partition (http://ruby-doc.org/core/classes/ Enumerable.html#M003161) cheers Chris Hu...

The subject might be misleading. Regardless, is this code valid: #include <stdio.h> void f(double *p, size_t size) { while(size--) printf("%f\n", *p++); } int main(void) { double array[2][1] = { { 3.14 }, { 42.6 } }; f((double *)array, sizeof array / sizeof **array); return 0; } Assuming casting double [2][1] to double * is implementation defined or undefined behavior, replace the cast with (void *). Since arrays are not allowed to have padding bytes in between of elements, it seems valid to me. vippstar@gmail.com wrote: > The subject might be misleading. &g...

sorry..the code: function printtree($array, $level){ while(list($k,$v) = each($array)) if(is_array($k)){ print("$k -><br>"); printtree($k,$level++); } else { for($i=0;$i<$level;$i++) print(" "); print("$k : $v<br>"); } } but it does only print the first level and get out !!! I can't figure what's wrong.... Please help !!!! BoB Bob Bedford wrote: > sorry..the code: > > function printtree($array, $level){ > while(list($k,$v) = each($array)) > if(is_array($k)){ > print("$k -><br>"); > printtree($k,$level++); > } > else > { > for($i=0;$i<$level;$i++) > print(" "); > print("$k : $v<br>"); > } > } > > but it does only print the first level and get out !!! > > I can't figure what's wrong.... I won't look through your code, but... Have you ever heard of foreach (http://www.php.net/manual/en/control-structures.foreach.php) and print_r (http://www.php.net/manual/en/function.print-r.php)? Berislav -- If the Internet is a Marx Brothers movie, and Web, e-mail, and IRC are Groucho, Chico, and Harpo, then Usenet is Zeppo. Bob Bedford wrote: > function printtree($array, $level){ > while(list($k,$v) = each($array)) > if(is_array($k)){ $k is *never* an array. I didn't test it ... but for it to work you should test $v inst...

Imagine I have an array of arrays of ints and want to sum all the ints. #include <stdio.h> int sumints(int arr[3][3]) { int c, r, s=0; for (r=0; r<3; r++) { for (c=0; c<3; c++) { s += arr[r][c]; } } return s; } int main(void) { int my_array[3][3] = {{0, 1, 2}, {3, 4, 5}, {6, 7, 8}}; printf("sum of ints is %d\n", sumints(my_array)); return 0; } I tried to define the su...

Hello How can I distinguish if an array is multidimensional of if it just contains an array? Or put it another way how can I tell at runtime whether a/b in the example below is an array containing an array, or if it is a multidimensional array. If I know beforehand exactly which type it is, I can use instanceof (see example), but I don't (especially the number of dimensions, I don't know). Else I can call getClass().getName() on the object and see if it starts with "[[" (pretty ugly IMHO). Is there another, cleaner method to do this? public static void main(String[] args) { ...

I have a function that I'm using to perform operations on strings in an array. There are times where I'd like to have this function work on arrays of arrays. Is there a simple way to tell if the value of an element in an array is a scalar, or is, instead, a reference to another array? I know I can use a regex to see if the string matches the pattern for an array reference, but is there a more "elegant" and easier way to do it? (And, while I'm at it, is there a way to check for a hash as well? I'd think they'd both be done the same way.) Thanks! Hal In <...

Hello I don't know if what I wrote in subject makes any sense. I have an array in which there are two entries, which are again arrays (one is numbers and one is text). Like I have entry called NEWDATA1 in workspace and in NEWDATA1 , there are entries called 'data' and 'textdata'. I want to separate 'data' (which is a column of numbers) from NEWDATA1. I actually imported a file (concfromcmg1.txt) which looks like Global Mole Fraction(SOL) 2000-01-01 1,1,1’ *SRF-FORMAT 0 Global Mole Fraction(SOL) 2000-01-03 1,1,1’ *SRF-FORMAT 0.705627 ...

Hello, How do I define an array of arrays ? Suppose T is an array of 3 elements. And I want T[0] = intarr(2,5,4), T[1] = intarr(6,5,4) and T[2] = intarr(7,8,4). How do I declare T ? Francois. Fritz writes: > How do I define an array of arrays ? > > Suppose T is an array of 3 elements. > And I want T[0] = intarr(2,5,4), T[1] = intarr(6,5,4) and T[2] = > intarr(7,8,4). > > How do I declare T ? As a pointer array. :-) t = PtrArr(3) t[0] = Ptr_New(intarr(2,5,4)) t[1] = Ptr_New(intarr(6,5,4)) t[3] = Ptr_New(intarr(7,8,4)) (*t[1])[0,*,2] = Indgen(...

I've to save in an array of array some values. Problem: I don't know the size of the array before filling it. I'd like something like $bigarray = array(): then runnig the code I must create dinamically (I don't know how many) few arrays in the bigarray; $bigarray["X"] = array(): $bigarray["Y"] = array(): then fill those arrays with few unknow number of values. array_push($bigarray["X"],$value1); array_push($bigarray["X"],$value2); array_push($bigarray["Y"],$value5); .... but array_push doesn't manage it. How to do so...

Hi. Is it possible in javascript to operate on an array without knowing how mamy elements it has? What i want to do is sending an array to a script, and this script should add all values from that array Could you show me a little example how to do this? Thanks. Leszek Leszek wrote: > Is it possible in javascript to operate on an array without knowing how > mamy elements it has? Of course. This is what the e.g. `length' property of Array objects is for. > What i want to do is sending an array to a script, and this > script should add all values from that array > ...

Hi, I am a C programmer trying to figure out a simple way of defining a 2D array. In C i would simply do: int dateArray[5][3] = {5,21,2004, 7,23,1979, 5, 6,1949, 6, 2,1977, 2,15,1975}; In java however I am not sure how to do this. From what I have read so far I know of one way. int[][] dateArray = new int[5][3]; dateArray[0][0] = 5; dateArray[0][1] = 21; dateArray[0][2] = 2004; .... Is there a quicker way to do this, similar to C. Thanx Joe "Joe Ray" <raymis@hotmail.com> wrote in message news:46039644.04052107...

Hi, there, I wonder, if that is possible to have a array of arrays, for example A(1)=a1(1:N,1:M); A(2)=a2(1:N,1:M); A(3)=a3(1:N,1:M); � If no such thing, is there any simple method to do the same things as dimension A(i,j,k) in Fortran? Could any one please input anything? Thanks hnliuhy wrote: > > > Hi, there, > I wonder, if that is possible to have a array of arrays, for > example > A(1)=a1(1:N,1:M); > A(2)=a2(1:N,1:M); > A(3)=a3(1:N,1:M); > � > > If no such thing, is there any simple method to do the same things > as > dimension > A(i,j,k) in Fo...

awk ' BEGIN{FS=OFS=":"} {split($4,a,",") for(i in a)u[a[i]] for(i in u){x=x","i;delete u[i]} print $1,$2,$3,substr(x,2);x="" }' /etc/group for(i in a)u[a[i]]----------------------------------------------I could not understand this line This means we can an array in an array?? nag wrote: > > for(i in a)u[a[i]] > > I could not understand this line > > This means we can an array in an array?? Yes. In the above example, the values of array a are used as subscripts of array u. See also: http://www.gnu.org/software/gawk/manual/gawk.html#Arrays Hermann On Aug 12, 11:54=A0pm, nag <visit...@gmail.com> wrote: > awk ' > BEGIN{FS=3DOFS=3D":"} > {split($4,a,",") > =A0for(i in a)u[a[i]] > =A0for(i in u){x=3Dx","i;delete u[i]} > =A0print $1,$2,$3,substr(x,2);x=3D"" > > }' /etc/group > > =A0for(i in a)u[a[i]]----------------------------------------------I > could not understand this line > > This means we can an array in an array?? No, it means that the elements of array "a" are the indices of array "u". e.g. a["1"]=3D"p", a["2"]=3D"q" u["p"]=3D"foo", u["q"]=3D"bar" If we could have an array within an array then this: a["1"]=3D"foo"; a["2"]=3D"bar" u["1"]=3Da[] would...

Theres something very basic about javascript arrays I'm missing. The value of unit[i].value is 17.00 and value of the qty[i].value is 5 and I put these values into an array: myarray[unit[i].value]=qty[i].value; I accessed the qty[i].value by putting it into <div id='test2>: document.getElementById('test2').innerHTML+=myarray[unit[i].value]; and it says 5 so far so good. but this is undefined: document.getElementById('test2').innerHTML+=myarray[17.00]; why ? meltedown wrote: > Theres something very basic about javascript arrays I'm missing. > The v...

Hi guys, I have a question dealing with arrays. Here it go: Suppose A is a 3 by 1 array, I want to assign A (1,1) a 5 by 1 array B, can I do this? How? Thanks in advance! "George " <guanjihou@gmail.com> wrote in message <hutpgd$km$1@fred.mathworks.com>... > Hi guys, > > I have a question dealing with arrays. Here it go: > > Suppose A is a 3 by 1 array, I want to assign A (1,1) a 5 by 1 array B, can I do this? How? > > Thanks in advance! Hi George, make A a cell array A = cell(3,1); B = randn(5,1); A{1} = B; Wayne % Us...

Hi, I need to create something like a matrix, say 32 bits on each row and up to 4 rows. That's why on my Spartan3 I have to receive 32 bits word from a serial port and I have to store them (I know I can just place a 32x4 bits long vector and store the data in the same row, but I'd like to learn more about array of array). I wrote: type row is array (cmd_buffer_word downto 0) of std_logic; type cmd_buffer is array (cmd_buffer_depth downto 0) of row; now, how could I transfer the whole 32 bits data inside a vector called cmd_tmp_buffer into the second row of my cmd_buffer? This follow...

Hi friends, I am trying to define a array of arrays. I have defined: integer,dimension(2,2):: & x=reshape(source= (/0,1,1,0/), shape=(/2,2/)), & y=reshape(source= (/1,0,0,1/), shape=(/2,2/)), & z=reshape(source= (/1,1,1,1/), shape=(/2,2/)) I want to define an array, say, s(3), of which, (x/y/z) are components, i.e. s(1)=x s(2)=y and s(3)=z. how can I achieve that? Rudra Banerjee <bnrj.rudra@gmail.com> writes: >Hi friends, >I am trying to define a array of arrays. >I have defined: > integer,dimension(2,2):: & > x=reshape(source= (/0,1,1,0/), shape=(/2,2/)), & > y=reshape(source= (/1,0,0,1/), shape=(/2,2/)), & > z=reshape(source= (/1,1,1,1/), shape=(/2,2/)) >I want to define an array, say, s(3), of which, (x/y/z) are components, i.e. >s(1)=x >s(2)=y >and s(3)=z. >how can I achieve that? $ cat z.f90 type mumu integer :: arr(2,2) end type type(mumu) :: s(3) integer :: i s(1)%arr = reshape(source= (/0,1,1,0/), shape=(/2,2/)) s(2)%arr = reshape(source= (/1,0,0,1/), shape=(/2,2/)) s(3)%arr = reshape(source= (/1,1,1,1/), shape=(/2,2/)) write (*,"(4(i1,tr1))") ( s(i)%arr, i=1,3) end $ gfortran49 z.f90 $ ./a.out 0 1 1 0 1 0 0 1 1 1 1 1 $ Anton On Tuesday, October 29, 2013 5:21:25 PM UTC-4, Rudra Banerjee wrote: > Hi friends, > > I am trying to define a array of arrays. > > I have def...

In PERL I can put arrays in arrays. my @array1 = ('val1', 'val2', 'val3'); my @array2 = ( \@array1 ); In TCL I'm trying set arr1(key1) val1 set arr1(key2) val2 set arr1(key3) val3 set arr2(key4) $arr1 Tclsh rightfully complains that $arr1 is a scalar and not an array. How do I set an array as the value in another array? Mike Mike schrieb: > In PERL I can put arrays in arrays. > > my @array1 = ('val1', 'val2', 'val3'); > my @array2 = ( \@array1 ); > > In TCL I'm trying > > set arr1(key1) val1 > set arr1(...

Hi friends, Please kindly assist me with an answer to this question: Is it possible to create a Matlab array whose elements are in turn 3 element arrays? I mean, how can I create an array as A = {(1,2,2), (3,2,1), (5,3,4), etc}. If possible, how do I access the elements of this array. If not, could this be possible in Fortran? Thanks. On 12/25/2012 8:14 PM, CHINEDU wrote: > Hi friends, > Please kindly assist me with an answer to this question: > > Is it possible to create a Matlab array whose elements are in turn 3 element arrays? > I mean, how can I create an array as A = {(1,2,2), (3,2,1), (5,3,4), etc}. If possible, >how do I access the elements of this array. If not, could this be possible in Fortran? > > Thanks. > A=[1 2 2; 3 2 1; 5 3 4] to access this matrix, use index. Like A(2,2) which will return 2 in this example,etc... --Nasser On 12/25/2012 8:14 PM, CHINEDU wrote: > Hi friends, > Please kindly assist me with an answer to this question: > > Is it possible to create a Matlab array whose elements are in turn 3 > element arrays? Sure... > I mean, how can I create an array as A = {(1,2,2), (3,2,1), (5,3,4), > etc}. If possible, how do I access the elements of this array. If not, > could this be possible in Fortran? Almost there...just have to use [] for the arrays inside the cell array curlies... >> A = {[1,2,2], [3,2,1], [5,3,4]} A = [...

Whatever you wanted to know about it but always were affraid to ask. <http://www.geocities.com/schools_ring/ArrayAndHash.html> VK wrote: > Whatever you wanted to know about it but always were affraid to ask. > > <http://www.geocities.com/schools_ring/ArrayAndHash.html> > I think you need to reconsider your comments about array length (my wrapping of comments): "var arrayObject = new Array(3); // arrayObject has 3 undefined // elements" That misconception has been repeated many times throughout your article. The ...

Hello, I am wondering if a three-dimensional arrays: array3d_1, array3d_2, array3d_3. Is it wise If pass this to a function/subroutine using array constructor to create four-dimensional array on the fly, such as: call mysubroutine ( (/array3d_1, array3d_2, array3d_3/) ) ? Will that be expensive, or is there better way to do it ? I am also not certain if this on-the-fly array construction will be the first or the last dimension. Thanks for any help. RDB reubendb <reubendb@gmail.com> wrote: > I am wondering if a three-dimensional arrays: > array3d_1, array3d_2, array3d_3. > Is...

I've this structure in a XML file: Type Model Detail Datas Datas Datas Datas /Detail Detail Datas Datas Datas /Detail /Model /Type I've parsed all the stuff, by putting everything in an array. Now, I've a problem as I must use datas in "Detail" tag every time they are processed, but I must first process datas in Model, so I have to wait until Model tag is closed. For now I put everything in an array called $datas (where I store the couple key/valu...

Does anyone know if (and how) to create an array/vector of vectors, not necessarily of the same dimension, e.g. if a=[1 2 3] and b=[9,10], if it is possible to form an array/vector c with c(1)=a, c(2)=b? Ray wrote: > Does anyone know if (and how) to create an array/vector of vectors, not > necessarily of the same dimension, e.g. if a=[1 2 3] and b=[9,10], if > it is possible to form an array/vector c with c(1)=a, c(2)=b? You can put any scilab object in a list : c = list(a,b); // or c=list([1 2 3],[9,10]); then c(1) is the vector [1 2 3] and c(2) the vector [9,10] c(1)(2) is the second component of the fist list component , etc... Now you can also use array of cells (as in Matlab) but I believe that lists are more tested than cells which have been recently introduced in scilab. hth Bruno Thank you. ...

Wave 3 of Lego Dimensions adds new characters and opens the Ghostbusters open world. Alongside the new Ghostbusters open world the Cyberman Fun ...

First 30 minutes of Lego Dimensions reveals mini-figures skills and ability matrix.

Resources last updated: 3/10/2016 11:51:05 AM