Get running with Laravel on Ubuntu ultra-fast

This is just a very quick guide to get a fresh Ubuntu install working with Laravel.  It doesn’t use Apache2, but the web server capability of PHP5.  It’s not a comprehensive guide, and it doesn’t go into setting up and installing a full LAMP stack, so there will be no MySQL – this is meant as a base to work from for more front-end AngularJS experimentation.

First, install PHP5 and necessary modules (Ubuntu 12.10 comes with Ubuntu 5.4 which is good enough)

sudo apt-get update
sudo apt-get install php5
sudo apt-get install curl
sudo apt-get install php5-mcrypt

Secondly we need to install composer which is used to install and update GitHub projects – like Laravel:

curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer

Lastly we create the project (I go to “~/Documents/Projects” for this):

composer create-project laravel/laravel project_name --prefer-dist

Lastly go to your newly created project folder and start the server (which, by default, can be seen at http://localhost:8000):

cd project_name
php artisan serve

Arduino Nunchuck project

nunchuck Sketch_bbI have cobbled together a couple of circuits to combine output to an OLED with input from a Nunchuck, through a WiiChuck adapter.  I have avoided using the analogue pin (by plugging the adapter directly into the arduino, over analogue pins 2-5) and instead used the 3.3v output because apparently the Wii Nunchuck should be powered by 3.3v and not 5v.  I have attached a diagram, but for clarity, there is the wiring explained here too: Continue reading

Processing multiple strings in an array

This post concentrates on filtering values from a one-dimensional array.

There are a lot of really useful functions in PHP, and it’s almost impossible to remember them all.  Array functions are no exception, and as with PHP functions generally the little inconsistencies are just waiting there to catch you out.

Anyway, I just wanted to mention the difference between array_walk and array_map, and why array_map is particularly useful.

Continue reading