How long did it take to connect to socket io?

Send the duration(in ms) a client waited to connect to a Socket IO instance off to Google Analytics . I use this on PrimaryWall to make sure it’s not taking schools a long time to connect to walls. If I start to see this number getting bigger I know something is going wrong so I have an alert set if the average gets above 1000ms.

This code sends the ms it took from when the document was ready to when the socket was ready.

$(document).ready(function ()
{
  var socketConnectDuration = 0;
  setInterval ( socketConnectDurationIncrease, 100 );  // Start a timer
  socket.on('connect', function ()
  {
    _gaq.push(['_trackEvent', 'Connection duration', 'Connection duration', socketConnectDuration]); // Send the length of time to GA
....
  }
}

function socketConnectDurationIncrease(){
  socketConnectDuration = socketConnectDuration + 100;
}

OWL energy monitor to Google Analytics

I have been able to get my CM160 owl energy monitor to provide data to Google Analytics. This allows me to track energy usage in my house.

It’s disgraceful how bad Owl’s support is for linux users but it’s great to see the community being so active in writing drivers/support to make it a reality.

I have a cron job that runs a php script that sends the data.

I have the Google Analytics PHP Class in the same folder.

The script looks like this:

$file = "/var/log/owl.txt";
$file = escapeshellarg($file); // for the security conscious (should be everyone!)
$line = `tail -n 1 $file`;
$data = explode(" ", $line);
$power = $data[6];
$power = $power*10; // times by 10 so its an integer

include 'autoload.php'; // ga class
use UnitedPrototype\GoogleAnalytics; // use the google analytics class

/* GA Stuff */
// Initilize GA Tracker
$tracker = new GoogleAnalytics\Tracker('UA-34066705-1', 'mclear.co.uk'); // CHANGE THESE SETTINGS

// Assemble Visitor information
// (could also get unserialized from database)
$visitor = new GoogleAnalytics\Visitor();
$visitor->setIpAddress('127.0.0.1');
$visitor->setUserAgent('Slave2');
$visitor->setScreenResolution('1024x768');

// Assemble Session information
// (could also get unserialized from PHP session)
$session = new GoogleAnalytics\Session();

// Assemble Page information
$page = new GoogleAnalytics\Page('/page.html');
$page->setTitle('My Page');

// Track page view
$tracker->trackPageview($page, $session, $visitor);

// Assemble Visitor information
// (could also get unserialized from database)
$visitor = new GoogleAnalytics\Visitor();
$visitor->setIpAddress("127.0.0.1");
$visitor->setUserAgent("slave2");


// Assemble Session information
// (could also get unserialized from PHP session)
$session = new GoogleAnalytics\Session();

// Assemble Page information
$page = new GoogleAnalytics\Page('/statisticsFromTheServer');
$page->setTitle('MySchoolHolidays Server');
/* End GA stuff */

$event = new GoogleAnalytics\Event();
$event->setCategory("power");
$event->setAction("costPerHour");
$event->SetLabel("pence");
$event->SetValue($power);
$event->setNonInteraction("true");
$tracker->trackEVent($event, $session, $visitor);

Your results will take a little while to come through and this can be tested by running the php script. If you don’t get an error then wait 24 hours and see if they come through under Content -> Events in GA

Disclaimer: I did try to use Open Web Analytics to accomplish this but it’s PHP class had an error so I gave up.

Is it illegally anticompetitive for Google to give schools Google Apps for free?

Today a French court ruled that Google has broken the law by providing the Google Maps API for free. While this may seem like an extreme ruling it is based on the fact that Google used to offer the service for free then began charging once all of their competition had been beaten into submission. I wonder if Google are trying to do the same with schools and Google Apps?

Microsoft and Google have been caught out doing predatory pricing on quite a few occasions in the past. Essentially predatory pricing is where you provide a service for free then after a period of time (Usually once all of your competitors have been destroyed) you start charging for this service. Companies accomplish this “scam” by providing propriety software, propriety software is basically software that can only be provided by one company. I am constantly warning the schools of the risks of investing in propriety standards and I’m sure that nearly all of my readers are tired of me beating on this drum… In this case I think the court actually got it wrong.

Google Docs doesn’t thwart our ability to develop PrimaryPad, PrimaryBlogger or SchoolEmail further, it’s obviously that Google Docs does affect our bottom line but we develop PrimaryPad because we believe in our products and in we know that our contributions towards Etherpad and an open standard for collaborative writing on the web will ultimately be the winner of the war. Remember folks.. Good customer service and open standards always win.

The day I gave up on Google


I can’t even give Google my money. I can’t contact them. I can’t report a bug. I can’t use their services and/or pay them to improve their services.

Microsoft’s alternative to Google’s product is a joke, no surprise there…

So I give up… Web Search via an API. You are broken, you need help, someone call a doctor.  Google, you need a better way of communicating with your customers, take a lesson from Amazon, you are great at learning so learn, evolve or die.

RIP Google – 15/12/2011

If you depend on Google for a service I can only recommend that you have a “Get out plan”.  Know about how to liberate your data and consider some alternative options.  Think about the important data you are going to lose when you liberate your data and how costly it will be to replace that data.  This is also a great opportunity for me to plug open source software and the freedoms that gives you.