Time killer and addictive Google Games

We’ve all at least once played the T-rex game on Google Chrome when the internet was done. But do you know Google offers more such games? Of course, these others require a working internet. .

1. 30th Anniversary of PAC-MAN
Google came out with one of the most addictive classic Pac-man game doodle on it’s 30th Anniversary on May 21, 2010. Go ahead and give it a try.

2. Basketball 2012
If you’re into basket ball, this one is definitely for you.

Continue reading “Time killer and addictive Google Games”

Error handling in PHP with Error logger working

Error handling in PHP with Error logger working

Logging errors in php is easy, cool and helpful when it comes to test the site for errors as I explained it in my earlier post Logging errors to file in PHP but only till the site is at developer’s end and you working on it. Once you take the site live its just not good anymore. Once you take it on the production end, you cannot show the errors to the user or in case if its even 100% error free you will find that 1 in a 100 person who likes to mess up with the sites. Being a programmer you gotta be ready for it. This is the place where comes error handling into play.

Here is a simple script. Just place these two functions in a file and include it at the right place. Probably including from the point onward from where you expect and error would be just perfect.

// Define a custom error handler
function userErrorHandler($errno, $errstr, $errfile = '', $errline = 0, $errcontext = array()) {
	// Getting error type
	$errorType = array (
			E_ERROR				=> 'ERROR',
			E_WARNING			=> 'WARNING',
			E_PARSE				=> 'PARSING ERROR',
			E_NOTICE			=> 'NOTICE',
			E_CORE_ERROR		=> 'CORE ERROR',
			E_CORE_WARNING		=> 'CORE WARNING',
			E_COMPILE_ERROR		=> 'COMPILE ERROR',
			E_COMPILE_WARNING	=> 'COMPILE WARNING',
			E_USER_ERROR		=> 'USER ERROR',
			E_USER_WARNING		=> 'USER WARNING',
			E_USER_NOTICE		=> 'USER NOTICE',
			E_STRICT			=> 'STRICT NOTICE',
			E_RECOVERABLE_ERROR	=> 'RECOVERABLE ERROR'
			);
	
	if (array_key_exists($errno, $errorType)) {
		$err = $errorType[$errno];
	} else {
		$err = 'CAUGHT EXCEPTION';
	}
	
	// Getting the error log file from php.ini
	$file 		= ini_get('error_log');
	
	// Creating the error log script, same as normal logger would do
	$error_string 	= "[" . date("d-M-Y H:i:s", $_SERVER['REQUEST_TIME']) . '] PHP ' . $err . '::' . $errstr . " in " . $_SERVER['SCRIPT_FILENAME'] . " on line " . $errline . "\r\n";
	
	// Logging error to a certain file
	error_log($error_string, 3, $file);
	
	// Check if the error code is not included in error_reporting
	if (!(error_reporting() & $errno)) {
		return;
	}
	
	// Restore default handlers to prevent errors in errors
	restore_error_handler();
	
	if (function_exists('restore_exception_handler')) {
		restore_exception_handler();
	}
	
	// Load error page
	require('_errors/error.php');
	exit();
}
set_error_handler('userErrorHandler');

// Define a custom handler for uncaught exceptions
if (function_exists('set_exception_handler')) {
	function userExceptionHandler($exception) {
		// Restore default handlers to prevent errors in errors
		restore_error_handler();
		if (function_exists('restore_exception_handler')) {
			restore_exception_handler();
		}
		
		// Load error page
		require('error.php');
		exit();
	}
	set_exception_handler('userExceptionHandler');
}

Note: Once you start error handling in real time error logging stops. To overcome this a short code is included inside the function that uses PHP’s error_log function to log errors. So if you have a specific error log file, just point it towards that.

Good luck!!!

Google’s April Fools’ Day Jokes

Since I found out the Google’s easter eggs like the Google gravity and do a barrel roll, I am always on the hunt to find out and reveal all such tricks and fun stuff that google has and is waiting out to be shown to people. In this approach I already have come up with three such lists before this one containing all the fun stuff that I found by now.

Now here is something different from my earlier lists to reveal more of google. In 2012, Google humor was out in full swing for April Fool’s Day, flooding its products with jokes and pranks.

  • 8-Bt Google Maps — Google Maps pays homage to the Nintendo with an 8-bit graphic version of the world. Also, here Google explains how planning your trip just got a lot like playing the Legend of Zelda
  • Now double your productivity with the google Chrome Multitask. One mouse used to be enough, but no longer.
  • Now replace the 26-character keyboard on mobile phones with just two buttons with the new Gmail Tap. It’s much more efficient… sort of. LL Cool J lends his expertise as Google’s Gmail Tap Product Lead. For more fun just try and download the Tap.
  • Google's Youtube DVD collectionThe YouTube Collection — The Internet is so big, you can never see it all. Google-owned YouTube announced that they’re changing that, offering a DVD collection of every video on YouTube. Order your pack now.
  • Really Advanced Search — Google’s Advanced Search can help you specific exact words and phrases to search for. Google’s Really Advanced Search gives you even more options, including searching by rhyming slang, subtext, or innuendo.
  • Google Racing — Anyone who has seen one of Google’s computer-driven cars wandering the country on behalf of Google Maps has wondered just how good of drivers those computers are. Just turn on your next NASCAR event.
  • Google voice for petsMiss your pets when away from them? Or sometimes feel that you don’t understand them? Not a problem anymore, try Google Voice for Pets
  • Click-to-Teleport — Ads in Google Search might send you to the website of your favorite sushi restaurant, but Google’s taking it one step further. Cut out the middle man, and just teleport to your dinner reservation with Click-to-Teleport.
  • Google Fiber — Google wants to improve every aspect of life, including your diet. Pick up a Google Fiber bar today. It’s “fiberlicious.”
  • Google stree rooGoogle Street Roo — Google needed some help mapping the Australian outback, but a team of over a thousand kangaroos is now solving that problem.
  • Jargon-Bot — If you’re confused by complicated work-jargon, Jargon-Bot may be the program you’re looking for.
  • Interplanetary Reporting — Users of Google Analytics, the site user tracking program, can now discover which users are visiting their site from Earth, or another popular planet with Interplanetary Reporting.
  • Go Ro — Google wants their ads to be optimized for all users, so the nearly dozens of Internet users with rotary phones will be benefitting from the new service. Like Google says, “Technology is cyclical,” and rotary phones are on their way back.Google rotary phone - Technology is cyclical
  • Google TV Click — You decide how your favorite TV shows and movies end. Use this special remote to helicopter support to the cast of the 300, or shoot Jar Jar Binks the first time he appears on the screen. You might be waiting for this feature for a long time, however, as it’s set to be released on April 31st (a hard to find day).
  • Canine Staffing Team — It’s tough to get a job at Google. Unless you’re an adorable and highly-skilled puppy, that is.
  • Google Search in China — There is no Google Search in China, so this peculiar and fun search page acts as a placeholder. Try to search using it.Google search china

Below are 21 more Google’s April Fools’ Day Jokes.

Yes, what started as one little joke on April 1st in 2000 has become an annual Google event. Trust nothing when visiting Google on April Fools’ Day. Here are some of the best from over the years:

  • MentalPlex — Google’s first April Fools’ joke in 2000 introduced the first mind-reading search engine, analyzing your “personal aura and brainwave activity” to give you great search results.
  • Pigeon Rank  Those familiar with Google’s PageRank had a good laugh in 2002 when Google released this explanation of Google’s revolutionary system of “pecking order.”
  • Google’s Moon Base — In 2004, Google presented the online community with an amazing opportunity to work at the new Google Copernicus Center. One qualification is that the applicant must be willing to relocate, considering that the new office is located on the Moon.Google lunar base. Now a chance to work from moon.
  • Google Romance — To prove their algorithm really can do it all, Google unveiled Soulmate Search, letting users trust in Google to find their perfect soulmate
  • Google Gulp — In an attempt to monopolize the beverage market along with the internet, Google Gulp, the world’s first “smart drink” was unveiledHave a sip and you are just ready to rock and roll with google gulp.
  • Gmail Paper — Tired of email? Gmail will now print out all of your emails and send them to you. Don’t worry about the environment, the paper is made out of “96% post-consumer organic soybean sputum, and thus, actually helps the environment.”
  • Gmail Custom Time — “Be on time, every time” Send mails in the past with google custom timewith Gmail Custom Time, the new service that lets you send emails to the past so you never miss a deadline again.
  • Google Books Scratch and Sniff — Don’t you wish our senses were more in tune with each other? Google helped solve this problem by offering scratch-and-sniff books.
  • Google TiSP — In 2007, Google Try google tisp offered a new service for internet users who didn’t want to pay for their internet connection: free wireless service. All you have to do is hook it up… to your toilet.
  • Google Talk Goes Green — On April Fools’ Day in 2008, Google prepped internet users for the upcoming Earth Day, requesting that anyone chatting online use Internet slang to reduce the CO2 emissions that are released with each instant message.
  • gBall — Australian Football got a lot more advanced when Google released the gBall, a computer chip-containing, vibrating football that gives you kicking tips and suggestions as you play.
  • The Virgle Mars Colony— Google teamed up with Virgin to create the plan for Virgle, the first permanent human colony on Mars. Take the questionnaire to determine if you can be a Virgle Pioneer.
  • Gmail Autopilot — Responding to emails is a pain, that’s why Google introduced Autopilot for Gmail. Now the complex program can respond to your emails for you. You’ll notice it’s not perfected yet.
  • Meow Me Now — Google Maps can find anything, including adorable kittens. Use Meow Me Now at any time to find the kittens who are closest and most suitable for petting.
  • 3D Google Books — The one thing about ebooks is that they just don’t feel real enough. With Google’s new 3D books, however, ebooks have become better than the real thing.
  • Wingdings is the new Font for Ads — You can find Google Adsense ads all across the web selling every product imaginable. Now Google ads will feature the font of nonsense symbols that Google claims is most popular with “cryptologists and carrier pigeons.”
  • Gmail Motion — Put that outdated keyboard down. Gmail Motion uses your built-in webcam and Google’s tracking technology to understand every action you’d ever like your computer to take.
  • Google Docs Motion — The breakthrough Motion technology also works with Google Docs.
  • Google Translate for Animals — If you’ve grown tired of talking to boring, old people, Google Translate for Animals can help you make some new friends.
  • Google Autocompleters — Ever wonder how Google can predict what you’re typing? It’s the work of Google’s impressive team of Autocompleters, featured in this video.
  • Comic Sans for Everyone — If switching ads to Wingdings wasn’t enough, Google also declared that Comic Sans is the most enjoyable font, and all websites should be viewed using Comic Sans. Always.

Generating a simple jquery popup

Recently I needed to make a simple pop up box in WordPress and I searched for plugins to achieve what I wanted but failed. Well, if you look for it, you will surely find many plugins for JQuery popup as well as WordPress popup but none helped me. In my lookout for the plugin I found this really cool and simple script that would do the required work for you with just simple tweaks.

Demo: Click me.

The CSS

Continue reading “Generating a simple jquery popup”