It’s funny how a silly idea can end up taking over your life.
Pretty generic idea right? That kind of describes every single website-as-a-service out there, however programming is an incredibly creative persuit so as dry as my remit sounded the execution could be as weird as I wanted.
This is the result
The site is billed as Glasgow’s premier website as it provides a single critical observation, is it Taps Oan or Taps Aff?
Nationally endorsed sun-stroke
There’s an unagreeable temperature upon which Glaswegian’s will deem it appropriate to start undressing in response to a lick of heat coming from the sky. Although no-one can settle upon when it’s appropriate (some say never) what we can agree upon is the taxonomy of the conditions: it’s Taps Aff weather.
Removing one’s shirt under favourable atmospheric conditions is not unique to the west-coast of Scotland, but the fervour with which locals descend upon every sun-kissed park, patio and beer garden is a source of civic pride. This could perhaps have something to do with Glasgow receiving the fewest hours of sun per year than any other European city clocking in at an average total of 1202 hours. Even Reykjavik in Iceland pulls in more with 1268 hours per year and it’s a bawhair off being in the arctic circle.
This phrase Taps Aff has therefore come to embody far more than just paradoxical undressing. It represents shucking your responsibilities in favour of topping up your vitamin-D, meeting with friends under the sun and making the most of the good weather as soon as it arrives.
Taps-Aff (Scots Vernacular) Literally “tops off.” The removing of one’s shirt in the event of warm weather, a phenomenon rarely seen in Glasgow. Now an expression describing good times being had.
Antonym: Taps-Oan, “tops on”.
So when is it Taps Aff?
Since its inception the website has been through 3 phases, each time getting better at identifying when it’s Taps Aff:
- A dumb client-side JS driven version
- Slightly smarter PHP server-side implementation
- The current smarty-pants version implemented using Django
Taps Aff v1.0
At first the website would just look at the current temperature in Glasgow, including wind-chill. I very scientifically pulled the threshold of 17°C out of my arse and had the site say Taps Aff if the local temperature was greater, Taps Oan if it was lower.
Here’s the guts of the very first version of the site written using JQuery. Note that all the weather data I retrieved was in Fahrenheit so the actual threshold was 63°F
By this point I figured I was done and I had learnt all I needed about Ajax and Json. That was until I started getting hundreds of visitors per day.
Being a coder I’m by de facto full of hubris so the thought of all that traffic on something I’d put minimal effort into gave me the heebee jeebees. I done the only logical thing: purchased the domain taps-aff.co.uk and started working on a proper version.
Taps Aff v2.0
Version 2.0 of the site gave me a chance to learn more about using a new (to me) paradigm whilst structuring a project. I also had some website work using Zend coming up so I figured learning a lighter PHP framework would be a good stepping stone so I opted to use KissMVC.
Anyone who has had the pleasure of seeing one of their personal projects take off in popularity understands the praise-to-critisim ratio. By the time v2.0 of the site was flying around the internet I was getting thousands of hits per day and only the negative feedback seemed to register. This was almost always to do with the site giving its opinion on the weather and the general public disagreeing.
Taps Aff v2.1
By this point the site was now allowing people to search the weather anywhere in the UK so I was on the receiving end of even more
criticism encouragement. It was important to make the site smarter so I started diving deeper into the weather data I was receiving from Yahoo.
Amoungst Yahoo’s current observations are a bunch of weather codes. When deciding if it was Taps Aff the site started considering these codes along with whether the sun was up. Here’s the weather codes I was using to see whether if it was definitely not Taps Aff.
This incarnation of the site stood for a few years and has served the most amount of traffic over the site’s life. However I was still getting beef off people for the site not being accurate enough. On top of that people were after an API, forecasts, maps…
More importantly I wasn’t too happy having to keep feeding the feature creature in a programming language I wasn’t interested in (sorry php), using a framework that had been dingied by its creator 10 years ago.
Not going to slag Taps Aff v2.1 too much though as it’s seen a lot of visitors.
Taps Aff v3.0
In April 2018 I finally conceded that a complete rewrite of the site would give me the chance to reinvent The Tap and build something I’d be happy to keep working on.
Remember that time spent working on taps-aff.co.uk is meant to be educational and fun? A redesign also would give me the chance to brush up on some software development tools; my idea of a great time.
For the nerds: I decided that for v3.0 what I’d like to play with was:
- Django Web framework for the backend
- Bootstrap 4 for the frontend
- Heavy use of Grunt to automate a bunch of jobs
- Jenkins for CI
- I was tempted to use Vue.js but in the end opted for a static site with this one simple CSS trick Firefox hates
My apologies for the technobabble above, sincerely. What I meant to say was I was going to build a website so fancy I’d be able to mess with it’s millions of settings from my phone.
And what about all those missing features people were after? By rebuilding the site in a more favourable framework anything’s possible. Maps? No bother. API? Piece of piss. Forecasting? Don’t sweat it.
In the end the rebuild and implementation of new features only took a few of weeks and was the requisite level of fun.
The core of whether it’s Taps Aff now looks a bit more professional.
Once weather data has been pulled from Yahoo the database considers whether the conditions are tolerable then has a look at the temperature.
The source code for the current version of Taps Aff is available here.
WHEN IS IT TAPS AFF?
If you’ve read this far you deserve to know. On the first sunny day of the year, if there’s no wind and the sky is clear the threshold sits around 17°C. The “almost there” warning comes on at about 15°C.
Outside of those parameters though it’s all over the place. I suppose you could reverse engineer the default settings if you were really interested.
To be honest though the way the site’s currently configured I find myself wandering around tweaking the settings from my phone as I’m out and about. I suppose the final answer of when it’s Taps Aff is when I decide it is. What a superpower.
Where does all this weather data come from?
Since its inception I’ve been using Yahoo’s free weather service to provide realtime status information along with future forecasting and location services (i.e. converting postcodes to place names).
Recently they updated their service and you need to have a whitelisted application in order to retrieve data from them. I’ve documented the move to this service here along with any sample code you might need to do the same.
To keep in Yahoo’s good-books I heavily cache requests so that I don’t lose access to their free service. I’ve never made a penny off this site and don’t plan on it, so there’s no chance I could move over to a paid-for weather service. For the amount of traffic taps-aff.co.uk receives I’d have to pay the likes of Weather Underground thousands of pounds per year… although being able to do hourly forecasting would be super cool.
This website has been a really weird part of my life for ages now.
I’ve had job interviews where the employer has been more interesting talking about how I parse the weather outside rather than the work at hand. I was a little freaked out another time someone said “you look like that guy who made Taps Aff”.
There’s a whole bunch of things I’d like to get to over time. Not forgetting the personal goal for Taps Aff is to have a sandbox to play in and improve as a developer I would like to investigate:
- Operating the site as an AWS Lambda instance with Zappa
- Getting Docker/Kubernetes involved
- Finish the cross-platform app I started developing (just got push notifications to implement and it’s done!)
Most of all I can’t believe this is what I’m now an expert in, it reminds me of this joke:
A man goes into a pub in a small town and, for whatever reason, gets introduced to the clientele. There’s Farmer Jack, Barman Jim, Maurice “Dancer” and Sheepshagger John. After a few pints, the visitor’s curiosity gets the better of him and he asks John what’s with the nickname.
“See this pub?” asks John, “I built it, but they don’t call me Pubbuilder John? I’m the local doctor, I saved Barman Jim’s life once when he choked on a peanut, but they don’t call me Lifesaver John. Every year, I supply a huge Christmas tree for the village green, but the don’t call me Christmas Tree John.
“But you shag one lousy sheep…”