Hi,
I've had a look round similar articles such as this one and I can't quite get it to work, quite possible I'm just misunderstanding.
I've got a simple script which parses a bit of xml and prints out specific fields - what I'm having trouble doing is accessing the data of SimpleXMLElement Objects.
XML (simplified for clarity)
<cha...
Hi there. First time i post here and hope somebody will be able to help me.
I have a file whos numbering starts at 610 and goes on to 1019. I want to use PHP's preg_match() function to start the numbering from 0 and go on till 410.
Here is some code i've been working on. But i cant get the function to replace the numbers. I don't know ...
We have list in html:
<ul class="list">
<li>some text<li>
<li>some text<li>
<li>some text<li>
<li>some text<li>
<li>some text<li>
...
<li>some text<li>
</ul>
There can be more than 100 <li>
How to do:
1) Add for each <li> id with number, like:
<li id="item1">some text<li>
<li id="item2">some text<li>
...
<li id="item200">some text<...
I have an array string[] with values that are mostly convertible to integers.
var values = new [] {"", "1", "2", "a", "3"};
I need to convert values to an array of integers, discarding any items that aren't convertible. So I end up with
var numbers = new [] {1, 2, 3};
What would be the most efficient (quickest and clean code) way ...
Alright, I know how you normally would declare a pointer:
void SomeFunction(array<float> ^managedArray)
{
pin_ptr<float> managedArrayPtr = &managedArray[0];
}
This works fine except when managedArray contains no elements. In that case, it throws an IndexOutOfRangeException.
In C# you can do this:
void SomeFunction(float[] managedA...
int main(void)
{
char four[4] = "four";
return 0;
}
When compiled as a C++ program, G++ reports
xxx.cpp: In function int main():
xxx.cpp:3: error: initializer-string for array of chars is too long
When compiled a a C program, GCC reports no error.
It appears to me, that the assignment is correctly copying all 4 bytes into t...
I have a bison grammar for collecting arguments of a function. This is what it is so far:
args: arg {$$ = intArray($1);} //pseudo-code function
| args arg {$$ = $1 + $2;} //pseudo-code array addition
arg : NUM {$$ = $1;}
| exp {$$ = $1;}
How can I create an array of inte...
I have a matrix lets say:
a =
401.4800 344.0900 305.0300 462.2100 310.0600 397.3400 502.5900
547.7100 429.9600 540.3400 737.3600 491.4700 474.7400 735.8700
I want to get the first and last columns only so that:
b =
401.4800 502.5900
547.7100 735.8700
...
I have an array with let's say, 500 elements. I know I can select the first 100 by doing .first(100), my question is how do I select elements from 100 to 200?
...
Is there a PHP function that will do the following:
Move a specified array value from it's current index and then either:
Moved in between two existing indices.
Swapped with a second index/value.
I made the class below for the task, but wonder if there is a pre-existing function in the PHP library?
Here is the class I have created ...
I've got some Data being returned by an API that is formatted in a string, I want to convert it to an array so I can pick values out of it.
Comes in like the following:
images/20100819_202433.jpg{
"permalink": "http://burstn.com/sayhi#burst/06d67eed55d05dd545583de5b4ca3556",
"total_comments": "0",
"caption": "",
"created_at": "2010-...
Hi,
I want to receive unlimited $_POST variables including an additional number and turn them into arrays like paypal form does.
Example:
<form action="mysite">
<input name="productname" />
<input name="productname1" />
<input name="productname2" />
Etc....
</form>
I will turn that into a php array after receiving it:
products(gta,t...
Hi,
I have a list of US regions set up as checkboxes. When a user submits the form, I need an array of associated states. This array is used for comparing to another array in my SQL tables.
Using jQuery or javascript, what's the best way to go about this?
I've got the general idea I believe:
//populate region to state arr...
I need to keep checkboxes in a collection and access them via matrix coordinates.
The following example works but only if I know the size of the matrix beforehand, since an array is used.
What would be the best kind of approach/collection to achieve the same result but also allow the matrix to be defined at runtime, e.g. Dictionary<>, ...
How can you query an object with an array?
var myArray = ['A','C']
Using myArray, how can I get a returned array with ['1','3'] out of the following (previously JSON object) (without using a third party query script -- unless it's jQuery :)
[ { "property1": "1",
"property2": "A"
},
{ "property1": "2",
"property2": "B...
Summary: Given an array
{a, b, ..., w, x, ..., z}
insert several elements {m, n, ..., r} in the position of x, also removing x. Final array:
{a, b, ..., w, m, n, ..., r, ..., z}
Have an return array
$return_arr = array(
'saa'=>'A2223',
'asab'=>'asB',
'wqed'=>'D234',
...
I've tested the following and it works on both PHP 5.2 and 5.3, however, it's not documented anywhere as far as I can see so I'm evaluating its use.
I have a function in a class called isValid, this checks a hash to see if the given value is in the set of allowed values. There are some values that are valid, but deprecated; I'd like my ...
I have a list of data that includes both command strings as well as the alphabet, upper and lowercase, totaling to 512+ (including sub-lists) strings. I want to parse the input data, but i cant think of any way to do it properly other than starting from the largest possible command size and cutting it down until i find a command that is ...
In my properties file I have one property, which contains a comma separated list of values
In my code, I would like to load that property in, split it from the commas, and add each value into an array. I also want to make sure I don't have values in the array due to whitespace etc
example property :
prop_allowed_extensions = .jpeg,ti...
My code processes a huge number of values and I'm looking for an efficient structure to keep track of the top (N) values, where N is less than 10, so collecting ALL numbers then sorting the list and taking the first (N) is probably not the most efficient way.
To do that, I'm building a collection of fixed size N, to keep the top (N) va...