What are the advantages of using
var foo = [];
over using
var bar = new Array();
i've been told to use [] over new Array() but never with much explanation
Hi guys,
let's assume I've got the address of my array (passed as a pointer to the function) in esi register. How can I access a particular cell of the array? i.e:
my_array[a + b * c]
where c is constant.
Thank you for the fast reply!
Cheers
If there is an array with elements: 1,2,3,4, the program should return another array with sum of all combinations:
1
2
3
4
3 (1+2)
4 (1+3)
5 (1+4)
5 (2+3)
6 (2+4)
7 (3+4)
6 (1+2+3)
7 (1+2+4)
8 (1+3+4)
9 (2+3+4)
10 (1+2+3+4)
How to recive an array from flash vars?
So I have HTML page. with flash app on it. I vant to send an array to flash. How to do such thing using flashVars (I have something like uid=12&sid=12&sid=32&sid=12&sid=32) so i need to get dinamic\random\beeg\unnown number of Sid's not losind UID how to du such thing?
Hi,
I've got an array
var assoc_pagine = new Array();
assoc_pagine["home"]=0;
assoc_pagine["about"]=1;
assoc_pagine["work"]=2;
I tried
if (assoc_pagine[var] != "undefined") {
but it doesn't seem to work
I'm using jquery, I don't know if it can help
Thanks
if I add an item to the $_COOKIE array as such:
setcookie("favorites[]", "value", time()+3600);
I can delete any item from the $_COOKIE[favorites] array like this:
setcookie("favorites[$deletekey]", "", time()+3600);
EXCEPT the first one added so this does not work:
setcookie("favorites[0]", "", time()+3600*24);
How can I delete the first one and leave others intact?
I have a ruby array that looks something like this:
my_array = ['mushroom', 'beef', 'fish', 'chicken', 'tofu', 'lamb']
I want to sort the array so that 'chicken' and 'beef' are the first two items, then the remaining items are sorted alphabetically. How would I go about doing this?
User writes a series of tags (, separated) and posts the form.
I build an array containing the tags and delete dupes with array_unique() php function.
I'm thinking of doing:
go through the array with foreach($newarray as $item) { ... }
check each $item for existence in the tags mySQL table
if item does not exists, insert into tags table
Is there a FASTER or MORE OPTIMUM way for doing this?
I have an An Array called Names[5] and one called scores[5][5]
each row coesponds with the name in the respective index.
I need to find the highest score in the scores array and return the name that corosponds with it
<script type="text/javascript">
$(document).ready(function() {
$("a").click(function() {
$("#results").load( "jquery-routing.php", { pageNo: $(this).text(), sortBy: $("#sortBy").val()} );
return false;
});
});
</script>
how do I create an array in jquery and use that array instead of "{ pageNo: $(this).text(), sortBy: $("#sortBy").val()}"
What's the recommended way of creating a pre-populated two-dimensional array in Scala? I've got the following code:
val map = for {
x <- (1 to size).toList
} yield for {
y <- (1 to size).toList
} yield (x, y)
How do I make an array instead of list? Replacing .toList with .toArray doesn't compile. And is there a more concise or readable way of doing this than the nested for expressions?
What is the stability of Array.sort in different browsers. I know that the ECMA Script specification does not specify which algorithm to use, nor does it specify whether the sort should be stable.
I've found this information on for Firefox
https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array/sort
which specifies that firefox uses a stable sort.
Does anyone know about IE 6/7/8, Chrome, Safari?
How do you print out the contents of a 2d int array
Ive code written in java for a sudoku game and im trying to create a game on the android using the same code
My code in java reads in a text file(sudoku grid)
i see canvas.drawText will read in a string, but how do you do it for a 2d int array, so it prints out in a grid?
Need to store values from foreach loop into an array, need help doing that. Code below does not work, only stores the last value, tried $items .= ..., but that is not doing the trick either, any help will be appreciated.
<?php
foreach($group_membership as $i => $username) {
$items = array($username);
}
print_r($items);
?>
Hi,
I want to use C# to check if a string value contains a word in a string array. For example,
string stringToCheck = "text1text2text3";
string[] stringArray = ("text1", etc... )
if(stringToCheck.contains stringArray( //one of the items?
{
}
How can I check if the string value for 'stringToCheck' contains a word in the string array?
Thanks,
I have array of colors:
String s[]=new String[]{"red","black..............};
The only possible colors are red and black. I need an algorithm which partitions the array such that all red come before all black. How can I compare/exchange them to accomplish that?
Hello guYz plz help me out in making it possible to open the files by the adress provided in an array of strings.........
a way to open file is as given below...
ifstream infile;
infile.open("d:\aslam.txt");
but how can i open file providing an array of string as an adress of file.....
like this
infile.open(arr[i]); (but its not working)
plz help me.........
HI,
I need to create an array of images,in which, every time i tap, a new image gets placed at "view".
and at some particular duration of time, i need to clear that array of images, so that all the images gets cleared from the view.
like on button click, i want to clear all the images which are on the view, through taps,
should be clear at once.
Hope i m clear with my question.
looking for an quick reply.
regards
shishir
i have an NSObject with 2 property's
@interface Entity : NSObject {
NSNumber *nid;
NSString *title;
}
i have 2 array's with Entity's and I want to compare those two on the nid with a predicate
so i can produce an array with only matching nid's
I have an array Items which has 10 elements. I need to remove the 5th element (index=4)
the new array should have 9 elements and all elements after the 5th element will be shifted forward
what command(s) should i use?
I have an associative array in JSON
var dictionary = {"cats":[1,2,37,38,40,32,33,35,39,36], "dogs", [4,5,6,3,2]};
Can I get the keys from this? I tried in Visual studio putting a breakpoint but can't see any property that represents keys. Is it not possible?
I'm fine creating a separate array if necessary, but was just hoping it wasnt :
var keys = ["cats", "dogs"];