In 'Me Too!' it was about the bus cleaning woman again. It was windy and she was scared of everything and broke her broom. A large tree branch blew into the bus depot and stopped the door from closing. Must have been very windy. Remembering Granny Murray's saying, she broke the twigs off the branch and tied them round her broken broom handle to make a new broom.
After cleaning up all the leaves with her new broom, the inspector came in, he walked past the camera and gave a thumbs up, he looked like he was either quite pleased or embarassed to be on TV, obviously the director had decided not to let him have any lines though.
In big cook little cook, Big cook Ben was using a broom as horse, and his broom broke too!
After lunch I went on Animal Crossing, then went in the garden for a while and took some photos. I was hoping to see some small bees on the plum blossom, but a lot of the plum blossom was gone and I didn't see any insects on the blossom that was left either. There didn't seem to be any flies on the Salix Caprea or holly bushes either. I did get a few pics of a bug, but it kept moving around and was in the grass (so grass kept getting in between the bug and the lens), so I'm not sure if I got any good pics of it.
I checked my email, then sorted the pics I'd taken today. I did some more work on my website until Dinner time.
After dinner I did more website stuff. I spent a large part of the evening trying to work out why a function that was supposed to fire a function to move a node, then fire the same function again to move another node didn't work, whilst running the same function to move each node manually did work. There were quite a few things wrong with my code that caused this problem, but the main one that stumped me for the longest was that I was using a foreach loop to fire the function that moves the node.
With the way I have written my code, each time a node is moved, you will need to reload any nodes you want to access the details of, as their lft and rgt values will (very likely) have been changed due to the node being moved.
So my original code looked like this:
if($children)
{
include('categoryMoveFunctions.php');
foreach($children as $key => $child)
{
moveAsSiblingCat($child, $nodeDetails);
if($children[$key])
{
//If we have just moved a child, reload the next child's details and the parent node as their lft and rgt will now have changed
$nodeDetails = getNodeDetails($node);
$children[$key] = getNodeDetails($children[$key]['id']);
}
}
}
However, after much head scratching,
echo
ing and print_r
ing, I realised that the $child
array being passed to the moveAsSiblingCat()
function was not being updated. I checked the PHP Manual entry for foreach
, and indeed foreach works on a copy of the array, so changing the array items has no effect unless you reference the array. I just changed my code to a for loop and it seems to work fine now:if($children)
{
include('categoryMoveFunctions.php');
for($i=0; $child = $children[$i]; $i++)
{
moveAsSiblingCat($child, $nodeDetails);
if($children[$i+1])
{
//If we have just moved a child, reload the next child's details and the parent node as their lft and rgt will now have changed
$nodeDetails = getNodeDetails($node);
$children[$i+1] = getNodeDetails($children[$i+1]['id']);
}
}
}
After getting that working I did a backup, then went to bed.
The weather today was foggy and overcast in the morning until about 10am, then it was quite sunny and a bit cloudy until about 5pm when it got more cloudy.
Food
Breakfast: Maple & Pecan crunch oat cereal; cup o' tea.
Lunch: Smoked Barvarian ham with sweet & crunchy salad sandwich; a couple of Chilli flavour Doritos; clementine; hot cross bun with butter; cup o' tea.
Dinner: Spaghetti; Bacon and cheese sauce; bacon; mixed veg; ground black pepper. Pudding was ½ banana and an American style chocolate brownie cookie.
No comments:
Post a Comment