Apr
13
PBS 33 of x – JS Testing with QUnit
Filed Under Computers & Tech, Software Development on April 13, 2017 | 1 Comment
I had intended to continue running parallel JavaScript and HTML streams for this instalment, but when preparing the notes for the JavaScript stream it became obvious I’d need the dedicate the entire instalment to JavaScript.
What we’ll be doing in this instalment is taking a first look at the concept of software testing. Testing is a vital tool in a software developer’s toolbox. In particular we’ll be looking at two useful concepts, and a tool to help us build and run our test suites. We’ll be looking at the concepts of Test Driven Development (TDD), and Unit Testing (UT). We won’t be religiously adhering to either – instead, I want to encourage you to pick and choose the aspects of these things that work for you.
The tool we’ll be looking at to implement our JavaScript test suites is QUnit. This is a Unit Testing framework developed by the jQuery project, and used by them for jQuery’s test suite.
All code files used in this instalment are contained in a single ZIP file which you can download here.
Mar
30
Spectacle – Another Mac Window Tiler
Filed Under Computers & Tech on March 30, 2017 | 1 Comment
Earlier this week I posted a review of the Mac window tiling app Magnet which is currently on sale in the Mac App Store for €0.99. @DriesDeRoeck replied on Twitter to point me nice free and open source alternative – Spectacle.
Mar
28
Magnet – A Mac Window Tiler
Filed Under Computers & Tech on March 28, 2017 | 2 Comments
Magnet is the first Mac app I discovered organically on the front page of the Mac App Store. I wasn’t looking for anything, I just opened the Mac App Store app to run some updates, and there, on the front page, Apple were featuring Magnet, and it caught my eye and then my interest enough to hand over €0.99 to there an then!
What does Magnet do? It’s a macOS app that allows you to quickly and easily re-size and re-position windows to a number of useful presets so you can easily lay out your windows. You can instantly adjust any given window so it takes up the left half of the screen, the bottom-right quarter, and so on. The app is clearly inspired by the built-in feature that has shipped with the last few versions of Microsoft Windows that allows you to snap windows into a few pre-defined arrangements by bouncing them off one of the edges of the screen, but Magnet takes that idea farther than Microsoft have, and it does so in a very Mac-friendly way.
Mar
14
PBS 32 of x – JS Error Handling Revision | HTML Selects
Filed Under Software Development, Computers & Tech on March 14, 2017 | 2 Comments
In this instalment we’ll continue our twin-track approach of mixing a little JavaScript revision with learning some new HTML. In this case, we’ll revise JavaScript’s error handling mechanism (throw
, try
& catch
), and learn how to use the HTML <select>
tag to create dropdown menus and multiple-selection lists.
We won’t be updating our date and time prototypes, but we will be using them in example HTML pages, so in this instalment our two tracks come into direct contact with each other for the first time. We’ll use an HTML page with multiple dropdowns to allow users to select a date, and then render that date in many formats using our pbs.Date
prototype. We’ll also use JavaScript’s error handling features to respond appropriately when a user attempts to render an impossible date like the 31st of February 2010.
Finally, the challenge set at the end of this instalment will also combine our prototypes with HTML forms, and JavaScript error handling.
You can download my solution to the challenge set in the previous instalment, and all the code samples for this instalment in a single ZIP file here.
Mar
1
PBS 31 of x – JS Static Functions | Checkboxes & Radio Buttons
Filed Under Software Development, Computers & Tech on March 1, 2017 | 4 Comments
We’re going to continue our twin-track approach in this instalment – first some JavaScript, then some HTML Forms. We’ll start with my sample solution to the challenge set in the previous instalment, then we’ll look at one final new concept related to JavaScript prototypes – static functions. We’ll wrap up our revision and deeper dive into JavaScript prototypes with a final, finished, version of our algorithm for generating prototypes.
Switching our focus on HTML forms, we’ll look at some important form-specific ARIA roles, we’ll introduce two useful tags for enclosing forms, or parts of forms <fieldset>
& <legend>
, and we’ll introduce the concept of form data. With those foundations laid, we’ll look at how to add checkboxes and radio buttons to web forms, and how to interact with them through jQuery.
You can download a ZIP file containing the code files for this instalment here.
Feb
17
PBS 30 of x – Comparing JS Objects | Introducing WAI-ARIA
Filed Under Software Development, Computers & Tech on February 17, 2017 | 2 Comments
In this instalment we’re going to continue with our dual-track approach, first, looking at some more JavaScript prototypes, then switching tack to HTML forms again.
We’ll start with my sample solution to the challenge set in the previous instalment. Then, we’ll move on to add an important enhancement to our prototypes – support for object comparisons. Strictly speaking, this won’t actually be revision – we haven’t looked at the intricacies of comparing objects before.
We’ll finish our JavaScript section with another challenge.
When we switch back to HTML we’ll take a big-picture look at an important accessibility standard named WAI-ARIA. We want to build our forms in a screen-reader-friendly way from day one, and to do that, we need to begin learning about ARIA. ARIA is really quite big, so all we’ll be doing this time is taking in an overview so we understand why it exists, and the basic concepts its built around.
We’ll finish by creating a final, fully accessible, button complete with a pretty scalable icon.
In the next instalment we’ll finally be ready to move on to some more different form inputs, specifically, checkboxes and radio buttons.
Feb
3
PBS 29 of x – JS Prototype Revision | Glyph Icons
Filed Under Software Development, Computers & Tech on February 3, 2017 | 4 Comments
In this instalment we’ll continue with our twin-track approach of revising JavaScript prototypes, and learning about HTML forms.
We’ll start by moving our JavaScript revision out of the PBS playground, and over to NodeJS, getting you much better error reporting. Then we’ll have a look at my sample solution to the challenge from the previous instalment, and we’ll eradicate another bad smell from the prototype. We’ll come face-to-face with the implications of the fact that variables don’t contain objects, but references to objects. If you don’t bear that fact in mind, you can end up with spooky action at a distance that seems like the worst kind of black magic. The kind of bugs that baffle, mystify, and drive you nutty as squirrel poo!
We’ll then switch gears back to HTML forms, where we’ll learn about a very powerful technique for including scalable vector-based icons in your form elements. These very special icons are known as glyph icons, and while rolling your own is a significant undertaking, you don’t have to, because you can use icon sets created by others. We’ll learn about glyph icons using the free and open source glyph icon set from Font Awesome.
You can download a ZIP file containing the sample solution to the previous challenge, and, the example HTML file from today’s examples here.
Jan
20
PBS 28 of x – JS Prototype Revision | CSS Attribute Selectors & Buttons
Filed Under Computers & Tech, Software Development on January 20, 2017 | 4 Comments
In this instalment we’ll continue our parallel streams of JavaScript prototype revision, and web forms.
We’ll start by looking at a sample solution to the challenge set at the end of the previous instalment. We’ll look at what is good about the solution, and where it falls short. We’ll then improve the prototypes through the user of private helper functions.
Before moving on to look at HTML buttons in detail, we’ll learn some new CSS selectors that are particularly useful for styling web forms.
Dec
31
PBS 27 of x – JS Prototype Revision | HTML Forms
Filed Under Computers & Tech, Software Development on December 31, 2016 | 2 Comments
In this instalment we’ll make a start on a large topic which we have intentionally ignored until now – taking user input on the web. The way this is done is through HTML forms. It will take us a few instalments to learn all about them, so we’ll start with the basics in this instalment.
The code for the examples in this instalment has been collected into a single ZIP file which you can download here.
Dec
10
PBS 26 of x – HTML Data Attributes with jQuery
Filed Under Software Development, Computers & Tech on December 10, 2016 | 10 Comments
After our brief division in the previous instalment, it’s time to get back to learning new things. We’ll learn about data attributes – a mechanism for embedding data into HTML elements.
We’ll also revise what we learned about defining our own object prototypes to start including prototypes in our APIs.
Finally, as a practical worked example, we’ll build a better clock API for Allison’s website. Each Sunday she streams the live recording of her podcast from podfeet.com/live at 5pm at her house. To avoid timezone confusion, Allison would like a clock on that page that shows the current time at her house.
As usual I’ve packaged all the files needed for the worked example into a ZIP file which you can download here.