Turning off display of error messages in PHP

As an add-on to my previous post, here is one way where you can turn off the display of PHP error messages for individual scripts:

ini_set (‘display_errors’, 1);

Of course, you might prefer to just adjust the server settings, but this single line will definitely work for all cases in the event you do not have admin access to the server. You can also choose to make things easier by including all common settings in an include() file

Displaying Error Messages

This seems to be a cardinal sin that many web sites are committing. In order to prevent any potential security issues or accidentally divulging the system architecture, all systems that are LIVE should not display the verbose error messages that are used for the developers’ debugging purposes.

If you just want to check out some of these errant sites, just click here (courtesy of Bing). While most of the error messages may not reveal much and may not compromise security, why tempt fate?

Why I was never in the Navy

During my time in the Armed Forces, I was posted to the Army for BMT and for my initial phase in Officer Cadets’ School (OCS). Following that I was posted to the Air Force. Never did I ever step near the Navy… and for good reason.

I’m not particularly good in the water and I think I only really tried learning how to swim in Secondary School. To my horror, there was one day in OCS where all the cadets were woken up early in the morning to go for a dip in the pool wearing our full uniform!

I gamely tried my best but the moment I stepped off the diving platform and hit the water, I had trouble keeping myself afloat and had to struggle to the side of the pool and grab on for dear life.

A standard HTML template

If you’re not doing anything too funky and you’re using an old-school text editor to write PHP code (which I do most of the time), then the HTML template below will serve you well for most cases. If you’re trying to do anything advanced, you might need to modify the DTD specified in the DOCTYPE tag to another one.

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml” xml:lang=”en” lang=”en”>
<head>
<meta http-equiv=”content-type” content=”text/html;  charset=utf-8” />
<title>Insert title here</title>
</head>
<body>
</body>
</html>

What’s the most important phase in the SDLC?

I came across this interesting question earlier and it did set me thinking… Consider the conventional SDLC (Software Development Life Cycle) which consists of the Analysis, Design, Development, Testing and Implementation phases. Of these 5, which would you pick to be the most important?

Of course, generally speaking I would say that all 5 are important and that you will not be able to attach any less importance to one over another. However, if I really had to choose, I will favour the Design phase over the rest. A good design will immediately highlight any requirements that may have been overlooked during the Analysis phase, and will also serve as a guideline during the Development phase. You will also be able to perform tests against the design specs. However, there might be less correlation between the Design and Implementation phase, unless its a hardware project instead of a software project.

What about your take on this question? It should be interesting to see the different viewpoints out there.

冤枉啊!!!

This incident happened in JC where a group of us were gathered in the canteen having our ice milos and just having a small gathering in between lessons. The moment we stood up to go, the grumpy old lady in the canteen shouted at us to remind us to pick up our cups. This was uncalled for as we always picked up after ourselves and never left any cutlery or utensils behind.

Unfortunately for us, the VP happened to be in the canteen at that time and he immediately thought the worst of us and sent us to the office to be dealt with. As we knew that we did nothing wrong, we had a standoff with the VP and things remained at a stalemate until our form teacher came to the office to vouch for us and we were allowed to leave.

XHTML DTDs

With so many people using visual drag-and-drop tools to create web pages nowadays, I wonder how many people still truly appreciate what goes on behind the scenes after they click on “Save”?

Based on current standards, if the tools you used to create the web page is compliant with standards, it should specify a W3C DTD that it will comply with, failing which it may not be rendered properly by an Internet browser. But of course, so many Internet browsers are so flexible (read non-compliant) that they tend to forgive errors and attempt to interpret and render the page anyway.

Here are the 4 DTDs where one be used in your web pages depending on your needs.

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Frameset//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd”>

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.1//EN” “http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”>