Lets say I have this array:
$queue = array("orange", "banana", 'apple', 'watermelon');
If I want to remove any of them,for example I want to remove banana, how to do it?
Example:
var arr_1:Array = new Array();
arr_1.push({sdate:"2010-02-02",status:"New"});
arr_1.push({sdate:"2010-02-03",status:"New"});
arr_1.push({sdate:"2010-02-04",status:"New"});
arr_1.push({sdate:"2010-02-05",status:"New"});
How can i change element number 3 status to: "Old", without removing it. just update the status value??
How would you obtain the min and max of a two-dimensional array using LINQ? And to be clear, I mean the min/max of the all items in the array (not the min/max of a particular dimension).
Or am I just going to have to loop through the old fashioned way?
Lets say I have an array : a=[[1,2,3],[4,5]]
and I have another array : b=[[2.5,1.5,3.5],[1.5,2.5]]
I need to sort 'a' with respect to 'b'.
i.e the output should be = [[3,1,2],[5,4]]
I tried but my code seemed to be very lengthy. It would be great if you could help me out.Thanks!
I have a formula which is working; the formula uses an array. I tried to extract the formula to create a custom formula but now get an error in the syntax.
I am wondering if the array is causing the problem as the error is on the line:
last_element_current:=val(sc_array[1]) + 1;
and the error is: the ) is missing and highlights the variable sc_array before the index [1].
I have a form where users can add input fields with jQuery.
<input type="text" id="task" name="task[]" />
After submitting the form I get an array on PHP.
I want to handle this with the $.ajax() but I have no idea how to turn my <input>s to an array in jQuery.
Thanks in advance.
How do I pass an array through a function, for example:
$data = array(
'color' => 'red',
'height' => 'tall'
);
something($data);
function something($data) {
if ($data['color'] == 'red') {
// do something
}
}
how can I get the function to recognize $data[color] and $data[height]?
Hi all,
I got an array which contains some data like this:
$arrs = Array("ABC_efg", "@@zzAG", "@$abc", "ABC_abc")
I was trying to print the data out in this way (Printing in alphabetic order):
[String begins with character A]
ABC_abc
ABC_efg
[String begins with character other than A to Z]
@$abc
@@zzAG
I don't know how to do it.
I have this array:
Array ( [#LFC] = 1 [#cafc] = 2 [#SkySports] = 1)
How do i display it like this on a page? (preferably in value descending order as below):
#cafc (2), #LFC (1), #SkySports (1)
Thanks
I have an array, i don't know the length but i do know it will be =48bytes. The first 48bytes are the header and i need to split the header into two.
Whats the easiest way? I am hoping something as simple as header.split(32); would work ([0] is 32 bytes [1] being 16 assuming header is an array of 48bytes)
using .NET
Hello!
I have a byte array, as follows:
byte[] array = new byte[] { 0xAB, 0x7B, 0xF0, 0xEA, 0x04, 0x2E, 0xF3, 0xA9};
The task is to find the quantity of occurrences '0xA' in it.
Could you advise what to do? The answer is 6.
I'm making a call to PayPal's credit card processor, and after a successful/unsuccessful transaction it returns me a string that looks like this:
DoDirectPayment failed: Array ( [TIMESTAMP] = 2010%2d05%2d02T23%3a33%3a28Z [CORRELATIONID] = 8c503f5c6c861 [ACK] = Failure [VERSION] = 51%2e0 [BUILD] = 1268624 [L_ERRORCODE0] = 10527 [L_SHORTMESSAGE0] = Invalid%20Data [L_LONGMESSAGE0] = This%20transaction%20cannot%20be%20processed%2e%20Please%20enter%20a%20valid%20credit%20card%20number%20and%20type%2e [L_SEVERITYCODE0] = Error [AMT] = 90%2e00 [CURRENCYCODE] = USD )
I'm not a javascript pro, but how exactly can I turn that into a parseable array?
Thank you!
This question is related to the post here. Is it possible to initialize an array without assigning it? For example, class foo's constructor wants an array of size 3, so I want to call foo( { 0, 0, 0 } ). I've tried this, and it does not work. I'd like to be able to initialize objects of type foo in other objects' constructor initialization lists. Is this possible?
Hi, how can i convert this into an array?
if someone searches for "lo" he gets the text "no query", but how can i do this for more words? i tried it with array('1','2')..
if ($query == 'lo')
{
exit ('No Query.');
}
i want something like this
if ($query == 'lo', 'mip', 'get')
{
exit ('No Query.');
}
so, if someone types mip he gets the message..
thank you!!
I have an array like this:
int a[100];
I am filling only the first 4 elements in this array:
a[0] = 1;
a[1] = 2;
a[2] = 3;
a[3] = 4;
When I do sizeof(a)/sizeof(a[0]) it returns 100.
Is there a way I can get number of elements to which I have assinged a value and thus filtering out the remaining 96 unassigned elements?
thanks
If I have a hash in Perl that contains complete and sequential integer mappings (ie, all keys from from 0 to n are mapped to something), is there a means of converting this to an Array?
I know I could iterate over the key/value pairs and place them into a new array, but something tells me there should be a built-in means of doing this.
howdy,
i currently have a method that checks what is around the centre item in a 3x3 grid, if what is in the 8 adjacent positions is containing what i am checking for i want to mark that square on an array with length 7 as being 1.
to do this i need to create and return an array in my method, is it possible to do this?
I want to add an additional value into an array before passing it to json_encode function,
but I can't get the syntax right.
$result = db_query($query);
// $row is a database query result resource
while ($row = db_fetch_object($result)) {
$stack[] = $row;
// I am trying to 'inject' array element here
$stack[]['x'] = "test";
}
echo json_encode($stack);
This will be implemented in Javascript (jQuery) but I suppose the method could be used in any language.
I have an array of items and I need to perform a sort. However there are some items in the array that have to be kept in the same position (same index).
The array in question is build from a list of <li> elements and I'm using .data() values attached to the list item as the value on which to sort.
What approach would be best here?
<ul id="fruit">
<li class="stay">bananas</li>
<li>oranges</li>
<li>pears</li>
<li>apples</li>
<li class="stay">grapes</li>
<li>pineapples</li>
</ul>
<script type="text/javascript">
var sugarcontent = new Array('32','21','11','45','8','99');
$('#fruit li').each(function(i,e){
$(this).data(sugarcontent[i]);
})
</script>
I want the list sorted with the following result...
<ul id="fruit">
<li class="stay">bananas</li> <!-- score = 32 -->
<li>pineapples</li> <!-- score = 99 -->
<li>apples</li> <!-- score = 45 -->
<li>oranges</li> <!-- score = 21 -->
<li class="stay">grapes</li> <!-- score = 8 -->
<li>pears</li> <!-- score = 11 -->
</ul>
Thanks!
I am processing a form and in turn, receiving a response code based on the information submitted. I have a list of approximately 40 response codes (and their meaning) in my hands and am trying to build an 'if' statement that checks against a predefined array and returns a specific value.
Just not sure how to do this
First pass conceptually:
$bads = array (1,2,3,4,5,6)
if ($output['responsecode'] == (any value in $bads) {
echo "you suck";
}
Is it possible to assign php array in MySQL IN() function? for example,
$numbers = array('8001254656','8886953265','88864357445','80021536245');
$sql = mysql_query("SELECT * FROM `number_table` WHERE `number` IN ($numbers)");
Any Ideas?
Thanks,
Hi,
I have string like this;
"String {tag_0} text {tag_2} and {tag_1}"
Now i need to replace all {tag_INDEX} with elements from array
$myArray = array('a','b','c');
so after replacement it should looks like:
"String a text c and b"
What is the best way to do this? I'm trying with preg_replace and preg_replace_callback but without any good results
Hello
I want to create in C++ an array of Objects without using STL.
How can I do this?
How could I create array of Object2, which has no argumentless constructor?
Hello,
I have a for loop that loops over one array...
for i=1:length(myArray)
In this loop, I want to do check on the value of myArray and add it to another array myArray2 if it meets certain conditions. I looked through the Matlab docs, but couldn't find anything on creating arrays without declaring all their values on initialization or reading data into them in one shot.
Many thanks!
Hi, I am using the xpath in php5 to parse a xml document. The problem I have is writing a foreach to correctly display the following array
array(1) {
[0]=
object(SimpleXMLElement)#21 (2) {
["file"]=
string(12) "value 1"
["folder"]=
string(8) "value 2"
}
}
Ideally i would like to get the value by using $row['file'] or $row['folder']. Thanks for any help.