Basis Lab

Where the data lives

Explain what is actually stored when something is saved, read a file at the level of its bytes, and diagnose the everyday corruptions, mangled accents, a number that is not quite the number you typed, and a date that moved by a day, from first principles rather than by trial and error

Bytes, Text and File Formats

Underneath every format is a run of bytes. This course is about what those bytes mean, and about the four or five ways the meaning gets lost in transit.

8 lessons, written and corrected before you arrived. Reading them here needs no account. The first reads the whole way through; the others open and then stop, because a page nobody owns cannot tell who is reading it. Starting the course gives you your own copy, where every idea has problems standing under it and you can ask about any sentence.

Start reading

  1. 01Everything Is a Run of BytesEvery stored thing is a sequence of bytes plus an agreement about how to read them. The bytes are the fact and the agreement is the convention, and only one of them is in the file.
  2. 02Counting in Twos and Sixteensopening onlyPlace value works in any base. Two is what the hardware counts in, sixteen is what people read it in, and a byte dump is legible once the two are the same idea.
  3. 03Letters as Numbersopening onlyA letter is a number, and the agreement that assigns the numbers has changed twice. A name arriving with a question mark where the accent was is that history showing through.
  4. 04Whole Numbers, and Where They Stopopening onlyA whole number stored in a fixed number of bytes covers a fixed range, and what happens at the end of that range is a wrap rather than an error.
  5. 05Numbers With Fractions In Themopening onlyA tenth cannot be written exactly in twos, so the usual fractional number is an approximation from the first value, which is why totals come out a hundredth of a penny wrong.
  6. 06Dates, Times, and the Day It Movedopening onlyAn instant and a local time are different things. Storing one when you meant the other is why a date is a day earlier for some users and not for others.
  7. 07Rows, Columns and the Separator Problemopening onlyA table can be written row by row or column by column, and the choice decides how much has to be read to answer a question. Separators decide whether it can be read at all.
  8. 08Making It Smalleropening onlyCompression removes repetition, so what a file compresses to is a measure of how repetitive it was. The ratio is the number worth knowing before deciding it was worth doing.