Adding a large number of event handlers to a page has an adverse affect on performance and a common technique for alleviating this problem is known as event delegation where we add a single event handler to a parent element somewhere up the heirarchy. This works due to the flow of events through the DOM, and I put the technique to good use in my Interactive Periodic Table. In this post I will demonstrate event delegation using a simplified version of the Periodic Table.
HTML5 gave us the ability to add arbritrary pieces of information to any element to use behind the scenes for any purpose you wish. These are known as data attributes and I put them to good use in my Interactive Periodic Table. There is plenty of information around on the topic but often with simplistic or contrived examples so here I will present a real-world usage with a simplified version of the Periodic Table.
My original intention was to simply produce a filterable version of the table, and in this post I have done just that. However, while researching the topic I found that it was far more complex than I originally realised and that there is huge scope for expanding the topic to show more infomation and also to show the existing information in different formats. This is therefore an ongoing project which I will enhance in the future. Watch this space...
The math.js library I have used in a couple of previous posts includes comprehensive functionality for handling matrices, and in this post I will demonstrate how to use it for creating matrices as well as basic matrix arithmetic.
This first version has quite modest ambitions: just the ability to draw a few simple shapes as well as text. However, SVG is far more capable than most people realise so I will add further functionality in the future with the aim of creating a far more comprehensive library.
Most people are familiar with a few of the more common prefixes used before many units to denote a fraction or a multiple of the unit - kilograms, megabytes, centimetres etc.. As well as these there a number of less well known ones, going right up to yotta and right down to yocto.
Benford's Law centres on the perhaps surprising fact that in numeric data such as financial transaction, populations, sizes of geographical features etc. the frequencies of first digits follow a roughly reciprocal pattern.