forked from katyhuff/2018-03-27-npre199
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
471 lines (389 loc) · 18.4 KB
/
index.html
File metadata and controls
471 lines (389 loc) · 18.4 KB
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
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Software Development for Engineering Research - Getting Started</title>
<meta name="description" content="
First lecture for ME 599: Software Development for Engineering Research
">
<meta name="author" content="Kyle Niemeyer">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<link rel="stylesheet" href="dist/reset.css">
<link rel="stylesheet" href="dist/reveal.css">
<link rel="stylesheet" href="dist/theme/simple.css" id="theme">
<!-- For syntax highlighting -->
<link rel="stylesheet" href="plugin/highlight/monokai.css">
<!-- If the query includes 'print-pdf', include the PDF print sheet -->
<script>
if( window.location.search.match( /print-pdf/gi ) ) {
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = 'css/print/pdf.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
}
</script>
<!--[if lt IE 9]>
<script src="lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<section>
<h1>Getting Started</h1>
<h3>Software Development for Engineering Research</h3>
<br/>
<h3>Kyle Niemeyer. 4 January 2022</h3>
<h3>ME 599, Corvallis, OR</h3>
</section>
<section>
<section data-markdown>
<textarea data-template>
## Today: Class overview & getting started with version control
</textarea>
</section>
<section data-markdown>
<textarea data-template>
### What this class **is** for:
- Learning computational skills to be successful in modern research
- Developing a software package from scratch for your research
</textarea>
</section>
<section data-markdown>
<textarea data-template>
### What this class **isn't** for:
- Just learning more Python (though you will)
- Those who aren't comfortable doing open-ended, self-directed work
</textarea>
</section>
<section data-markdown>
<textarea data-template>
### Motivation
Nearly all research relies on software—even experimental—but researchers don't
get trained in best practices in the same way as experimental methods.
</textarea>
</section>
<section data-markdown>
<textarea data-template>
### What are we going to learn about?
- Version control
- Collaborative software development
- Structuring programs
- Working with files
- Improving performance, parallelization
- Reproducible research
- Writing about software, documentation
- Sharing software openly, copyright
</textarea>
</section>
<section data-markdown>
<textarea data-template>
## Anything missing?
</textarea>
</section>
</section>
<section>
<section>
<h2>Who are you?</h1>
<br/>
<img src="./images/student-breakdown.png" height="250" alt="Student status breakdown">
<img src="./images/area-breakdown.png" height="250" alt="Student research area breakdown">
</section>
<section>
<img src="./images/python-class-breakdown.png" height="250" alt="Breakdown of who took Python class">
<img src="./images/command-line-breakdown.png" height="250" alt="Breakdown of command line comfort">
<img src="./images/OS-breakdown.png" height="250" alt="Breakdown of OS preferences">
</section>
<section data-markdown>
<textarea data-template>
## (Introductions)
</textarea>
</section>
</section>
<section>
<section data-markdown>
<textarea data-template>
## Who am I?
<img src="./images/kyle-niemeyer-web-face.jpg" height="200" alt="Kyle Niemeyer">
Dr. Kyle Niemeyer, Associate Professor, MIME
**Background:** computational combustion modeling
**Languages:** Matlab, Fortran, C/C++/CUDA, Python
</textarea>
</section>
<section>
<img src="./images/kyle-github-profile.png" height="600" alt="Kyle's GitHub profile">
</section>
</section>
<section>
<section>
<h2>Course Resources</h2>
</br>
<ul>
<li class="fragment">
<b>Syllabus:</b> on Canvas
</li>
<li class="fragment">
<b>GitHub:</b> <a href="https://github.com/SoftwareDevEngResearch">github.com/SoftwareDevEngResearch</a>
</li>
<li class="fragment">
<b>Other resources:</b> on Canvas
</li>
<li class="fragment">
<b>Slack chat room:</b>
<a href="https://researchsoftw-27f5620.slack.com">researchsoftw-27f5620.slack.com</a>
</li>
</ul>
</section>
<section>
<h2>Textbook</h1>
<br/>
<a href="http://physics.codes/" class="image"><img src="./images/effective-comp-physics.jpg" height="300" alt="Effective Computation in Physics"></a>
<p><a href="http://physics.codes/">http://physics.codes/</a></p>
<p>Chapters 1–6 should be review</p>
</section>
<section>
<h2>Project</h2>
<br/>
<p>Most of your work in the class will be centered around a project developing a new software package for your research.</p>
</section>
</section>
<section>
<section>
<h2>Rest of today: version control</h2>
<h3 class="fragment">What for?</h3>
<ul>
<li class="fragment">Back up changing files</li>
<li class="fragment">Store and access an annotated history</li>
<li class="fragment">Manage merging of changes between different change sets</li>
</ul>
</section>
<section>
<h2>Why important?</h2>
<a href="http://phdcomics.com/comics/archive.php?comicid=1323" class="image"><img class="fragment" src="./images/phd-comics-versions.gif" height="450" alt="Comic on file versions from PhD Comics http://phdcomics.com/comics/archive.php?comicid=1323"></a>
<p class="fragment"><small><a href="http://phdcomics.com/comics/archive.php?comicid=1323">Image credit: Jorge Cham, PhD Comics</a></small></p>
</section>
<section>
<h2>Saving copies</h2>
<p class="fragment"><img src="./images/code-file.png" height="50" style="vertical-align:middle"> <code>important_code.py</code></p>
<p class="fragment"><img src="./images/code-file.png" height="50" style="vertical-align:middle"> <code>important_code-2.py</code></p>
<p class="fragment"><img src="./images/code-file.png" height="50" style="vertical-align:middle"> <code>important_code-fix.py</code></p>
<p class="fragment"><img src="./images/code-file.png" height="50" style="vertical-align:middle"> <code>important_code-final.py</code></p>
<p class="fragment"><img src="./images/code-file.png" height="50" style="vertical-align:middle"> <code>important_code-final-4apr.py</code></p>
</section>
<section>
<h2>Git commits</h2>
<p class="fragment current-visible"><img src="./images/code-file.png" height="50" style="vertical-align:middle"> <code>important_code.py</code></p>
<p class="fragment current-visible"><img src="./images/code-file.png" height="50" style="vertical-align:middle"> <code>important_code.py</code></p>
<p class="fragment current-visible"><img src="./images/code-file.png" height="50" style="vertical-align:middle"> <code>important_code.py</code></p>
<p class="fragment current-visible"><img src="./images/code-file.png" height="50" style="vertical-align:middle"> <code>important_code.py</code></p>
<p class="fragment"><img src="./images/code-file.png" height="50" style="vertical-align:middle"> <code>important_code.py</code></p>
</section>
<section data-markdown>
<textarea data-template>
## Types of Version Control
<p class="fragment">Centralized:
<ul>
<li class="fragment">Concurrent Version System (cvs)</li>
<li class="fragment">Subversion (svn)</li>
<li class="fragment">Perforce (p4)</li>
</ul>
</p>
<p class="fragment">Distributed:
<ul>
<li class="fragment">Decentralized CVS (dcvs)</li>
<li class="fragment">mercurial (hg)</li>
<li class="fragment">bazaar (bzr)</li>
<li class="fragment"><b style="color:blue">Git (git)</b></li>
</ul>
</p>
</textarea>
</section>
<section>
<h2>Git</h2>
<div class="fragment">
<img src="./images/giant-swiss-army-knife.jpg" height="350">
<blockquote cite="http://ixd.ucsd.edu/home/f16/index.php">
Git is a knife whose handle is also a knife. – <a href="http://ixd.ucsd.edu/home/f16/index.php">Philip Guo</a>
</blockquote>
</div>
</section>
<section>
<a href="https://xkcd.com/1597/" class="image"><img src="./images/xkcd-git.png" height="500" alt="If that doesn't fix it, git.txt contains the phone number of a friend of mine who understands git. Just wait through a few minutes of 'It's really pretty simple, just think of branches as...' and eventually you'll learn the commands that will fix everything."></a>
<p><small><a href="https://xkcd.com/1597/">Image credit: xkcd</a></small></p>
</section>
</section>
<section>
<section>
<h2>Getting Started with Git</h2>
<br/>
<br/>
<pre><code data-trim class="bash">
$ git --help
$ git config --global user.name "Kyle Niemeyer"
$ git config --global user.email "kyle.niemeyer@oregonstate.edu"
$ git config --global core.editor "vim"
</code></pre>
</section>
<section>
<pre><code data-trim class="bash">
~ $ mkdir analysis_code
~ $ cd analysis_code
~/analysis_code $ git init
Initialized empty Git repository in ~/analysis_code/.git/
</code></pre>
</section>
<section>
<pre><code data-trim class="bash">
~/analysis_code $ ls
~/analysis_code $ ls -A
.git
~/analysis_code $ cd .git && ls -A
HEAD config description hooks index info logs objects packed-refs refs
</code></pre>
<br/>
<br/>
<p class="fragment">Try this yourself.</p>
</section>
<section>
<h2>Adding files</h2>
<br/>
<pre><code data-trim class="fragment bash">
~/analysis_code $ touch README.md
</code></pre>
<pre><code data-trim class="fragment bash">
~/analysis_code $ git add README.md
</code></pre>
<pre><code data-trim class="fragment bash">
~/analysis_code $ git status
</code></pre>
<br/>
<br/>
<p class="fragment">Try this yourself.</p>
</section>
<section>
<h2>Committing changes</h2>
<p class="fragment">Snapshot of repository = <b>revision</b></p>
<br/>
<p class="fragment">Committing a revision:
<ul>
<li class="fragment">Saves current state with a unique ID (hash)</li>
<li class="fragment">Names you as author</li>
<li class="fragment">Allows you to add a message</li>
</ul>
<pre><code data-trim class="fragment bash">
~/analysis_code $ git commit
</code></pre>
<p class="fragment">Try this yourself.</p>
</section>
<section>
<h2>Options to save time:</h2>
<br/>
<br/>
<pre><code data-trim class="fragment bash">
~/analysis_code $ git commit -m "This is my message"
</code></pre>
<pre><code data-trim class="fragment bash">
~/analysis_code $ git commit -am "This is my message
committing all changes"
</code></pre>
</section>
<section>
<h2>Commit messages:</h2>
<br/>
<p class="fragment">Bad commit message:</p>
<pre><code data-trim class="fragment bash">
Fixed bug
</code></pre>
<p class="fragment">Good commit message:</p>
<pre><code data-trim class="fragment bash">
Fixed bug in mass calculation
Due to incorrect density value, mass was being calculated
orders of magnitude larger than it should. The correct value
of density fixed this problem.
</code></pre>
</section>
<section>
<a href="https://xkcd.com/1296/" class="image"><img src="./images/xkcd-git_commit.png" height="400" alt="Merge branch 'asdfasjkfdlas/alkdjf' into sdkjfls-final"></a>
<p><small><a href="https://xkcd.com/1296/">Image credit: xkcd</a></small></p>
</section>
<section>
<h2>Viewing the history and differences</h2>
<br/><br/>
<pre><code data-trim class="fragment bash">
~/analysis_code $ git log
</code></pre>
<pre><code data-trim class="fragment bash">
~/analysis_code $ git diff
</code></pre>
</section>
<section>
<h2>Undoing work</h2>
<br/>
<p class="fragment">Un-add a file:</p>
<pre><code data-trim class="fragment bash">
~/analysis_code $ git reset new-file.txt
</code></pre>
<p class="fragment">Reset repository to previous commit:</p>
<pre><code data-trim data-noescape class="fragment bash">
~/analysis_code $ git reset [mode] [commit]
</code></pre>
<p class="fragment">Remove uncommitted changes:</p>
<pre><code data-trim class="fragment bash">
~/analysis_code $ git checkout -- README.md
</code></pre>
</section>
<section>
<h2>Branches</h2>
<br/>
<pre><code data-trim class="fragment bash">
~/analysis_code $ git branch
* master
~/analysis_code $ git branch experimental
~/analysis_code $ git branch
experimental
* master
~/analysis_code $ git branch new
~/analysis_code $ git branch -d new
~/analysis_code $ git checkout experimental
~/analysis_code $ git branch
* experimental
master
</code></pre>
</section>
<section>
<h2>Merging Branches</h2>
<br/><br/>
<pre><code data-trim class="fragment bash">
~/analysis_code $ git checkout master
~/analysis_code $ git merge experimental
~/analysis_code $ git log
</code></pre>
</section>
</section>
<section>
<h3>Next time: remote version control (GitHub)</h3>
</br>
<p class="fragment">Assignment for next week: project proposal</p>
</section>
</div>
</div>
<script src="dist/reveal.js"></script>
<script src="plugin/notes/notes.js"></script>
<script src="plugin/markdown/markdown.js"></script>
<script src="plugin/highlight/highlight.js"></script>
<script>
// More info about initialization & config:
// - https://revealjs.com/initialization/
// - https://revealjs.com/config/
Reveal.initialize({
hash: true,
// Learn about plugins: https://revealjs.com/plugins/
plugins: [ RevealMarkdown, RevealHighlight, RevealNotes ]
});
</script>
</body>
</html>