Image for post
Image for post

I recently wrote an article on building a seven segment display in JavaScript. In this article I will expand on that idea to create a multi-segment display which, as you can see from the banner above, can display not only numbers but also letters and a selection of punctuation.

The Project

The project consists of the following files which you can clone/download the Github repository.

  • multi_segment_display.js
  • multi_segment_display.htm
  • multi_segment_display_page.js

The display itself lives in multi_segment_display.js and is implemented as a ES6/ES2015 class. Let’s look at the code, starting with the constructor.

Firstly the _ColorSchemes object is used as an enumeration for the ColorScheme property. There are then a number of variables for the content and format of the display which we will see in use later on. Finally there are several function calls to set up the display which I’ll describe in detail in due course. …

Image for post
Image for post

For this project I will write a JavaScript Widget which uses SVG to display numerical values on a web page in a seven segment display style.

This post has an associated video on YouTube.

The Project

This project consists of the following files which you can clone/download the Github repository.

  • seven_segment_display.js
  • seven_segment_display.htm
  • seven_segment_display_page.js

The first JavaScript file contains the widget itself. The HTML file contains a set of controls to configure, control and display an instance of the widget, and the second JavaScript file contains the code for the page.

The widget is implemented as an ES6/ES2015 class. …

Image for post
Image for post
Image: Pixabay

The Caesar Shift Cypher was named after Julius Caesar and is the simplest method of encypherment possible. It consists of shifting letters along by one or more places, so for example if you use a shift of 1 then A becomes B, B becomes C etc.. To decypher the message you just shift letters in the opposite direction. Clearly it lacks sophistication and can easily be cracked, either by trial and error or, if you have a reasonable length of encrypted text, using frequency analysis.

As a little programming exercise I will code the Caesar Shift Cypher in Python, and in a future post will break it with frequency analysis. …


Chris Webb

I am a software engineer based in London and I write articles on JavaScript, Python, C and other programming topics.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store