-
Notifications
You must be signed in to change notification settings - Fork 0
/
session1a.html
427 lines (421 loc) · 14.3 KB
/
session1a.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>Exploring your computer</title>
<link rel="stylesheet" href="css/reset.css" />
<link rel="stylesheet" href="css/reveal.css" />
<link rel="stylesheet" href="css/theme/solarized.css" />
<!-- Theme used for syntax highlighting of code -->
<link rel="stylesheet" href="lib/css/monokai.css" />
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
<style>
.mono {
font-family: monospace;
font-weight: bold}
.bigImg {
max-width: 60%;
}
.container {
display: flex;
text-align: left}
.container p {
margin-left: 4%}
.warn {
flex-grow: 0;
flex-shrink: 0;
width: 5em}
.dossier {
flex-grow: 0;
flex-shrink: 0;
width: 7em;
}</style>
</head>
<body>
<div class="reveal">
<div class="slides">
<section>
<h1>Explore your computer</h1>
</section>
<section>
<h2>Goals</h2>
<ul>
<li>Learn the different types of files</li>
<li>Browse the file system</li>
<li>Create/delete/move folders and files from the command line</li>
</ul>
</section>
<section>
<section>
<h1>Files, formats and character encoding</h1>
</section>
<section>
<h2>File types</h2>
<ul>
<li><strong>executable files</strong>: they contain programs</li>
<li><strong>data files</strong>: they contain different types of
information: text, image, audio, video.</li>
</ul>
</section>
<section>
<h2>File types (another taxonomy)</h2>
<ul>
<li><strong>text files</strong>: data is stored using electronic text
(characters). They are human-readable.</li>
<li><strong>binary files</strong>: data is stored in binary format. They
are computer-readable but not human-readable.</li>
</ul>
</section>
<section>
<img src="img/punch-card.jpg" alt="punched card file" class="bigImg"
style="max-width:55%" />
<div class="fragment"><p><a
href="https://commons.wikimedia.org/wiki/File:PunchCardDecks.agr.jpg"
target="_blank">Punched card decks</a> by
ArnoldReinhold</p></div>
</section>
<section>
<h2>Formats</h2>
<ul>
<li>The file extension can be used as a hint to the format</li>
<li>The format tells us the specific software we need to read it and/or
manipulate it (e.g. data files) or run it (i.e. executable
files)</li>
</ul>
</section>
<!--<section>
<figure><img src="img/file_extensions.png" alt="xkcd file extensions" />
<figcaption><a href="https://xkcd.com/1301/" target="_blank">File
extensions</a> by xkcd</figcaption></figure>
</section>-->
<section>
<h2>Character encoding</h2>
<ul>
<li>Any “text” is created from <strong>characters</strong>.</li>
<li>Characters that are needed for a specific purpose are grouped into a
<strong>character set</strong>.</li>
<li>To refer to a character in an unambiguous way, each character is
associated to a <strong>code point</strong> (a number).</li>
<li>Characteres are stored in the computers as one of more
<strong>bytes</strong>.</li>
<li>A <strong>character encoding</strong> is a set of mappings between
the bytes and the character set.</li>
</ul>
</section>
<section>
<h2>What character encoding?</h2>
<h3>UTF-8</h3>
<div class="fragment">
<div class="container">
<img src="img/warning.png" alt="warning sign" class="warn" />
<p>Your machine might be using a different encoding by default (eg.
Windows-1252 or CP-1252)</p></div>
</div>
</section>
<!--<section>
<figure>
<img src="img/encoding.png" alt="xkcd encoding" />
<figcaption><a href="https://xkcd.com/1209/" target="_blank"
>Encoding</a> by xkcd</figcaption>
</figure>
</section>-->
<section>
<h2>In this course we will work with:</h2>
<ul>
<li><span class="mono">.txt</span> plain text</li>
<li><span class="mono">.csv</span> tabular plain text (comma-separated
values)</li>
<li><span class="mono">.json</span> JavaScript Object Notation. It
stores and trasmits data consisting of attribute-value pairs and
collections of elements</li>
<li><span class="mono">.py</span> source code in the script language
Python</li>
<li><span class="mono">.ipynb</span> notebook documents used by Jupyter
Notebook, interactive computational environment to work with
Python</li>
</ul>
</section></section>
<section>
<section>
<h1>The file system</h1>
</section>
<section>
<h2>The terminal</h2>
<ul>
<li>Also known as console, command-line interface</li>
<li>It processes commands to a computer program in the form of lines of
text</li>
</ul>
</section>
<section>
<h2>To open the terminal</h2>
<ul>
<li>Linux: press <span class="mono">CTRL + ALT + T</span></li>
<li>Windows: press <span class="mono">Windows + X</span>; select <span
class="mono">Windows PowerShell</span> or open the start menu
and type “Powershell”</li>
<li>Mac: in the Finder, open <span class="mono"
>/Applications/Utilities</span> (or use Launchpad and type
“Terminal”)</li>
</ul>
</section>
<section>
<h2>Command</h2>
<p style="text-align:left">It is a request the user sends to the OS for it
to execute it. Elements:</p>
<ol>
<li>Name of a executable program (e.g. <span class="mono"
>python</span>)</li>
<li>A set of options whose name is preceded by one or two hyphens (e.g.
<span class="mono">-i</span> or <span class="mono"
>--help</span>)</li>
<li>A set of arguments to define the file(s) or the data that must be
used</li>
</ol>
</section><section>
<h2>Command example</h2>
<p class="mono">python my_wonderful_collation_script.py</p>
</section>
<section>
<h2>File/directory naming conventions</h2>
<div class="container">
<img src="img/warning.png" alt="warning sign" class="warn" />
<div><p>Do not use whitespaces!</p>
<p>(and avoid special characters as well)</p></div>
</div>
</section>
<section>
<h2>Paths</h2>
<ul>
<li>A path specifies a unique location in a file system. It points to a
location by following the directory tree hierarchy, thus it looks
like a slash-separated list of directory names followed by either a
directory name or a file name. Eg.: <ul>
<li>macOS: <span class="mono"
>/Users/<em>username</em>/Desktop</span></li>
<li>Linux: <span class="mono"
>/home/<em>username</em>/Desktop</span></li>
<li>Windows: <span class="mono"
>C:\Users\<em>username</em>\Desktop</span></li>
</ul></li>
</ul>
</section>
<section>
<h2>Path representation (conventions)</h2>
<ul>
<li>root directory <ul>
<li>UNIX: <span class="mono">/</span></li>
<li>Windows: <span class="mono">\</span> (relative to current
working directory root) or <span class="mono"
><em>drive_letter</em>:\</span></li>
</ul></li>
<li>directory separator <ul>
<li>UNIX: <span class="mono">/</span></li>
<li>Windows: <span class="mono">\</span></li>
</ul></li>
</ul>
</section>
<section>
<h2>Path representation (conventions)</h2>
<ul>
<li>current directory: <span class="mono">.</span></li>
<li>parent directory: <span class="mono">..</span></li>
</ul>
</section>
<section>
<h2>Types of path</h2>
<ul>
<li>relative: path in relation to the current location</li>
<li>absolute: path in relation to the disk root</li>
</ul>
</section>
<section>
<h2>To change folder</h2>
<ul>
<li>UNIX: <span class="mono">cd <em>directory_name</em></span></li>
<li>Windows: <span class="mono">Set-Location
<em>directory_name</em></span> or <span class="mono">cd
<em>directory_name</em></span> or <span class="mono">chdir
<em>directory_name</em></span></li>
</ul>
</section>
<section>
<div class="container">
<img src="img/index.jpeg" alt="example of folder structure"
class="dossier" />
<div style="text-align:left; margin-left:2%">
<p>We are in “dossier3”</p>
<ul>
<li>“my” absolute path: <span class="mono"
>/arborescence/dossier1/dossier3</span></li>
<li>to move to dossier5 (relative path): <span class="mono">cd
dossier5</span></li>
<li>to move to dossier1 (relative path): <span class="mono">cd
..</span></li>
<li>to move to dossier4 (relative path): <span class="mono">cd
../dossier4</span></li>
<li>to move to root: <span class="mono">cd /</span></li>
</ul>
</div></div>
</section>
<section>
<h2>Directories</h2>
<p>When we open the terminal, we are at the root of our personal folder</p>
</section>
<section>
<a
href="https://commons.wikimedia.org/wiki/File:Linux_File_System_Structure.png"
target="_blank">
<img src="img/linuxfile.png" alt="Linux file system" />
</a>
</section>
<section>
<figure>
<img src="img/linuxfile_home.png" alt="Linux file system" />
</figure>
</section>
<section>
<figure>
<img src="img/windows-list.png" alt="Windows file system" />
</figure>
</section>
<section>
<figure>
<img src="img/windows-user.png" alt="Windows file system" />
</figure>
</section>
<section>
<figure>
<img src="img/windows-root-console.png" alt="Windows console" />
</figure>
</section>
<section>
<figure>
<img src="img/windows-root-console-highlight.png" alt="Windows console"
/>
</figure>
</section>
<section>
<figure><img src="img/mac-file-system.png" alt="Mac file system" />
</figure>
</section>
<section>
<h2>List the contents of a directory</h2>
<ul>
<li>UNIX: <span class="mono">ls</span></li>
<li>Windows: <span class="mono">ls</span> or <span class="mono"
>dir</span></li>
</ul>
</section>
<section>
<h2>Exercise 1</h2>
<ol>
<li>Open the terminal</li>
<li>List all files and directories</li>
<li>Go to your desktop</li>
</ol>
</section>
</section>
<section>
<section>
<h1>Modifying the file system</h1>
</section>
<section>
<h2>Create a directory</h2>
<ul>
<li>UNIX: <span class="mono">mkdir <em>directory_name</em></span></li>
<li>Windows: <span class="mono">mkdir <em>directory_name</em></span> or
<span class="mono">New-Item <em>directory_name</em></span></li>
</ul>
</section>
<section>
<h2>Copy a file</h2>
<p><span class="mono">cp <em>file_name_source</em>
<em>file_name_output</em></span></p>
</section>
<section>
<h2>Move a file</h2>
<p><span class="mono">mv <em>file_name_source</em>
<em>file_name_output</em></span></p>
</section>
<section>
<h2>Delete a file</h2>
<p><span class="mono">rm <em>file_name</em></span></p>
</section>
<section>
<h2>Delete a directory</h2>
<p><span class="mono">rm -r <em>directory_name</em></span></p>
</section>
<section>
<h2>Exercise 2</h2>
<p style="text-align:left">Using the command line:</p>
<ol>
<li>Open the terminal and go to your desktop or documents folder</li>
<li>Create the folder “my_data”</li>
<li>Bonus (optional): Copy or move at least one of the files with which
you want to work in this course</li>
</ol>
</section>
</section><section>
<section>
<h1>Additional materials</h1>
</section>
<section>
<h2>OS: Windows</h2>
<ul>
<li>Dawson, Ted: “<a
href="https://programminghistorian.org/en/lessons/intro-to-powershell"
target="_blank">Introduction to the Windows Command Line with
PowerShell</a>”. <em>The Programming Historian</em>.</li>
</ul>
</section>
<section>
<h2>OS: All</h2>
<ul>
<li>Milligan, Ian & Baker, James: “<a
href="https://programminghistorian.org/en/lessons/intro-to-bash"
target="_blank">Introduction to the Bash Command Line</a>”.
<em>The Programming Historian</em>.</li>
<li>W3C: “<a
href="https://www.w3.org/International/questions/qa-what-is-encoding"
target="blank">Character encodings for beginners</a>”.</li>
<li>Priceton University Library: <a
href="https://libguides.princeton.edu/c.php?g=102546&p=930626"
target="_blank">“File naming and structure”</a>. Research Data
Management at Princeton.</li>
</ul>
</section>
<section>
<h2>Resources</h2>
<ul>
<li><a href="https://www.webatic.com/encoding-explorer" target="_blank"
>Encoding Explorer</a> (by Webatic)</li>
<li><a href="https://fileinfo.com/" target="_blank">FileInfo</a>
(database with file formats and extensions)</li>
</ul>
</section>
</section>
</div>
</div>
<script src="js/reveal.js"></script>
<script>
Reveal.initialize({
dependencies: [
{ src: 'plugin/markdown/marked.js' },
{ src: 'plugin/markdown/markdown.js' },
{ src: 'plugin/notes/notes.js', async: true },
{ src: 'plugin/highlight/highlight.js', async: true }
]
});
</script>
</body>
</html>