
Physics with matter.js in p5.js
From falling boxes to slingshots
Tutorials and guides by Pedram Badakhchani, Head of eLearning, full-stack developer and AI engineer, and online tutor on the University of London BSc Computer Science. Written for my students and open to everyone: JavaScript, p5.js, Python, Django, databases, Git and web development. New here? Start with my Start here page.

From falling boxes to slingshots

Ten sketches, from simple to challenging, written the way larger projects are written

Tested with: uv 0.13.1, Python 3.14.8 and Django 5.2.18 LTS, October 2026. Django 5.2 is the current long-term-support release, with security fixes until April 2028. Looking for my 2021 version with D

Updated October 2026. Removed a stray sentence, corrected the point about global variables and memory, and added an example of var ignoring blocks and a section on module scope. The new examples were

Updated October 2026: the XQuery part has been rewritten. The first version tried to run XQuery with lxml, which can't do that (it supports XSLT 1.0, not XQuery), so that example never worked; it now

Introduction to XML eXtensible Markup Language (XML) is a versatile markup language that defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. It

Part 3 - Using Model Serializers with Django Rest Framework Updated October 2026: re-tested with the original versions (Django 4.2, DRF 3.15.1) and with Django 5.2 LTS and DRF 3.18.3 (see the note in

Part 2 - Building RESTful Endpoints from Django Models Updated October 2026: re-tested with the original Django 4.2 versions and with Django 5.2 LTS (see the note and the updated requirements.txt in

Updated October 2026: every statement on this page has been re-run on MySQL 8.0 on Linux (the setup used in the Coursera labs), and the output shown is from that run. This update fixes the Moons table