Mist Labs Blog

Like many other developers I aspire to write clean, efficient code and while I don't always achieve that goal I am always on the lookout for ways to help me in that pursuit.

It always makes me a little sad when I look at an error log file to try and diagnose a problem only to find it bloated with deprecation and notice warnings which are easily preventable with a little care and attention. I know you can turn off logging for these types of errors but I feel it is better to fix these issues rather than ignore them.

To that end, I have created a little utility script to tail the apache error log and trigger an Ubuntu Notification each time the error log is updated. This allows me to be aware of, and resolve these errors during the development phase so they do not make it through to the live environment.

Read more

My Top 10 Linux Commands

By Chris Shennan | 3rd November 2014

Over the last couple of years my role has expanded significantly and I have really had to pick up some good tips and tricks to try and make me as efficient as possible.  One area that has had to grow has been my familiarity with linux, terminal and my comfort with the command line and so I thought I would share my top 10 linux commands which I use on a regular basis. 

In no particular order:- 

1) Make a directory and any parent directories that do not exist.

mkdir -p app/cache

2) Replace a string within a file.

sed -i 's/alpha/beta/g' beta-site.conf

I found this useful for copying a vhost file from an existing site and quickly change all the references to the new domain name.

Read more

It was one of those moments of clarity followed quickly by a doh! from everyone.  

We were trying to include a branch of one of our Symfony bundles in our project using composer but composer refused to see the branch.  We checked the repository and the branch was definitely there so we could not understand why composer was not able to check out the branch.

To include the branch were were trying:-

[digital@devserver devsite]$ php composer.phar require htg/pagination-bundle:v2

(any eagle-eyed people able to spot the issue yet?)

Read more

The beginning of the year saw me working on the latest version of the Herald Scotland app (both android and iOS versions were released at the beginning of May) using Sencha Touch and PhoneGap. App development is not one of my primary skills and the learning curve from my comfort zone of PHP to Sencha Touch has been a steep one and one which I'm still far from conquering, however I thought it might be useful to share some of what i have learned and hopefully steers others away from some of the issues I encountered.

Read more

When implementing HttpCache within one of our Symfony2 projects I came across a curious problem in that regardless what I set the shared max age to it would always show as s-maxage=0 in the network inspector and the cache result was always a miss.  This puzzled me and so to try and isolate the issue I broke it down to the most basic example I could, but even then I still experienced the same s-maxage=0 problem.

My simple example was

public function indexAction()
   $response = $this->render('HtgPageBundle:Default:fullPage.html.twig');

   return $response;

where HtgPageBundle:Default:fullPage.html.twig just contained a simple "<h1>Hello</h1>".

Read more

7192OS_cov.jpg I’ve been developing with Symfony2 for a while now and it is a fantastic framework which allows me and my team to develop quickly and efficiently.  There is a fantastic amount of documentation on http://www.symfony.com but I sometimes feel there is a bit of a gap between the documentation in The Book and The Cookbook and something in between the two would be helpful.

I’ve recently been reading the Extending Symfony2 Web Application Framework book by Sébastien Armand and found it to be a good read for the intermediate Symfony2 developer and provided me with several ah-ha moments, some of which have already been incorporated into the projects I am involved with.

Read more

I recently had to migrate a rather messy crontab from one server to another and to try and simplify things I wanted to split the crontab into managable chunks.  

Unfortunately the crontab does not have any import / include functionality and I didn't want to use different user accounts to have different crontabs (this would likely cause permission issues, a management headache, and I would be replacing one messy solution with another) so after a quick Google I found that the solution was to create the separate files and concatentate them into the crontab.

Read more

The second part of this Sonata Bundles mini series takes us onto installing the SonataAdmin bundle.  This pretty much follows the instructions in the official documentation but required a few additional steps in order to get it up and running.  The basic process I followed is detailed below.

Step 1 - Update the deps file to install the necessary vendor bundles

Add the following lines to the deps file of your Symfony2 project








Read more

In this first part of my mini series about installing and configuring the Sonata Project bundles I will address the prerequiste which is to ensure we have a working Symfony2 project set up and configured.  This will focus on 2 main parts:-

  • The Bare Essentials - Just enough to get it going
  • The Optional Extras - One or 2 nice little touches to help smooth over issues later on.

Hopefully this will be helpful to more than just me :)

Read more

Recently I have started learning Symfony2 (having previously been using Symfony 1.4 and Diem) and I opted to try out the Sonata Project bundles, primarily so I could use the SonataAdminBundle for my CRUD admin interface to allow an easy and quick way to enter data and the SonataAdminBundle had a very similar look and feel to what I was already using.

I had a few issues getting the bundles all working together as the Sonata Project bundles come in 8 parts (all of which can be found at http://sonata-project.org/bundles/) and there were some inter-dependencies and undocumented configuration options which took me a little while to figure out.   I did find it challenging with some of the documentation to get single bundles running by themselves and more challenges (and less documentation) about how to get them all up and running together and had to resort to a lot of Google searches and trial and error methods.

Read more