eCommerce & Shopping Online Kavoir & Whatever

How to Add Gift Cards / Certificates to Your Amazon Account?

When you get the gift card or certificate number (a series of alpha-numeric strings) such as this:


You may add it to your Amazon account so the gift amount is added to your Gift Card Balance before you can spend it.

After you have signed in Amazon, go to “Your Account” and scroll to the “Payment” section and you would see the link “Apply a Gift Card to Your Account”.

Or, just click this link:


Enter your gift card number and click “Apply to Your Account”. If the amount is successfully added to your gift balance, you’d see something like this:


Easy, huh!!

Free PHP Classes & Library PHP Tips & Tutorials

PHP: Crontab Class to Add, Edit and Remove Cron Jobs

Provided that your user account on the server has the privileges to access crontab thus can create or remove cron jobs, you can use this PHP class to integrate crontab in your application. I created it for many of my own projects that need crontab to do scheduled jobs. It’s pretty straightforward.

Don’t know what crontab is and how it works? Read here and here. With this class, you or your users can easily set up crontab jobs and automate tasks by schedule with the web interface.

The Crontab Class

class Crontab {
	// In this class, array instead of string would be the standard input / output format.
	// Legacy way to add a job:
	// $output = shell_exec('(crontab -l; echo "'.$job.'") | crontab -');
	static private function stringToArray($jobs = '') {
		$array = explode("\r\n", trim($jobs)); // trim() gets rid of the last \r\n
		foreach ($array as $key => $item) {
			if ($item == '') {
		return $array;
	static private function arrayToString($jobs = array()) {
		$string = implode("\r\n", $jobs);
		return $string;
	static public function getJobs() {
		$output = shell_exec('crontab -l');
		return self::stringToArray($output);
	static public function saveJobs($jobs = array()) {
		$output = shell_exec('echo "'.self::arrayToString($jobs).'" | crontab -');
		return $output;	
	static public function doesJobExist($job = '') {
		$jobs = self::getJobs();
		if (in_array($job, $jobs)) {
			return true;
		} else {
			return false;
	static public function addJob($job = '') {
		if (self::doesJobExist($job)) {
			return false;
		} else {
			$jobs = self::getJobs();
			$jobs[] = $job;
			return self::saveJobs($jobs);
	static public function removeJob($job = '') {
		if (self::doesJobExist($job)) {
			$jobs = self::getJobs();
			unset($jobs[array_search($job, $jobs)]);
			return self::saveJobs($jobs);
		} else {
			return false;

Public Methods

You may well ignore the private methods that do the internal chores. And keep in mind that any cron job is a text string.

  1. getJobs() – returns an array of existing / current cron jobs. Each array item is a string (cron job).
  2. saveJobs($jobs = array()) – save the $jobs array of cron jobs into the crontab so they would be run by the server. All existing jobs in crontab are erased and replaced by $jobs.
  3. doesJobExist($job = ”) – check if a specific job exist in crontab.
  4. addJob($job = ”) – add a cron job to the crontab.
  5. removeJob($job = ”) – remove a cron job from crontab.

This class has been tested on Rackspace Cloud and Wiredtree. Feel free to post your comments below and let me know how it works on other web hosts.

Business and Marketing Kavoir & Whatever Make Money Online

Some random thoughts on personal / business development

personal developmentMaking sense is NOT what I’m known for. You are warned.

Success is a shadow of rarity. Try to be rare before you try to be successful.

99% of the people takes whatever they can while 1% gives whatever they can. 1% is a rarity. So they are 100 times more likely to get what they want than the 99%.

The idea of owning something is the source of suffering. It worries you and occupies your mentality, keeping you from achieving more because you are afraid to lose the things you have earned.

One should not try to own something. Owning or getting something such as wealth should not be the overall goal of his or her endeavors. Instead, one should try pushing the limits.

Want to be more financially successful? Don’t think of target numbers, but think about these questions – Why am I limited at where I am now? Why are the few others so ahead of me? What can be done to lift that limit and go farther? What can be done to be more productive or more creative? – And answer these questions by very very specific answers.

For example, I worry that one day I would lose the revenue streams of the many sites I created in the last 4 years, so I spent considerable time each week maintaining and promoting them. While results are slightly better and better by month, it’s ultimately not exponential growth which you would need to be a billionaire. It’s just a linear growth. Linear growth would only get you a millionaire at the best.

And this LIMITS me. It keeps me from getting better.

While these old sites occupy large portions of my schedule, I can’t concentrate enough on projects with “better outlook”. AND because I am dedicating my time to so many different projects at the same time, hardly any of them would eventually roll into an exponential growth at all because none of them are good enough to hit critical mass.

Even worse, it costs a lot when you multi-task.

It’s hard to give up on something you’ve been working so hard to build, because you are emotionally attached to it. It produces little yet you hold it dear.

Stop! Don’t get married to your projects. Move on, when you find out the niche isn’t as good as you thought it would be.

So I found one of the things that are limiting me – multi-tasking on too many projects at the same time. And my solution to this is: I’ll concentrate on one project at a time from now on.

Caring too much about the results would lead you to “copy” what the successful guys are doing, which is exactly what you don’t want to do if you don’t want to be mediocre.

You can do much better when you don’t care about the results than when you do.

Only when you lose you grow.

“Do one thing good, so the rest doesn’t suck. ”

(This line was from one of the movies. Can’t recall the title though.)

There is NO such thing as a saturated niche.

Be stubborn. Don’t seek advice. People are stupid. Don’t listen to them. Do what you think is right. Fail? So what!!

Take care.