A VIDEO

9-bits:

Leap represents an entirely new way to interact with your computers.

Seems like a great way to avoid fingerprint-covered screens, as we propel into our gesture-based future. I’m impressed that they’re going straight into production with this — and curious to hear how usable it actually is.

Reblogged from 9-Bits by David Kaneda
A PHOTO

kevin:

Actual video footage of the shuttle!

Reblogged from Jacob Bijani
A TEXT POST

Complaince with EU Cookie Law could cost UK £10 Billion

eucookielaw:

QuBit which provides a platform for content owners and ecommerce sites to analyse consumer data and deliver more personalised web experiences for web businesses has reported that a “worst case scenario” for complying with the EU Cookie Law could cost the UK economy £10bn in lost revenue if implemented incorrectly.

According to KPMG 95% of major businesses are not yet complaint with the EU Cookie Directive due to become compulsary on 26th May 2012.

The “worst case scenario” report breaks down as follows:

  • If users are continually asked to consent to cookie use on sites this could cost £2.6 billion.
  • A drop in cookie acceptance for analytics tools would cost the UK Analytics industry £21 million
  • A word round is to make people register on your website, affecting visits by by 23 percent, this could cost upto £2.37 billion
  • Both behavioural advertising, (targeted advertising), and retail optimisation (personally reocommended products ie like ones on Amazon), could suffer at a cost of £648 million and £1.389 billion respectively
  • Affliate marketing could be hit by up to £80 million.
  • UK businesses relocating to new geographical locations could cost the economy £2.922 billion, as happened with the Gambling industry.

It was reported on 25th April 2012 that the UK had entered back into recession.  With the EU in a mess, can we really afford these directives and give other countries like the USA an advantage when it comes to doing business online.

Reblogged from EU Cookie Law Help
A PHOTO

This Spam message made me chuckle.  I just fancied a Pizza too! Still waiting for it to arrive….. hmmm…

A PHOTO
Reblogged from Web Vampire
A TEXT POST

Essential PHP functions

jacob:

function pre_r($array)
{
    echo "<pre>" . print_r($array, true) . "</pre>";
}

function die_r($array)
{
    die(pre_r($array);
}

Reblogged from Jacob Bijani
A TEXT POST

PHP Dependency Injection with Service Locator

In PHP, Dependency Injection lets us inject instances of objects into other objects so we don’t have to rely on using Singletons and even worse, Globals.  In this tutorial, we are bending the rules of dependency injection slightly by assigning dependencies to static keywords rather than setting via a method.

To explain, first of all let me show you how you would normally access an instance of a class from within another class method using a Global.

class globalClass{
  private $myGlobalClassProperty = '3';
  
  public function getMethod() {
    return $this->myGlobalClassProperty;
  }
}

$myGlobalClass = new globalClass();

class myClass() {

  private function myClassMethod() {
    global $myGlobalClass;
    return $myGlobalClass->getMethod();
  }
}

The above usage of globals isn’t ideal, so how do we access an object instance from within another object?  This is where dependency injection comes into play.  First we need to create a controller, you can also call this a container if you prefer.  Basically the only roll our controller will do is house all our potential global instances in one place for us to access to our hearts content.  We have kept this class static so never have to create or depend on any instances of it - this keeps our code clean.

// Here we set our instances into the container 
// class which houses all our potential globals class InC_Controller {
// lets define the keywords for the
// instances we want to hold public static $database; public static $Session; public static $User; // returns a dependency over static method public static function getDependency($dependency) { return self::$$dependency; } }

Next for the purposes of this tutorial, we are going to create a User class, this will house user info.  We have set a property called $this->info to hold “User Profile for John”.  We will then assign an instance of User directly to our controller object above.


// Our User Class class User { private $info = 'User Profile for John'; function getUserInfo() { return $this->info; } function setUserInfo($i) { $this->info = $i; } }

Here we assign our User instance to the controller.  Next we are going to access the setUserInfo method of our User instance via a static method of our Controller object so we can change the User profile from John to Brian.  If we call on getUserInfo, we can print the output to screen, this should display “User Profile for Brian”. 


// Next we assign our User Instance to our controller InC_Controller::$User = new User();
// We can now access our User methods
// directly via our Controller service controller InC_Controller::getDependancy('User')->setUserInfo('User Profile for Brian'); echo InC_Controller::getDependancy('User')->getUserInfo();
 

In our final demonstration of dependency injection with Service Locator, we are going to access our controller from within another class using the service locator, replacing the need to use a global.  First we create a fictitious class called cool, and a method called getCoolUser.  Upon creating an instance of cool, and then calling upon the method getCoolUser, we can output “User Profile for Brain” to the screen, thus saving having to manage and declare globals for instances we may need to use here and there.  Uses for this include instances of database and session objects.

class cool {

    public function getCoolUser() {
// We can also access our User instance
// methods from within other classes,
// no need for Globals!
 return InC_Controller::getDependancy('User')->getUserInfo(); } } // Outputs User Profile for Brian $cool = new cool(); echo $cool->getCoolUser();