Hello all!

Around now, 4 years ago, after weeks of worrying, I found out that I had done enough on my A-Levels that I had been offered a place at my first choice University.

4 years later and the final deadline for my dissertation – my final assessment for this course -  has passed. At 3pm yesterday, I officially finished.


This has been the most difficult assessment that I have done over the past 4 years and perhaps even the most difficult one that I have done in my whole academic life!

The past week was particularly stressful as I set out to finish the report in time for today. I actually finished it for the day before because I had to get it printed and bound.

Then there was the stress a few weeks back to get a working system ready to demo. In fact, there were many stresses of trying to get that thing to work! This dissertation has been a constant presence in my life.

Also both my desktop and netbook failed. My desktop seems to randomly have power cuts. Then it didn’t even switch on for a week until it randomly started working fine until last weekend…I hope its the power supply unit and not the motherboard.

Then the netbook hardrive died. I had to buy a new one and reinstall everything. Decided to go for an SSD drive and it really sped things up. Luckily, in both cases, there was no loss in data as everything was in the cloud.

I do have some worries. I am constantly thinking, what if I missed out something major! I was not able to check with my tutor if it was OK before I finished, so I worry that I have gone completely the wrong way. Or what if I have missed out a section? Or done the references wrong so I get done for plagiarism? What if I submitted an incomplete version by accident (I have checked but still)?

So what next?

Well despite finishing all possible work I am still technically a student. Here are a few more milestones that will be happening until I finish:

1st September – Start my new full time job. Although it is at the same company doing more or less the same role, I will no longer be a student in their eyes, just a full time employee.

Latest 19th September – I find out my final mark for the dissertation and indeed my entire degree.

30th September – This is the date that my course officially ends. My student card and my student travel card both expire on this date. This is the date I am no longer a student.

27th, 28th, or 29th January 2015 – The graduation ceremony is on one of these three dates. Not sure which one yet.

Next week I shall be going on my summer holiday. It is still in August so technically, although late, it is a summer holiday! I have been looking forward to it and although I can’t completely forget about University until my result, at least there will be no hard work until I return and I can relax a little bit.


I can’t believe that I haven’t done a post here since April! It is amazing how “tomorrow” becomes “the weekend” which then becomes “next week”.

The truth is that I won’t be able to get back into the swing of things until September (or at the very earliest, late August)! The reason: university.

Being in my final year, I am currently undertaking a final year project. It is a project that I pretty much started a year ago and will not finish until towards the end of August.

At this point, I will have finished my long 4 years at university and I will no longer be a student. I have been looking forward to that day for a long time now and now, it is just around the corner.

However, between now and then, there is a lot of hard work. There is lots to do on the project before the deadline and I don’t have a lot of time to do it.

I want to spend a lot of time looking after this blog and it is time that I simply don’t have whilst the deadline is looming.

So this will probably be the last post I make more a while. I will check in occasionally to keep the back end up to date and will still read comments that I receive and when I return, I will commit the proper amount of time that I want to give this blog!

Why Does It Take So Long When Unsubscribing From Newsletters?

I recently posted a comment on an article for the Guardian newspaper. The process was quick and easy but I inadvertently signed up for a daily newsletter!

This is annoying as it is. I am usually very careful to spot the check-boxes and rigorously read them to make sure that I do not sign up to more unwanted mail.  So when one slips through, I come to the conclusion that it wasn’t there.

But I digress, this article is about something that annoys me even more: the unsubscribe process.

After following the “unsubscribe” link, I am greeted with this message: unsubscribe“This will take effect within 7 days.”

7 days?! It takes 7 days for a simple PHP script to update a single record in a database after pressing a button?!

The Guardian are not the only ones. Every time I have unsubscribed from any newsletter, they have shown me a similar message.

But I don’t understand why! They are able to sign you up instantly, so why can’t they unsubscribe instantly.

It is obvious to me that it is not a technical issue. Updates on a database should take seconds at most.

So if it is not a technical issue what is it? Is it so they can get as much of our attention as possible before we go? Surely anyone unsubscribing will just delete any remaining e-mails that come through, so this is a waste of time!

There is simply no good explanation.

I am not the only person to question this. But the answers people have suggested on that post are unsatisfactory.

The only decent explanation can be found as a comment of this post they said:

Until recently it used to take around 10 days (sometimes less) to process the unsubscribe requests as the email newsletters were managed by a third party company. The requests were sent through to them once a week in a batch.

That still doesn’t answer the question of why it doesn’t take that long to subscribe. If it took 10 days to unsubscribe, it should take 10 days to subscribe! There is no excuse really.

This answer was from 2010, but even then, I would expect any third-party company to handle instant requests! Maybe via an API?

So that concludes my rant. Let me know your thoughts in the comments if you have had similar experiences. I would be particularly interested if you are maintaining a system that handles unsubscribe requests, maybe you can enlighten us!

How to Fix Heartbleed OpenSSL Bug

This week, a major bug on Openssl, called Heartbleed, was announced which basically renders any ssl protection useless.

You can test if your site is vulnerable by doing this test by Qualys.heartbleedbeforeAs you can see, we have failed the test and it highlights the fact that we have the vulnerability.

How to patch it

sudo -s
(optional, but the other commands will have to be proceeded with sudo if you do not).

openssl version -b

You will get something like, built on: Wed Jan  8 20:45:51 UTC 2014. If the date is less than April 7th, then you will have the bug.


apt-get upgrade openssl

Press Y to continue.

Note: you may need to do apt-get update first to get the latest packages.

And that is it. Vulnerability fixed. Do openssl version -b again and check the day is at least Apr 7.heartbleed after

The test also shows the vulnerability is fixed!

Thanks to my colleague, Sheraz, for help finding a solution to the problem!

Quick Guides: #1 – Installing PHP Composer

Want to install and use PHP Composer on your Ubuntu machine?

Simply run:

curl -sS | php -- --install-dir=/usr/local/bin --filename=composer

You can now use the command, composer install in a directory that has a composer.json file.

Want to know what a composer.json file should look like?

See below for an example:

    "require": {
        "symfony/class-loader": "v2.4.1",
        "symfony/yaml": "v2.4.1"
Voila! Another guide decrapified.

Life before vs Life after the Web

This week, the World Wide Web turned 25! Seems strange to think that it is only a little bit older than me!

The Metro ran an article where they looked at 11 ways that the web has changed our lives.

I thought I would add to the list some more ways that I thought of.


1. Sharing photos


Before:  Use up the rest of the film used for the holiday pictures and then take it to the chemist to be printed. “Would you like the 24 hour service or the 7 day service?”

After:  Plug camera into computer. Log on to Facebook. Upload all photos. Spend 24 hours tagging them all.

2. Selling stuff


Before: Put a hand written note in the corner shop window. If you are feeling really posh, make a listing in the local paper or in the Loot newspaper. Wait by the phone.

After: Take amazing pictures from every angle. Create a listing on a website such as eBay, go about your day whilst buyers have a bidding war over your item.

3. Fund raising for sponsored activity


Before: Get people to pledge how much they will donate for you to do something. Spend three months following the event tracking down the pledgers, who are suddenly always busy.

After: Create a page on Justgiving. Spread this page through the power of social media. Anyone who pledges automatically has money taken from their account and placed directly in the hands of the charity.

4. School research project

Cat Reading

Before: Go to the library and use the Dewey Decimal System to locate the books on the topic. “The book is checked out for another week?! But the deadline is tomorrow!”

After: Google.

5. Topup pay as you go phones (does anyone even have these anymore?)


Before: Down the local shop. “Hi can I have £10 top up for O2 please.” “O2?” “Yes, O2″ (seriously, the guy in the sweet shop would always do this double check and it would infuriate me inside. You heard the £10 part correctly, so why do you need to know the network again!?). Then call a number, and type a 10000 digit number to load your call time. That is if your top up ticket doesn’t get wet or blown away by the wind.

After: Log into the network’s website and top up online. Balance is added instantly.

It is interesting to note that in all these scenarios, the World Wide Web on its own did not do anything. It was people who used this amazing tool to create and do even more amazing things.

Ubuntu Editors

Ubuntu Text Editors

I remember the first time that I used an Ubuntu text editor.

It was during a simpler time when I was some how developing on a Windows machine.

I was trying to debug and fix multiple PHP scripts using vi. I still have nightmares to this day about that.

This week, I was reminded of this pain by a fellow colleague who came to me after experiencing the same pain.

I have no idea why vi was designed the way it was. So you open a file up with it (making sure you do it with “sudo”, otherwise everything you do would be for nothing).

Then you move your cursor to the right place and start typing. Nothing happens.

Oh of course, you have to press “a” first, and then you can type what you like. How obvious is that?!

OK, I now want to move to a different line. I am still in “insert mode” because I have not finished typing. In true terminal tradition, I begin using the arrow keys to move my cursor…

What the….

The joys of ViLetters are appearing!!

When I press the arrows,  the cursor moves and puts a letter in place. One of 4 depending which arrow I press. Why??? What was the design decision behind this to make it do this?!?! It just makes no sense! It is not like I don’t have 26 other keys which are dedicated to typing letters!

To move, I have to remember to press Esc, to get out of “insert mode”, then press the arrows, then press “a” again.

What about saving. Well obviously, you type a colon to do a command, followed by a letter; and obviously the letter of choice for saving is “w” (I guess, on hindsight, w means write).

But wait!

Screenshot from 2014-03-10 09:20:56What does this even mean?! It only appears sometimes! It is so spontaneous that I have gotten into the habit of adding the ! every time.

I have since gotten used to the commands of vi. But I will never be able to understand the logic behind having letters appear when I press arrows. It is so ridiculous!

Luckily, there is a solution that fixes this. It is called vim.

Simply run: apt-get install vim and it will automatically install and be used instead of vi.

It still has the same commands as vi, and you can still use it as if you are using vi (sudo vi text.txt).

It comes with two improvements:

  1. It fixes the stupid design flaw of not being able to use the arrow keys whilst in insert mode.
  2. It adds colours to the code to make it a little bit more readable.

In my opinion vim is how vi should have been to begin with. I have gotten very used it to it and always use it when I want to quickly edit, say, a config file, for example. Unfortunately, it is not always installed on every server and vi comes to haunt me.

If vim is still not easy enough for you, you can always use nano.

Nano is as close to a GUI text editor as you are going to get in terminal.

Just do apt-get install nano and then say sudo nano text.txt to use (Note: it does not automatically override vi like vim does).

Then just start typing as you would in a text editor! No pressing keys to begin typing or stop typing. No weird behaviour when you press the arrow keys.

Screenshot from 2014-03-10 09:52:51All the commands you need are helpfully listed at the bottom. Note that the ^ actually means Ctrl. So CTRL+O will save it. But you will be given the option to change the name of the file (no random need for exclamation marks either!).

Finally, you have gedit.

People who use the desktop edition of Ubuntu will be very familiar with this one. It is the text editor you open if you use the GUI interface to open a file.

But, if for some reason you have to open one in terminal (because of permissions), and nano is still too scary, sudo gedit file.txt will open the said file in gedit.

You will then have a GUI interface of a text editor with all the familiar buttons and menus. I won’t go into detail for these, as if you are struggling to use even gedit, then there is really little hope for you!

Ubuntu Editors

Quadratic Equation Calculator Icon

My First Android App!

I have finally built and published an Android App!!

It went live yesterday. Unfortunately, it is nothing too exciting. It is simply a quadratic equation calculator. But I had to start somewhere and I learnt a lot in the process of building it.

I decided to support devices pre-4.0 and this is where most of my problems came:

  • The action bar – an extremely useful built in menu bar that I had originally coded from scratch – is only available from, Android 3.0 on-wards. So I had to use a special support library to make it available for older phones. Problem was including this library in project was not that straightforward.
  • The action bar still doesn’t behave as well as it does newer devices as the support library I used didn’t support everything.
  • Getting a Context Action Bar to work on an older device was also a mission!

So most of my problems came from having to support older devices. In future apps, I don’t think I will do this. I will set the threshold as 4.0.

Today, just over a quarter of people still use devices less than 4.0, so I will lose this percentage of downloads. However, I will still cover 75% of all devices and this number can only get higher! It will also save a lot of headaches (at least for now until future versions come out!).

But to be honest, I doubt I will have much time for side projects from now until August when I finish University. This is why I was so keen to finish this app now and get it out there.

To find out more about the app including a link to the Play store,  click here!

Simple Select Statement In Doctrine

So I have recently found myself thrown into the deep end of Doctrine. The post assumes that you already know what an EntityManager is and that you have one already mapped your table to an entity object.

All I wanted to do was a simple “SELECT * FROM table WHERE x = y” type query. After a while I found the solution. The documentations that I found seemed to think that I was already able to use Doctrine, but the truth is I didn’t set it up! I was just told to use it!

Anyway, here is the code:

$query = “SELECT tbl FROM NameSpace\To\Table\Entity tbl WHERE tbl.column = :var”;
$queryObj = $this->entityManager->createQuery($query);
$queryObj->setParameter(“var”, $var);
$results = $queryObj->getArrayResult();

Let me go through that line by line:

$query = “SELECT tbl FROM NameSpace\To\Table\Entity tbl WHERE tbl.column = :var”;

This is a simple string of your query written in Doctrine Query Language. You will see that instead of * you put the table name that you declare after in the From clause. This is a massive bit of craziness, you are using a sort of variable before declaring it!For selecting in all columns you put the name of the table on its own, the one in the From clause which can be anything. For selecting specific columns, you do a list: tbl.column1, tbl.column2. Those columns must match the names you have in the Entity object.

Then you have the From clause. This should have the namespace to the Entity of the object that you are selecting from followed by the table name you are using in the rest of the query.

Then the WHERE. tbl.column is pretty standard. Again, the tbl is whatever you state in the FROM. Then I have :var. Wtf is this? Well think of this as a place holder that can be later replaced with some value. It is the same as if you were going to append a variable to a query string but done differently.

$queryObj = $this->entityManager->createQuery($query);

This simply turns your query into an object. You obviously call the createQuery() function from wherever you have stored your EntityManager object that you would have created at some point.

$queryObj->setParameter(“var”, $var);

OK, remember the :var in the query string earlier? This is how you replace it. Call the setParameter function from the query object and pass it the parameter name and the value that you want to replace it with. I just happen to have that value stored in some variable, $var.

$results = $queryObj->getArrayResult();

Finally, you do the call. Now, you could do getResult(). This would give you an object where the columns are protected fields and they have the values of the associated value in the table. I am not sure when this would be useful. I found getArrayResult() more useful because I was actually able to do something with it afterwards.

So there you have it. All that for a couple of hours. Would have been easier to use mysqli. I should be grateful that I didn’t have to create the Entity manager and the logistics behind that.

Although I did have to make all the Entity classes and the 700+ fields that they contain (don’t ask).

Brief Guide To Ubuntu Permissions

Anyone who uses Ubuntu will have used the Terminal. They would have seen a screen such as the one below:

Ubuntu SnapshotBut what do all those letters and words mean? This brief guide will help you out.

The first column contains the permissions. This dictates what you and other users are allowed to do to a particular directory or file.

The first letter is either d, l or -.

  • d – this means that it is a directory
  • l – means that is is a symbolic link to another directory
  • - – means it is neither of the above and probably a file.

The remaining 9 characters are separated into 3 blocks (I will come to this later), the blocks consist of 3 characters:

  • r – read privileges has been granted.
  • w – write privileges has been granted, this includes creating and deleting files.
  • x – the file can be executed.

The block is always appears in that order (rwx) and if any of those letters are instead a dash (-) then that particular privilege has not been granted e.g.

  • r-x means read privileges and execute privileges have been granted but not write
  • -w- means only write privileges have been given.

As I said before, there are 3 lots of these blocks.

  • First block is privileges given to the owner.
  • Second block is privileges given to the group.
  • Third block is privileges given to everyone else.

So putting that all together here is an example:


  • So the d tells us that it is the directory.
  • The first block of 3 is the privileges for the owner and it is rwx, which means the owner can read, write and execute the directory.
  • The second block of 3 is for the group that owns it and is r-x, which means the members of the group can read and execute the directory but not write.
  • The third and final group is r– and this tells us that all other users can read only.

A word about the owner and the group. On the screen above you can see the words “root root” in each row. The first “root” is the user that owns the directory and the second “root” is the group that owns the directory. This is how you can work out who has permissions to do what.

So if it was “dandreaa administrators” it would mean that the owner, dandreaa, would have the privileges of the first block of 3 and the other users who belongs to the group, administrators, would have the permissions of the second block of 3. That means in the above example, dandreaa would be able to read, write and execute, whilst everyone else who was a member of the administrator group, would be able to read and execute only.

Note that the user has to be a member of the group that owns it.

I hope this all makes sense! Let me know if you need clarification!