I have seen functions to list all file in a directory but how can I list all the files in sub-directories too, so it returns an array like?
$files = files("foldername");
So $files is something similar to
array("file.jpg", "blah.word", "name.fileext")
...
There are simple 2d array with some sort of tree like this:
node1
node2
node3
It's structure is:
array(
array (
'id' : 1,
'pid': 0,
'title' : 'node1',
'level' : 1
),
array (
'id' : 2,
'pid': 1,
'title' : 'node2',
'level' : 2
),
array (
'id' : 3,
'pi...
I seem to recall (though can't find any reference now) to one being able to do something akin to
my @a = ("foo","bar");
my ($item1, $item2) = @a;
The above does not do what I want it to (obviously) but I seem to recall that there is some way to do this, where it loads the items associated with the order of the scalars in the parenthes...
Is there a way i can replace the values of one array with the values of another which has identical keys?
$arr1 = Array
(
[key1] => var1
[key2] => var2
)
$arr2 = Array
(
[key1] => var3
[key2] => var4
)
I want to change $arr1's values to the ones in $arr2 i...
I am experimenting a little bit with gamestudio.
I am making now a shooter game.
I have an array with the pointer's to the enemies. I want. to when an enemy is killed. remove him from the list. And I also want to be able to create new enemies.
Gamestudio uses a scripting language named lite-C. It has the same syntax as C and on the webs...
This is from Sun's tutorial's exercise area so I suppose it is homework.
I know how to use a for loop to iterate the string, but I wish to learn arrays while I am at it and store them in so. This is what I got so far:
BufferedReader in = new BufferedReader(new FileReader("xanadu.txt"));
int c;
char letters[] = new char[27]; //26 + newl...
for example:
[ (id=>1, email=>'[email protected]', name=>'tim'),
(id=>2, email=>'[email protected]', name=>'joe'),
(id=>3, email=>'[email protected]', name=>'dan') ]
How can I extract the email column and put it in its own array?
...
I was always wondering about this, but never really looked thoroughly into it.
The situation is like this: I have a relatively large set of data instances. Each instance has the same set or properties, e.g:
# a child instance
name
age
height
weight
hair_color
favorite_color
list_of_hobbies
Usually I would represent a child as a hash ...
Is there a simple way to check if all values in array are equal to each other?
In this case, it would return false:
$array[0] = 'yes';
$array[1] = 'yes';
$array[2] = 'no';
And in this case, true:
$array[0] = 'yes';
$array[1] = 'yes';
$array[2] = 'yes';
So, yeah, is there a function/method to check all array values at once?
Thanks...
#include<stdio.h>
#include<conio.h>
void insert(int arr[]);
# define LEN 10
int count;
void main(void)
{
clrscr();
int arr[]={20,21,22,23,24};
insert(arr);
getch();
}
void insert(int arr[])
{
if(size==count)
printf("no space");
return;
int index,value;
printf("enter index and value");
scanf("%d %d",index,val...
So the title is somewhat misleading... I'll keep this simple: I'm comparing these two data structures:
An array, whereby it starts at size 1, and for each subsequent addition, there is a realloc() call to expand the memory, and then append the new (malloced) element to the n-1 position.
A linked list, whereby I keep track of the head, ...
I need to repeatedly make calls to a template function with different classes defined elsewhere in the code, like so:
MyTemplateFunction<ClassOne>( &AnotherTemplateFunction<ClassOne> );
MyTemplateFunction<ClassTwo>( &AnotherTemplateFunction<ClassTwo> );
MyTemplateFunction<ClassThree>( &AnotherTemplateFunction<ClassThree> );
MyTemplateFu...
// sizeofarray.cpp
#include <iostream>
template <typename T,int N>
int size(T (&Array)[N])
{
return N;
}
int main()
{
char p[]="Je suis trop bon, et vous?";
char q[size(p)]; // (A)
return 0;
}
I heard that an array size in C++ must be a constant expression. So char q[size(p)] is invalid, am I right? But I got no errors when...
I have an autocomplete text box that users can type an item code into and need to find out what the id number of that item code is in javascript.
An associative array is the way I would imagine it should be done, but the following seems a little long winded and Im hoping someone has a better way to do it or shorthand of what I have belo...
i have the following code:
which uses an array to write the result to file
i want to create another array to read the celebities aray from another file
<?php
require("class.XMLHttpRequest.php");
function hot($news){
$url="https://localhost/search.aspx?search=".$news."";
$ajax=new XMLHttpRequest();
$ajax->setRequestHeader("Cookie"...
I am building a matrix class ( I am aware one exists), I'm thinking about initialization. Currently one of the initializations is
double[,] data;
public Matrix(double[,] data)
{
if (data.GetLength(0) == 0 || data.GetLength(1) == 0)
{
throw new ArgumentException();
}
this.data = (double[,])(data.Cl...
Hi all, i have 2 arrays:
$foo = array(
'1' => '2',
'3' => array(
'4' => '5'
),
'6' => array(
'7' => '8',
'9' => '10',
'11' => array(
'12' => '13',
'14' => '15'
)
)
);
$bar = array(
'1',
'6' => array(
'7',
'11' => array(
...
Hello,
I'm trying to unparse a string into an array, here is my code:
EDIT: I've found a bit more information.
startTimeArray = [[NSMutableArray alloc] init];
NSString *tmpStartTimeString = [[tempItems objectAtIndex:0] valueForKey:@"temp_start_time"];
startTimeArray = (NSMutableArray *)[tmpStartTimeString componentsSeparatedByCharac...
I have this code:
require("class.XMLHttpRequest.php");
function hot($news){
$url="https://localhost/search.aspx?search=".$news."";
$ajax=new XMLHttpRequest();
$ajax->setRequestHeader("Cookie","Cookie: host");
$ajax->open("GET",$url,true);
$ajax->send(null);
if($ajax->status==200){
$rHeader=$ajax->getResponseHeader("Set-Cookie")...
I am trying to work out how to split the following hexadecimal string into an array of paired numbers.
At the moment i have the following:
function getRGB(hexVal) {
var substrHexVal = hexVal.substring(1,hexVal.length);
var splitHexVal = substrHexVal.split("");
return splitHexVal;
}
var a = getRGB("#00FF00");
a;
Whic...