Dealing with personal opinion in web design

Design can be a very subjective matter. All of us have our personal likes and dislikes when it comes to the appearance of the products, tools and websites we use, but it’s important for both the designer and client to set those aside when you’re working on a web design project.

Websites are designed for their audience, for the users that the owner is hoping will visit and complete some transaction or task. As part of the user-centred design process, we research the users; create personas and use-cases for them, so that we can better understand how to tailor the site to their needs. And yet it’s very common for feedback to come in from members of the project team (on both sides) that involve personal opinion. For example, “I don’t really like the use of green in the sidebar”, or “Perhaps the product image should be a little larger”.

We need to remember that we’re not designing for ourselves, we’re designing for our users and so we need to set aside our opinions and think in terms of evidence. On what basis were these design choices made, and is there evidence to suggest that a different approach would be better?

Andy Clark of Stuff & Nonsense spoke about his approach to this subject on the Boagworld podcast offering the suggestion that if the person persists in pushing their opinion then you could offer a compromise:

“We’ll look at both versions, your version and my version; we’ll launch with my version and then we’ll test yours separately and see if it’s better.”

This puts weight in the designer’s approach, based on their experience and training, whilst exploring the suggestion and incorporating it at a later date if it proves itself through testing.

My First Five Months with ASP.Net MVC – NxtGenUG

At OCC we have been using Microsoft’s web application framework ASP.Net MVC on a number of our projects and products for a couple of years now and really enjoy the flexibility, power and transparency it offers. But it’s still relatively young and new features are added frequently so we’re keen to learn as much as we can from others that have been working with it.

With that in mind, last week James and I attended a NxtGenUG meeting with a talk from Richard Costall covering useful tips and tricks for those using ASP.NET MVC 3.0, based on his first five months of working with it on a new project. Richard demonstrated a simple site created using the new Razor view engine.

His main points were:

  • Creating a ViewModel for each View is generally good practice. This allows data of relevance to the View only (e.g. page title) to be decoupled from core entity data.
  • If @Html.EditorFor() is passed a collection, it will render an editor view for each member of the collection automatically – no need to write looping code.
  • Mixed collections of inherited entities (for example, a shopping basket containing different sorts of product) are very easy to display and edit using MVC. Just create a View to display each inherited type. The MVC plumbing will automatically work out which View to use based on the type of each object in the collection. Ensuring that the correct ViewModel is bound on processing of posted data is a little trickier – if necessary, you can override the default ModelBinder implementation.
  • The Post-Redirect-Get pattern can save writing a lot of ViewModel rebuild code when submitted data is rejected due to a validation failure. Add the ModelStateToTempData attribute (from MvcContrib) to the HttpGet action to override the default ViewModel data with the user’s previous inputs. This pattern also avoids the “resend previously submitted information” warning displayed by the browser when F5 is pressed after a POST.
  • Use Html Extension Helpers to implement non-standard editor controls such as sliders.

There was some lively discussion in the group concerning the relative merits of MVC and WebForms technologies for commercial development. The general view was that MVC was the better technology to use – it produces elegant and compact HTML (no nasty viewstates), plays well with jQuery, enables finer control of rendering and is more easily testable and reusable. However, some thought the lack of rapid prototyping support may make it a hard sell in time-pressed commercial environments; perhaps there is room for some innovation there.

Thanks to NxtGenUG and Richard for an interesting and informative evening!

Set up WordPress in the Cloud on Windows Azure

“The Cloud” is a term that we use to describe a way of hosting and running websites and applications where we ship off our files and databases to whomever we choose and have all the worries of managing the details of hardware, operating systems, networks and datacentres managed for us by them. This way, the specialists at the cloud provider can focus on providing a high quality, scalable platform, and the customer can focus on developing and deploying their website or application.

There are many cloud providers and today we will look at the recently-refreshed Windows Azure from Microsoft.

Windows Azure

Azure is Microsoft’s cloud platform and runs on their datacentres all around the world. As a Microsoft product many web developers might shy away from Azure as an option with concerns it might not support non-Microsoft technologies or frameworks such as PHP, Node.js, Python, or Java – actually Azure supports all these and more; any operating system and any language.

Azure Splash Image

You can learn all about what Windows Azure offers on their “What is Windows Azure?” page, so I won’t go into detail here. Instead, we’ll look at a specific example, getting a WordPress website (build in PHP and usually run on Apache with MySQL) up and running on Windows Azure.

The first step is to set up an account on Azure, you’ll need a phone number and a credit/debit card (which will not be charged) to validate your account. They currently have a 3-month free trial, after that their prices seem very reasonable and like most cloud providers you only pay for what you use.

WordPress on Azure

Once you’re logged in, click on the “Manage” option in the navigation at the top of the screen and you’ll be taken to the page shown below.

The Azure manage page

From here, click on the “Sign in to the Management Portal” link on the left and you’ll be taken to the shiny, new Azure management app.

The first time you access it you’ll get a little tour, but eventually you’ll get to your dashboard, which will be empty and look something like this:

Azure dashboard (empty)

Just a side note: When I registered there was a short wait before the “web sites” option (which we will be using below) was available to me; just a couple of hours.

Choose the “web sites” option on the left and click “create a web site”.

Azure new website screen

Choose the “from gallery” option, highlighted above, and then find the WordPress option in the list of apps available.

Add WordPress from the app gallery

Click the “Next” arrow and choose your website’s URL; leave the database setting as “Create a new MySQL database”; and choose the region closest to you (or your audience).

Configure the initial website settings

Click the “Next” arrow again and confirm your new MySQL database settings, then click the final “Next” icon to complete the process and Azure will begin deploying your new site.

Azure deploying the WordPress site

A few moments later and it will inform you that the deployment is complete, and the site is up and running.

Azure deploy successful

That’s it! Your WordPress site is now live and can be accessed at the URL you configured in the setup earlier; you can get there nice and quickly by clicking the “Browse” icon in the toolbar at the bottom of the Azure portal.

Configure WordPress

As this is WordPress, the first time you access it, it will ask you to complete the installation by making a few configuration choices.

WordPress setup

Click the “Install WordPress” button at the bottom to complete the setup and WordPress will show you a “Success!” message with a “Log In” button that will take you to your new WordPress admin login area. Enter your chosen WordPress username and password and log in to see your blog Dashboard.

WordPress dashboard

You’ll want to visit the Settings section using the menu bar on the left to tweak any final settings, but you’re all ready to go!

Configure Azure

With any hosted service you’re likely to want to be able to view usage statistics, configure FTP and publishing access, etc. So let’s switch back to Azure.

Set up FTP access

Click on the name of your new site in the Web Sites list and you’ll see a one-off startup page welcoming you and giving you some options for how to proceed.

Azure website startup screen

First off, let’s set up FTP access so that you can begin customising WordPress further with custom themes and plugins. Click on “Set up deployment credentials” under the “Publish your app” heading (if you’ve dismissed the welcome screen you can access this through the “Reset deployment credentials” option under the “quick glance” heading on the dashboard).

Azure publish credentials

Choose your username and password, click the tick to confirm and you’ll be sent back to the welcome screen with a success message.

Click the “Dashboard” option at the top of the Welcome screen and you’ll see your Azure website dashboard (you can get back to the welcome screen by clicking the cloud with a lightning bolt icon on the left of the dashboard option).

Azure website dashboard

Here you can see a wealth of usage information, as well as plenty of further configuration options. If you scroll down a little, you’ll find your FTP address on the right, under the “FTP hostname” heading. Use this along with the credentials you just set up and you can begin uploading to, and editing your, WordPress installation.

Publishing alternatives

If you use git as your source control you can configure Azure to have its own git repository for your website, which you can push updates to and it’ll build and deploy your changes automatically. Click the “Set up Git publishing” option to be guided through that.

Azure set up git

You also have the option of linking your site to TFS (Team Foundation Server) for publishing via that code-base, or you can download a publishing profile to load into Visual Studio to allow direct publishing from there.

To Conclude…

I’m really impressed with Microsoft’s cloud platform; Azure is beautifully designed with lots of thoughtful options and a clear user experience. Hopefully you’ll agree that setting up WordPress is a breeze, and it’s not the only option, Azure also has off-the-shelf installations of Drupal, Joomla and Umbraco in its gallery and I’m sure the list will continue to grow.

In the future I’ll be writing about deploying a custom .Net web application to Azure so keep an eye out for that!

Stop serving insecure files over a secure connection

I’m sure you’ve come across IE7′s warning “This page contains both secure and nonsecure items. Do you want to display the nonsecure items?” Or IE’s more recent warning “Do you want to view only the page content that was delivered securely?” Other browsers have similar messages, which will rightly unnerve cautious internet users.

These warnings are the result of the page being secured, delivered over HTTPS, but some of the page’s resources being delivered using HTTP. It’s a simple thing to overlook if you have a site that has both secure and unsecured areas, but share master pages, or other code that might link to JavaScript, CSS, and image files.

Thankfully there are a couple of really simple solutions:

Use relative paths

In your link to the resource, be it an src attribute in HTML or a url in CSS, you can use a relative path, which will automatically take on the same protocol as the current page.

For example, if you were linking to a background image from your CSS, you could use background-image: url(images/bg.png); which would look for an images directory in the same folder as your CSS file and find bg.png in there.

Omit the protocol

Technically this is simply another type of relative path, only this time you leave off just the http or https from the beginning of the path.

For example, if you were linking to Google’s Content Delivery Network to get your copy of jQuery then you could use <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> and the browser will fetch the script using whatever protocol the page is using.

Improve WordPress page speed without plugins

There are plenty of WordPress plugins out there that promise to improve your page speed in various ways, but the truth is you can do a great deal without resorting to them and just making a few simple but effective changes to your Apache configuration. In fact, this article applies equally to any Apache website, not just WordPress.

As we know, keeping our page load times nice and snappy is the key to happy visitors and one of the important factors in SEO. Whilst it’s something to take seriously, it’s not too hard to understand with some pointers. This post will take you though the easy wins that are often overlooked when setting up a new WordPress site:

We’ll be using Google Page Speed and Yahoo’s YSlow browser plugins as a way of measuring the improvements in our page speed and getting tips for where to focus our efforts.

Leverage Browser Caching

Browser caching is when the server tells your browser how long to cache copies of your site’s files; the HTML, CSS, JavaScript, images, etc. The server does this using “HTTP headers” it attaches to the files it sends to the browser, in this case specifically the cache-control header, which specifies the number of seconds the browser should keep hold of the file before it should ask for a new copy.

If you open up Firebug and switch to the “Net” tab, or the alternative if you’re using developer tools in another browser, you should see a list of all the resources your page is sending to the browser (you might need to refresh the page to get this).

Screenshot of the Firebug Net tab without browser caching

Without browser caching we can see that all the page's resources are being downloaded from the server

The “Status” column shows us that all our page’s resources are being delivered by the server – this is what the “200 OK” status means. We want to change this so that the browser gets the resources from its cache, which is far quicker.

To do this we will use the Apache mod_expires module, which will allow us to define how long the server will tell the browser to cache the various types of resource.

First you’ll need to endure that mod_expires is enabled on your server, so open up your Apache httpd.conf file and search for the line LoadModule expires_module modules/mod_expires.so it’s commented-out by default so uncomment it or add it in as necessary.

Next, add in the configuration. Just like for compression, above, this can be added to the http.conf or .htaccess files.

For our site, we use the following configuration:

# Content expiration headers
<IfModule mod_expires.c>
    ExpiresActive On

    ExpiresDefault "access"

    ExpiresByType text/html "access"
    ExpiresByType text/xml "access"
    ExpiresByType application/xml "access"
    ExpiresByType application/xhtml+xml "access"
    ExpiresByType text/css "access plus 1 month"
    ExpiresByType text/javascript "access plus 1 month"
    ExpiresByType text/x-javascript "access plus 1 month"
    ExpiresByType application/javascript "access plus 1 month"
    ExpiresByType application/x-javascript "access plus 1 month"
    ExpiresByType image/gif "access plus 1 month"
    ExpiresByType image/jpg "access plus 1 month"
    ExpiresByType image/jpeg "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType application/pdf "access plus 1 month"
    ExpiresByType application/x-shockwave-flash "access plus 1 month"
    ExpiresByType image/ico "access plus 1 year"
    ExpiresByType image/icon "access plus 1 year"
    ExpiresByType image/x-icon "access plus 1 year"

    # Need to register the icon mime type
    AddType image/vnd.microsoft.icon .ico
    ExpiresByType image/vnd.microsoft.icon "access plus 1 year"
</IfModule>

Let’s break this down:

  • ExpiresActive On switches on cache-control for all our resources.
  • ExpiresDefault "access" sets the default cache expiry to be instant – as soon as the content is accessed.
  • The following lines are all similar to ExpiresByType text/css "access plus 1 month" where we say what type of resource we are talking about (in this case CSS files) and how long they should be cached (in this case 1 month after they are accessed).
  • Note that the HTML and XML types are all set to “access”, this means they won’t be cached by the browser. We chose to do this so the user is guaranteed to see the very latest content, but what you choose will depend on your site.
  • The final couple of lines add in a non-standard type of image/vnd.microsoft.icon, which is used by favicons, and then adds an expiry for that type.

After making this change, restart your server and take another look at your page. The first time you look at it, it will still request all the resources from the server (as it hasn’t been told to cache them yet) but when you look at the headers of one of your files you’ll see the new cache-control header is in there.

Screenshot showing the cache-control header

Note the "Cache-Control" header is now present

The next time you refresh your page, your browser will know to get these resources from its cache rather than request them from the server, so your new page load should look more like the following:

Screenshot of the Firebug Net tab with browser caching

With browser caching enabled we can see that all the page's resources are being fetched from the browser's cache

Much better! Now all our content is coming straight from the browser cache (denoted by the “304 Not Modified” statuses) and you can see the loading speeds are all significantly faster.

Enable Compression

When the server sends information to the browser it can be configured to compress the data in order to make the loading speeds quicker. To enable compression in Apache, first you will need to check that mod_deflate and mod_headers are enabled on your server, so open up your Apache httpd.conf file and search for the following lines, they are commented-out by default so uncomment them or add them in as necessary:

  • LoadModule deflate_module modules/mod_deflate.so
  • LoadModule headers_module modules/mod_headers.so

Next, add in the configuration. This can be added to any of the following locations:

  • The base-level of the httpd.conf file so that it applies to all your server’s sites.
  • Into one of the <location> sections so that it applies to just that location’s files.
  • Into a .htaccess file so that it applies to just the files governed by that file.

For our site, we use the following configuration:

# Compress text, html, javascript, css, xml
<IfModule mod_deflate.c>
    # The list of mime types we want to compress
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE image/svg+xml
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/atom_xml
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/x-javascript
    AddOutputFilterByType DEFLATE text/javascript
    AddOutputFilterByType DEFLATE text/x-javascript

    DeflateCompressionLevel 9

    # Netscape 4.x has some problems...
    BrowserMatch ^Mozilla/4 gzip-only-text/html

    # Netscape 4.06-4.08 have some more problems
    BrowserMatch ^Mozilla/4\.0[678] no-gzip

    # MSIE masquerades as Netscape, but it is fine
    # BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

    <IfModule mod_headers.c>
        # Make sure proxies don't deliver the wrong content
        Header append Vary User-Agent env=!dont-vary
    </IfModule>
</IfModule>

Let’s break this down:

  • There are a number of lines similar to AddOutputFilterByType DEFLATE text/html – these lines tell the server to compress specific types of file, in this example, HTML files. Here we list all the types of file we want to compress and anything we leave out will be sent normally. Note that images and PDFs are not included, it’s only text-based files.
  • DeflateCompressionLevel 9 sets the compression level to its highest. This will take more processing power so adjust this according to your needs.
  • There are a some lines that begin with BrowserMatch, these take care of compatability with some older browsers.
  • Finally there is a section that ensures proxies work well with our compression.

Now that’s all set up Apache will compress all the content it can and, using Firebug, you’ll see both the size and load time of all the text-based resources drop nicely.

Disable ETags

A common complaint of YSlow is that “There are x components with misconfigured ETags” – because we have taken control of our browser caching, we don’t really need ETags any more (they are just another way for your browser to control its cache) so the simplest solution is to turn them off.

To do this you’ll need to have mod_headers enabled (as for enabling compression, above) and add the following to your httpd.conf or .htaccess file:

# Turn off ETags as we're manually managing our caching
<IfModule mod_headers.c>
    Header unset Etag
    FileETag none
</IfModule>

This removes the Etag HTTP header and YSlow will stop complaining and give you an A-grade for ETags.

Follow our developers at Dev Camp

Day 1 was spent settling in and setting up in the beautiful cotswolds.

After supper and before turning in, they get stuck into business splitting up the application tasks thus:

  • Server-side – RavenDB and ASP.Net MVC – Mariusz and Neil
  • Client-side – Backbone.js and HTML5 – Tomasz (and Andrew, when he arrives)
  • UX – CSS framework(s) and JavaScript – Luke

They will do a fair bit of pair programming before moving on to parallel development after getting the basics done.

Follow their Day 1 activities on their OCC Dev Camp blog

They are covering a lot of ground during the week, starting with Rapid, reponsive UI development and looking in some depth at the many CSS frameworks and Responsive Web Design.

Follow the OCC Dev Camp week progress.

Dev Camp kicks off in the Cotswolds

Some of our developers have gone camping. Dev Camping.

All Set Up - raring to go!

5 of our IT consultants have disappeared to deepest Gloucestershire where they have set up camp where they aim to do some amazing things, experimenting with some of the latest technologies and bring this experience back to web application development at OCC.

You can read about the OCC Dev Camp on their own blog. Please do interact with the guys via their blog, post comments, give useful tips, or if you wish to know about anything you read about on their blog.

Tips for streaming video with Amazon CloudFront + Flowplayer

Flowplayer is a Flash-based video-player that supports streaming video using the Adobe’s Real-Time Messaging Protociol (RTMP). Amazon CloudFront is a content-delivery network (CDN) tied in with Amazon’s Simple Storage Service (Amazon S3), and can stream via RTMP. Great! This is a simple-to-set-up, cost-effective, and reliable video-on-demand system.

Where you can get a little bit tangled up is the way the video resource is identified to the player. Following the recipe for Flowplayer with the RTMP plug-in, you need two values, the url property of the clip, and the netConnectionUrl of the plug-in. The second of these is the URL of the streaming distribution from CloudFront with /cfx/st added to the end, as in rtmp://s2xxxxxxxx.cloudfront.net/cfx/st .

The clip’s url property is based on its Amazon S3 object key.  The instructions in Amazon’s developer guide says mysteriously:

To serve MP3 audio files or H.264/MPEG-4 video files, you might need to prefix the file name with mp3: or mp4:. Some clients can be configured to add the prefix automatically. The client might also require you to specify the file name without the file extension (e.g., magicvideo instead of magicvideo.mp4).

Some experimentation indicates that with Flowplayer you add the mp4: prefix and can omit the .mp4 suffix. Also when they say ‘file name’, they mean the whole object key, including any slashes. So if the clip is stored on S3 as foo/bar.mp4, then the clip’s url property is mp4:foo/bar.

Choosing agile development

The oldest software process is “code and fix”. This actually works on small one-man projects, but as a system grows, bugs become harder to fix. A typical sign of such a system is a long test phase after the system is “feature complete”. Such a long test phase plays havoc with schedules as testing and debugging is near impossible to schedule.

The classic response comes from engineering, whose methods try to plan the software process in detail for a long time span. The goal of engineering methods is to define a process that will work well whoever happens to be using it.

In an attempt to strike a balance between these two approaches, “agile” methods appeared and current best practice at OCC follows an adaptation of an agile methodology.

Agile methods follow iterative development: frequently producing working software with subsets of required features.  This kind of adaptive process requires a close relationship with the client and encourages adaptive development. The advantage is that this lowers software risk – the client sees what they are getting early. However, the project needs to be held within the client’s business constraints – we are usually hired to deliver business critical systems on time and on budget.

At OCC we usually work on fixed-price contracts. Clients issue requirements, ask for bids, accept a bid, and then the onus is on us to build the software.  A fixed price contract requires stable requirements and hence a predictive process.

We cannot fix all of (time, price & functionality) in software projects. The usual agile approach is to fix time and price, and to allow the functionality to vary in a controlled manner. At OCC we fix price and functionality and manage time in a controlled manner – at our own risk. That is, we typically guarantee delivery of agreed functionality for an agreed price. We then work towards the agreed deadline. As software development is not a predictive process the deadline is at risk.

In practice, OCC accepts the risk of slippage on fixed-price contracts because we are good at estimating timescales. For large projects, we often advise breaking the project up into smaller contractual projects to contain risk for both parties.

This behaviour by OCC means our method is best described as an Agile method called Feature Driven Development[1] (FDD). Feature Driven Development separates into two distinct project phases:

  1. Pre-proposal (Develop an Overall Model, Develop Features List and Plan By Feature) is a “one time” process and leads to the project proposal. If the project initiation is long and complex this becomes it own small consultancy project on a time & materials basis.
  2. The second construction phase is iterative and proceeds in a [design by feature - build by feature] manner incrementally delivering the project with high client visibility.

We’ve been developing software since 1989 constantly enhancing and adapting our methodologies and perfecting our processes, enabling us to deliver original, robust and flexible IT soltutions.

Online video content using Amazon S3 for TaxTV

The conventional approach to making videos or other data available online is to buy a server and host it at an ISP. This requires up-front capital costs for the server, and development of systems to keep track of backups, redundant copies, and scaling up as your needs increase. An alternative approach is to use storage web services, such as Amazon’s Simple Storage Service, or Amazon S3 for short. Your files are stored on the same highly scalable, reliable, fast, inexpensive data storage infrastructure that Amazon uses to run its own global network of web sites. They only charge for storage you use (starting at 15¢ per gigabyte-month), so the costs start low and ramp up as you gain traffic. Your development time is freed up so you can spend more working on the more interesting aspects of your application.

TAXtv (http://taxtv.co.uk/) is a subscription-only monthly video of tax news and information. The episodes are viewable by subscription only, and the editing and production of the video files is contracted out to Video Inn Productions. OCC’s task was to provide a convenient way for Video Inn to upload the files to the web site and for the editors of the site to obtain a unique URL for the episode to include in the monthly mail-out. To do this we used the service from Amazon called Simple Storage Service, or Amazon S3 for short.

The Trouble with Videos

If a picture is worth a thousand words, a video is worth a million: less poetically, an episode of TAXtv weighs in at about 200 MB. You generally want to offer users a choice of sizes, so we could reckon on an episode being 500 MB. In the case of TAXtv, we can delete old episodes; a site with videos that do not expire would need to budget for a lot more storage.

There are two other limits we may bump in to: monthly download caps, and maximum data rate. Assuming subscribers watch the video once each, we can multiply the number of subscribers by 200 MB to get the monthly download requirement. Someone watching in real time needs to fetch the video data at around 1 Mb/s to avoid pauses for buffering. With a monthly subscription, the majority of views can be expected to fall in the two days after an episode is released; worse than that, we can expect them to fall mostly in office hours. So we can estimate the necessary data rate by dividing the monthly bandwidth by 16 hours.

Subscriber count 100 1,000 10,000 100,000 1,000,000
Monthly bandwidth/GB 20 200 2000 20,000 200,000
Data rate/Mb/s 3 28 280 2,800 28,000

These are just rough figures, but they show that 1000 subscribers would be pushing the limits of a shared host, 10,000 subscribers exceeds the capacity of a dedicated server with 100 Mb/s Ethernet and 100,000 exceeds Gigabit Ethernet: it will need a server farm, not just one server.

Obviously you don’t expect 100,000 subscribers on day one. The headaches start because you need to worry about future requirements while deploying even the small-scale version. This entails buying server hardware before you have the subscriber numbers to pay for it. You also need to plan ahead for when you need to scale up to a server farm rather than a single server.

Amazon S3 and Amazon CloudFront

Obviously Amazon have had to solve this problem for their own massive datacentres, and they are willing to sell their solution as a service, Amazon S3. The idea is to pay just for the capacity you use, without needing to know the details of hardware and configuration.

S3 objects can be downloaded via normal URLs, or for greater performance we can use Amazon’s content-delivery network, Amazon CloudFront. This gives each person downloading the file the lowest-latency, highest-bandwidth connection to the data, using Amazon’s edge servers. CloudFront also supports streaming, using the protocol understood by Flash video players.

We developed a small web app that presents a form for uploading video files directly to Amazon S3. This is great because it saves us the trouble of handling the uploaded files and then copying them to S3 ourselves. The form includes a digital signature which means we can allow Video Inn to upload videos without giving them the keys to the S3 account. Our app stores the URLs of the uploaded files against the episode number, and then produces a URL for inclusion in the monthly mail-out.

The episode page uses the same embedded video player as before, Flowplayer 3.1. The difference is that we activate its streaming plug-in, and supply URLs referring to our distribution on Amazon CloudFront instead of on our own server.

Bottom Line

Uploading and downloading the videos during development cost us about 30¢, which is a lot easier to pay up-front than £5000 for a dedicated server and hosting. Not only that, but the development time was reduced by eliminating the need for us to plan and deploy a scaleable solution, or even to purchase and deploy the streaming server. The existing shared hosting will suffice for the episode page and the editing app.

As the number of subscribers increases we would expect the Amazon CloudFront cost to increase accordingly:

Subscriber count 100 1,000 10,000 100,000 1,000,000
Monthly bandwidth/GB 20 200 2000 20,000 200,000
Monthly CloudFront cost $3 $30 $300 $2500 $17,000

These figures are approximate and ignore a few dollars spent on S3; the important thing is that you don’t have to pay for 1,000 subscribers’ usage until you have 1,000 subscribers.