Swedish Army Band Oct. 21, 2018 in Music, Videos
See the Swedish Army Band play their instruments! Sorry about the shakyness.
See the Swedish Army Band play their instruments! Sorry about the shakyness.
Sticking with music, here are three playlists each containing every BBC Radio station in 320kbps, 128kbps, and 94kbps.
This week I used Markov Chains to create folk music. It is output in ABC and rendered using ABCjs.
The music it makes is a little bit strange and it doesn’t really understand how many beats should be in a bar, but if that is a problem up the iterations. Keep raising the iterations and eventually you might even hear a tune that you know!
Under the hood, it is relatively simple. I started by downloaded about 300 folk tunes from Sourceforge. After making an Ajax request to load them, it “parses” each tune into a data structure that is easy to work with. Then two Markov Chains are generated for the title and for the music, the other attributes are just chosen randomly. Tunes can be played back with or without chords, and on any instrument. Click here to start.
I teased with an idea, and here is a very basic demo of it complete and released. Just a warning, it runs poorly, looks bad, and isn’t fun to play. Enjoy!
On a more serious note, while this is not the result I wanted I have definitely learned, or at least re-learned a few things. Looking over it, a project like this is likely too big for me, at my current skill level, with the short amount of time I gave myself.
Not to be confused with chess boxing, although feel free to play box chess boxing. Box chess is a new, dumb, derivative, variant of chess that we almost certainly reinvented down at the pub on a Friday night. To play take a standard chessboard. No piece is allowed to enter or pass through c3-c6, d3, d6, e3, e6, or f3-f6. The knight however can jump over the spaces and land in the center two by two square. It was fun, and strange to play. If bishops feel to week swap the blocked spaces for c4-c5, d3, d6, e3, e6, and f4-f5 to form a ring instead.
Reverse chess is quick, simple, and deadly. Start the game with the row of pawns swapped with the back row. That is it. Unlike a regular game of chess which starts with a slow (relatively) ramp up reverse chess is action packed from the beginning. Every piece is at risk and you are one move away from being checked. I also suspect that this dumb perversion of chess could be solvable, or the start at least be optimised. What is the best first move, take a piece or check? I do not know!
Stratego Chess is chess, played on a Stratego-like grid. The squares d2-d3, d6-d7, e2-e3, and e6-e7 are blocked out and no piece, no even the knight can enter. Unlike Stratego the pieces are not hidden, it is a mix between the two.
This summer I finished my exams, developed this blog, traveled across north-western Europe, graduated from university, relaxed in Center Parcs, moved to Bath, started learning new instruments, and started working for Netcraft. It has been a busy time where I have traveled far and done many things. But when I think about it, I do not feel I have done enough. I feel that I have failed to create. I need to change this.
So, what will I make? I’m honestly not entirely sure. I am planing to start with a couple of Unity games and I am considering resuming work on some previous ideas. From there, I want to work on a lower level, and I have ideas. But, I do not only want to make games and demos. I want to experiment and make new, different things. Maybe I’ll write fiction, compose music, make art. Who knows? I don’t!
Intersection Observer is a relatively new API with decent support that can have a huge impact on performance. It has many uses and can trigger all sorts of code but this article is simply looking into performance. With it, image lazy loading can be quickly and easily added to any site including static Jekyll sites.
To start, define a variable to store the Interaction Observer. For simpler deployment, the code below avoids using modern JavaScript features such as let and arrow functions.
var observer
Secondly, a function to load a given image. Here, a temporary image is created to load the image and if successful the source of the actual image is replaced.
function loadImage(image) {
var i = new Image();
i.onload = function() {
image.classList.add('lazy-loaded')
image.src = image.dataset.lazySrc
}
i.onerror = function() {image.classList.add('lazy-error')}
i.src = image.dataset.lazySrc
}
Thirdly, a function to process intersections. It checks which images are currently intersecting.
function onIntersection(entries) {
for (var e in entries) {
if(entries[e].intersectionRatio <= 0) continue
observer.unobserve(entries[e].target) // Stop watching
loadImage(entries[e].target)
}
}
Fourthly, lazily loaded images are located and the code is run.
var images = document.querySelectorAll('img[data-lazy-src]')
if ('IntersectionObserver' in window) {
observer = new IntersectionObserver(onIntersection, {rootMargin: '250px'})
for(var i in images) {
if(typeof images[i] === 'object' && 'classList' in images[i] &&
!images[i].classList.contains('lazy-loaded') &&
!images[i].classList.contains('lazy-error')) {
observer.observe(images[i])
}
}
} else {
for(var image in images) loadImage(image)
}
But, the code above can only lazy-load images with very specific markup. This is where this nasty piece of Liquid code comes in. Liquid is fundamentally a very limited language with no direct way to initialise arrays, weird syntax, and no regular expressions. So, instead of using regular expressions, we can instead create a nasty piece of splitting code which works just well enough for the job.
The HTML Jekyll generates from Markdown is simple and regular enough for the following code to work. I would not expect it to work for more complicated HTML. But it’s worth a shot!
{%- assign excerpt = content | split: '<img src="' -%}
{%- for e in excerpt -%}
{%- if forloop.first == true -%}
{{ e }}
{%- else -%}
{%- if e contains '" alt="' -%}
{%- assign f = e | split: '" alt="' -%}
{%- assign url = f | first -%}
{%- assign g = f | shift | join: '" alt="' | split: '"' -%}
{%- assign alt = g | first -%}
{%- assign rest = g | shift | join: '"' -%}
<noscript><img src="{{ url }}" alt="{{ alt }}" /></noscript><img class="script-required" src="#" data-lazy-src="{{ url }}" alt="{{ alt }}"{{ rest }}
{%- else -%}
{%- assign f = e | split: '"' -%}
{%- assign url = f | first -%}
{%- assign rest = f | shift | join: '"' -%}
<noscript><img src="{{ url }}" /></noscript><img class="script-required" src="#" data-lazy-src="{{ url }}"{{ rest }}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
Now I recommend styling the unloaded images with width and height. If known ahead of time it can be set explicitly. Failing that, I recommend setting a generic default using CSS.
img {
min-width: 100px;
min-height: 100px;
}
And finally with this in place, my site often enjoys a perfect score in Google Chrome Inspector Audit. It cleanly beats google.com which has a top score of 91 and even beats motherfuckingwebsite.com in every category but performance where it draws at 100.
Goodbye Southampton.
University is over and it’s time to start the next chapter of my life.
After what was approaching nearly two decades in education, it’s finally time to enter the real world.
I’m moving to Bath where I’ll be working for Netcraft, a company which specialises in Internet research, anti-phishing and security services.
I’m looking forward to it!
Four years later, and my time at university has come to a close. I have earned my Masters. My time here is at a close. It is a bitter-sweet day. After The Ceremony everyone went outside for a year photo.
We took photos of Jet, LLoyd, Daniel, Me, Andy, and Edmund. And finally enjoyed the reception.
The last day of our trip. In the evening we fly back. Our flight is delayed so I spend the night with a friend. Tomorrow I will take the trains back home and prepare for Graduation.
We’re Off To Rent A Boat. A Paddleboat. Along The River We Go
The penultimate day. We see the metro system, a museum, and escape from an escape room.
We Explore The Subway. This Is T Centralen. We Get Off After One Stop.
Theme park number two. We board the ferry and spend the day in Tivoli.
Walking Along The South Bank. Looking On The Water. We Wait At A Dock.
A pretty relaxing day. We watch the changing of the guard, explore the city, and have a good time.
Stockholm Is Under Construction. Walking Through The Bustling Streets Towards The Palace.
We leave Copenhagen and set off for Stockholm by train. The journey is long and the day is short. We explore.
Checking Out And Leaving For Stockholm. Six Hour Later We Emerge From The Station. And Find Two Statues.
To the zoo! We see so many animals, and so many young animals. The view from the tower is pretty nice as well.
Its Me
Today we tour the city, we see a marching band.
An Early Start And A Walking Tour. Black Towers and The Oldest Street In Copenhagen
After an early start and quick breakfast, we went to spend the day in Tivoli Gardens. The day started overcast and cloudy but quickly picked up. This may have put people off as for the first few hours the queues were tiny. In a little under 7 hours we went on nearly every ride (some multiple times), talked, ate, and rested. It was a great day out. Afterwards we wandered the city and had burgers for dinner while listening to live jazz - formulating plans for tomorrow.
A Statue Of Hans Christian Anderson On The Way To Tivoli Gardens. A Grip Man In Case Of Emergency As Tivoli Is A Really Old Theme Park. Queuing For The Daemon We See A Pagoda.
After a night in Plön we depart, we say goodbye to one of our companions. Then, it is on to the train for five hours as we travel to Copenhagen. It is a long journey and after watching the scenery dart past for a while we watch some TV. Halfway through the trip our train boards a car ferry. We disembark and explore the ship. Near land we re-embark and watch The Grand Budapest Hotel for the remainder of the Journey. In Copenhagen we walk to the hostel, check in and set out to explore. A jazz festival is in town for our stay. We watch. The day finishes with pizza.
One Last Look From The Hostel Window. Hidden In The Woods. Looking Out Onto The Lakes.
It’s Been Fun But Now We Split Good Luck.
Taking a break from city visits we spend a day in Plön. After a short train ride we check in, and walk around the many lakes. Plön is a beautiful town in the middle of the German countryside. It is quite, and normally rather serene if not for the Harley Davidson festival. So many bikes. After a good walk we head down to a local Indian restaurant and have our last meal as the three of us. Ending the day we return to the hostel. Football is on and it’s coming home.
Leaving Generator Hamburg Onwards To Plön. Inside Hamburg Hbf.
Using a special day pass, we spend the day visiting four different museums dotted across the city. Then, we enter a submarine. While it seems rather large, it is designed to fit eighty four people inside. That would be rather cramped.
Museum Number One. A Musical Display.
Visiting the botanical gardens. Seeing the sights. Wandering the Waterfront. A good day.
Visiting The Botanical Gardens and Purple Flowers Everywhere. Venturing Inside The Greenhouses.
We spend the day inside Miniature Wonderland! It’s amazing.
Sitting On University Grounds Eating Break. Unzipped.
A day of traveling spend mostly on a train. Not much happens today. When we arrive in Hamburg we check into our hostel, and wander the streets. We see a dragon.
I’m On A Train. A Deserted Platform That Time Forgot. Entering Hamburg. Looking Back At Hamburg Central Station.
Sorry about the delay, I had some really bad news recently and lost the desire to update this blog for a little while. On our last day in Amsterdam we split and rent two bikes, cycling all of the way into Amsterdam. It takes us two hours, and afterwards we relax and cycle around the city. In the evening we meet up again for an evening meal. We take the train back.
Ultrecht Station. Train Tracks.
For our second day we catch the train into Amsterdam, have breakfast by the canals, and explore the city. We wander. Our party takes a trip to Body World. Finally, we take the free ferry to the north and have some ice cream. The weather is perfect.
Inside Ultrecht Station. Looking At Amsterdam Central Station.
We traveled from Brussels to near Amsterdam, staying in Ultrecht for the night. The day is mostly uneventful, with most of it spent on the train. However, we walk along a few Dutch canals, explore the suburbs, and have dinner in IKEA.
Leaving The Hostel and Brussels Central Station. Walking Along The Avenue.
The last day, lets make it count. We walk to the Botanical gardens and split. Me and Andy decide to visit Autoworld.
Swag. A Statue. An Interesting Facade On An Empty Building.
After visiting the Atomium yesterday, we journeyed south-east towards the European Parliament. There, we saw the fantastic House of European History, the disappointing Parliamentarium, and the interesting Hemicycle. We walked back to the hostel, cooked, and rested for the dinner.
A Wall Mosaic. Suspended Street Lighting.
Day two and we were off to an early start. We ate a buffet breakfast, talked to our hostel-mates, and ventured north. We visited the Basilica and peeked inside. Finished in 1911, this modern cathedral is a marvel. Then we caught a train.
Then, off to the Atomium we went. It is huge and has fantastic views of the surrounding city. Then, we visited the ADAM museum and wandered around the Expo grounds. Most of the buildings have been long since destroyed or replaced, but the Chinese and Japanese pavilions are still intact. Or so we thought. Upon arriving in the gardens we find the Chinese pavilion boarded up and the Japanese pavilion inaccessible. Light research reveals that they were both closed five years ago as they were starting to fall apart. A shame. In the evening we cook a fry up, and play a few games of pool.
Zeppelin. The Streets and a Lamp and Trees.
Today is the first day of our adventure. After an early breakfast I set out and caught the express train to Waterloo. Then I walked across central London to St. Pancras International taking in the view on the way. At the station I meet up with my friends, chat, and catch the Eurostar headed for Brussels. We are on out our way.
We arrived mid afternoon, so after we checked into our hostel we ventured into the city, exploring the Grand Place. As places go it is pretty grand with many old and fancy guild halls from when this square was more than just a tourist attraction. Nearby is the infamous and underwhelming Manneken Pis along with several large murals.
For dinner we buy ingredients and retire to the hostel. We cook a simple pasta dish. As we now have a rough idea of the cities layout we discus plans for the next few days. Tomorrow we decide to head north towards the Atomium and see the remnants of Expo 58.
Catching the Train. Entering Waterloo.
Me and a few of my friends just finished university and so we have decided to go interrailing around Europe.
On this blog I am chronically our journey. We are planning to depart from London and take the Eurostar to Brussels. There we will catch trains to Amsterdam, Hamburg, Plön, Copenhagen, and Stockholm. Finally we will be flying back to London on Ryanair.
Photos of the earth taken today by NASA DSCOVR EPIC. Earth Polychromatic Imaging Camera (EPIC) captures images of a sunlit earth to monitor the atmosphere and the environment. View earth
This project demonstrates the ability to visualize, and trace transactions through the Bitcoin network, evaluating three different methods. Namely poison, haircut and First-In-First-Out (FIFO).
To achieve this, a web application was created to first build up a network graph representing Bitcoin addresses as nodes, and transactions as directional edges. This allows the user to easily grasp the history of any given Bitcoin address, and then trace any transaction either up or down the graph.
By clicking on a node in the graph, the application will automatically load that address and it’s associated transactions, adding it to the graph. By hovering over a node in the graph, the tool-tip on the right will appear. It displays a number of useful statistics about the address, and gives the user the option to trace transactions by clicking on any of the colourful buttons.
I’ve started running the Southampton Parkrun, a 5K run every Saturday morning on the common. It’s great fun, and my times are slowly but surely improving.
This year in a team of five, we set out to investigate and experiment with the oneM2M standard, for our client InterDigital. Overall we were successful, here are our findings:
For the mass deployment of the Internet of Things to be a success, a global standard for machine to machine communication needs to become established. This report explores the oneM2M standard for Machine to Machine communication, researching its capabilities, how to make use of it, and ultimately builds systems upon it. Using them, data streaming, live video, and federation are put to the test.
This project is a oneM2M research project, with InterDigital as the client. They have created the oneTRANSPORT data marketplace, and this report with federate with their system, to demonstrate oneM2M.
This weekend, I participated in two hackathons. On Friday afternoon I took part in the Bloomberg CodeCon Grand Finals (again). Then in the evening everyone everyone went to Swingers Golf Bar. On Saturday morning I explored the city, swinging by the Tate Modern just before I left. Image courtesy Bloomberg.
Then on Saturday evening and Sunday morning I created a game for the Southampton Game Jam, the theme was transmission. Normally you have 48 hours, but I was lucky to even have 20. So I got to work, and created SnowDrift, a classic 2D platformer, using raw JavaScript no frameworks. Click on the image below to play in your browser. Overall, the weekend was busy, but fascinating. I really enjoyed it.
After recent browsing, I had the idea to convert the Puzzling Stack Exchange into a book. Overall, the project was a success, however maths is currently not rendered as such. The book contains the top 100 questions and answers ever submitted to the site, formatted nicely to fit into a small A5 book(let).
I would like to thank the Puzzling Stack Exchange community for writing the puzzles, Stack Exchange for providing the data, and creativecommons.org for making this possible. Like the puzzles within, the book is licensed under the CC BY-SA 3.0 license. The book was created using the Stack Exchange Data Explorer to gather data, Python to parse and structure the data, and Pandoc to typeset as PDF. And thank you, the reader for reading this “book”. I hope you enjoy the puzzles. If you wish to contribute to this book, it can be found on my github.
Today I was playing a rather interesting variation of Cheat and Sh*thead with a group of friends, and thought it be worth sharing. But before doing so, I will fill you in on the rules of both games, for context.
Setup: Shuffling a deck of cards and deal three to each player, leaving the pile in the centre of the table.
Gameplay: Players take it in turns to announce and play face down one or more cards of higher, lower, or equal value. If at any time a player suspects that the previous player cheated, they can loudly call CHEAT. All cards the player placed by that player are flipped. If the player has cheated, they pick up all of the cards, otherwise the accuser picks up all of the cards. The next player is whoever does not pick up cards. A player cannot call cheat on another if any cards have been placed atop of theirs.
Scoring: Once one player has placed all of their cards, a victor is crowned, and the game is over. If desired, count the number in each players hands to determine who came second, third, and so on.
Notes: The speed of the game depends on the group, but the faster they play, the easier it is to cheat. Unless the group is a hundred percent certain that a player is not cheating, it is worth accusing them after they place their final card. If desired, the game can continue after a player wins. However as players gather more and more cards, the game slows and lies become harder.
Setup: The deck with Jokers is shuffled, and each player is given three face down cards. Then, each player is given an additional six cards, three of which much be placed face up atop their face down cards. Then the pile is placed in the centre of the table. The player with the greatest number of lowest value cards (excluding magic cards) in their hand starts. If multiple players draw, then the player who is first clockwise of the dealer starts.
Gameplay: Each player takes turns playing cards from their hands, face ups, or face downs - in that order. Cards must be of higher (Ace high), or equal value, but they must all be of the same value. After playing, a player draws back up to three cards if possible. Some cards are Magic and have special actions as denoted in the table below.
The winner of the game is the first player to play all of their cards. However, the game can continue until all players bar one have played all of their cards.
Magic Cards: 2, Reset the current value. 7, Invisible, the next player must play equal or higher than the previous card. 8, Play Low, the next player must play lower than the previous card. 10, Burn, the pile is discarded and the player gets another turn. King, Change the direction of play. Joker, The next player cannot play a magic card.
Notes: Sh*thead can be played with any number of face down cards, as long as there are enough cards. Just ensure that each player is dealt that number plus three before choosing face up cards. If desired, players can choose different magic cards or different magic actions.
An amalgamation of both games. It is played like Sh*thead but instead of playing cards face up, they are placed face down so players must announce their actions. Players can call CHEAT at any time to force a check. As an optional rule, Jokers can be used as wild cards instead of magic cards for added confusion.
When making decisions, people negotiate to maximise utility and social welfare - agents are no different. Utilizing the GENIUS framework, this report tests time dependent concessions, and fitness proportionate selection putting them to test in a negotiation competition. The results are analysed and discussed.
Recently I decided to get back into playing the flute. Years ago I learnt the flute in school, but dropped it after a year or two, so I’m (fortunately) not a complete novice.
As practicing on your own can get a bit boring I have joined the Southampton Folk Society. Here we play folk tunes, sing folk songs, and put on Cèilidhs for students. I’m not very good, but I have fun. Download the Folksoc Tunebook.