this one creates an error:
@settings = {
:tab1 => {
:name => {
:required => true
},
:description
}
}
need to change :descrpition to :description => {}, but i don't have any values for :description so i want it to remain as is (without the empty => {})
Would you show me the best way to handle th...
Hi,
I am building a template system for emailing people that currently works in the format of:
$array['key1'] = "text";
$array['key2'] = "more text";
<!--key1--> // replaced with *text*
<!--key2--> // replaced with *more text*
For this particular project I have a nested array with this kind of structure:
$array['object1']['nest1']['...
In Delphi, it is possible to create an array of the type
var
Arr: array[2..N] of MyType;
which is an array of N - 1 elements indexed from 2 to N.
If we instead declare a dynamic array
var
Arr: array of MyType
and later allocate N - 1 elements by means of
SetLength(Arr, N - 1)
then the elements will be indexed from 0 to N - ...
How validate file upload in CakePHP?
When i wrote some like this:var $validate = array(
'file' => array(
'select' => array(
'rule' => array('selectFile'),
'message' => 'There is no file!'),
'type' => array(
'rule' => array('typeFile'),
'message' => 'Bad type!'),
...
The setup:
I have a project that is using CouchDB. The documents will have a field called "tags". This "tags" field is an array of strings (e.g., "tags":["tag1","tag2","etc"]). I am using couchdb-lucene as my search provider.
The question:
What function can be used to get couchdb-lucene to index the elements of "tags"?
If you have...
Is this code correct?
char *argv[] = { "foo", "bar", NULL };
...
I am parsing a log containing nicknames and hostnames. I want to end up with an array that contains the hostname and the latest used nickname.
I have the following code, which only creates a list over the hostnames:
hostnames = []
# while(parsing):
# nick = nick_on_current_line
# host = host_on_current_line
if host in hostname...
I have this:
[1]=>
object(SimpleXMLElement)#6 (1) {
["@attributes"]=>
array(14) {
["name"]=>
string(5) "MySQL"
["acknowledged"]=>
string(1) "1"
["comments"]=>
string(1) "1"
["current_check_attempt"]=>
string(1) "1"
["downtime"]=>
string(1) "0"
["last_check"]=>
string(19) "2010-05-01 ...
Hi all ! I use to load plist which are in my main Bundle (Ressource folder) into an array using :
NSString *path = [[[NSBundle mainBundle] resourcePath]stringByAppendingPathComponent:nomPlist ];
NSMutableArray *tmpQuestion = [[NSArray alloc] initWithContentsOfFile:path];
arrayQuestion = [ [NSArray alloc] initWithArray:tmpQuestion]; ...
I am just starting with perl and would like some help with arrays please.
I am reading lines from a data file and splitting the line into fields:
open (INFILE, $infile);
do {
my $linedata = <INFILE>;
my @data= split ',',$linedata;
....
} until eof;
I then want to store the individual field values (in @data) in and array so that the ar...
I have read this question and I'm still not sure whether it is possible to keep pointers to methods in an array in Java, if anyone knows if this is possible or not it would be a real help. I'm trying to find an elegant solution of keeping a list of Strings and associated functions without writing a mess of hundreds of 'if's.
Cheers
...
I'm playing about with a stop words within my code I have an array full of words that I'd like to check, and an array of words I want to check against.
At the moment I'm looping through the array one at at a time and removing the word if its in_array vs the stop word list but I wonder if there's a better way of doing it, I've looked at ...
I'm having trouble understanding the result of the following statements:
>>> from array import array
>>> array('L',[0xff,0xff,0xff,0xff])
array('L', [255L, 255L, 255L, 255L])
>>> from array import array
>>> array('L','\xff\xff\xff\xff')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: string length ...
This script:
<?php
$lines[] = '';
$lines[] = 'first line ';
$lines[] = 'second line ';
$lines[] = '';
$lines[] = 'fourth line';
$lines[] = '';
$lines[] = '';
$lineCount = 1;
foreach($lines as $line) {
echo $lineCount . ': [' . trim($line) . ']<br/>';
$lineCount++;
}
?>
produces this output:
1: []
2: [first line]
3: [sec...
My programming language has no arrays, no lists, no pointers, no eval and no variable variables. All it has:
Ordinary variables like you know them from most programming languages: They all have an exact name and a value.
One stack. Functions provided are: push (add element to top), pop (remove element from top, get value) and empty (ch...
Is there an accepted general term that subsumes the concepts of variables, class instances and arrays? Basically "any typed thing that needs memory". In C++, such a thing is called an object, but I'm looking for a more language-agnostic term.
§ 1.8 The C++ object model
1 The constructs in a C++ program create, destroy, refer to,...
Is there anyway to order an array in this way? For example if I had this array:
$array = array("foo", "bar", "item", "item", "foo", "foo");
And I wanted to order it so that it was "foo", "foo", "foo", "item", "item", "bar" is there any way to do that?
...
I am binning a 2d array (x by y) in Python into the bins of its x value (given in "bins"), using np.digitize:
elements_to_bins = digitize(vals, bins)
where "vals" is a 2d array, i.e.:
vals = array([[1, v1], [2, v2], ...]).
elements_to_bins just says what bin each element falls into. What I then want to do is get a list whose len...
So client gives me a string like "1,23,23,abc,ggg,544,tf4," from user 12 . There can be infinit number of elements with no spaces just value,value,... structure. I have users table (with users uId(key), names etc). I have streams table with ( sId(key), externalID, etc values). User sends me externalId's. And I need to hawe externalId's ...
Hello !
It's late and I know it is a very simple question but right now I do not have an idea and deadline is near..
I've got two arrays:
$array1 = array(
'a' => 'asdasd',
'b' => 'gtrgrtg',
'c' => 'fwefwefw',
'd' => 'trhrtgr',
);
$array2 = array(
'b', 'c'
);
What was the name of function to get a part of assoc array by key...