Jan 30: How computers work; more histograms Storage is organized in - - PowerPoint PPT Presentation

jan 30 how computers work more histograms storage is
SMART_READER_LITE
LIVE PREVIEW

Jan 30: How computers work; more histograms Storage is organized in - - PowerPoint PPT Presentation

Jan 30: How computers work; more histograms Storage is organized in directories (folders) and files / C:\ /Users/mimno C:\Users\mimno /Users/mimno/Documents C:\Users\mimno\Documents Storage is organized in directories (folders) and files /


slide-1
SLIDE 1

Jan 30: How computers work; more histograms

slide-2
SLIDE 2

Storage is organized in directories (folders) and files

/ /Users/mimno /Users/mimno/Documents C:\ C:\Users\mimno C:\Users\mimno\Documents

slide-3
SLIDE 3

Storage is organized in directories (folders) and files

/ /Users/mimno /Users/mimno/Documents C:\ C:\Users\mimno C:\Users\mimno\Documents "Forward slash" "Backslash"

slide-4
SLIDE 4

Applications

slide-5
SLIDE 5

Paths identify files

/Users/mimno/Documents/2950/plans.txt ~/Documents/2950/plans.txt 2950/plans.txt Absolute path starts with / or c:\

slide-6
SLIDE 6

Paths identify files

/Users/mimno/Documents/2950/plans.txt ~/Documents/2950/plans.txt 2950/plans.txt ~ means "current user's home directory"

slide-7
SLIDE 7

Paths identify files

/Users/mimno/Documents/2950/plans.txt ~/Documents/2950/plans.txt 2950/plans.txt Relative path implies a current working directory

slide-8
SLIDE 8

Paths identify files

/Users/mimno/Documents/2950/plans.txt ~/Documents/2950/plans.txt 2950/plans.txt File extensions give hints about how to interpret contents of files

slide-9
SLIDE 9

Paths identify files

/Users/mimno/Documents/2950/plans.txt ~/Documents/2950/plans.txt 2950/plans.pdf File extensions give hints about how to interpret contents of files, and which app

  • pens them
slide-10
SLIDE 10

Files contain bytes

Text files: Bytes = characters Used for documents, source code, data e.g. .txt, .rtf, .py, .csv, .xml Byte-character relationship defined by character encoding e.g. UTF-8, Latin-1, ISO-8859-7 You can look at a text file without knowing which application will read it (but it might look different) Binary files: Bytes = ¯\_(ツ)_/¯ Used for formatted docs, compiled code, data, compressed files, images e.g. .pdf, .exe, .npy, .zip, .gif Byte-data relationship defined by application. You cannot look at a binary file except through an appropriate application.

slide-11
SLIDE 11

A CSV file

Size,Color 1,green 2,red 2,green 3,red

slide-12
SLIDE 12

A CSV file

Size,Color\n1,green\n2,red\n2,green\n3,red\n[EOF]

slide-13
SLIDE 13

A CSV file

Size,Color\n1,green\n2,red\n2,green\n3,red\n[EOF]

Is \n forward- or back-slash?

slide-14
SLIDE 14

A CSV file

Size,Color↩1,green↩2,red↩2,green↩3,red↩[EOF]

slide-15
SLIDE 15

A CSV file

Size,Color↩1,green↩2,red↩2,green↩3,red↩[EOF] 83 105 122 101 44 67 111 108 111 114 10 49 44 103 114 101 101 110 10 50 44 114 101 100 10 50 44 103 114 101 101 110 10 51 44 114 101 100 10

slide-16
SLIDE 16

A CSV file

Size,Color↩1,green↩2,red↩2,green↩3,red↩[EOF] 83 105 122 101 44 67 111 108 111 114 10 49 44 103 114 101 101 110 10 50 44 114 101 100 10 50 44 103 114 101 101 110 10 51 44 114 101 100 10

ASCII maps numbers from 0-127 to common English characters, numbers, punctuation, and whitespace

slide-17
SLIDE 17

A CSV file

Size,Color↩1,green↩2,red↩2,green↩3,red↩[EOF] 83 105 122 101 44 67 111 108 111 114 10 49 44 103 114 101 101 110 10 50 44 114 101 100 10 50 44 103 114 101 101 110 10 51 44 114 101 100 10

slide-18
SLIDE 18

A CSV file

Size,Color↩1,green↩2,red↩2,green↩3,red↩[EOF] 83 105 122 101 44 67 111 108 111 114 10 49 44 103 114 101 101 110 10 50 44 114 101 100 10 50 44 103 114 101 101 110 10 51 44 114 101 100 10

slide-19
SLIDE 19

A CSV file

Size,Color↩1,green↩2,red↩2,green↩3,red↩[EOF] 83 105 122 101 44 67 111 108 111 114 10 49 44 103 114 101 101 110 10 50 44 114 101 100 10 50 44 103 114 101 101 110 10 51 44 114 101 100 10

slide-20
SLIDE 20

A CSV file

Size,Color↩1,green↩2,red↩2,green↩3,red↩[EOF] 83 105 122 101 44 67 111 108 111 114 10 49 44 103 114 101 101 110 10 50 44 114 101 100 10 50 44 103 114 101 101 110 10 51 44 114 101 100 10

What is the ASCII code for "f"? What letter corresponds to ASCII 100?

slide-21
SLIDE 21

A tab-delimited file

Size Color 1 green 2 red 2 green 3 red

slide-22
SLIDE 22

A CSV file

Size\tColor\n1\tgreen\n2\tred\n2\tgreen\n3\tred\n[EOF]

slide-23
SLIDE 23

A tab-delimited file

Size▶Color↩1▶green↩2▶red↩2▶green↩3▶red↩[EOF]

slide-24
SLIDE 24

A tab-delimited file

Size▶Color↩1▶green↩2▶red↩2▶green↩3▶red↩[EOF] 83 105 122 101 9 67 111 108 111 114 10 49 9 103 114 101 101 110 10 50 9 114 101 100 10 50 9 103 114 101 101 110 10 51 9 114 101 100 10

slide-25
SLIDE 25

Is .ipynb (Jupyter notebook) a binary or text format?

Answer: it's a text file in JSON format. JSON allows us to represent nested data using lists [1, 2, 3] and dictionaries {"a": 1, "b": "hello"}. CSV can only represent row/column tables. Each cell is represented by a dictionary that records the type of cell, the source code for the cell, and the output if any. Image data is represented in binary, but in base64 encoding. This uses 64 displayable characters (a-z, A-Z, 0-9, some punctuation), which can represent six

  • bits. It's slightly inefficient (only six of eight bits are useful), but safe to transmit as

text.

slide-26
SLIDE 26

How to turn in a valid homework

Answer all the questions (except discussion) Save your notebook with all cells executed Save your notebook in a .zip file

slide-27
SLIDE 27

Which sequence of die rolls is more likely?

A [5, 1, 5, 1, 4, 5, 6, 3, 4, 1] B [1, 1, 1, 3, 4, 4, 5, 5, 5, 6] C [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]