Brainlag

Glossary

The words that show up in lessons and error messages, in a sentence or two each.

A

addressC

The number of a byte in memory. Every variable lives at one, and &score gives you the address of score.

Pointers and addresses

aggregateSQL

A function that squashes many rows into one value: COUNT, SUM, AVG, MIN, MAX.

Aggregates, GROUP BY and HAVINGWhat is "misuse of aggregate"?

arrayWeb

A JavaScript list of values in order, written in square brackets. songs[0] is the first item, songs.length counts them and songs.push(x) adds one to the end.

Arrays

array decayC

When you pass an array to a function or use it in most expressions, it turns into a pointer to its first item. That is why a function cannot use sizeof to learn an array's length.

Arrays in memoryPointers and addresses

arrow functionWeb

A short way to write a JavaScript function: (a, b) => a + b. With no curly braces after =>, the value is returned without writing return.

Functions, parameters and return

async and awaitWebPython

async marks a function that can pause; await pauses it until a promise (or, in Python, a coroutine) is done and hands back the result. The rest of the program keeps running meanwhile.

Promises, async and await

attributeWeb

Extra information written inside an opening tag, as name="value". In <a href="/shop/">, href is the attribute that says where the link goes.

B

box modelWeb

Every element is drawn as a box of content, padding, border and margin. box-sizing: border-box makes width include the padding and border.

The box model

buffer overflowC

Writing past the end of an array, for example a 20-char name into a char name[8]. C does not stop you, and the extra bytes overwrite whatever comes next.

Arrays in memoryWhat is "memory access out of bounds"?

C

callbackWebPython

A function you pass to other code so that code can call it later, like the function given to addEventListener, setTimeout or map.

Functions, parameters and return

clauseSQL

One part of a SQL statement that starts with a keyword: SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT. They always go in that order.

What is a SQL syntax error?

columnSQL

One named piece of information that every row has, like title or price. Each column holds one type of value.

SELECT, columns and aliases

compilerC

The program that reads your C source and turns it into machine instructions. If it finds a mistake, it stops with a compile error and no program exists to run.

Compiling a C program

CSS gridWeb

A CSS layout of rows and columns. grid-template-columns: 1fr 1fr 1fr makes three equal columns that the children fill in order.

Whack-a-mole with a timer

CSS selectorWeb

The part of a CSS rule that picks which elements it styles: p, .card, #score, nav a. document.querySelector takes the same selectors in JavaScript.

The DOM and events

CTESQL

A common table expression: a named result made with WITH name AS (...) at the top of a query, then used like a table below it. It breaks a big query into readable steps.

SubqueriesAn artist report for a streaming app

D

dereferenceC

Following a pointer to the value it points at, with *. If p points at hp, then *p = 70; changes hp.

Pointers and addresses

dictionaryPython

A collection that maps keys to values, written {"potion": 3}. You look values up by key, not by position. Often shortened to dict.

Dictionaries

docstringPython

A string written as the first line inside a function to say what it does. Tools and help() show it.

Functions and return values

DOMWeb

The Document Object Model: the browser's live tree of objects built from your HTML. JavaScript reads and changes the DOM, and the page updates to match.

The DOM and events

E

eventWeb

Something that happens on the page, such as a click, a key press or text typed into a box. You react to one by adding a listener for it.

The DOM and events

event listenerWeb

A function the browser runs every time a certain event happens on an element. button.addEventListener("click", handleClick) adds one.

The DOM and eventsA reaction-time tester

exceptionPython

An error raised while a program runs, like ValueError or KeyError. If nothing catches it, the program stops and prints a traceback.

Catching errors with try and except

F

f-stringPython

A string with an f in front that fills in values from curly brackets: f"{name} has {hp} HP".

Strings and text

flexboxWeb

A CSS layout for putting items in a row or a column. display: flex on the parent, then gap, justify-content and align-items space and line up the children.

foreign keySQL

A column that holds another table's primary key, like songs.artist_id pointing at artists.id. It is what you join on.

JOIN: two tables into one result

G

GROUP BYSQL

Sorts rows into groups that share a value and gives one result row per group, so aggregates work per group. HAVING then filters the groups.

Aggregates, GROUP BY and HAVING

H

headerC

A file of declarations, pulled in with #include. #include <stdio.h> tells the compiler that printf exists and what it takes.

What does "undeclared" mean?

heapC

Memory you ask for while the program runs, with malloc, and must give back yourself with free. It lives until you free it, not until a function returns.

The stack and the heapAn array that grows

HTML elementWeb

One piece of a page, written as an opening tag, some content and a closing tag. <p>Hello</p> is a paragraph element; <img> is an element with no closing tag.

The box model

I

indentationPython

The spaces at the start of a line. In Python they decide which lines belong to an if, loop or function, so they are part of the code.

What is an IndentationError?

indexSQL

A sorted lookup the database keeps for a column so it can find rows without reading the whole table, like the index at the back of a book. It speeds up reads and slightly slows down writes.

iterablePython

Anything a for loop can walk through one item at a time: lists, strings, dicts (their keys), range(10) and files.

Loops that build a result

J

JOINSQL

Combines rows from two tables wherever a column matches, like each song with its artist. LEFT JOIN also keeps rows that found no match.

JOIN: two tables into one resultWhat is "ambiguous column name"?

JSONWebPython

A text format for data made of objects, arrays, strings, numbers, true, false and null, like {"name": "Zara", "points": 9200}. APIs send it; JSON.parse and res.json() turn it into JavaScript values.

Promises, async and await

K

keyword argumentPython

An argument passed by name, like sorted(scores, reverse=True). It makes calls easier to read and lets you skip options that have defaults.

Functions and return values

L

listPython

An ordered collection of values in square brackets that can change after it is made. squad = ["Ana", "Ben"], then squad[0] is "Ana".

Lists and positions

list comprehensionPython

A one-line way to build a list from a loop: [s * 2 for s in scores if s > 10] doubles every score above 10.

Loops that build a result

M

malloc and freeC

malloc(n) reserves n bytes on the heap and returns their address, or NULL if it cannot. free(p) gives them back. Every malloc needs exactly one free.

The stack and the heap

memory leakC

Heap memory that is never freed, usually because the last pointer to it was lost. A program that leaks in a loop slowly uses up all memory.

The stack and the heapAn array that grows

mutablePython

A value that can be changed in place, like a list or dict. Strings, numbers and tuples are immutable: their methods hand back new values instead.

Names and values

N

negative indexPython

Counting from the end of a list or string: -1 is the last item, -2 the one before it.

Lists and positions

NonePython

Python's value for "nothing here". A function with no return gives back None, and so do methods like list.sort().

Functions and return valuesWhat is an AttributeError?

normalisationSQL

Designing tables so each fact is stored once. Instead of typing an artist's country on every song, songs point at one artists row that holds it.

NULLC

A pointer value that means "points at nothing". Check for it before you dereference, for example after malloc.

Pointers and addresses

null terminatorC

The 0 byte, written '\0', that marks the end of a C string. "Neon" takes 5 bytes: four letters and the terminator.

Strings are char arrays

NULL valueSQL

SQL's marker for "unknown" or "missing". It is not 0 or empty text, any comparison with it is unknown, and you test for it with IS NULL.

NULL, the missing value

O

objectWeb

In JavaScript, a set of named values in curly braces: { name: "Ana", level: 12 }. Read a value with a dot, player.level, or with brackets, player["level"].

Count the hashtags

P

paddingC

Unused bytes the compiler puts between struct fields so each one starts at an address that suits its type. It can make a struct bigger than its fields added up.

Structs, dots and arrowsA hex dump of a struct

pointerC

A variable that holds an address. int *p = &hp; makes p point at hp. Pointers are 4 bytes on this site's compiler.

Pointers and addresses

primary keySQL

A column (usually id) whose value is different for every row, so you can point at exactly one row. id INTEGER PRIMARY KEY.

promiseWeb

An object that stands in for a value that is not ready yet, such as the result of a fetch. It later resolves with the value or rejects with an error.

Promises, async and await

prototypeC

A one-line promise of a function's name, parameters and return type, like int twice(int n);, so code above the function's body can call it.

What does "undeclared" mean?

Q

querySQL

A question you ask the database in SQL. SELECT queries read data; other statements like INSERT and UPDATE change it.

SELECT, columns and aliases

R

rangePython

A run of whole numbers made on demand. range(5) is 0 to 4, and range(1, 11) is 1 to 10. Used to repeat a loop a set number of times.

Loops that build a result

rowSQL

One record in a table: one song, one player, one order. Also called a record.

SELECT, columns and aliases

S

schemaSQL

The design of a database: which tables exist, their columns and types, and the keys that link them. CREATE TABLE statements describe it.

segmentation faultC

The usual laptop crash when a program touches memory it does not own. This site reports it as memory access out of bounds.

What is "memory access out of bounds"?

selfPython

The first parameter of a method in a class. It points at the object the method was called on, so self.hp is that object's own HP.

setPython

An unordered collection with no duplicates. set(["gg", "gg", "lol"]) is {"gg", "lol"}, and checking x in s is fast.

sizeofC

Gives the size of a type or variable in bytes, worked out by the compiler. sizeof(int) is 4 here; sizeof an array is its whole size in bytes.

Types and sizesArrays in memory

slicePython

A run of items taken from a list or string with [start:end]. The start is included and the end is not, so "NeonFox"[:4] is "Neon".

Lists and positionsStrings and text

source fileC

The text file you write, like main.c. It is for people and the compiler; the machine never runs it directly.

Compiling a C program

specificityWeb

The score a selector gets for deciding the cascade: an id beats a class, and a class beats a plain element name. #nav .link beats .link, wherever they appear.

stackC

The memory where each function call keeps its local variables. It is handed out and taken back automatically as functions start and return.

The stack and the heapWhat is "Maximum call stack size exceeded"?

structC

A type that groups named fields, like a player's name, hp and level. Use p.hp on a struct and pp->hp through a pointer to one.

Structs, dots and arrows

subquerySQL

A SELECT inside another query, in brackets. It can stand for one value, a list for IN, or a whole table.

Subqueries

T

tableSQL

A grid of data about one kind of thing: songs, players, orders. Every row has the same columns.

SELECT, columns and aliases

template literalWeb

A string written in backticks that can hold values: ` Level ${level} . Anything inside ${ }` is worked out and put into the text.

Values and types

the cascadeWeb

How the browser decides which CSS rule wins when several set the same property. More specific selectors beat less specific ones, and if they tie, the rule written later wins.

tracebackPython

The report Python prints when a program crashes. Read it from the bottom: the last line names the error, the lines above show where it happened.

What is a NameError?

transactionSQL

A group of changes that happen all together or not at all. BEGIN, then the changes, then COMMIT to keep them or ROLLBACK to undo them.

try and exceptPython

A pair of blocks that catch an exception: Python runs the try block, and if a named error happens it jumps to the matching except block instead of crashing.

Catching errors with try and except

tuplePython

Like a list, but it cannot change once made. Written with round brackets: point = (3, 4). Good for fixed pairs like a name and a score.

Lists and positions

U

undefined and nullWeb

Two JavaScript values meaning "nothing". undefined is what you get when something was never set, like a missing property; null is a value someone set on purpose to say "empty".

What is "Cannot read properties of undefined"?

undefined behaviourC

Code the C standard makes no promise about, like reading past an array or overflowing an int. It may work, crash, or give wrong answers that change between machines.

Types and sizesWhat is "memory access out of bounds"?

V

viewSQL

A saved query with a name. CREATE VIEW top_songs AS SELECT ... lets you SELECT * FROM top_songs as if it were a table, and it always shows the current data.

Build the league table from match results

W

window functionSQL

A function with OVER (...) that works out a value from a group of related rows but keeps every row, like a rank or a running total.

Window functions