Popular Tags:

Today I broke the space time continuum

February 18, 2014 at 4:38 pm

I broke the space time continuum

Linux server admin cheat sheet.

February 9, 2014 at 5:23 am

Ubuntu

Restart Apache  sudo service apache2 restart
 Apache Config FIle  /etc/apache2/httpd.conf

Centos / Redhat

Restart Apache  sudo service mysql restart
 Apache Config FIle  /etc/apache2/httpd.conf

Who Facebook Unfriended me?

February 8, 2014 at 7:37 pm

unfriendedmeI was bored and have been wanting to write something to do this for quite some time. So I did. It’s a simple one-pager site that grabs your friends list via the Facebook connect API and compares the list over time. It’s free, easy to use and does exactly as the titles says: tell you who has unfriended you on Facebook.

Check it out here: http://who.fbunfriended.me/

Permanent Redirect vs Temporary Redirects in PHP

February 8, 2014 at 9:15 am

This is how you do a standard redirect:

[codesyntax lang=”php”]
<?php
header(“Location: http://ardi.co.za”);
?>
[/codesyntax]

And this is how you do a redirect that is permanent:

[codesyntax lang=”php”]<?php
header(“HTTP/1.1 301 Moved Permanently”);
header(“Location: http://ardi.co.za”);  
?>[/codesyntax]

Should you build a Mobile App or a Mobile Website?

February 5, 2014 at 8:33 am

top
bottom

How to find out what technologies are used on a website?

February 4, 2014 at 8:02 pm

ChromeSniffer

A while ago I posted “Is this site built with drupal“, which is basically an easy way to tell if a site was in fact built with Drupal. Only problem is, it can only check for one type of technology. Enter “Chrome Sniffer“.

Now you can easily see exactly what was used to build a site, simply by looking in the top left corner. Easy easy…

 

The Best Task Management / Scrum / Kanban Tool out there

February 4, 2014 at 6:32 pm

I’ve tried quite a few tools out there, including: Jira, KanBanTool and many others. Nothing compares to the simplicity and effectiveness of Trello. Check it out:

trello

A Harder Problem than You Might Think

February 3, 2014 at 10:30 pm

I recently had the problem of breaking an address into a specific sized array. For example:

$s = "203 Wembley Square, Wembley Square Road, Cape Town, South Africa, 8001";

The result must be evenly spread strings across a new array, of which only the maximum size is known. So, for example, if I specify that the maximum length must be 3, the result should be:

Array
(
    [0] => 203 Wembley Square, Wembley Square Road
    [1] => Cape Town, South Africa
    [2] => 8001
)

It might not be completely apparent why this is useful, but let me explain what I used it for. One of the tables in my database had three fields, namely:

  • address_line_1
  • address_line_2
  • address_line_3

For the scenario, there was no way that I could alter the database to cater for more or less fields. However, due to improvements on the system, there was a form that allowed users to enter the following “address” details:

  • Street Name
  • Building Name
  • City
  • Area Code
  • Country

So effectively, I had to map 5 lines onto 3 fields. The result I desired was:

  • address_line_1 = Street Name, Building Name
  • address_line_2 = City, Area Code
  • address_line_3 = Country

After exploring a host of options, I finally came to the following function that did what I want:

function splitArray($array, $maxSize = 3, $splitOn = array("\r\n", ",", "\r", "\n"))    
{
	# Split the array on multiple specified characters
	$arrayParts = explode(chr(1),str_replace($splitOn,chr(1),$array));

	# Format parts, remove invalid sections
	$finalAddressParts = array();
	foreach ($arrayParts as $a) {
	    $formatted = trim($a);
	    if (empty($formatted)) continue;
	    $finalAddressParts[] = $formatted;
	}
	$arrayParts = $finalAddressParts;

	# Create the chunks
	$maxPerLine = max(round(sizeof($arrayParts) / $maxSize), 1);
	$chunks = array_chunk($arrayParts, $maxPerLine);

	for ($i=0; $i < $maxSize; $i++)  {
	    $arrayLines[$i] = '';
	}

	$count = 0;
	foreach ($chunks as $chunk) {
	    $arrayLines[$count] = implode(", ", $chunk);
	    $count++;
	}

	return $arrayLines;
}

I'm sure there must be a shorter way to write this, and would love for anyone who knows of a way, to post it below. This is the best I could come up with that was both short and easy to read.

RD – A Taste of Things to Come

December 7, 2013 at 5:00 am

I’ve been trying really hard to squeeze some time in to make a few tracks. This is something I threw together today. Feel free to leave some comments below.

Is this site built with Drupal?

June 1, 2012 at 3:00 pm

Want to know if something was built with Drupal? Use this: http://isthissitebuiltwithdrupal.com/