Siesta Time

One of my fond memories as a child was siesta time in kindergarten!

There will come a time every afternoon when the teachers turned off all the lights and all of us little kids will help them to lay out some coloured straw mats (I distinctly remember some of the mats were red and blue) on the floor where we will all lie down and take our naps.

Too bad we all have to outgrow siestas (at least here in Singapore)…

Reverse Conditionals

I have made this mistake countless times in Java where I type “if (variable=1)” instead of “if (variable==1)”. The former will always return true since there is no error assigning the value “1” to the variable (assuming correct variable type), whereas the latter depends on whether the variable contains the value “1”.

To prevent such errors from cropping up in your code in your conditions, you can make use of the non-intuitive reverse conditionals. To modify my example above using reverse conditionals, I will type “if (1=variable)” and “if (1==variable)” instead. In this case, the former will immediately throw up an error upon compilation since it is not possible to assign a value to a literal in this case.

Proper date checking for PHP

Some sites seem to perform a simple date check where they just check if “Day” is a number between 1 to 31, “Month” is a number between 1 to 12 and the “Year” is a valid number.

While this check is inexpensive, it is definitely wrong as you may end up with strange combinations such as “31st April 2010” or you may also wrongly allow “29th February” to occur on non-leap years.

To save yourself some grief, make sure you use the checkdate() function to validate your date data.

Don’t bring your “work face” home

In American sports, some coaches require their players to up their intensity level in important games and “bring their game face”. Likewise in work, you might also adopt a persona in order to make things work smoother in the office. Or you might also be affected by some events at work that dampens your spirits.

By the law of averages, it is inevitable that you will face some issues in work that will probably upset you and it might unwittingly manifest itself passively or aggressively even after you have left the office and gone home. Furthermore, the chances of getting upset may increase depending on the industry you are involved in and the people you have to answer to.

Regardless of whether you had to answer to an immature alpha-male user who has a superiority complex, a supervisor who everyone knows is incompetent but continually attempts to pull the wool over people’s eyes, or a boss who is being manipulated, etc. Just forget about it once you step out of the office. Ultimately family is most important — just ask yourself, who do you think will visit you on a regular basis should something unfortunate happen to you and you end up in a long term stay in the hospital? Your boss, colleagues, friends? I would say the odds are strongly in favour of “family”… I suppose this posting is too late for the “Eat with Family” day, but it is never too late to show appreciation for your loved ones!