How a machine stores text, and how markup and styles build a page.
Lectures this week
- Information Representation in a Machine
- Efficiency of Encoding
- What is Markup?
- Introduction to HTML
- Introduction to Styling
- Types of CSS Styling
- Responsive Websites
Key points, notes and past questions
System Performance, Hardware & Encoding
The numbers behind encoding, time, disks, memory and server capacity.
- Start here: units from zero
- 8 bits = 1 byte; small b is bits, capital B is bytes.
- k, M, G go up by 1000 (1024 only when stated).
- rate × time = amount; amount ÷ rate = time.
- Convert to one unit before you divide.
- Bits for a character set
- Bits per symbol = ⌈log₂ k⌉.
- The space is a symbol.
- Size = length × bits per symbol.
- Adding symbols changes only the bits per symbol.
- Running time: plug in and scale
- Given n: compute both.
- Scale: × f(n₂)/f(n₁).
- n²: square the ratio; n log n: ratio × log ratio.
- Constants decide below the break-even n.
- Memory hierarchy and disks
- Register → SRAM → DRAM → SSD → HDD: slower and bigger.
- HDD: highest latency, lowest throughput.
- rev/s = RPM ÷ 60.
- Worst delay = one turn; average = half.
- DRAM bandwidth
- 64 bits = 8 bytes.
- DDR × 2, dual channel × 2.
- Use only the factors the question states.
- Recompute when one number changes.
- Propagation and processing delay
- Time = distance ÷ speed.
- Cable 2 × 10^8 m/s, air 3 × 10^8 m/s.
- Add each leg and the server delay.
- Closer servers cut latency.
- Server capacity
- Bits = bytes × 8.
- Network limit = link ÷ bits per request.
- Answer = the smallest limit.
- Memory: peak users × memory per user.
Notes18 past questions in this topic
Frontend Web Technologies (HTML, CSS, JavaScript & DOM)
The browser side that Flask pages feed.
- Start here: HTML, CSS and JavaScript, from zero
- HTML = content and structure.
- CSS = how it looks; selectors choose elements.
- JavaScript = behaviour, in the browser.
- JSON = data between programs, not a page language.
- HTML structure, lists and linking scripts
- HTML = content, CSS = styling, JS = extra behaviour.
<ul>unordered,<ol>ordered,<dl>term/description.- External JS:
<script src="file.js"></script>. - A page works without JavaScript.
- Which CSS rule wins
- inline > #id > .class > tag.
- On a tie, the later rule wins.
- The order of names inside
class="..."does not matter.
- Attribute selectors
~== whole word in a space-separated list.*== substring anywhere.- Hyphens do not split words for
~=.
- :valid and :invalid
:valid/:invalidupdate live.- Empty and not required → valid.
- minlength counts typed characters only.
- maxlength stops typing at the limit.
- HTML5 validation attributes and JavaScript checks
- HTML5 checks run first and block the submit event.
- JS onsubmit checks = client-side validation.
- Checks in the Flask view = backend validation.
- Message wording follows the browser's language.
- JavaScript output: alert, console, document.write, innerHTML
- alert = dialog box.
- console.log / console.error = developer console.
- innerHTML / textContent = inside an element.
- document.write after load = replaces the page.
- JSON syntax and parsing
- Object keys in double quotes.
- Arrays hold values, not key: value pairs.
- Mixed types in an array are fine.
- Property access order decides output order.
- The DOM, live collections and AJAX
- DOM = programming interface + abstract tree of the page; it can change.
getElementsByTagNameis live;querySelectorAllis static.- AJAX = background request + partial update, no reload.
- AJAX gives a better experience with less data.
Notes16 past questions in this topic
Week 1: Web FundamentalsWeek 3: MVC & UI DesignAll MAD 1 topics and weeks