Archive for July, 2005

Texas Cruise

Friday, July 22nd, 2005

A Texas rancher, visiting a South Dakota farmer friend, asked him to show him his farm.
After seeing the 1,000 acre spread, the Texan bragged that down home he could get into his car, drive all day, and by evening would not have gotten to the distant point of his ranch.
The South Dakotan simply replied, “You [...]

Control Seminar

Thursday, July 21st, 2005

The company I work for sometimes puts on what they call “Lunch and Learn” seminars during the employees’ lunchtime, dealing with a variety of physical and mental health issues. If the seminar lasts beyond the normal lunch hours, we’re supposed to get managerial approval to attend.
So, last week, this flier came around:
LUNCH AND LEARN SEMINAR:
WHO’S [...]

Fed Up

Wednesday, July 20th, 2005

Long ago, on New York’s lower east side, Mrs. Spinelli and Mrs.Goldberg were bragging about their respective abilities to overfeed dinner guests.
With evident pride Mrs. Spinelli says, “When they walk home from my house, they’re all doubled-over.”
Without a beat, Mrs. Goldberg answers, “From your house they can walk?”

Travelling Too Light

Tuesday, July 19th, 2005

A porter loaded down with suitcases followed the couple to the airline check-in counter.
As they approached the line, the husband glanced at the pile of luggage and said to the wife, “Why didn’t you bring the piano, too?”
“Are you trying to be funny?” she replied.
“No, I really wish you had” he sighed. “I left the [...]

Turtle Accident

Monday, July 18th, 2005

Two snails were standing on the side of the road, a turtle stopped and said, “Do you guys want a ride on my back”?
One of the snails took him up on his offer and off he went.
As the turtle reached the intersection another turtle came along and crashed into him. The poor little snail was [...]

New Home No Hears

Friday, July 15th, 2005

Top ten things you don’t want to hear from your real estate agent when you go to settlement on your new home:
1. “I think unexplained crop circles add a unique flair to any home’s garden.”
2. “Actually, it’s only the rear portion of the yard that overlaps the ancient Indian burial ground.”
3. “Yes, the last owner [...]

Sewing Machine Ad

Thursday, July 14th, 2005

The following is an ad from a newspaper which appeared four days in a row – the last three hopelessly trying to correct the first day’s mistake.
MONDAY:
For sale: R. D. Jones has one sewing machine for sale. Phone 948-0707 after 7 P.M.. and ask for Mrs. Kelly who lives with him cheap.
TUESDAY:
Notice: We regret having [...]

Roast Woes

Thursday, July 14th, 2005

The newly-married husband came home from the office to find his young wife in floods of tears. “Darling, whatever is the matter?” he asked.
“Sweetheart,” she sobbed, “the most terrible thing has happened! I cooked my very first Beef Bourguignon for you, and I got it out of the oven to season it, and the phone [...]

Do Something Nice

Monday, July 11th, 2005

Unable to attend the funeral after his Uncle Charlie died, a man who lived far away called his brother and told him, “Do something nice for Uncle Charlie and send me the bill.”
Later, he got a bill for $200.00, which he paid. The next month, he got another bill for $200.00, which he also paid, [...]

PHP Tip, more on building web forms

Sunday, July 10th, 2005

Sometimes when building web forms, you may need to collect multiple values for a single field. Perhaps you have a form which gives a list of common hobbies, and visitors can check all hobbies which interest them. But how do you get PHP to realize that the user has made multiple selections? All you need [...]

PHP Tip, using flush()

Saturday, July 9th, 2005

You may have noticed that scripts which take a long time to execute often display nothing but a blank “loading” page in the web browser until they finish running. If you find yourself in this situation with a script you’ve written, it’s possible to make the script output incrementally. To do this, use the flush() [...]

PHP Tip, “date math”

Friday, July 8th, 2005

Are you struggling with “date math?” If you’ve fallen into the trap of converting string-based timestamps into month, day, year, hour, minute, and second, and then trying to perform some sort of math or calculations based upon these values, consider storing timestamps in epoch format instead. Today’s tip is a bit longer than usual but [...]

Puppy Love

Friday, July 8th, 2005

For months he had been her devoted admirer. Now, at long last, he had collected up sufficient courage to ask her the most momentous of all questions:
“There are quite a lot of advantages to being a bachelor,” he began, “but there comes a time when one longs for the companionship of another being — a [...]

PHP Tip, using the uniqid() function

Thursday, July 7th, 2005

If you have a need for a unique string, consider using PHP’s built in uniqid() function. uniqid() will return a string value based upon the current system time, comprised of both letters and numbers, such as “3e5f173a6d6ed.”
This can be useful in a number of situations:
– Creating unique order IDs
– Generating default passwords
– [...]

Kid Quotes

Thursday, July 7th, 2005

“Everyone has feelings, except for snakes and principals.”
- Donna Maria G, age 9
“Laugh and the world laughs with you, cry and the world laughs at you.”
- Rob P, age 8
“If life gives you nothing but lemons, make up a better shopping list for it.”
- Steven B, age 8
“Moses came down with the Ten Amendments, which [...]

PHP Tip, using the rand() function

Wednesday, July 6th, 2005

Before using the rand() function, it’s a good idea to seed the random number generator first. This can be done with the srand() function. Its most common form is:
srand((double)microtime() * 1000000);
If you don’t take this step before using rand(), it’s possible – likely, even – that your “random” numbers will not necessarily be random.

Yard Sale Anger

Wednesday, July 6th, 2005

A woman was taking her time browsing through everything at a friend’s yard sale, and said to her, “My husband is going to be very angry I stopped at a yard sale.”
“I’m sure he’ll understand when you tell him about all the bargains you found,” her friend replied.
“Normally, yes,” she said. “But he just broke [...]

PHP Tip, using fopen(), fread(), and fclose()

Tuesday, July 5th, 2005

If you want to read the contents of a file into a variable, it is not necessary to use the fopen(), fread(), and fclose() commands. Instead, take advantage of PHP’s file() command, which will read a file into an array which is automatically split on newlines:
$text = file(“text.txt”);
If you’d rather have the file read into [...]

But Daddy

Tuesday, July 5th, 2005

My husband and I took our two-year-old daughter to the home-improvement store.
Madison got tired of walking, so my husband let her ride on his shoulders. As he walked, Madison began pulling his hair. Although he asked her to stop several times, she kept on.
Getting annoyed, he scolded, “Madison! Stop that!”
“But, Daddy,” she replied, “I’m just [...]

PHP Tip, writing a MySQL query

Monday, July 4th, 2005

When writing a MySQL query, it is not necessary to use escaped double quotes (\”) when representing literal strings within the query. Single quotes (apostrophes) will work fine. For example, the following two lines of code will perform the same query:
$result = mysql_query(“SELECT foo FROM bar WHERE baz=\”test\””, $db);
$result = mysql_query(“SELECT foo FROM bar WHERE [...]

Excuses To Give When You Have Missed Work

Monday, July 4th, 2005

~ I can’t come in to work today because I’ll be stalking my previous boss, who fired me for not showing up for work. Okay?
~ I have a rare case of 48-hour projectile leprosy, but I know we have that deadline to meet…
~ I am stuck in the blood pressure machine down at the Food [...]

PHP Tip, echoing text

Sunday, July 3rd, 2005

When echoing text or assigning variables, your script will execute faster if you use single quotes (apostrophes) instead of quotation marks around text which does not contain variables. For example, consider the following two statements:
echo ‘Hello, world, this is a test!’;
echo “Hello, world, this is a test!”;
Execution of the first statement will be faster than [...]

PHP Tip, PHP & forms

Saturday, July 2nd, 2005

When an HTML form is posted to a PHP script, PHP automatically converts periods in field names to underscores. For example, if you had form fields called “first.name” and “last.name” you would access them in PHP by using $_POST['first_name'] and $_POST['last_name'].
Attempting to use the field names with periods, e.g. $_POST['first.name'], will not work.

PHP Tip, using date()

Friday, July 1st, 2005

When using the date() function, keep in mind that you should use date(“i”) to obtain the minute. A great deal of code incorrectly uses date(“m”) for this, e.g.
$timenow = date(“H:m:s”); //incorrect
Passing “m” to the date() function will return the current month as a number from 1 to 12, not the current minute.

Bumper Stickers

Friday, July 1st, 2005

If You Can Read This, I Can Slam On My Brakes And Sue You
Forget World Peace — Visualize Turning Off Your Turn Signal!
HANG UP AND DRIVE!
Where There’s A Will…I Want To Be In It!
Ever Stop To Think, And Forget To Start Again?
This Would Be Really Funny If It Weren’t Happening To Me
If We Quit Voting [...]