14 coaches online • Server time: 03:19
* * * Did you know? The fouliest player is Bruce Wayne XVII with 2010 fouls.
Log in
Recent Forum Topics goto Post Gnomes are trashgoto Post Roster Tiersgoto Post Gnomes FTW! (Replays...
Christer
Last seen 10 minutes ago
Christer (5)
Overall
Super Star
Overall
Record
22/4/11
Win Percentage
65%
Archive

2024

2024-03-31 20:20:37
rating 6
2024-03-30 15:14:25
rating 6
2024-03-09 00:15:17
rating 5.5
2024-02-02 13:57:16
rating 5.9
2024-01-28 12:41:38
rating 6
2024-01-14 13:14:20
rating 6
2024-01-07 00:13:05
rating 6
2024-01-05 18:07:03
rating 5.9

2023

2023-12-29 22:52:22
rating 6
2023-12-21 21:21:09
rating 6
2023-12-19 16:04:27
rating 6
2023-11-02 13:35:55
rating 6
2023-10-03 18:18:21
rating 6
2023-09-13 19:12:07
rating 6
2023-07-12 18:17:17
rating 5.9
2023-07-11 22:33:25
rating 6
2023-06-29 11:09:33
rating 6
2023-05-27 23:06:09
rating 5.4
2023-05-10 11:45:33
rating 6
2023-05-03 21:31:28
rating 5.9
2023-04-25 18:01:24
rating 5.6
2023-01-29 15:52:51
rating 5.8
2023-01-21 18:35:18
rating 6
2023-01-11 12:39:37
rating 5.4
2023-01-02 18:57:10
rating 6

2022

2022-12-31 12:10:19
rating 6
2022-11-30 23:28:31
rating 5.6
2022-03-28 15:32:21
rating 5.8

2021

2021-10-16 20:23:20
rating 5.9
2021-09-02 11:32:40
rating 6
2021-08-27 23:04:22
rating 6
2021-08-06 23:08:34
rating 5.8
2021-07-26 01:26:31
rating 5.8
2021-07-20 02:46:59
rating 6
2021-07-07 20:30:33
rating 5.9
2021-06-14 14:24:30
rating 6
2021-03-09 00:39:11
rating 5.9

2020

2020-12-09 11:20:11
rating 6
2020-11-30 18:03:36
rating 5.8
2020-10-13 11:59:57
rating 5.9
2020-08-08 22:48:43
rating 5.8
2020-08-07 21:32:26
rating 5.9
2020-03-18 14:09:47
rating 6

2019

2019-12-13 21:32:02
rating 6
2019-11-25 16:00:40
rating 5.9
2019-04-14 23:33:08
rating 6
2019-04-07 16:59:39
rating 6
2019-04-07 00:55:26
rating 6
2019-01-08 15:27:38
rating 5.9
2019-01-05 02:58:18
rating 5.8

2018

2018-08-17 17:28:31
rating 6
2018-08-15 00:05:40
rating 6
2018-07-17 20:17:40
rating 6
2018-06-28 14:28:08
rating 5.9
2018-05-23 17:55:10
rating 6
2018-05-10 22:42:46
rating 6
2018-05-09 19:42:28
rating 6
2018-04-30 10:44:23
rating 5.8
2018-04-23 12:33:02
rating 5.8

2017

2017-04-23 18:06:35
rating 6
2017-04-06 23:00:56
rating 6
2017-04-03 19:06:00
rating 6
2017-03-29 22:35:46
rating 6
2017-03-25 16:18:39
rating 6
2017-03-11 21:24:26
rating 6
2017-02-14 14:23:58
rating 6
2017-02-10 14:54:03
rating 6

2016

2016-11-30 00:04:21
rating 6
2016-11-27 23:40:04
rating 6
2016-11-17 18:18:07
rating 6

2015

2015-09-06 23:59:26
rating 6
2015-01-24 15:56:29
rating 6
2015-01-22 13:10:32
rating 6
2015-01-19 21:20:53
rating 6
2015-01-10 19:03:45
rating 6

2014

2014-09-09 15:35:53
rating 6

2013

2013-04-26 11:48:40
rating 5.7

2012

2012-12-18 17:37:29
rating 5.9
2012-11-18 18:19:19
rating 6
2012-09-25 13:47:16
rating 5.6
2012-08-15 12:31:53
rating 5.9
2012-08-10 23:12:22
rating 5.9
2012-06-27 22:53:48
rating 5.9
2012-04-10 11:56:38
rating 5.9
2012-03-07 13:52:00
rating 5.9
2012-02-16 16:59:56
rating 5.9
2012-02-04 19:00:41
rating 5.3

2011

2011-07-25 23:32:43
rating 5.6
2011-05-23 13:12:52
rating 5.6
2011-02-04 14:26:18
rating 5.4

2010

2010-03-26 11:38:41
rating 5.1
2010-03-01 12:16:53
rating 5.6

2009

2009-12-08 16:40:30
rating 5.8

2008

2008-09-11 14:47:19
rating 4.1
2008-02-26 21:16:54
rating 5.3
2008-01-21 01:01:58
rating 5.6

2007

2007-11-06 21:23:14
rating 5.1
2007-10-16 00:26:11
rating 5.4
2007-09-30 17:10:03
rating 5.4
2007-09-30 12:01:42
rating 5.3
2007-08-09 12:14:57
rating 4.5
2007-08-06 12:02:52
rating 4.9
2007-08-03 17:56:21
rating 5.4
2018-05-10 22:42:46
18 votes, rating 6
Dev Workflow - Cache Busting
With the updates to my development workflow (as detailed in the previous blog), I added a feature that automates a process called cache-busting.

Before I explain the automated process, I'll begin by going over what it is and why it's necessary.

Beyond media (images and other graphical content), a typical webpage has three different basic components:

- Markup (HTML): The content of the page
- Style (CSS): The layout and "looks" of the page
- Script (JavaScript): The dynamic functionality of the page.

The markup is the root file, and it links to style and script roughly like this (slightly simplified):

markup.html:
<html>
<head>
<script src="script.js" />
<link href="style.css" />
</head>
<body>
Content goes here...
</body>
</html>

When you load a page like that, your browser will first get the html file, and process it. When it runs into the script and style references, it will request these from the web server as well.

Now, if this was always done, the web would be very slow overall, so your browser does something called "caching". This simply means that the browser remembers that it has loaded various things from the server and instead of requesting content it already downloaded before it simply reuses the previously fetched script and styles (the same is done for images, but normally not for HTML files).

This is all great under normal circumstances, but as a developer, I often change these scripts and styles on the server. Without doing anything, these updates wouldn't get loaded by the browsers unless you forced it to (shift-reload does this). This is clearly not very good, as an updated HTML would sometimes require that the script also changes to make sense and to have the webpage display properly.

To get around this, a technique called cache-busting is utilized, where the basic concept is to change the link to the scripts and styles so that the browser thinks it has not seen them before. A naïve way to do this would be to always make new names to your scripts (script-v1.js, script-v2.js, etc) and change your HTML to match. This approach would absolutely work, but would require a lot of manual changes to html files and also require you to clean up old versions of a script when you make a new one.

Instead, a common technique is to add things to the end of the script filename that points to the same file, but has a different URL, such as "script.js?v1". The question mark has special meaning on the web, and the file loaded by the server will be the one before the question mark. That solves one of the problems, but one thing still remains: You still have to change the html file every time a script is changed. I used to have a similar system in place for the site prior to the switch to the new dev platform.

With the changes I've done to the workflow, I was able to introduce a component called "gulp-rev". What this component does is two things:

1. Every time a file is run through it, a "hash" (sort of a finger print) is calculated for the contents. This hash gives a 10 digit hexadecimal string and uniquely identifies the contents of the file.
2. A dictionary is set up which allows conversion from the normal name of the script to a name that includes this hash.

For example, this dictionary from step 2 would contain a record like:

script.js => _a5b623b43d_/script.js

(For those of you who are familiar with gulp-rev, you'll realize this is a custom format and not the default one)

With me processing HTML through a scripting language (PHP in my case), I can modify the HTML above to the following (again, simplified):

markup.php:
<html>
<head>
<script src="<?php echo cacheLookup('script.js'); ?>" />
<link href="style.css" />
</head>
<body>
Content goes here...
</body>
</html>

The cacheLookup() function looks up the hashed version of script.js, and it will be replaced just as if I had written the following:
<script src="_a5b623b43d_/script.js" />
And whenever I process the script.js file with new changes, the hex hash will change and browsers will be happy.

So now you're asking why this doesn't force me to have loads of folders and files on the web server for these scripts. What I've done is to have a web server rewrite, that simply looks for a request looking like: (something)/_(10 digits)_/(something).js and simply treats this as if the 10 digit part isn't there, meaning the file it actually sends for any request like that is (something)/(something).js, which is the original name of the file, and this is the file I've stored on the web server.

And that's it. An automated way for me to do changes to a page and the script (and style) will automatically be updated properly on the browser side. I am expecting this to significantly reduce the moments where I deploy an update and forget to update the html to force a script to be reloaded.. Something that has happened way too often in the past. :)

Note that this new method is not very prevalent on the site just yet (you'll see it in action on the tournaments and boxtrophy pages at the time of writing).

Hopefully, this blog was a bit easier to digest than the previous one, which I fully realize was quite technical and complex.
Rate this entry
Comments
Posted by bghandras on 2018-05-11 07:01:50
Thanks, this was very easy to digest.
Posted by Christy on 2018-05-11 08:53:28
I don't need to know any of this to use your website but it is really interesting to see how it is done and the processes involved. Thanks for taking the extra time to ensure your users are kept up to date with even background changes.
Posted by garyt1 on 2018-05-11 18:56:12
Great work again!