Browsing all articles from April, 2011
Apr
23

Convert large numbers into a more readable format

Author Aaron    Category Programming     Tags , ,

It can be tricky to really understand the value of 7312946 or 983217 at the first glance. Saying 7.3M and 983k seems like a much better option. How to convert numbers into a nicer format? Like this:

/**
 * create a nicely formatted number
 * @param $number a large number
 * @param $shorten default true = append k or M, false = format with commas and dots
 * @return int
 */
function createHumanReadableInteger($number, $shorten = true) {
	if (is_numeric($number)) {
		if ($shorten) {
			if ($number < 100000) {
				$return_int = number_format($number, 0);
			} else {
				$number_proc = $number;
				$units = explode(" ", "B k M G T P");
				for ($i = 0; $number_proc > 1000; $i++) {
					$number_proc = $number_proc / 1000;
				}
				if ($number > 1000000) {
					$return_int = round($number_proc, 2) . " " . $units[$i];
				} else {
					$return_int = round($number_proc, 1) . " " . $units[$i];	
				}
			}
		} else {
			$return_int = number_format($number, 0);
		}
		return $return_int;	
	} else {
		return 0;
	}
}
Apr
9

Avoid broken links on your website

We’ve all been there – finding a link on our website that’s been broken for a couple of months and that has probably annoyed hundreds (if not thousands) of our visitors. Little annoyances like this can be enough for our visitors to get a feeling that we’re running a low quality website. What’s more, search engine spiders won’t love you for broken links either – you might get a small penalty for having broken links on your website, and you might be pushed down a bit in the search engine results.

Because of this it’s extremely important to make sure (every once in a while) that all the out-going links on your website actually work. I suggest you google for “xenu broken link finder” – the website looks a bit shady, but the software is really good and will check all your backlinks for you. It will actually check all links, images (including background images), frames, style sheets (CSS files), javascript files and java applets.

Apr
2

What do your visitors really want?

This is most certainly one of the biggest questions in the online business. You don’t usually come in contact with your visitors as much as you’d want, and even if you do, you don’t always ask the right questions and get the best answers. Because of all this, it can be extremely helpful to use some tools that enable you to discover some of the background of your visitors.

With Google Trends for Websites you can analyze any website’s visitors, be it your own website or your competitor’s website. You can figure out what country / region represents the largest portion of website’s visitors, what other websites those visitors like as well and what those visitors have been searching for in the past. This way you can figure out what your visitors are interested in and you can make sure that your website gives them exactly what they want.

Because of this, they’ll love you and come back for more.

Follow me on Twitter! Follow me on Twitter!
You can always stay up-to-date with our latest and craziest projects ...

Categories:

Monthly Archives:

I mostly write about:

Who is Aaron?

I'm a guy who started his own successful online business back in 2007. I was lucky enough to see my business expand 300+% every year.

At the moment my team and I reach over a million unique customers each month and always do our best to deliver the best quality services.