A web link sending a command to a Ruby daemon that instructs an Arduino to move a servo

Posted by .

I’m working on a remote camera shutter project, which is a Raspberry Pi with a webcam and when it detects motion it clicks the camera shutter button. The button is pressed by a small servo that is connected to an Arduino nano. The Raspberry Pi and Arduino communicate over serial.

As well as automatically taking photos based on motion I would also like to be able to take a photo by clicking a button on my website (which gives me a remote shutter button on my iphone). So I’m just going to go through the software involved in the communication between a web page, a Ruby daemon and the Arduino (over a serial connection). (more…)

Using LESS on a WordPress site, my thoughts

Posted by .

To use LESS in your WordPress theme you seem to have two options: Use something like wp-less to compile your LESS files into CSS, all done server-side using PHP, with caching taken care of as not to go through that process on every page load. Or use less.js to compile the LESS into CSS in your clients browser.

On a live site it’s probably best to do your visitors a favour and take care of the LESS compiling server-side. I thought it might be better to do this client side when building a website as it might be easier to debug. Thinking all LESS files would be compiled in the browser and then Chrome inspector would know which LESS file contained the style declaration I was looking for.

So I forked the wp-less plugin/class and added a method to choose client-side (less.js) compiling. Just incase Sanchothefat wanted to pull my changes back into his repo I added my changes in such a way that the default usage of that class is still the same but now you can make use of a different method to enable the client-side (less.js) compile. Simply include the class in your theme like so:

// Include the wp-less class
require_once( 'library/wp-less/wp-less.php' );
// Hook into init and tell wp_less to use_js method
// Comment out this line if you would rather use the default PHP compiler
add_action( 'init', array( 'wp_less', 'use_js' ), 20 );


WordPress starter theme framework performance

Posted by .

Part of the reason I’m creating this site right now is to try out a few starter themes that make use of frameworks such as Twitter Bootstrap and Foundation. I’ve used LESS before on a free site I created recently and I would like to explore CSS preprocessors a little further. Both of the above frameworks I mentioned use a CSS preprocessor which is why I’ve chosen these possible themes:

WordPress-Bootstrap - Described as a WordPress theme based on Twitter bootstrap. Looking at the codebase it’s also heavily based on bones, minus the LESS stuff.
WP-Foundation - A WordPress starter theme built on the Foundation 3 framework although it seems to be missing the main SASS files. This one also seems to rely on the bones codebase.
Bones - A starter theme with options to use SASS or LESS.

I’m currently using Bones simply because I can use LESS with it pretty much out of the box, it’s a nice fresh base to start on and the other themes seem to be based on bones anyway.

Performance tests

I have compared the homepage load times of the above themes and the default Twenty Eleven Theme (with 5 dummy posts with images etc) using the apache a/b benchmarking tool. I ran the test 3 times for each theme and picked the best performing run which I have included below.

I also noted down the page load data (an average based on 3 runs) from the Chrome Inspector network panel which I have included for each theme just above the a/b test results.

It’s pretty much of a muchness, none of the themes seem to add extra overhead compared to the default Twenty Eleven Theme despite having a number of extra PHP include files.


Hello world!

Posted by .

Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!

This theme is currently work in progress and will change from hour to hour, day to day, while I try out a couple of theme frameworks. Namely WordPress-bootstrap, wp-foundation and bones.