This is what I want:
foreach($_POST['something'] as $something){
foreach($_POST['example'] as $example){
$query = mysql_query("INSERT INTO table (row, row2) VALUES ('{$something}','{$example}')");
}
}
$_POST['something'] and $_POST['example'] are arrays from an input with
name="something[]" and name="example[]".
T...
Perhaps I'm doing something embarrassingly wrong, but why isn't this array being sorted?
$narray=array();
$dir_handle = @opendir($path.$projectFolder) or die("Unable to open $path$projectFolder");
$i=0;
while($file = readdir($dir_handle)) {
$filenameSplit = explode('.',$file);
if ($file != "." && $file != ".." && $filenameSplit[0...
I read a an array of bytes from a file
I pass this to a class that then assigns various bytes from that array to various members of varying sizes.
Ideally i would like to do something like this
memberThatIsAUShort = bitconverter.ToUShort(tempArray.subArray(3,5))
memberThatIsAShort = bitconverter.ToShort(tempArray.subArray(6,8))
Inste...
i am using this:
http://docs.scipy.org/doc/numpy/reference/generated/numpy.histogram.html
i have an list a that i want to use like this:
numpy.histogram(a,bins=[0.1,0.2,0.3,0.4...6], range=[0:6])
how do i include a set of bins 0.1 through 6 in 0.1 intervals?
how do i specify a range of 0 through 6?
...
Hi,
I'm trying to add functionality to the Arrays-class. In my project I use the (static) methods from Arrays and have some other methods that also handle array-conversion, sorting, etc...
I'm trying to add these to an object MyArrays that extends Arrays so I can go
MyArrays.toList(foo);
but also
MyArrays.myOwnFunction(bar);
but...
Hello,
It seems, if I'm not wrong, that because of the way Javascript handles Objects it is unpractical or inefficient to implement linked lists.
I would need a data structure in which I could easily do 2 operations(apart from indexing), appending at the end and removing (popping) an object at a given index.
Is using an Array and "rec...
i am working with lists, and there is a function that is returning something that looks like this:
array([0, 5, 3, 3, 0, 1, 2])
how do i cast those values into a list?
what does array mean?
...
Hi,
I don't really get why this isn't working:
thing = {
img78:{ exifmanufacturer:"Canon", exifmodel:"Canon EOS 450D", exifexposuretime:"1/125", exiffstop:"71/10", exifiso:"200"},
img79:{ exifmanufacturer:"Canon", exifmodel:"Canon EOS 550D", exifexposuretime:"1/125", exiffstop:"71/10", exifiso:"100"},
img80:{ exifmanufacturer:"Canon", ...
I just used array_filter to remove entries that had only the value '' from an array, and now I want to apply certain transformations on it depending on the placeholder starting from 0, but unfortunately it still retains the original index. I looked for a while and couldn't see anything, perhaps I just missed the obvious, but my question...
hi all ,
var a = new array();
a[1] = 'A';
b[10] = 'B';
console.log(a);
/*[undefined, "A", undefined, undefined, undefined, undefined, undefined, undefined,
undefined, undefined, "B"]*/
I want to remove undefined element
but what is the process??
...
Something about using $array_increment++ to fill an array seem inefficient, even though it works.
Is there a more efficient way to fill $color_names in the code below than using a variable to walk through the array? Since I'm using a foreach and 'if' to fill the array, it's harder to figure out a different way than using ++.
$array_inc...
We are trying to build an API to support commit() and rollback() automatically, so that we don't have to bother with it anymore. By researching, we have found that using eval {} is the way to go.
For eval {} to know what to do, I have thought of giving the API an array of functions, which it can execute with a foreach without the API ha...
I have a class that internally is just an array of integers. Once constructed the array never changes. I'd like to pre-compute a good hashcode so that this class can be very efficiently used as a key in a Dictionary. The length of the array is less than about 30 items, and the integers are between -1000 and 1000 in general.
...
Hello,
I would like to divide a large byte array into smaller chunks (say 64 bytes). Please help me with this.
...
I have an object:
stdClass Object
(
[Color] => Red
[Shape] => Round
[Taste] => Sweet
)
I want to trim each of the elements in the object and if that element is empty, set it to 'N/A'
So this object:
stdClass Object
(
[Color] => Red
[Shape] =>
[Taste] => Sweet
)
Would become this:
stdClass Object
(
[Co...
Let's say I have 4 arrays:
[1,3,54,4]
[54,2,3,9]
[3,2,9,54]
[54,8,4,3]
I need to get the objects (in this case integers but they will be custom object) that are present in (common to) all of the arrays. In the case above I would need the result to be: [54,3] as those are the only items two that are in all four arrays.
Order does not m...
I'm not a Ruby guy, I just play one on television. I have to modify someone's old Cron job to pull down some JSON and convert it into objects.
Here's the code
raw_json = Net::HTTP.get(URI.parse("url removed to protect the innocent"))
tags = ActiveSupport::JSON.decode(raw_json)
puts tags.count
tags.count will accurately trace as 5, ...
What is the difference between var_dump() and print_r() in terms of spitting out an array as string?
...
I am trying to compile following code in C#
String[] words = { "Hello", "Worlds" };
words = {"Foo", "Bar"};
and am getting compilation errors like
Error 1 Invalid expression term '{'
Error 2 ; expected
Error 3 Invalid expression term ','
On the other hand if i try
String[] words = { "Hello", "Worlds" };
words = new String[] {"Foo...
Hi,
I'm using custom objects to hold the name and schema from a set of SQL Server objects. I put the objects into an array, then I get another set of objects and put those into another array. What I'd like to do now is find all exact matches between the two arrays.
I'm currently using this:
$filteredSQLObjects = @()
foreach ($SQLObje...