Monthly Archives: June 2010

Computer Quotes – Debugging

“As soon as we started programming, we found to our surprise that it wasn’t as easy to get programs right as we had thought.  Debugging had to be discovered.  I can remember the exact instant when I realized that a large part of my life from then on was going to be spent in finding mistakes in my own programs.”
(Maurice Wilkes discovers debugging, 1949)

“Debugging is twice as hard as writing the code in the first place.  Therefore, if you write the code as cleverly as possible, you are–by definition–not smart enough to debug it.”
(Brian Kernighan)

“If debugging is the process of removing bugs, then programming must be the process of putting them in.”
(Edsger W. Dijkstra)

PHP – Check for bot visit ( the High Traffig Mode! )

Sometimes we need to check if a bot as visited our site. To do that we will need a function to detect the HTTP_USER_AGENT on every pageview.

We can the use a function like this:

function is_bot () {
	$botlist = array("Teoma","alexa","froogle",... );
	foreach($botlist as $bot) {
		if(eregi($bot, $_SERVER['HTTP_USER_AGENT'])) $thebot = $bot;
	}
	return ( $thebot ? $thebot : false );
}

But this solution can be very time consuming if you have a site with high traffic. ( for instance thousands of pageviews… )

Then how to improve this simple function?

Read more »

Computer Quotes – Programming Languages

“There are only two kinds of programming languages: those people always bitch about and those nobody uses.”
(Bjarne Stroustrup)

“PHP is a minor evil perpetrated and created by incompetent amateurs, whereas Perl is a great and insidious evil perpetrated by skilled but perverted professionals.”
(Jon Ribbens)

“The use of COBOL cripples the mind; its teaching should therefore be regarded as a criminal offense.”
(E.W. Dijkstra)
Read more »