Daily Archives: Wednesday 30/07/2008

CaClimb! My Life 30 JUL 2008

Tree Okay, so now we have had CaPoo!, CaJump! and CaNavigate!, so next on the list is CaClimb! as I discovered for myself while outside looking for the damn cats so I could put them inside and go off to gym yesterday.

Coco as per usual was pretty easy to trick into coming to me so that I can grab her and toss her inside, but Olympus was nowhere to be seen… until I looked upwards that is.

There at the top of a thin, tall, palm-like tree (pictured right) was Olympus, his whole body wrapped around the trunk and currently in the process of crawling down the tree in a very hilarious, worm-like manner! I could hardly believe my eyes (or contain my laughter)!

And not just that. The boy had been making me proud all day long already. He’d already chased off the mean-tempered cat of the complex, Abby, and then followed that up by making friends with the two other white cats that prowl the grounds. And then to top off everything, he even made an unannounced visit into one of the lady’s homes across the parking lot! Talk about adventuresome!

(Oh, and he is now capable of jumping in and out of the house via my ‘man room’ window!)

*sniff*, they grow up so fast….

The Irishman and the Squaw Jokes & other Funny Stuff 30 JUL 2008

Squaw

Two Red Indians and an Irishman were walking through the woods when all of a sudden one of the Red Indians ran up a hill to the mouth of a small cave.

“Wooooo! Wooooo! Wooooo!” he called into the cave and listened closely until he heard an answering, “Wooooo! Wooooo! Woooooo!” coming from inside the opening. Hearing the reply, he tore off all of his clothes and dashed into the cave.

Puzzled, the Irishman asked the remaining Indian what that was all about.

The Indian explained to him that it was their custom that during mating season, whenever a Red Indian man sees a cave, they need to holler “Wooooo! Wooooo! Wooooo!” into the opening and should they get an answer back, then that means that there is a beautiful female squaw sitting inside and waiting for a man to arrive.

Just then the two of them came upon another cave and the second Indian dashed up to the cave, stopped, and hollered, “Wooooo! Wooooo! Wooooo!”

Immediately there was an answer of “Wooooo! Wooooo! Wooooo!” from deep inside the cave and just like the first, the second Indian tore off all his clothes and ran straight into the cave.

The Irishman continued to wander around the woods alone for a while, before spying a third, rather large cave just up a hill.

“Hoo, man! Just look at the size of this cave! It is easily three times as large as those caves that those Indians found, which must mean that this cave must hold some pretty fine women in it!”

So standing in front of the dark opening, the Irishman hollered “Wooooo! Wooooo! Wooooo!” and just like with the others, he soon heard an answering call of “WOOOOO! WOOOOO! WOOOOO!”

With a gleam in his eye and a huge grin on his face, the excited Irishman immediately tore off all of his clothes and ran full tilt into the cave.

…..

..

The following day, the headline of the local newspaper read…

NAKED IRISHMAN RUN OVER BY TRAIN!!

PHP: Insert a String into another String Programming 30 JUL 2008

PHPWhile most modern programming languages do feature a function that allows you to insert one string into another string at any given position, PHP for some or other reason simply doesn’t. So while you might be well versed in using a good old insert(str,x) function in any of the other languages that you might be used to, doing the same in PHP will no doubt leave you scratching your head as you frantically browse through all of the PHP string functions in their nifty online manual while trying to find the elusive little bugger.

So if no native string insert function exists, how exactly does one go about doing it then?

Well, the solution lies in the creative use of the PHP substring replace function (substr_replace). Essentially our goal is to insert our insert string into the original string by replacing a ‘substring’ of length zero at the desired position in the original string.

The syntax for doing this would then be:

$newstring = substr_replace($orig_string, $insert_string, $position, 0);

So for example if we wanted to inject ‘my’ into the classic sentence ‘Hello world!’, you would code:

echo substr_replace('Hello world!','my ',6,0);

Which would then result in ‘Hello my world!’ appearing on the screen. (Note, if you enter a negative position then the string is inserted so many characters from the end of the original string.)

Nifty