What do software developers and plasterers have in common?

Control F1 Lead Developer Nick Payne’s musings on the similarities between plastering and programming.

What do software developers and plasterers have in common? A bizarre question, you might say, but hear me out.

Recently, having purchased our first home, we were on the look out for trades-people – people skilled in the art of making our world comfortable, pleasing to the eye and functional. However, we were at something of a disadvantage. We didn’t have the first idea about how to install an alarm system, hang wallpaper or plaster a ceiling; nor did we have the tools or time to do so. We also didn’t have a clue what it might take – both in temporal and pecuniary terms – to get to where we wanted to be.

What we did know, however, is that our home needs to be secure, not to have holes in the wall where the up-lighters used to be, and to have ceilings that are free from asbestos. 

So discussions began, and we soon realised that we needed a plan; some requirements and maybe an idea of cost. We headed to Google and looked for trades-people local to us, but Geography alone wasn’t enough – we also needed to feel confident that their previous work was acceptable to their customers.

The alarm system was particularly enlightening. Being a self-confessed geek, I wanted an all singing, all dancing, system – one which I could monitor remotely, turn on and off from upstairs and downstairs, arm automatically when I left from both front and rear doors, etc. etc… It quickly became obvious that I’d missed the point!  

On speaking to our chosen alarm specialist (who also happened to be the electrician) I realised a few things: I’ve never left the house by the rear door; the house isn’t big enough to warrant being able to set the alarm from upstairs; that remote monitoring is only as good as the people at the end of it. We also realised that although the electrician was more than happy to install such a system, we simply couldn’t justify the cost – it would give us no additional benefits over and above what we now have installed.

It was a similar story with the plasterer: we showed him the rooms we needed attending to and he said, “that’ll be £X”. I was rather taken aback. We chatted further and it soon became clear that he’d plastered many a ceiling before, of the same size, in similar houses, with similar resources and materials. 

So, back to the original question… how does this compare to software development? Well, software developers are able to provide systems just like the all singing, all dancing alarm system. We’re also able to give a confident quote when we’ve done similar work before. But the really good developers can also get to the bottom of what it is that you really want. 

Here at Control F1, we work hard to understand what it is that you’re trying to achieve, and to provide the most cost efficient, effective solution possible. And whilst innovation remains at the heart of what we do, we tell it like it is and never provide you with novelty purely for the sake of it. Just as repairing the holes in my walls and making my home secure improves my physical existence, so at Control F1 we find the best solution to make your digital life better. 

Glowing gherkins, link baiting and the Internet of Things: reflections from Digital Shoreditch 2015

Last week, our Marketing Manager Florence spoke at Digital Shoreditch 2015. From the latest developments in Virtual Reality to why link baiting is ruining the internet, the festival certainly didn’t disappoint. In this post, Florence summarises her top 10 takeaways:

Big data and the Internet of Things

  1. The Internet of Things is helping us to build smarter cities, but to see the full benefit of this communities need to take hold of the data and put it to good use, said Richard Channell, Technology Director at Arqiva. The following video, which he shared, provides a good introduction to civic technology:

  1. Similarly, Francesco D’Orazio of Pulsar told us that big data is only useful if you know how to use it, quoting Michael Palmer:

“Data is just like crude. It’s valuable, but if unrefined it cannot really be used. It has to be changed into gas, plastic, chemicals, etc., to create a valuable entity that drives profitable activity; so must data be broken down, analysed for it to have value”.

  1. We also need to cultivate trust and reciprocity around personal data and collective memory. A case in point came from Pascal Raabe, who suggested that “if you have an import function, you should also have an export function”, irrespective of the type of platform that you are building.

Emerging technologies

  1. Virtual Reality can provide a window into the world of others, encouraging empathy beyond geographical borders, according to William McMaster, head of Virtual Reality at Visualise Creative Ltd. This has implications beyond the gaming industry, introducing new and interesting possibilities for journalism.
  1. Digital technology can and should be harnessed for the benefit of the natural world. This one’s a cheeky plug for my session on Warblr – an app that automatically recognises birds by their song and uses data to aid research and conservation. You can watch my talk in full here.

Content

  1. Taking risks is the key to good content, according to Catherine Toole of Sticky Content, who suggests that we need to “say what people are really thinking” if we are to get to the zeitgeist – see this clever admission from Crayola:

crayola

  1. You can’t build meaningful relationships through link baiting. “Storytelling is about truly connecting with people”, said Neil Bennett of AnalogFolk, and it requires a level of truthfulness – linkbaiting is only a short-term strategy. So lay off “The Best Cat GIF Post In The History Of Cat GIFs” for now…
  1. Real time reactive content is a great way to get your business noticed, but make like the folks at KittenCamp and remember that it should always be Balsy:
  • Balanced: brave and brand appropriate
  • Actionable: (and that action should be brand building too)
  • Likeable: for obvious reasons
  • Long-term: fads are unsustainable
  • Surprising: because the internet is full of clutter
  • You-Centric: focused on the customer, as well as your brand

The weird, wacky and wonderful

  1. Gherkins can conduct electricity. Not very well, it should be added, but we do have evidence of this in action courtesy of Sam Bompas of Bompas & Parr:

image1

  1. This video might just be the best thing on the internet (according to KittenCamp, at least):

And this one might just be the worst:

Does that count as link baiting? Sorry…

Until next year!

 

 

Reflections from Strata + Hadoop World: how big data is moving up in the business

As part of our commitment to new and disruptive technologies, we sent Lead Developer Phil Kendall to Strata + Hadoop World in London. As well as taking over our Twitter feed for the week, Phil’s written up a summary of his experience at the conference – enjoy!

One of the themes from the keynotes at Strata + Hadoop World was the idea that big data is moving up in the business. For a lot of companies, big data has been a tactical solution, deployed only to fit a specific need. There were obviously some companies – for example those in the online advertising and mobile gaming industries – who had built their business around a big data model, but for the more traditional industries, big data wasn’t “a part of their DNA”. What we saw at Strata + Hadoop World was some big, risk-averse companies starting to restructure around a big data model: we had both Maite Agujetsas, CTO of Santander Group, and Phillip Radley, Chief Data Officer at BT (watch his keynote here) explaining how they were rebuilding their business with big data as a first class citizen.

One of the advantages of being a tactical solution is the freedom to innovate – and this was the theme of an excellent keynote from Tim Harford of the Financial Times. While making marginal improvements is a valuable activity (to steal from Tim’s keynote, it’s how Team GB won 70% of the track cycling gold medals at the 2012 Olympics), we also need to invest in those ideas which go “outside the box” and can make a radical change to a business, an industry or whatever else. Those ideas are risky – the vast majority of them aren’t going to give a good return on investment. How can we ensure that we’re still going to invest in those issues when big data has become a core, business critical part of a big business?

If you haven’t watched Tim’s keynote yet (and you really should), then don’t expect Tim to provide any answers here – his keynote was more a plea to ensure that we do keep providing that kind of investment, along with some great statistics from medical research in the US which showed that risky research can be as valuable as those small changes in the long run.

Some other themes I picked up on from the conference:

  • Hadoop has been around since 2005 or so. In the past 10 years, we’ve learnt a lot more about what we’re wanting to do with big data, and that’s meaning that Hadoop is starting to show its age. Is the time now right to move to a “2nd generation” product for big data, and is that product Spark? (I may be slightly biased on this one having been to the fantastic Spark Camp by Paco Nathan. The kool-aid was very tasty).
  • How is the Internet of Things and the enormous quantities of data that we’re going to see going to affect how we build systems? Ted Dunning of MapR and Maaten Ectors of Canonical (the people behind Ubuntu) gave different talks on this – Ted’s focused on how to get our existing databases to scale up massively (and you can view a variant of it here), whereas Maarten’s focused on how to push the processing of that data closer to the sensors so that we don’t actually need to send and store all that data in the first place. A different take on the problem came from Simon Elliston Ball of Hortonworks – once we have all these devices pushing out data, who’s going to write the code to interpret the information from each and every one of them? For even a relatively simple project like making his house work out when to turn the lights on, Simon was already writing large amounts of code – so he turned to machine learning to do it all for him. Did it work? Not so far, but the idea of reducing the amount of code that developers need to write in order to deploy a solution is an interesting one.
  • How are we going to deal with the inevitable ethics questions that come out of big data? Majken Sander and Joerg Blumtritt gave a really powerful example in their talk on “Algorithm ethics: The inevitable subjective judgments in analytics”: when we have fully automated cars, who decides what happens in a crash? Should the car swerve out of the way to avoid hitting a 30 year old entrepreneur if that involves hitting a 70 year old grandmother? Perhaps more importantly, how can the general public know which decisions the algorithm is making? The theme was repeated in Francine Bennett and Duncan Ross’s talk “Using data for EVIL” (watch Francine’s summary of the talk here) – which helpfully let us know all the ways in which we can be unethical with our data. But of course they didn’t want us to do that… Aside: if you’re a data scientist actually looking to do good rather than evil, check out DataKind, the charity of which Francine and Duncan are directors.

Where does that leave us all? We know that big data is changing the technology landscape, but in the next few years we’re going to see it change industries outside the high tech sector – and that’s a great opportunity either for new players to come in and disrupt markets, or for incumbents with the vision to invest to reestablish their dominance. In the longer term, the Internet of Things is coming – while it’s very much in its infancy right now, we’re starting to see the beginnings of ubiquitous connectivity. I don’t think anyone has a real handle on how that’s going to change things, either at a technological level or an ethical one. About the one thing I am sure of is that it’s going to be an interesting ride – jump on board, or soon your business will be looking around and saying “where did our market share go?”

Help! I can’t delete my Elastic Beanstalk environment…

In follow up to his last post on using the MATLAB Compiler Runtime with AWS Elastic Beanstalk, Lead Developer Phil Kendall now explains how he worked round some issues he had when deleting an Elastic Beanstalk environment.

So, you’ve had your nice AWS Elastic Beanstalk environment up and running for a while, but for whatever reason you’ve decided its now time to retire that environment. That should be nice and simple: just go to the AWS console and hit the “Terminate Environment” option. It starts chugging away, removing your EC2 instances and the like, but then suddenly it stops with an obtuse error message:

EnvironmentTerminationFailed

(The blacked out squares there are our AWS account number)

With a little bit of thought, you can probably work out that “:DeletionTest” refers to an EC2 security group in your environment, and if we go and look at the security group, we can see that it does in fact contain a reference to the security group we’re trying to delete:

SecurityGroupReference

Removing that reference helps, but we’re still stuck with those “030008803268:rds.ec2sg.765575” and “644125515248:elmo.ec2sg.446077” references. What’s going on there?

The simpler of the two is probably “030008803268:rds.ec2sg.765575″: the clue’s in the name – it’s an RDS security group (note for the potentially confused: RDS security groups are/were a concept which applied only to the older EC2-Classic platform; if your AWS account is relatively recent, you can only use the newer EC2-VPC platform and so won’t ever see an RDS security group – but if you’re reading this post it may well be because you’ve got an RDS security group somewhere!)

However, the console isn’t going to give you any sort of clue as to which RDS security group it is. If you’ve got only a few security groups, you may be able to eyeball them and work out which one contains the reference, but if not you’re probably going to have to pull out the API. The example here is in PowerShell, but you should fairly easily be able to convert it to whatever your weapon of choice is:

Get-RDSDBSecurityGroup | Where-Object { ($_.EC2SecurityGroups | Select-Object -ExpandProperty EC2SecurityGroupName) -contains "awseb-e-mvuaz2etah-stack-AWSEBSecurityGroup-L5YQ4RLDJATB" }

In our case, that finds us the RDS security group quite nicely, and we can again remove the reference to “awseb-e-mvuaz2etah-stack-AWSEBSecurityGroup-L5YQ4RLDJATB”.

Unfortunately, the “644125515248:elmo.ec2sg.446077” reference doesn’t give us nearly such a nice hint as to which service that’s coming from. However, with a hat tip to Craig Watcham, we get the hint that it might be an ElastiCache security group. We can again deploy the API to find out exactly which group it is:

Get-ECCacheSecurityGroup | Where-Object { ($_.EC2SecurityGroups | Select-Object -ExpandProperty EC2SecurityGroupName) -contains "awseb-e-mvuaz2etah-stack-AWSEBSecurityGroup-L5YQ4RLDJATB" }

…and then delete the reference.

After all that, we can hit “Terminate Environment” again and, with a following wind, your environment should go away.

For completeness, if you do want to use the API to find which EC2 security groups reference another one, there’s a couple of commands to run (because the references can be on either the ingress or egress rules):

Get-EC2SecurityGroup | Where-Object { ($_.IpPermissions | Select-Object -ExpandProperty UserIdGroupPairs | Select-Object -ExpandProperty GroupName) -contains "awseb-e-mvuaz2etah-stack-AWSEBSecurityGroup-L5YQ4RLDJATB" }
Get-EC2SecurityGroup | Where-Object { ($_.IpPermissionsEgress | Select-Object -ExpandProperty UserIdGroupPairs | Select-Object -ExpandProperty GroupName) -contains "awseb-e-mvuaz2etah-stack-AWSEBSecurityGroup-L5YQ4RLDJATB" }

As always, any comments, improvements or such like are very welcome.

Getting started with Titanium

They say that a problem shared is a problem halved, so here at Control F1 we’re all about sharing. In this post, Senior Developer Gabby Littler describes a problem she recently encountered with Titanium, and how she overcame it. We hope it might help others who are using this technology for the first time…

As a developer, I’m sure this situation is familiar to you. You’re starting out on with a new technology, and you need to get something working quickly. It can be difficult to find a route into the documentation and find the sections you need to get something up and working. That’s the situation I was in with Titanium a few months ago, so I’ve put together a simple example of an app with a login screen to help get you started. In this article I’ll go through how I handled the login, how I achieved the layout of the screen, the general approach I took to styling it, and how I added finishing touches to make it feel nice and usable. The full project is available here: https://bitbucket.org/controlf1/alloy-logintutorial. Handling the login The login is handled in the doLogin function. In the example this is just a placeholder, but this is where you would add your code to validate the fields and authenticate the user.

function doLogin(e) {
	// Put your login logic here
	alert("Logging in with user name '" + $.usernameTextField.value + "' and password '" + $.passwordTextField.value + "'");
}

Layout The layout is handled in index.xml, using standard controls. To achieve my layout I used three main principles:

  1. If you don’t specify a layout for a component, it will have an absolute layout.
  2. If a component has an absolute layout, its children will be centred in the view unless you specify otherwise.
  3. If a component has a vertical layout, its children will laid out one after the other, you guessed it, vertically.

Using those rules, you can see how my screen is built up. I have the darkBox view that sits neatly in the centre of the window.

<View id="darkBox" class="darkGreenBg rounded" width="80%" height="50%">

Sitting in the centre of that I have the transparentCentredBox. This has a vertical layout for my login controls. It is styled to be exactly the right size for these controls, so they are nicely centred on my screen as well.

<View id="transparentCentredBox" class="widthFill heightSize vertical">

At the bottom of the screen I have a control (in this case a button that links to our website). This is sitting inside an absolute layout but is anchored to the bottom with bottom=“10”. I didn’t specify a left or right setting, so the control is centred horizontally.

<Button id="linkButton" class="heightSize transparentBg white" title="www.controlf1.co.uk" onClick="openLink" bottom="10"/>

Styling The styling for this example is mostly done in index.tss. I use a variety of different styling techniques here. Specific components To style a specific component, I add an entry to the .tss file for the id of that component. For example, the username text field:

"#usernameTextField": {
	autocorrect: false,
	autocapitalization: Ti.UI.TEXT_AUTOCAPITALIZATION_NONE,
	keyboardType: Ti.UI.KEYBOARD_URL,
	returnKeyType: Ti.UI.RETURNKEY_NEXT
},

Specific types of components

For components that all share a group of comment styling elements, I create a class and add the styling to the .tss file. For example the loginControl class is used to style comment elements of my text fields and my login button.

".loginControl": {
	width: "80%",
	top: "10dp",
	bottom: "10dp"
}

Every instance of a control type If I want to style every instance of a particular type of control, I add an entry for that control in the .tss file. For example, the TextField:

"TextField": {
	height: "40dp",
	bubbleParent: false
}

Granular styling

For styles that could apply to lots of different components, for example size constraints, layouts and colours, I create granular style classes. These can be applied easily in the view, are maintainable and make the view code nice and readable. The darkGreenBg class is an example of this. It is declared in the .tss file:

".darkGreenBg": {
	backgroundColor: "#0D6322"
}

It is applied in the .xml as a class wherever it is needed, for example in my darkBox view:

<View id="darkBox" class="darkGreenBg rounded" width="80%" height="50%">

Ad hoc styling You’ll notice that there I have some ad-hoc styling, such as some widths, heights and positions, directly in the .xml file, for example my darkBox view:

<View id="darkBox" class="darkGreenBg rounded" width="80%" height="50%">

I found in some cases where the styling only applies to a single control it’s much more readable and maintainable to add these styles inline. This is a personal preference, and you may prefer to separate all your styles out into the .tss file. Finishing touches I added a couple of finishing touches that make the form feel a bit more polished. Keyboard type To make inputting values feel natural, I set some properties on the text fields in index.tss. For the user name field I turned off auto-correct and auto-capitalisation. I set the keyboard up to expect URLs so email addresses can easily be entered, and I set the text of the return key to Next (for iOS only).

"#usernameTextField": {
	autocorrect: false,
	autocapitalization: Ti.UI.TEXT_AUTOCAPITALIZATION_NONE,
	keyboardType: Ti.UI.KEYBOARD_URL,
	returnKeyType: Ti.UI.RETURNKEY_NEXT
}

For the password field I set the return key text to Go and I turned on the password mask.

"#passwordTextField": {
	returnKeyType: Ti.UI.RETURNKEY_GO,
	passwordMask: true
}

Handle the keyboard return

By default, returning from the keyboard simply blurs its text field. This would make filling in the form a very stilted experience, so to make it slicker I overrode it. I added the onReturn handlers to the text fields.

<TextField class="loginControl" hintText="User name" id="usernameTextField" onReturn="focusPassword"/>

Returning from the user name field focuses the password field. Returning from the password field calls the login code.

Hide keyboard

Users typically expect the keyboard to be hidden when they click outside of a text field. This is done by adding a click listener to your window.

<Window id="window" class="fill lightGreenBg" onClick="hideKeyboard">

The listener blurs the text fields on the screen, which will hide the keyboard.

function hideKeyboard() {
    $.usernameTextField.blur();
    $.passwordTextField.blur();
}

You also need to remember to set bubbleParent for the text fields to false in index.tss. Otherwise click events on these will bubble up to the window and call hideKeyboard, immediately blurring the field again.

"TextField": {
	height: "40dp",
	bubbleParent: false
}

Summary That concludes my article on how to create a simple login screen with Titanium. I hope you find it useful. Feel free to comment below if you have anything to add.

VentureFest: staying ahead in a heady world

You may have seen a few little references to VentureFest on our Twitter feed last Thursday. We spent an enjoyable spring day at York Racecourse writing with 3D doodlers, learning more about equity crowdfunding (shoutout to our friends at SyndicateRoom!) and trying out new apps. Of course, it wasn’t all fun, games and playing with remotely controlled kettles (checking out @appkettlevision is a must for anyone who likes a cuppa). It was also a great opportunity to learn more about upcoming technology trends and meet some new faces; Yorkshire is buzzing with innovative people!

Meanwhile our Marketing Executive Amy was busy gleaning as much digital knowhow as possible. In this post she shares the top tips she picked up on the day.

These days, you can’t help but understand what this does: #

As a technology company, it makes sense that our marketing strategy is based mostly online, and VentureFest York provided an ideal opportunity to check out what others are up to on the World Wide Web.

In David Norris’ talk on Strategic Digital Marketing, he revealed that only 20% of companies think that digital marketing won’t make a difference to their business. That means, whether they measure it or not, 80% of businesses believe that their digital strategy helps them towards their goals. On the consumer side, 90% of people will believe a peer review over anything else.

2015 is the year of connecting with people on a personal level, and it has never been more important.

Here are my key takeaways:

  1. Strategise. So you know what’s round the corner. And you’re already there, looking it right back in the face.
  2. Know your market. Focus only on the areas that are important to you and your business.
  3. Keep up the good work. Set a level you want to work at and keep it consistent, but set realistic goals.
  4. Always look for new ways to put yourself out there.

Of course, like everything, strategy is absolutely key. Ask yourself some simple questions – what do you want to do with your digital marketing? What is the main aim? Who do you need to talk to? For Control F1, it’s about engaging, sharing and learning from others in our lovely techie community and contributing to this. There are many different ways to achieve this; social media, SEO, and email marketing to name but a few! Investing in every single one may not help. To quote David Norris:

“A client I was working with was spending £84,000 a year on Pay Per Click. We had a look at the click rate on these sponsored links and how many leads it generated. Over the several years they had been paying this amount, Pay Per Click generated three leads.”

Three Leads. Now of course if these three leads were each for £2M worth of work and one of them came to fruition, then that would be a different story. But the company in question clearly hadn’t even been taking the time to evaluate their ROI.

In terms of social media, one of David Norris’ key points was never to let you social media accounts go to waste – keep on posting or shut them down!

Luckily, with analytics tools, it’s easy to understand and quantify the effects of digital marketing – especially with social media – accounts now come with an impressive array of free analytics software – Twitter Analytics is a personal favourite!

For us, tweeting isn’t simply about letting our followers know what is happening at Control F1. Instead, we tweet what we are interested in and what our audience will be interested in too; we love technology, so we tweet tech news! We want to engage people, but we don’t want to force ourselves to be engaging.

Blogging is also a great way to increase engagement, helping you to build a following and carve out a place for your company within your chosen verticals. We get different members of our team engaged by writing for our blog, which helps to build their profile and also ensures we have a variety of different voices reflecting the diversity of our business as a whole. Blogging lets people know who you are in more depth, helping to build more meaningful relationships.

Relationships should be reciprocal and as the natural next step for this relationship is listening, please let me know what you think in the comments below!

What to do with an infinite number of monkeys at 3:43 in the morning

Control F1 Product Development Director Dale Reed shares what keeps him up at night…

As an insomniac, my main problem is that my brain sometimes just doesn’t want to go to sleep. Like a petulant child it will sit there either singing the same song over and over again just to annoy me (and never a good one either), or spend hours obsessing over completely ridiculous things. My brain, who throughout the day is normally reasonably helpful, at night suddenly becomes my nemesis, Moriarty to my Holmes, Hyde to my Jekyll, Moby Dick to my Captain Ahab (you get the point). Going forward this anti- brain alter-ego will be referred to as Geoffrey. We all have a Geoffrey in our lives, that annoying friend that thinks he knows everything about every subject ever and just won’t shut up…

Recently, I had read an article about a chap who had decided to test out the infinite monkey theorem (you know the one, if you gave a monkey a typewriter and an infinite amount of time, it would eventually be able to write the complete works of Shakespeare).

Though I always applaud time spent on completely pointless tasks, I took umbrage at his methods. To test out the theorem, he was using distributed computing to generate random words. If any computer created a word that actually made sense and was used in the complete works of Shakespeare, then it was slotted into place throughout the works (so, for example, if it randomly came up with the word ‘of’, then all of the ‘of’s within Shakespeare’s complete tomes were considered complete).

To me this is the application of the Eric Morecambe methodology, i.e. all the right words, just not necessarily in the right order! If I’m employing a monkey and presumably coughing up for all the bananas, then I want to receive the complete works of Shakespeare, written one word after the other as the bard himself would well expect! Just generating random words then plonking them in place when they happen to fit really doesn’t seem in keeping with the theorem IMHO.

To me that was the end of it, nice idea, not too keen on the implementation, move along.

Unfortunately Geoffrey had different ideas.

So there I am, 3:43 in the morning, can’t sleep. Then Geoffrey pipes up…

“What are the odds of a monkey being able to type the complete works of Shakespeare in one go anyway?”

And then spent the next three hours working it out. I don’t know what he’s on but I’d really like him to stop taking it.

So, here it is, my calculations (Ok, Ok my ridiculous semi-conscious brain’s calculations) for getting the complete works of Shakespeare, start to finish.

First, we need to calculate the odds of actually being able to type the complete works of Shakespeare, monkeys or no.

This is actually pretty straight forward:

  1. Find out how many different individual characters Shakespeare used in his text.
  2. Find out how many characters there are in his complete works.
  3. Do some long, long, long, long, long multiplication!

Item 1, number of characters. Now bearing in mind I was trying to sleep and completely refused to get out the iPad and start Googling, despite Geoffrey’s insistence, I just guessed. I reckoned obviously you need a-z (I decided not to worry about upper and lower case), 0-9, spaces, full stops, commas, apostrophes etc. So 26 alpha characters, 10 numeric, plus I reckoned about 14 ‘other’ would be enough, 50 characters in total. It’s a nice round number and should cover most things I hoped.

(Note:

In actuality, once I checked properly there are 55 characters used in the version I have, as follows:

!”&'(),-.:;<?[] _0123456789abcdefghijklmnopqrstuvwxyz|}

So the guesswork wasn’t a million miles away!

We also need to consider the carriage return, so it’s actually 56 in total.

The really sad fact about the above is that I had to write some code to scrape the complete works to pull out this list of characters. I think Geoffrey is getting surreptitiously involved in my waking life now too!)

So now to consider the odds. First I’ve decided to give our Monkey a PC instead of a typewriter. I mean, this isn’t the middle ages, plus it means we don’t have to worry about replacing paper etc., or our simian friend taking the paper and eating it or using it to wipe… Well, let’s not think about it! I also realised we’d need a special keyboard making, with just our 50 characters on it. It’d be a nightmare if he got to the last page then hit the escape key or something by mistake! So, we have our monkey. We have our special 50 character keyboard. His finger is poised and ready to hit the first key. What are the odds that our Simian employee hits the correct first character in our work? 1 in 50, right? There’s a 1 in 50 chance that the key he presses is the correct first character. Now, let’s put that aside for a second and consider the second character. What are the odds that he presses the second character correctly? 1 in 50 again? Well, yes, BUT, unfortunately, if it were that easy we’d all win the lottery every week.

The problem is we need to calculate the odds of him hitting the first key correctly AND then the second key, not each key individually. So this means, the chances are 1 in 50^2. Or 1 in 2500 in other words. Third key we have to multiply by 50 again (1 in 50^3) and so on. As an example, in my copy of the complete works the first sentence is from the first sonnet, and is ‘from fairest creatures we desire increase,’, which is 42 characters long. To get that entire string, we’re looking at odds of 1 / 50^42. Or in other words, one in 26,539,768,742,087,885,687,527,987,706,116,853,281,844,223,293,134,704,738,830,807,228,099,854,336.

For one pretty short sentence. Hmm. Even the lottery is looking easy to win against those kinds of odds!

The complete works of Shakespeare is approximately 5 million characters long.

So the odds of writing out the complete works of Shakespeare using a 50 character keyboard is 1 in 50^5,000,000. Don’t worry, I’m not going to write that out in long hand; however we can determine that it’s a number with around 10 million digits. In other words, twice as many digits as the complete works of Shakespeare. Basically, it’s a lot. More than Microsoft had in mind when they created BigInt, anyway!

Of course, all of this is based on a single monkey with nothing better to do. Now to me if we’re going to apply infinity to the equation (i.e. infinite time), why not just apply that to the number of monkeys instead?

So, what if we had an infinite number of monkeys, with a keyboard each?

Well, in that case, the odds are pretty irrelevant. As ridiculously huge as our odds are, our number of monkeys is infinitely huger, and any number divided by infinity is basically zero (just as any number divided by zero is effectively infinity). So, we can then determine that at least one of our infinite number of monkeys will, on the first go, immediately type out the complete works of Shakespeare, from start to finish, no mistakes. Indeed, as we have an infinite number of monkeys, then actually multiple monkeys will do so. Taking this to a logical conclusion, a subset of our infinite monkeys will write the complete works of Shakespeare the first time they attempt it, and as any subset of infinity is itself (arguably!) also infinity, we can surmise that an infinite number of monkeys will write the complete works of Shakespeare, first time.

Putting aside the mother of all copyright battles that is bound to ensue (and if anyone is going to start the mud-slinging, it’s likely to be an infinite number of monkeys!), what does that give us?

Well, to me the original theorem just isn’t thinking very logically. If you are going to apply infinity to the argument, clearly giving us an infinite number of monkeys to work with is way more sensible than a single monkey having an infinite amount of time. Taking into account time required for banana breaks, throwing feces at passers by etc., we can I think safely assume one key press every 2 seconds on average. 5 million key presses = 10 million seconds. Which is 166,667 minutes, which is 2,778 hours, which is just under 116 days.

So in conclusion, with an infinite number of monkeys, we will receive an infinite number of copies of the complete works of Shakespeare, within around 116 days.

And, hopefully, get some sleep.

…Of course, the fact that I decided not to include upper case characters has been bothering me…

CF1 shortlisted for Fast Growth Business award

Here at Control F1 HQ, we’re excited to be able to share with you the news that we’ve been shortlisted for a Yorkshire Business Masters award.

We’re one of four businesses that will be battling it out for the title of “Fast Growth Business” at this year’s awards, spearheaded by TheBusinessDesk.com.

This financial year marks our most impressive growth to date as a business, and we’ve doubled in size, moving into a brand new office in Bates Mill to accommodate our growing team. We’re working with a stellar list of clients too, including big brands such as the RAC, Travis Perkins and the NHS.

According to the Yorkshire Business Masters event organisers, there were “a record number of entries” this year, so we’re proud as punch to have made the cut!

Judges making the shortlisting included the region’s deputy agent for the Bank of England Will Holman, and UKTI regional director Mark Robson.

We’re looking forward to having a good old knees-up at the awards dinner on February 26th – wish us luck!

How to use the MATLAB Compiler Runtime with AWS Elastic Beanstalk

One of Control F1’s current projects is working alongside the RAC on their RAC Advance platform, a revolutionary new technology that uses the latest diagnostic software to deliver an enhanced breakdown service for customers. 
As is so often the case when working with innovative new technologies, our team have uncovered a number of solutions and fixes that haven’t been documented in the past. And because we’re all about sharing, lead developer Phil Kendall explains here, (for the technically minded amongst you), some of the team’s learnings re: using MATLAB Compiler Runtime with AWS Elastic Beanstalk….

One of the components of the RAC Advance system (an ASP.NET web application) we’re working on makes use of MATLAB to perform some of the advanced calculations that make the platform a success.

In order to provide scalability and reliability, the component is deployed via AWS Elastic Beanstalk. When Control F1 began their work with the RAC, the component was hosted on a custom AMI which had to have the MATLAB Compiler Runtime manually installed, and then the AMI had to be maintained over time. One of the improvements we were hoping to make to the system was to reduce the number of manually maintained components in the system, so we began looking at whether it was possible to install the MATLAB Compiler Runtime automatically via Elastic Beanstalk’s configuration mechanism (.ebextensions).

To my slight surprise, this didn’t seem to be anything anyone had ever done before (or at least, had ever publicly documented how to do). Fortunately, the solution turned out to be not too complicated, although there are a couple of rough edges I’d like to smooth off:

  1. Download the appropriate version of the MATLAB Compiler Runtime from Mathworks’ website, and put this into an S3 bucket you control. You’ll need to make the file publicly readable.
  2. Create the following file and save it as “matlab.config” in a “.ebextensions” folder of your web application (note that the spacing is crucial here, and that’s it’s all spaces, not tabs):

sources:
  c:\\MatlabCompilerRuntime: https://s3-eu-west-1.amazonaws.com/your-bucket-name-goes-here/MCR_R2014b_win64_installer.exe
commands:
  01_install_matlab:
    command: setup.exe -agreeToLicense yes -mode silent
    cwd: c:\\MatlabCompilerRuntime\\bin\\win64
  02_modify_path:
    command: setx PATH "%PATH%;C:\Program Files\MATLAB\MATLAB Compiler Runtime\v82\runtime\win64"
  03_reset_iis:
    command: iisreset

(Note that the config files within the .ebextensions folder are run in alphabetical order so if you’ve already got other extensions in there, you may want to rename the file so that it’s run in the correct order).

To some extent, that’s all there is to it, but it’s probably worth an explanation as to how that’s working. Essentially, there are two main steps: the first, indicated by the “sources” stanza, downloads a ZIP file from the specified location (our S3 bucket) and expands it into the specified folder. While the MATLAB Compiler Runtime installer has an “.exe” extension, it’s actually a self-extracting ZIP file, and the Elastic Beanstalk functionality is perfectly happy to deal with this.

The second step is to actually run the installer – this is what is accomplished by the “01_install_matlab” stanza, which uses the silent install functionality of the installer. (If you’re using the 32-bit runtime, you’ll need to modify the path specified in the “cwd” line). Finally, we kick IIS to pick up a modified PATH which includes the native MATLAB DLLS (“03_reset_iis”).

While this solution works, as noted above there’s a couple of things I’d like to improve:

  1. Ideally, you wouldn’t have to make the file in the S3 bucket publicly readable. However, the “sources” functionality supports only publicly readable files at the moment, so there’s no easy way round this. It would be possible to install other components onto the box which would let you authenticate and download a protected file, but that seems like overkill. Hopefully Amazon will add authentication support for “sources” at some point.
  2. The observant will note I skipped over the “02_modify_path” stanza – what’s that for? As noted, when the MATLAB installer finishes, it modifies PATH to include the location of the native MATLAB DLLs. However, the installer runs as a background task, so the actual command returns instantly, and crucially before it has modified PATH. As far as I know, there’s no way of knowing when the installer has actually completed, so we bodge around this by manually adding what we know is going to be added to PATH, which means that IIS will be able to find the DLLs once they’ve been installed. This is obviously not the nicest solution in the world, but it works.

Hopefully this little guide helps anyone else who’s looking to do this sort of thing – please leave a comment if there’s anything you’d like to ask, or if you can help with those improvements!

Phil Kendall
Lead Developer

CF1 win Manchester Study Group’s SME competition!

We’re delighted to have won a place on Manchester University’s 2015 European Study Group in Industrial Mathematics.

The win will allow us to collaborate with the brightest and best in mathematical and computational science to further our work in the field of telematics. (That’s using technology to monitor the movement of remote objects such as fleets of vehicles, in case you were wondering!)

Telematics is becoming increasingly important to the insurance industry, for example, where placing a tracking device in vehicles allows insurers to monitor driver behaviour, estimate risk and reward those who drive more safely.

Over the next two years the volume of data generated by vehicle-based users is expected to grow to several million. But our work goes beyond driver behaviour, also looking at real-time responses to changes in circumstances, including dynamic factors such as weather, road works, accidents and elements of road design.

The specialist mathematical skills provided by Manchester University will help us in our long-term mission to build a centre of excellence right here in sunny Huddersfield, outside of London and the Oxbridge corridor.