Hello all,
I've got a php array:
$toField = explode(",", $ids); //Which looks something like '24,25,26,29'
I want to pass this array via jQuery AJAX, with this:
<form id="myForm">
<input type="hidden" value="'.$toField.'">
<input type="submit" id="sendMessage" class="faceboxSubmit" name="ok" value="Send Reply"/>
</form>
And ...
I have 10 arrays, each consisting of similar type of values. I want to capture subset of these values (capture only the digits) from each array and then compare it with subset from other array. And also, I want to capture the number part of values from both arrays only when there is no dash in the value (i.e. 2EF = capture '2'but if 45F-...
Say we have this piece of C code:
int x[] = {1, 2, 3, 4, 5};
printf("%d", *(x + 1)); //prints 2
printf("%d", *(x + 500)); //prints 7209065 (...?)
As you can see from the second call, it still returns something...but it's garbage.
So I ask, how do you handle such a case in C? ie, how do you know if the returned element is really an ...
Lets say I have the following code.
double *return_array(void) {
double foo[2];
foo[0] = 5;
foo[1] = 6;
cout << foo << endl;
cout << foo[0] << endl << foo[1] << endl;
return foo;
}
double *bar = return_array()
cout << bar << endl;
cout << bar[0] << endl << bar[1] << endl;
Now, bar and foo are still the same pointer ...
I was just wondering how I can match the value of two variable, for example if I have
var A = [1,2,3];
var b = [A,B,C];
how can I output the first value of each and second value of each and so on, so the output will become
A1,B2,C3
thanks
...
I can declare a structure:
typedef struct
{
int var1;
int var2;
int var3;
} test_t;
Then create an array of those structs structure with default values:
test_t theTest[2] =
{
{1,2,3},
{4,5,6}
};
But after I've created the array, is there any way to change the values in the same way I did above, using only one line, spec...
I am writing a light weight serialization function and need to include two variable sized arrays within this.
How should I track the size of each?
How should I define the struct?
Am I going about this all wrong?
EDIT: the result must be a contiguous block of memory
...
Hey all, I have a huge array coming back as search results and I want to do the following:
Walk through the array and for each record with the same "spubid" add the following keys/vals: "sfirst, smi, slast" to the parent array member in this case, $a[0]. So the result would be leave $a[0] in tact but add to it, the values from sfirst, ...
How can you do this? My code seen here doesn't work
for($i=0;i<count($cond);$i++){
$cond[$i] = $cond[$i][0];
}
...
Hello!
I have following script:
$cbid = 0;
$arrayid = 0;
while ($FINDNEWSresult = mysql_fetch_array($FINDNEWSquery)) {
echo "<tr>";
// Prvi stolpec - označevanje (checkbox)
echo "<td class=\"middlerow checkbox\"><input id=\"" . $FINDNEWSresult['NEWSid'] . "\" type=\"checkbox\" /></td>";
echo "<td class=\"middlerow\"><a class=...
I have an array of an unknown length which will always have an evenly divisible amount of values, for example:
print_r($initialarray);
Array ( [0] => 30 [1] => 31 [2] => 32 [3] => 33 [4] => 34 [5] => 35 )
I need to create sets:
Set 1: 30 v 35; 31 v 34; 32 v 33;
Set 2: 30 v 34; 31 v 33; 32 v 35;
Set 3: 30 v 33; 31 v 32; 34 v 3...
I've coded quite a lot of projects both academically, personally, and commercially.
And the one thing that always has seen me through is...
Arrays.
Sure you create structures or Objects (to put into those arrays), but in the end its held and manipulated via arrays.
My question is do we really need anything else?
Also on a similar v...
I have to put datas every 10 seconds in an array. Is it silly to index this array with modified timestamps
$a[timestamp] = 54;
$a[timestamp+10] = 34;
or in Javascript with the setInterval() and passing via Ajax the index (very crappy to me) ?
or have I a best option ?
Further details :
I have to link the real-time with entries in...
Well the title sucks. But here is what I am trying to do.
I have a foreach loop that is already pulling all the rows from a mysql db table using a db object style query in a function. That function is grabbing all fields and setting it up in an array ex foreach ($blahs as $blah => $blah_data)
That now allows me to populate the page w...
I was reading an article: Optimizing JavaScript for Execution Speed
And there is a section that says:
Use this code:
for (var i = 0; (p = document.getElementsByTagName("P")[i]); i++)
Instead of:
nl = document.getElementsByTagName("P");
for (var i = 0; i < nl.length; i++)
{
p = nl[i];
}
for performance reasons.
I always use...
I was wondering how is it possible to go through the values of an array and add their values together.
var arr = [1,2,3,4];
should I use
var add = $.each(arr,function() {
});
but how can I add the values together.
thanks
...
In Ruby 1.8.6, I have an array of, say, 100,000 user ids, each of which is an int. I want to perform a block of code on these user ids but I want to do it in chunks. For example, I want to process them 100 at a time. How can I easily achieve this as simply as possible?
I could do something like the following, but probably there's an ...
How to remove duplicate values from an array in PHP and count the occurrence of every element?
I have this array
foo
bar
foo
I want the result to be in array like this
value freq
---- ----
foo 2
bar 1
Thanks
...
I'm using .NET 2.0
I have a large array of string.
I want to check whether a particular string is there in the array or not,
I'm not sure, whether following code is optimized or I need to make it more optimized.
please guide.
string []test_arr= new string[]{"key1","key2","key3"};
Boolean testCondition = (new List<string>(test_arr)).Cont...
I wrote a function that gives me the length of a dynamic array by converting it to string and asking length(trim(string));
function arraylength(a: array of char): integer;
var i: integer;
s: string;
begin
for i:=0 to high(a) do
begin
s[i] := a[i-1];
Result := length(trim(s));
end;
end;
In my main program i read text into...