Styling the HTML5 Meter Tag Using the Shadow DOM

Almost three years ago I read an article on html5doctor describing the meter tag, during the course of the article an example is given of the http://www.justgiving.com/  gauge of how near you are to your target:

The article goes on to suggest this would be an ideal use case for the <meter> tag, however at that time it was impossible to style the meter tag to look like this. This afternoon after discovering that shadow DOM support had made it into Chrome stable I attempted to recreate the Just Giving meter using no images and without a mess of divs.

This is the result, one I’m pretty happy with, I haven’t really made much attempt to style the surrounding areas, I just wanted to concentrate on the (frankly rather cool) meter:

Or see a live demo.

Read more ▼

Installing PHP 5.4 in Ubuntu

I’ve been excitedly awaiting some of the new features found in PHP 5.4, in particular array notation and file upload progress monitoring so I decided to try and install PHP 5.4 on Ubuntu. Fortunately there is a repository of prebuilt packages for Ubuntu.

I recommend using a VM so you don’t mess up any stable PHP install.

Update

Since writing this post php 5.4 stable has been released and a more up to date package is available in this ppa: https://launchpad.net/~ondrej/+archive/php5 I haven’t tested this personally but should work as described below.

Installation

The ppa can be simply added to ubuntu:

sudo add-apt-repository ppa:ondrej/php5

Then installing as normal

sudo apt-get update
sudo apt-get install php5 libapache2-mod-php5

Codeigniter Unit Testing with Simpletest and PHP 5.3

I’m a regular user of codeigniter-simpletest developed by Eric Barnes however I ran into a number of issues when attempting to run some features under PHP5.3, this was due to using an old version of Simpletest. I have now updated this and had my pull request accepted and merged into the main repo so that it now uses the most recent versions (1.1alpha3).

There is however one important change to note which will stop old tests working, that is the way that test classes define a label, these are optional so this only applies if you use them in your project. The name of the test is now passed through the simpletest constructor otherwise the default is to use the classname of the test.

Before

class test_users_model extends CodeIgniterUnitTestCase
{
	public function __construct()
	{
		parent::__construct();

		$this->UnitTestCase('Users Model');

		$this->load->model('users/users_model');
	}

etc...

After

class test_users_model extends CodeIgniterUnitTestCase
{
	public function __construct()
	{
		parent::__construct('Users Model');

		$this->load->model('users/users_model');
	}
etc...

I’m also working on integration with CI systems, Jenkins in particular based on this rather cool presentation: Setting up a Continuous Integration Server for Ubuntu with Codeigniter and Github

Enabling web sockets on Opera Mobile

A little project I’m working on requires the use or websockets in Opera Mobile, I’d read they were supported but when I tried it just threw an exception, then I discovered you have to enable them in the config:

  1. Browse to opera:config in opera mobile
  2. Open the User Prefs section
  3. Check the enable websockets box
  4. Scroll right to the bottom of the page and select save
  5. Enjoy much websockety goodness

getUserMedia(), the device API and the state of the webcam in browser using javascript and html5 video

Since first considering web camera applications during my MSc thesis I’ve be fascinated by different uses and application of webcams on the web. I believe outside of skype they are a very under utilised tool for both communication and interaction and despite their long existence I believe there is still a very long way to go in what they can do.

Android camera live view in a webpage getUserMedia

In this post I intend to summarise recent developments surrounding using a webcam within web applications and go on to discuss current implementations available for using a webcam with javascript.

Read more ▼

Backing up my world – Online back ups for work and play

For a good while I’ve been meaning to get around to backing up my data properly. I’ve always had an external hard disk on which I backed up my important data periodically but that only covers the most basic of situations. If my house burnt down, or more likely somebody broke into my house,even just a power surge, I could conceivably loose both my real copy and the backup. From this I decided the only sensible way was to explore an offsite backup solution to use in addition to local backups. I’ve also been spurred on after buying an SSD and being unconvinced about their reliability. Indeed since starting to write this post my new SSD was recalled by corsair…

Daily backup drives

In this post I’ll describe what I backup and the online services and software I used.

Read more ▼

Websocket URL routing (specifying MQTT subscription topic by URL)

My previous example Node.js, MQTT and Websockets showed the use of a websocket to broadcast messages from a subscribed MQTT topic, however the topic was hard coded and the messages broadcast to all who connected. The example below uses the same client side script to connect but allows the MQTT topic to be specified in the URL and only broadcasts to the individual client. Now to subscribe to a topic “test” the websocket address would be ws://<ip>/test.
Read more ▼

Node.js, MQTT and Websockets

For a while I’ve been looking at how to bridge the MQTT protocol and websockets to make it easier to build web applications using data broadcast in MQTT streams. In the past I used python and mod_pywebsocket along with mosquitto python libraries however this was cumbersome and difficult to install.  Here I present a simple solution using node.js to interact with mosquitto MQTT clients. Node.js lends itself to working well with messaging systems like MQTT and websockets due to its event driven nature. I’m also in love with node.js at the moment!

This is much simpler than previous attempts and I put the initial test together in less than ten minutes.

Prerequisites

Obviously you’ll need to have node.js and mosquitto installed and also the node library node-websocket-server (which can easily be installed using npm). All my work was tested under ubuntu but there is no reason why it wouldn’t work on OSX or even cygwin. To test you’ll need a websocket compatible browser such as recent versions of chrome.

System Structure

mosquitto_pub and mosquitto_sub are command line MQTT clients supplied with the mosquitto MQTT broker, here mosquitto_sub will be called using node.js as child processes, events are generated on output from the process. The data is then captured and broadcast over a websocket. In this case a simple jquery page is used to display the broadcast messages but in a real application there would be more client side processing to make a useful application.

Read more ▼

Chromium OS – another look 1 year on

Just over a year when the chromiumOS code was first released I spent a while compiling it and experimenting and posted my opinions

I made a few basic points:

  1. Little wifi hardware support
  2. Requires a DHCP network
  3. Quick boot time (~10s)
  4. It’s just like Google chrome and nothing else

A few weeks ago @popey mentioned on twitter he was compiling it and this inspired me to have another go with it. In this post I intend to see if things have moved on.

chromiumos default screen

Read more ▼

Building a Low Powered and Silent Atom Based Server (Sheevaplug alternative)

After I had problems with my sheevaplug power supply I had lost faith in the device and didn’t trust it to survive being on 24/7 without exploding/setting on fire etc… so after NewIT kindly fixed it I sold it. This left me with no server to mess with so I decided to try and build a new one – the two primary requirements being that it used as little power as possible (ideally around 10W – the same as my sheevaplug with hd and usb hub) and was totally silent. In this post I’ll describe what I came up with.

My low powered, atom based server.

Read more ▼