Raspberry Pi – Location Aware Media Server – Pairing

As mentioned in the post Raspberry Pi Location Aware Media Server I mentioned a new project I am embarking on. This post is to document my current process and thinking regarding the pairing process for the beacon Pi’s and the server Pi and for the initial setup to be carried out.

This post will reflect my current plans therefore will change over time. Where I have decided against a certain approach I will either create a new post specifying why or I will update this post giving reasons depending on the most appropriate approach. Continue reading “Raspberry Pi – Location Aware Media Server – Pairing”

Raspberry Pi – Location Aware Media Server Project

Recently I purchased a Raspberry Pi and have been considering what I should do with it.

1 consideration has been to create a location aware media server.  What do I mean by location aware media server? Well most media servers will allow you to create playlists and output to whatever speakers are attached. With my project however I plan on making the system know which room you are in and to then output to speakers in that specific room, if you move room the music will follow.

Prior to jumping into such a project there are a few things that I have to work out as well as to decide the full functionality of the system. Continue reading “Raspberry Pi – Location Aware Media Server Project”

Developing And Monthly Projects.

As many people know it can be very easy to make plans however harder to action them. I seem to be very good at procrastination and less so of removing things from my to do list.

To help me focus and get into the swing of programming I have decided that I need to set myself proper tasks with a set time for completion. To make sure that I carry through I am also going to be posting updates on my blog.

The plan is to start a new project on the 1st of every month, once the end of the month arrives I should have a project that I can then release. This does not necessarily mean the product will be perfect but in a state that I am happy to show others and essentially gives me something to build upon in future. Some of these may remain proof of concepts therefore will never be in a finalised state.

I have now set myself a bucket list, over time I will mark off those that are completed and add new tasks and projects to the list.

For my first month I am working on a simple Crossword Maker. This will not necessarily be something that will result in a finalised project but aims at getting me back into the swing of programming again.

The requirements of this are quite simple. For creating the crossword we have:

  1. User decides on the grid size for the crossword and this is output to the browser
  2. User can select which boxes are blank.
  3. User enters the answers into the crossword
  4. Script automatically creates numbered clue placeholders
  5. User can specify the question
  6. javascript submits the structure of the crossword to a PHP script
  7. Potential to have a script automatically generate the crossword with specified answers so that the creator doesn’t have to crate the layout.

For allowing people to complete the crossword:

  1. Script fetches the structure from the server and outputs this
  2. User manually enters the answers into the crossword grid
  3. If a user clicks on a clue when the user starts to enter the answer it automatically puts the letters into the correct locations.
  4. User can click on a button to check the solutions, the javascript submits the answers to the server and this specifies either correct or incorrect.
  5. Another potential would be to have a cheat option that fills in a letter for a chosen clue.


What do you guys think? How do you keep yourself motivated and staying on task? How about suggestions for projects?

Usability Over Security And Reliability

As developers we can face some difficult choices. Do we make life easier for the user or do we err on the side of security which can detract from the usability of our applications?

Make Use Of recently ran an article that highlights issues caused when usability is given too high a priority over reliability and security.

The article explains that the twitter account of Roger Ebert recently started to post after a long period of quiet. The problem? Roger Ebert died 2 years ago.

Clearly Roger Ebert had not been posting himself. It was thought that his wife had started to post as she retweets using the account at times (why???) but this soon became clear that this was not the case. Make Use Of appears to have come to a good conclusion  as to the cause. Roger Elbert appears to have posted Twitter updates using SMS. As Roger no longer has an active phone the number had been recycled and given to another customer in the meantime. As the phone number had been registered for Twitter this remains in place. The new owner can now post as Roger.

Now is this an issue for Twitter or the cellular network. In an ideal world there would be no need to recycle numbers but of course there are a limited number available and inevitably these do have to get reused. Therefore such issues fall upon us as developers (in this case Twitter) to make sure that we consider the failure points of our features and how we can overcome issues.

In Twitters case it would seem that once validated a mobile number can be used with impunity to post with no consideration of this being passed onto someone else. This could easily be overcome. For example for the end-user to have to verify the number on a periodic basis, if an app on the mobile device is also used maybe the app could do this on behalf of the user if they are logged in. This may not stop all occurrences of such issues but will help reduce this greatly. Not only this, but it would give the new owner of the number an easy way to opt out and stop receiving nuisance communications etc.

This issue is not restricted to mobile numbers. 2 years ago Yahoo announced that they would be freeing up dormant email accounts. An account was considered dormant if the user had not logged in to Yahoo for over a set time period. I do not disagree with Yahoo’s decision in doing so however this poses a problem for service providers. Consider the things we do over email. For example if you reset a password on most services you simply require access to the email account in question. This might be easy to use but how secure is it? Also consider some of the private information that we may send over email. Would we or the user be happy if such information was given to other people?

Any thoughts? Let me know.

Issue when implementing NSURLSession

I have recently been playing with NSURLSession and seeing the benefits of using this over the old method.

Today I came across a slight issue that is worth noting. During my programming session I was implementing the delegates. I started with NSURLSessionDelegate then moved onto NSURLSessionTaskDelegate. At this point I decided to test the code and found that the following method was called in my delegate object

– (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error

I tried to output the error using

NSLog(@”%@”, [error localizedDescription]);

But unfortunately this was not helpful as I received Null. I originally thought that there was an error in my coding however I could not locate 1. On further checking I found that I have made a couple of assumptions and I believe they were quite well founded.

The description of – URLSession:task:didCompleteWithError: is as follows:

Tells the delegate that the task finished transferring data.

Unfortunately I do not believe the method is named very well. As the description states this method is called when an error occurs. If no errors occur then the task completed successfully.

To ensure that the request was successful something along the lines of the example brow will work.

- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error
    //TODO Implement method
    if (error == Nil) {
        //TODO ascertain the failure and report failure to the caller
    //TODO Report success

Help Audit Truecrypt

Over the last couple of months Edward Snowden has shown us how intrusive governments has been. This has also raised questions such as how safe are you when using encryption software.

As Truecrypt is 1 of the more popular encryption solutions there is a vested interest for the NSA, GCHQ and other spy organisation in breaking the protection that these provide. There have also been suggestions that the NSA have attempted to coerce software developers in actively introducing backdoor’s into their software.

To date there has not been any large-scale security audits on the Truecrypt source code. Well this is about to change.

A team of people have started an Indiegogo Campaign.The campaign has already met the starting target however please do not let this influence your decision in backing the campaign. The more money pledged the better the results for the audit. The money will ensure that those carrying out the audit are properly compensated and funds are available to entice people in reporting bugs that they fund.

Be sure to back the Truecrypt Audit on Indiegogo.

Installing Zend Server 6.1 using Nginx and PHP 5.4.

Zend recently updated Zend Server and added the ability to use Nginx as the web server. I thought I would give it a go. I have installed Zend Server 6.1 on a fresh new install of Cent OS 6.4 (I used the minimal install ISO weighing at around 300 meg).

The following are the steps required to install.

Firstly we need to create the Nginx repository file as we re going to use yum to install everything:

touch /etc/yum.repos.d/nginx.repo

Next we need to add the repo details to use. Firstly open the file in vi:

vi /etc/yum.repos.d/nginx.repo

Then add the repo details (press “i” before typing, 😡 to close and save the file)

 name=nginx repo

We now need to do the same for Zend Server:

touch /etc/yum.repos.d/zend.repo

Open the file:

vi /etc/yum.repos.d/zend.repo

Enter the repo details (remembering to press “i” before typing, 😡 to close and save the file):

 name=zend-server - noarch

Now we simply need to download everything. For this I am choosing to use PHP 5.4 (my choices are 5.4 and 5.3, replace 5.4 with 5.3 in the next command if you are chosing PHP 5.3):

yum install zend-server-nginx-php-5.4

You maybe prompted to allow a key to be used. This is ok we are using the official repos for the packages so select y if prompted.

After some time (depending on your connection speed) Zend Server 6.1, PHP 5.4 and Nginx will be installed and we can reach the GUI. You maybe wondering when we installed Nginx. When we asked yum to install Zend Server it saw that it was dependant upon Nginx being installed first so added this to the download list (and used the Nginx repo from above to install it).

Now I am only using this locally behind a router etc so decided that I would disable iptables. I strongly recommend you do not do this for public servers. To disable iptables simply run the following command:

/etc/init.d/iptables stop

We can now access both the Nginx web server and the Zend Studio control panel which is located at http://your-ip:80081

Now we shall finish the installation. Firstly accept the licence and click next. The choose the profile you are using. As this is a development machine for me I am going to choose the development option. Needless to say you should choose the option that is right for your situation. Again click on next.

On this next page it is going to ask you for a password 4 time. 2 for the admin and 2 for the developer. If you intend to use the free licence, the developer password really is not going to be of much use but I would set something you will know anyway. The developer user is disabled for the free licence. Click next after entering the password.

On the next page click next. Read the summary and click submit.

After a few moments you will enter the web interface for the Zend Server application. Be sure to browse about and become comfortable with it. Be warned tho the initial licence is a trial licence and after 7 days you will need to enter a new licence. As mentioned there is a free licence which will disable some functionality (but still useful). For a breakdown of what each licence includes be sure to check our the Zend Server editions page which has more info.

One last note. The first time entering the web interface you will not be prompted for a login. After this you will need to use a login. The login is:

Username: admin
Password: As entered

Enjoy and happy programming.

Updating Zend Server 6.01 (PHP 5.4.11) to 6.10 (PHP 5.4.16)

Not too long ago I installed Zend Server which is a great tool that can help you manage and debug your PHP applications. It can also help make sure that your development environment is the same as your live environment so that surprises are less common for you.

Recently Zend updated Zend Server to 6.10 however there are no good instructions on how to update the product. After a bit of browsing I could see some questions about how to do this but little in the way of answers (it did only update a few days ago).

Anyway when you install Zend Server on Linux it sets up a new yum repository to use to install and keep the package updated however when trying to update nothing actually updated.

Upon checking the repository file at “/etc/yum.repos.d/zend.repo” I found that this contained the following:

 name=Zend Server
 name=Zend Server - noarch

As you can see the file specifically references the repository for 6.0. To try to fix this I changed the file to have:

 name=Zend Server
 name=Zend Server - noarch

Once I had done this I then carried out the following 2 commands:

yum clean all
yum update

This now prompted me if I wanted to update many components. Low and behold Zend Server now reports:

PHP Version 5.4.16Zend Server Version: 6.1.0

Zend Framework: 1.12.3, 2.2.1
Zend Server Gateway: 0.9.0
Build: 71826

Fingers crossed. All appears fine.

One thing that is a bit disappointing however is that now we have no ETA on Zend Server with PHP 5.5 support. I was looking forward to utilising some of the PHP 5.5 features on the product I am making.

PHP 5.5 Release Imminent

*** New Since Writing This ***

PHP has now officially been released as can be seen on the PHP news page.


The release of PHP 5.5 is imminent now. The source code now appears to be getting merged on the official PHP github repository. The news file (which highlights a lot of the new features and fixes) can be found at https://github.com/php/php-src/blob/php-5.5.0/NEWS. I am particularly looking forward to using the new password functionality as well as being able to use the FINALLY keyword.

Along with the release of PHP 5.5 this will begin the end of life process for PHP 5.3. The issue is already being discussed on the PHP internals list.


As you can see the current plan is that once 5.3.27 is release in a few weeks the only updates to the 5.3 branch will be security only fixes (and there doesn’t appear to be any opposition to this). Johannes Schluter has posted a new blog post about what you can do from here if you are using PHP 5.3 and can be found here.

Now really is a good time to be looking at upgrading PHP. Preferably you should be looking at upgrading to 5.5.


A good video to help explain the new release and update cycle for PHP can be found on youtube (this subject starts at 3:14):