-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
1877 lines (1733 loc) · 93.3 KB
/
index.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
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
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en"><head>
<script src="index_files/libs/clipboard/clipboard.min.js"></script>
<script src="index_files/libs/quarto-html/tabby.min.js"></script>
<script src="index_files/libs/quarto-html/popper.min.js"></script>
<script src="index_files/libs/quarto-html/tippy.umd.min.js"></script>
<link href="index_files/libs/quarto-html/tippy.css" rel="stylesheet">
<link href="index_files/libs/quarto-html/quarto-html.min.css" rel="stylesheet" data-mode="light">
<link href="index_files/libs/quarto-html/quarto-syntax-highlighting-dark.css" rel="stylesheet" id="quarto-text-highlighting-styles"><meta charset="utf-8">
<meta name="generator" content="quarto-1.0.38">
<meta name="author" content="Shannon Pileggi">
<title>Debugging</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
<link rel="stylesheet" href="index_files/libs/revealjs/dist/reset.css">
<link rel="stylesheet" href="index_files/libs/revealjs/dist/reveal.css">
<style>
code{white-space: pre-wrap;}
span.smallcaps{font-variant: small-caps;}
span.underline{text-decoration: underline;}
div.column{display: inline-block; vertical-align: top; width: 50%;}
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
ul.task-list{list-style: none;}
pre > code.sourceCode { white-space: pre; position: relative; }
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
pre > code.sourceCode > span:empty { height: 1.2em; }
.sourceCode { overflow: visible; }
code.sourceCode > span { color: inherit; text-decoration: inherit; }
div.sourceCode { margin: 1em 0; }
pre.sourceCode { margin: 0; }
@media screen {
div.sourceCode { overflow: auto; }
}
@media print {
pre > code.sourceCode { white-space: pre-wrap; }
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
}
pre.numberSource code
{ counter-reset: source-line 0; }
pre.numberSource code > span
{ position: relative; left: -4em; counter-increment: source-line; }
pre.numberSource code > span > a:first-child::before
{ content: counter(source-line);
position: relative; left: -1em; text-align: right; vertical-align: baseline;
border: none; display: inline-block;
-webkit-touch-callout: none; -webkit-user-select: none;
-khtml-user-select: none; -moz-user-select: none;
-ms-user-select: none; user-select: none;
padding: 0 4px; width: 4em;
color: #97947a;
}
pre.numberSource { margin-left: 3em; border-left: 1px solid #97947a; padding-left: 4px; }
div.sourceCode
{ color: #f8f8f2; background-color: #2b2b2b; }
@media screen {
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
}
code span { color: #f8f8f2; } /* Normal */
code span.al { color: #dcc6e0; } /* Alert */
code span.an { color: #d4d0ab; } /* Annotation */
code span.at { color: #ffd700; } /* Attribute */
code span.bn { color: #dcc6e0; } /* BaseN */
code span.bu { } /* BuiltIn */
code span.cf { color: #ffa07a; } /* ControlFlow */
code span.ch { color: #abe338; } /* Char */
code span.cn { color: #ffa07a; } /* Constant */
code span.co { color: #d4d0ab; } /* Comment */
code span.cv { color: #d4d0ab; font-style: italic; } /* CommentVar */
code span.do { color: #d4d0ab; font-style: italic; } /* Documentation */
code span.dt { color: #dcc6e0; } /* DataType */
code span.dv { color: #dcc6e0; } /* DecVal */
code span.er { color: #dcc6e0; } /* Error */
code span.ex { } /* Extension */
code span.fl { color: #f5ab35; } /* Float */
code span.fu { color: #ffd700; } /* Function */
code span.im { } /* Import */
code span.in { color: #d4d0ab; } /* Information */
code span.kw { color: #ffa07a; } /* Keyword */
code span.op { color: #00e0e0; } /* Operator */
code span.ot { color: #ffa07a; } /* Other */
code span.pp { color: #dcc6e0; } /* Preprocessor */
code span.sc { color: #00e0e0; } /* SpecialChar */
code span.ss { color: #abe338; } /* SpecialString */
code span.st { color: #abe338; } /* String */
code span.va { color: #f5ab35; } /* Variable */
code span.vs { color: #abe338; } /* VerbatimString */
code span.wa { color: #d4d0ab; font-style: italic; } /* Warning */
</style>
<link rel="stylesheet" href="index_files/libs/revealjs/dist/theme/quarto.css" id="theme">
<link href="index_files/libs/revealjs/plugin/quarto-line-highlight/line-highlight.css" rel="stylesheet">
<link href="index_files/libs/revealjs/plugin/reveal-menu/menu.css" rel="stylesheet">
<link href="index_files/libs/revealjs/plugin/reveal-menu/quarto-menu.css" rel="stylesheet">
<link href="index_files/libs/revealjs/plugin/reveal-chalkboard/font-awesome/css/all.css" rel="stylesheet">
<link href="index_files/libs/revealjs/plugin/reveal-chalkboard/style.css" rel="stylesheet">
<link href="index_files/libs/revealjs/plugin/quarto-support/footer.css" rel="stylesheet">
<style type="text/css">
.callout {
margin-top: 1em;
margin-bottom: 1em;
border-radius: .25rem;
}
.callout.callout-style-simple {
padding: 0em 0.5em;
border-left: solid #acacac .3rem;
border-right: solid 1px silver;
border-top: solid 1px silver;
border-bottom: solid 1px silver;
display: flex;
}
.callout.callout-style-default {
border-left: solid #acacac .3rem;
border-right: solid 1px silver;
border-top: solid 1px silver;
border-bottom: solid 1px silver;
}
.callout .callout-body-container {
flex-grow: 1;
}
.callout.callout-style-simple .callout-body {
font-size: 1rem;
font-weight: 400;
}
.callout.callout-style-default .callout-body {
font-size: 0.9rem;
font-weight: 400;
}
.callout.callout-captioned.callout-style-simple .callout-body {
margin-top: 0.2em;
}
.callout:not(.callout-captioned) .callout-body {
display: flex;
}
.callout:not(.no-icon).callout-captioned.callout-style-simple .callout-content {
padding-left: 1.6em;
}
.callout.callout-captioned .callout-header {
padding-top: 0.2em;
margin-bottom: -0.2em;
}
.callout.callout-captioned .callout-caption p {
margin-top: 0.5em;
margin-bottom: 0.5em;
}
.callout.callout-captioned.callout-style-simple .callout-content p {
margin-top: 0;
}
.callout.callout-captioned.callout-style-default .callout-content p {
margin-top: 0.7em;
}
.callout.callout-style-simple div.callout-caption {
border-bottom: none;
font-size: .9rem;
font-weight: 600;
opacity: 75%;
}
.callout.callout-style-default div.callout-caption {
border-bottom: none;
font-weight: 600;
opacity: 85%;
font-size: 0.9rem;
padding-left: 0.5em;
padding-right: 0.5em;
}
.callout.callout-style-default div.callout-content {
padding-left: 0.5em;
padding-right: 0.5em;
}
.callout.callout-style-simple .callout-icon::before {
height: 1rem;
width: 1rem;
display: inline-block;
content: "";
background-repeat: no-repeat;
background-size: 1rem 1rem;
}
.callout.callout-style-default .callout-icon::before {
height: 0.9rem;
width: 0.9rem;
display: inline-block;
content: "";
background-repeat: no-repeat;
background-size: 0.9rem 0.9rem;
}
.callout-caption {
display: flex
}
.callout-icon::before {
margin-top: 1rem;
padding-right: .5rem;
}
.callout.no-icon::before {
display: none !important;
}
.callout.callout-captioned .callout-body > .callout-content > :last-child {
margin-bottom: 0.5rem;
}
.callout.callout-captioned .callout-icon::before {
margin-top: .5rem;
padding-right: .5rem;
}
.callout:not(.callout-captioned) .callout-icon::before {
margin-top: 1rem;
padding-right: .5rem;
}
/* Callout Types */
div.callout-note {
border-left-color: #4582ec !important;
}
div.callout-note .callout-icon::before {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAIKADAAQAAAABAAAAIAAAAACshmLzAAAEU0lEQVRYCcVXTWhcVRQ+586kSUMMxkyaElstCto2SIhitS5Ek8xUKV2poatCcVHtUlFQk8mbaaziwpWgglJwVaquitBOfhQXFlqlzSJpFSpIYyXNjBNiTCck7x2/8/LeNDOZxDuEkgOXe++553zfefee+/OYLOXFk3+1LLrRdiO81yNqZ6K9cG0P3MeFaMIQjXssE8Z1JzLO9ls20MBZX7oG8w9GxB0goaPrW5aNMp1yOZIa7Wv6o2ykpLtmAPs/vrG14Z+6d4jpbSKuhdcSyq9wGMPXjonwmESXrriLzFGOdDBLB8Y6MNYBu0dRokSygMA/mrun8MGFN3behm6VVAwg4WR3i6FvYK1T7MHo9BK7ydH+1uurECoouk5MPRyVSBrBHMYwVobG2aOXM07sWrn5qgB60rc6mcwIDJtQrnrEr44kmy+UO9r0u9O5/YbkS9juQckLed3DyW2XV/qWBBB3ptvI8EUY3I9p/67OW+g967TNr3Sotn3IuVlfMLVnsBwH4fsnebJvyGm5GeIUA3jljERmrv49SizPYuq+z7c2H/jlGC+Ghhupn/hcapqmcudB9jwJ/3jvnvu6vu5lVzF1fXyZuZZ7U8nRmVzytvT+H3kilYvH09mLWrQdwFSsFEsxFVs5fK7A0g8gMZjbif4ACpKbjv7gNGaD8bUrlk8x+KRflttr22JEMRUbTUwwDQScyzPgedQHZT0xnx7ujw2jfVfExwYHwOsDTjLdJ2ebmeQIlJ7neo41s/DrsL3kl+W2lWvAga0tR3zueGr6GL78M3ifH0rGXrBC2aAR8uYcIA5gwV8zIE8onoh8u0Fca/ciF7j1uOzEnqcIm59sEXoGc0+z6+H45V1CvAvHcD7THztu669cnp+L0okAeIc6zjbM/24LgGM1gZk7jnRu1aQWoU9sfUOuhrmtaPIO3YY1KLLWZaEO5TKUbMY5zx8W9UJ6elpLwKXbsaZ4EFl7B4bMtDv0iRipKoDQT2sNQI9b1utXFdYisi+wzZ/ri/1m7QfDgEuvgUUEIJPq3DhX/5DWNqIXDOweC2wvIR90Oq3lDpdMIgD2r0dXvGdsEW5H6x6HLRJYU7C69VefO1x8Gde1ZFSJLfWS1jbCnhtOPxmpfv2LXOA2Xk2tvnwKKPFuZ/oRmwBwqRQDcKNeVQkYcOjtWVBuM/JuYw5b6isojIkYxyYAFn5K7ZBF10fea52y8QltAg6jnMqNHFBmGkQ1j+U43HMi2xMar1Nv0zGsf1s8nUsmUtPOOrbFIR8bHFDMB5zL13Gmr/kGlCkUzedTzzmzsaJXhYawnA3UmARpiYj5ooJZiUoxFRtK3X6pgNPv+IZVPcnwbOl6f+aBaO1CNvPW9n9LmCp01nuSaTRF2YxHqZ8DYQT6WsXT+RD6eUztwYLZ8rM+rcPxamv1VQzFUkzFXvkiVrySGQgJNvXHJAxiU3/NwiC03rSf05VBaPtu/Z7/B8Yn/w7eguloAAAAAElFTkSuQmCC');
}
div.callout-note.callout-style-default .callout-caption {
background-color: #dae6fb
}
div.callout-important {
border-left-color: #d9534f !important;
}
div.callout-important .callout-icon::before {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAIKADAAQAAAABAAAAIAAAAACshmLzAAAEKklEQVRYCcVXTWhcVRS+575MJym48A+hSRFr00ySRQhURRfd2HYjk2SSTokuBCkU2o0LoSKKraKIBTcuFCoidGFD08nkBzdREbpQ1EDNIv8qSGMFUboImMSZd4/f9zJv8ibJMC8xJQfO3HPPPef7zrvvvnvviIkpC9nsw0UttFunbUhpFzFtarSd6WJkStVMw5xyVqYTvkwfzuf/5FgtkVoB0729j1rjXwThS7Vio+Mo6DNnvLfahoZ+i/o32lULuJ3NNiz7q6+pyAUkJaFF6JwaM2lUJlV0MlnQn5aTRbEu0SEqHUa0A4AdiGuB1kFXRfVyg5d87+Dg4DL6m2TLAub60ilj7A1Ec4odSAc8X95sHh7+ZRPCFo6Fnp7HfU/fBng/hi10CjCnWnJjsxvDNxWw0NfV6Rv5GgP3I3jGWXumdTD/3cbEOP2ZbOZp69yniG3FQ9z1jD7bnBu9Fc2tKGC2q+uAJOQHBDRiZX1x36o7fWBs7J9ownbtO+n0/qWkvW7UPIfc37WgT6ZGR++EOJyeQDSb9UB+DZ1G6DdLDzyS+b/kBCYGsYgJbSQHuThGKRcw5xdeQf8YdNHsc6ePXrlSYMBuSIAFTGAtQo+VuALo4BX83N190NWZWbynBjhOHsmNfFWLeL6v+ynsA58zDvvAC8j5PkbOcXCMg2PZFk3q8MjI7WAG/Dp9AwP7jdGBOOQkAvlFUB+irtm16I1Zw9YBcpGTGXYmk3kQIC/Cds55l+iMI3jqhjAuaoe+am2Jw5GT3Nbz3CkE12NavmzN5+erJW7046n/CH1RO/RVa8lBLozXk9uqykkGAyRXLWlLv5jyp4RFsG5vGVzpDLnIjTWgnRy2Rr+tDKvRc7Y8AyZq10jj8DqXdnIRNtFZb+t/ZRtXcDiVnzpqx8mPcDWxgARUqx0W1QB9MeUZiNrV4qP+Ehc+BpNgATsTX8ozYKL2NtFYAHc84fG7ndxUPr+AR/iQSns7uSUufAymwDOb2+NjK27lEFocm/EE2WpyIy/Hi66MWuMKJn8RvxIcj87IM5Vh9663ziW36kR0HNenXuxmfaD8JC7tfKbrhFr7LiZCrMjrzTeGx+PmkosrkNzW94ObzwocJ7A1HokLolY+AvkTiD/q1H0cN48c5EL8Crkttsa/AXQVDmutfyku0E7jShx49XqV3MFK8IryDhYVbj7Sj2P2eBxwcXoe8T8idsKKPRcnZw1b+slFTubwUwhktrfnAt7J++jwQtLZcm3sr9LQrjRzz6cfMv9aLvgmnAGvpoaGLxM4mAEaLV7iAzQ3oU0IvD5x9ix3yF2RAAuYAOO2f7PEFWCXZ4C9Pb2UsgDeVnFSpbFK7/IWu7TPTvBqzbGdCHOJQSxiEjt6IyZmxQyEJHv6xyQsYk//moVFsN2zP6fRImjfq7/n/wFDguUQFNEwugAAAABJRU5ErkJggg==');
}
div.callout-important.callout-style-default .callout-caption {
background-color: #f7dddc
}
div.callout-warning {
border-left-color: #f0ad4e !important;
}
div.callout-warning .callout-icon::before {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAIKADAAQAAAABAAAAIAAAAACshmLzAAAETklEQVRYCeVWW2gcVRg+58yaTUnizqbipZeX4uWhBEniBaoUX1Ioze52t7sRq6APio9V9MEaoWlVsFasRq0gltaAPuxms8lu0gcviE/FFOstVbSIxgcv6SU7EZqmdc7v9+9mJtNks51NTUH84ed889/PP+cmxP+d5FIbMJmNbpREu4WUkiTtCicKny0l1pIKmBzovF2S+hIJHX8iEu3hZJ5lNZGqyRrGSIQpq15AzF28jgpeY6yk6GVdrfFqdrD6Iw+QlB8g0YS2g7dyQmXM/IDhBhT0UCiRf59lfqmmDvzRt6kByV/m4JjtzuaujMUM2c5Z2d6JdKrRb3K2q6mA+oYVz8JnDdKPmmNthzkAk/lN63sYPgevrguc72aZX/L9C6x09GYyxBgCX4NlvyGUHOKELlm5rXeR1kchuChJt4SSwyddZRXgvwMGvYo4QSlk3/zkHD8UHxwVJA6zjZZqP8v8kK8OWLnIZtLyCAJagYC4rTGW/9Pqj92N/c+LUaAj27movwbi19tk/whRCIE7Q9vyI6yvRpftAKVTdUjOW40X3h5OXsKCdmFcx0xlLJoSuQngnrJe7Kcjm4OMq9FlC7CMmScQANuNvjfP3PjGXDBaUQmbp296S5L4DrpbrHN1T87ZVEZVCzg1FF0Ft+dKrlLukI+/c9ENo+TvlTDbYFvuKPtQ9+l052rXrgKoWkDAFnvh0wTOmYn8R5f4k/jN/fZiCM1tQx9jQQ4ANhqG4hiL0qIFTGViG9DKB7GYzgubnpofgYRwO+DFjh0Zin2m4b/97EDkXkc+f6xYAPX0KK2I/7fUQuwzuwo/L3AkcjugPNixC8cHf0FyPjWlItmLxWw4Ou9YsQCr5fijMGoD/zpdRy95HRysyXA74MWOnscpO4j2y3HAVisw85hX5+AFBRSHt4ShfLFkIMXTqyKFc46xdzQM6XbAi702a7sy04J0+feReMFKp5q9esYLCqAZYw/k14E/xcLLsFElaornTuJB0svMuJINy8xkIYuL+xPAlWRceH6+HX7THJ0djLUom46zREu7tTkxwmf/FdOZ/sh6Q8qvEAiHpm4PJ4a/doJe0gH1t+aHRgCzOvBvJedEK5OFE5jpm4AGP2a8Dxe3gGJ/pAutug9Gp6he92CsSsWBaEcxGx0FHytmIpuqGkOpldqNYQK8cSoXvd+xLxXADw0kf6UkJNFtdo5MOgaLjiQOQHcn+A6h5NuL2s0qsC2LOM75PcF3yr5STuBSAcGG+meA14K/CI21HcS4LBT6tv0QAh8Dr5l93AhZzG5ZJ4VxAqdZUEl9z7WJ4aN+svMvwHHL21UKTd1mqvChH7/Za5xzXBBKrUcB0TQ+Ulgkfbi/H/YT5EptrGzsEK7tR1B7ln9BBwckYfMiuSqklSznIuoIIOM42MQO+QnduCoFCI0bpkzjCjddHPN/F+2Yu+sd9bKNpVwHhbS3LluK/0zgfwD0xYI5dXuzlQAAAABJRU5ErkJggg==');
}
div.callout-warning.callout-style-default .callout-caption {
background-color: #fcefdc
}
div.callout-tip {
border-left-color: #02b875 !important;
}
div.callout-tip .callout-icon::before {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAIKADAAQAAAABAAAAIAAAAACshmLzAAADr0lEQVRYCe1XTWgTQRj9ZjZV8a9SPIkKgj8I1bMHsUWrqYLVg4Ue6v9BwZOxSYsIerFao7UiUryIqJcqgtpimhbBXoSCVxUFe9CTiogUrUp2Pt+3aUI2u5vdNh4dmMzOzHvvezuz8xNFM0mjnbXaNu1MvFWRXkXEyE6aYOYJpdW4IXuA4r0fo8qqSMDBU0v1HJUgVieAXxzCsdE/YJTdFcVIZQNMyhruOMJKXYFoLfIfIvVIMWdsrd+Rpd86ZmyzzjJmLStqRn0v8lzkb4rVIXvnpScOJuAn2ACC65FkPzEdEy4TPWRLJ2h7z4cArXzzaOdKlbOvKKX25Wl00jSnrwVxAg3o4dRxhO13RBSdNvH0xSARv3adTXbBdTf64IWO2vH0LT+cv4GR1DJt+DUItaQogeBX/chhbTBxEiZ6gftlDNXTrvT7co4ub5A6gp9HIcHvzTa46OS5fBeP87Qm0fQkr4FsYgVQ7Qg+ZayaDg9jhg1GkWj8RG6lkeSacrrHgDaxdoBiZPg+NXV/KifMuB6//JmYH4CntVEHy/keA6x4h4CU5oFy8GzrBS18cLJMXcljAKB6INjWsRcuZBWVaS3GDrqB7rdapVIeA+isQ57Eev9eCqzqOa81CY05VLd6SamW2wA2H3SiTbnbSxmzfp7WtKZkqy4mdyAlGx7ennghYf8voqp9cLSgKdqNfa6RdRsAAkPwRuJZNbpByn+RrJi1RXTwdi8RQF6ymDwGMAtZ6TVE+4uoKh+MYkcLsT0Hk8eAienbiGdjJHZTpmNjlbFJNKDVAp2fJlYju6IreQxQ08UJDNYdoLSl6AadO+fFuCQqVMB1NJwPm69T04Wv5WhfcWyfXQB+wXRs1pt+nCknRa0LVzSA/2B+a9+zQJadb7IyyV24YAxKp2Jqs3emZTuNnKxsah+uabKbMk7CbTgJx/zIgQYErIeTKRQ9yD9wxVof5YolPHqaWo7TD6tJlh7jQnK5z2n3+fGdggIOx2kaa2YI9QWarc5Ce1ipNWMKeSG4DysFF52KBmTNMmn5HqCFkwy34rDg05gDwgH3bBi+sgFhN/e8QvRn8kbamCOhgrZ9GJhFDgfcMHzFb6BAtjKpFhzTjwv1KCVuxHvCbsSiEz4CANnj84cwHdFXAbAOJ4LTSAawGWFn5tDhLMYz6nWeU2wJfIhmIJBefcd/A5FWQWGgrWzyORZ3Q6HuV+Jf0Bj+BTX69fm1zWgK7By1YTXchFDORywnfQ7GpzOo6S+qECrsx2ifVQAAAABJRU5ErkJggg==');
}
div.callout-tip.callout-style-default .callout-caption {
background-color: #ccf1e3
}
div.callout-caution {
border-left-color: #fd7e14 !important;
}
div.callout-caution .callout-icon::before {
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAIKADAAQAAAABAAAAIAAAAACshmLzAAACV0lEQVRYCdVWzWoUQRCuqp2ICBLJXgITZL1EfQDBW/bkzUMUD7klD+ATSHBEfAIfQO+iXsWDxJsHL96EHAwhgzlkg8nBg25XWb0zIb0zs9muYYWkoKeru+vn664fBqElyZNuyh167NXJ8Ut8McjbmEraKHkd7uAnAFku+VWdb3reSmRV8PKSLfZ0Gjn3a6Xlcq9YGb6tADjn+lUfTXtVmaZ1KwBIvFI11rRXlWlatwIAAv2asaa9mlB9wwygiDX26qaw1yYPzFXg2N1GgG0FMF8Oj+VIx7E/03lHx8UhvYyNZLN7BwSPgekXXLribw7w5/c8EF+DBK5idvDVYtEEwMeYefjjLAdEyQ3M9nfOkgnPTEkYU+sxMq0BxNR6jExrAI31H1rzvLEfRIdgcv1XEdj6QTQAS2wtstEALLG1yEZ3QhH6oDX7ExBSFEkFINXH98NTrme5IOaaA7kIfiu2L8A3qhH9zRbukdCqdsA98TdElyeMe5BI8Rs2xHRIsoTSSVFfCFCWGPn9XHb4cdobRIWABNf0add9jakDjQJpJ1bTXOJXnnRXHRf+dNL1ZV1MBRCXhMbaHqGI1JkKIL7+i8uffuP6wVQAzO7+qVEbF6NbS0LJureYcWXUUhH66nLR5rYmva+2tjRFtojkM2aD76HEGAD3tPtKM309FJg5j/K682ywcWJ3PASCcycH/22u+Bh7Aa0ehM2Fu4z0SAE81HF9RkB21c5bEn4Dzw+/qNOyXr3DCTQDMBOdhi4nAgiFDGCinIa2owCEChUwD8qzd03PG+qdW/4fDzjUMcE1ZpIAAAAASUVORK5CYII=');
}
div.callout-caution.callout-style-default .callout-caption {
background-color: #ffe5d0
}
</style>
<style type="text/css">
.reveal div.sourceCode {
margin: 0;
overflow: auto;
}
.reveal div.hanging-indent {
margin-left: 1em;
text-indent: -1em;
}
.reveal .slide:not(.center) {
height: 100%;
}
.reveal .slide.scrollable {
overflow-y: auto;
}
.reveal .footnotes {
height: 100%;
overflow-y: auto;
}
.reveal .slide .absolute {
position: absolute;
display: block;
}
.reveal .footnotes ol {
counter-reset: ol;
list-style-type: none;
margin-left: 0;
}
.reveal .footnotes ol li:before {
counter-increment: ol;
content: counter(ol) ". ";
}
.reveal .footnotes ol li > p:first-child {
display: inline-block;
}
.reveal .slide ul,
.reveal .slide ol {
margin-bottom: 0.5em;
}
.reveal .slide ul li,
.reveal .slide ol li {
margin-top: 0.4em;
margin-bottom: 0.2em;
}
.reveal .slide ul[role="tablist"] li {
margin-bottom: 0;
}
.reveal .slide ul li > *:first-child,
.reveal .slide ol li > *:first-child {
margin-block-start: 0;
}
.reveal .slide ul li > *:last-child,
.reveal .slide ol li > *:last-child {
margin-block-end: 0;
}
.reveal .slide .columns:nth-child(3) {
margin-block-start: 0.8em;
}
.reveal blockquote {
box-shadow: none;
}
.reveal .tippy-content>* {
margin-top: 0.2em;
margin-bottom: 0.7em;
}
.reveal .tippy-content>*:last-child {
margin-bottom: 0.2em;
}
.reveal .slide > img.stretch.quarto-figure-center,
.reveal .slide > img.r-stretch.quarto-figure-center {
display: block;
margin-left: auto;
margin-right: auto;
}
.reveal .slide > img.stretch.quarto-figure-left,
.reveal .slide > img.r-stretch.quarto-figure-left {
display: block;
margin-left: 0;
margin-right: auto;
}
.reveal .slide > img.stretch.quarto-figure-right,
.reveal .slide > img.r-stretch.quarto-figure-right {
display: block;
margin-left: auto;
margin-right: 0;
}
</style>
<link href="index_files/libs/countdown-0.4.0/countdown.css" rel="stylesheet">
<script src="index_files/libs/countdown-0.4.0/countdown.js"></script>
</head>
<body class="quarto-dark">
<div class="reveal">
<div class="slides">
<section id="title-slide" class="center">
<h1 class="title">Debugging</h1>
<p class="author">Shannon Pileggi</p>
</section>
<section id="agenda" class="title-slide slide level1 center">
<h1>Agenda</h1>
<p>Getting started</p>
<p>Troubleshooting</p>
<p>Moving on</p>
<p>Debugging your code</p>
<p>Debugging in RStudio</p>
<p>Debugging their code</p>
<p>Special cases</p>
<p>Read the source</p>
</section>
<section>
<section id="getting-started" class="title-slide slide level1 center">
<h1>Getting started</h1>
<div class="cell">
</div>
<div class="cell">
</div>
</section>
<section id="about" class="slide level2">
<h2>About</h2>
<p><strong>Licensing</strong></p>
<p>This work is licensed under a <a href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a> (CC BY-SA4.0).</p>
<p><br> <br></p>
<p><strong>Material</strong></p>
<p>This material was originally developed as part of the 2-day RStudio Conference <a href="https://rstats-wtf.github.io/wtf-2022-rsc/" target="_blank">“What They Forgot To Teach You About R”</a> workshop.</p>
</section>
<section id="checklist" class="slide level2">
<h2>Checklist</h2>
<p><br></p>
<p><svg aria-hidden="true" role="img" viewbox="0 0 448 512" style="height:1em;width:0.88em;vertical-align:-0.125em;margin-left:auto;margin-right:auto;font-size:inherit;fill:#C7B41D;overflow:visible;position:relative;"><path d="M438.6 105.4C451.1 117.9 451.1 138.1 438.6 150.6L182.6 406.6C170.1 419.1 149.9 419.1 137.4 406.6L9.372 278.6C-3.124 266.1-3.124 245.9 9.372 233.4C21.87 220.9 42.13 220.9 54.63 233.4L159.1 338.7L393.4 105.4C405.9 92.88 426.1 92.88 438.6 105.4H438.6z"></path></svg> R installed? Pretty recent?</p>
<p> Recommended R ≥ 4.2.0</p>
<p><svg aria-hidden="true" role="img" viewbox="0 0 448 512" style="height:1em;width:0.88em;vertical-align:-0.125em;margin-left:auto;margin-right:auto;font-size:inherit;fill:#C7B41D;overflow:visible;position:relative;"><path d="M438.6 105.4C451.1 117.9 451.1 138.1 438.6 150.6L182.6 406.6C170.1 419.1 149.9 419.1 137.4 406.6L9.372 278.6C-3.124 266.1-3.124 245.9 9.372 233.4C21.87 220.9 42.13 220.9 54.63 233.4L159.1 338.7L393.4 105.4C405.9 92.88 426.1 92.88 438.6 105.4H438.6z"></path></svg> RStudio installed?</p>
<p> I’m on 2022.02.3+492</p>
<p><svg aria-hidden="true" role="img" viewbox="0 0 448 512" style="height:1em;width:0.88em;vertical-align:-0.125em;margin-left:auto;margin-right:auto;font-size:inherit;fill:#C7B41D;overflow:visible;position:relative;"><path d="M438.6 105.4C451.1 117.9 451.1 138.1 438.6 150.6L182.6 406.6C170.1 419.1 149.9 419.1 137.4 406.6L9.372 278.6C-3.124 266.1-3.124 245.9 9.372 233.4C21.87 220.9 42.13 220.9 54.63 233.4L159.1 338.7L393.4 105.4C405.9 92.88 426.1 92.88 438.6 105.4H438.6z"></path></svg> Ready to build packages?</p>
<p> <code>devtools::has_devel()</code><br> <em>Your system is ready to build packages!</em></p>
</section>
<section id="additional-resources" class="slide level2 smaller">
<h2>Additional resources</h2>
<ul>
<li><p>WTF Ch 11 <em>Debugging R code</em> <br> <a href="https://rstats.wtf/debugging-r-code.html" class="uri">https://rstats.wtf/debugging-r-code.html</a></p></li>
<li><p>Advanced R Ch 22 <em>Debugging</em> <br> <a href="https://adv-r.hadley.nz/debugging.html" class="uri">https://adv-r.hadley.nz/debugging.html</a></p></li>
<li><p>Jenny Bryan 2020 RStudio Conf Keynote <em>Object of type closure is not subsettable</em> <br> <a href="https://github.com/jennybc/debugging#readme" class="uri">https://github.com/jennybc/debugging#readme</a></p></li>
<li><p>Amanda Gadrow 2018 Webinar <em>Debugging techniques in RStudio</em> <br> <a href="https://www.rstudio.com/resources/webinars/debugging-techniques-in-rstudio/" class="uri">https://www.rstudio.com/resources/webinars/debugging-techniques-in-rstudio/</a></p></li>
<li><p>Jim Hester 2019 <em>Introduction to debugging in R and RStudio</em> <br> <a href="https://www.jimhester.com/talk/2019-crug-debugging/" class="uri">https://www.jimhester.com/talk/2019-crug-debugging/</a></p></li>
<li><p>Maëlle Salmon 2021 <em>How to become a better R code detective?</em> <br> <a href="https://masalmon.eu/2021/07/13/code-detective/" class="uri">https://masalmon.eu/2021/07/13/code-detective/</a></p></li>
<li><p>Kara Woo 2019 RStudio Conf <em>Box plots A case study in debugging and perseverance</em> <a href="https://www.rstudio.com/resources/rstudioconf-2019/box-plots-a-case-study-in-debugging-and-perseverance/" class="uri">https://www.rstudio.com/resources/rstudioconf-2019/box-plots-a-case-study-in-debugging-and-perseverance/</a></p></li>
</ul>
<div class="footer">
</div>
</section>
<section id="section" class="slide level2">
<h2></h2>
<img data-src="img/debugging.jpg" alt="A cartoon of a fuzzy round monster face showing 10 different emotions experienced during the process of debugging code. The progression goes from (1) “I got this” - looking determined and optimistic; (2) “Huh. Really thought that was it.” - looking a bit baffled; (3) “...” - looking up at the ceiling in thought; (4) “Fine. Restarting.” - looking a bit annoyed; (5) “OH WTF.” Looking very frazzled and frustrated; (6) “Zombie meltdown.” - looking like a full meltdown; (7) (blank) - sleeping; (8) “A NEW HOPE!” - a happy looking monster with a lightbulb above; (9) “insert awesome theme song” - looking determined and typing away; (10) “I love coding” - arms raised in victory with a big smile, with confetti falling." style="width:20.0%" class="r-stretch"><div class="footer">
<p>Artwork by <a href="https://twitter.com/allison_horst">@allison_horst</a>.</p>
<p><a href="https://github.com/allisonhorst/stats-illustrations" class="uri">https://github.com/allisonhorst/stats-illustrations</a></p>
</div>
</section></section>
<section>
<section id="troubleshooting" class="title-slide slide level1 center">
<h1>Troubleshooting</h1>
</section>
<section id="search" class="slide level2">
<h2>1. Search</h2>
<p><br></p>
<ul>
<li><p>Google <em>exact</em> error message</p></li>
<li><p>keyword search on <a href="https://community.rstudio.com/">RStudio community</a></p></li>
<li><p>keyword search on <a href="https://stackoverflow.com/">stackoverflow</a>, <code>[r]</code> tag</p></li>
</ul>
<p>Samantha Csik 2022 R-Ladies St. Louis Workshop <em>Teach Me How To Google</em>: <a href="https://samanthacsik.github.io/teach-me-how-to-google/slides/RLadiesSTL-2022-02-22.html#1">slides</a>, <a href="https://youtu.be/93WsFQUuxvA">recording</a></p>
</section>
<section id="reset" class="slide level2 smaller">
<h2>2. Reset</h2>
<p><brshort></brshort></p>
<div class="r-fit-text">
<p>Have you tried turning it <code>OFF</code> and <code>ON</code> again?</p>
</div>
<div class="fragment">
<p><brshort></brshort></p>
<div class="r-fit-text">
<p>Restart R, especially when things get weird.</p>
</div>
</div>
<div class="fragment">
<div class="columns">
<div class="column" style="width:50%;">
<p>Session -> Restart R or</p>
<ul>
<li><p>Ctrl + Shift + F10 (Windows),</p></li>
<li><p>Cmd + Shift + 0 / Cmd + Shift + F10 (Mac)</p></li>
</ul>
</div><div class="column" style="width:50%;">
<p><code>Tools -> Global Options -> Workspace</code></p>
<p><img data-src="img/workspace-options.PNG"></p>
</div>
</div>
<div class="footer">
</div>
</div>
</section>
<section id="your-turn-exercise-00" class="slide level2">
<h2>Your turn, exercise 00</h2>
<p><a href="https://rstudio.cloud/spaces/293870/join?access_code=5lSkhQedDhpg6X-KDU0j433JgYYpIsz1YZaLGXBU" target="_blank">Click here to open the NHS-R RStudio Cloud debugging work space.</a></p>
<p><brshort></brshort></p>
<div class="question">
<p>In RStudio Cloud, set your Workspace options as shown.</p>
</div>
<p><code>Tools -> Global Options -> Workspace</code></p>
<div class="columns">
<div class="column" style="width:50%;">
<p><img data-src="img/workspace-options.PNG"></p>
</div>
</div>
<div class="cell">
<div class="cell-output-display">
<div class="countdown" id="timer_c736d3a8" data-update-every="1" data-play-sound="true" tabindex="0" style="right:0;bottom:0;font-size:2em;">
<div class="countdown-controls"><button class="countdown-bump-down">−</button><button class="countdown-bump-up">+</button></div>
<code class="countdown-time"><span class="countdown-digits minutes">03</span><span class="countdown-digits colon">:</span><span class="countdown-digits seconds">00</span></code>
</div>
</div>
</div>
</section>
<section id="reprex" class="slide level2">
<h2>3. Reprex</h2>
<div class="r-fit-text">
<p>minimum <code>repr</code>oducible <code>ex</code>ample</p>
</div>
<div class="columns">
<div class="column" style="width:45%;">
<p><img data-src="img/reprex-logo.png"></p>
</div><div class="column" style="width:55%;">
<p><br> <br> <a href="https://reprex.tidyverse.org/" class="uri">https://reprex.tidyverse.org/</a></p>
</div>
</div>
<p><brshort></brshort></p>
<div class="footer">
<p><em>make a reprex….. please</em> by Sharla Gelfand (2021)</p>
<p>slides: <a href="https://make-a-reprex-please.netlify.app/#1" class="uri">https://make-a-reprex-please.netlify.app/#1</a></p>
<p>recording: <a href="https://www.youtube.com/watch?v=G5Nm-GpmrLw" class="uri">https://www.youtube.com/watch?v=G5Nm-GpmrLw</a></p>
</div>
</section>
<section id="minimum" class="slide level2">
<h2>minimum</h2>
<div class="quarto-figure quarto-figure-center">
<figure>
<p><img data-src="img/haystack.PNG"></p>
</figure>
</div>
<div class="footer">
<p>Jenny Bryan (2020) <em>Object of type closure is not subsettable</em></p>
<p><a href="https://github.com/jennybc/debugging" class="uri">https://github.com/jennybc/debugging</a></p>
</div>
<aside class="notes">
<p>MINIMAL: Don’t wring hands and speculate. Work a small concrete example that reveals, confirms, or eliminates something.</p>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside>
</section>
<section id="reproducible-example" class="slide level2">
<h2><code>repr</code>oducible <code>ex</code>ample</h2>
<div class="quarto-figure quarto-figure-center">
<figure>
<p><img data-src="img/say_do.PNG"></p>
</figure>
</div>
<div class="footer">
<p>Jenny Bryan (2020) <em>Object of type closure is not subsettable</em></p>
<p><a href="https://github.com/jennybc/debugging" class="uri">https://github.com/jennybc/debugging</a></p>
</div>
<aside class="notes">
<p>Reproducible example: No reliance on hidden state</p>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside>
</section>
<section id="why-reprex" class="slide level2">
<h2>why reprex</h2>
<img data-src="img/reprex-why.PNG" class="r-stretch quarto-figure-center"><div class="footer">
<p>Jenny Bryan (2020) <em>Object of type closure is not subsettable</em></p>
<p><a href="https://github.com/jennybc/debugging" class="uri">https://github.com/jennybc/debugging</a></p>
</div>
</section>
<section id="review" class="slide level2">
<h2>Review</h2>
<p><br></p>
<p>Troubleshooting strategies:</p>
<p><br></p>
<ol type="1">
<li><p>Search</p></li>
<li><p>Reset</p></li>
<li><p>Reprex</p></li>
</ol>
</section>
<section id="but-what-if" class="slide level2">
<h2>But what if</h2>
<img data-src="img/swat-bugs.gif" class="r-stretch"><div class="footer">
<p><a href="https://giphy.com/gifs/TreehouseDirect-agent-binky-8UabbehIqkR0akDt1y" class="uri">https://giphy.com/gifs/TreehouseDirect-agent-binky-8UabbehIqkR0akDt1y</a></p>
</div>
</section></section>
<section>
<section id="moving-on" class="title-slide slide level1 center">
<h1>Moving on</h1>
<p><br></p>
<div class="r-fit-text">
<p>from troubleshooting to…</p>
</div>
<p><brshort></brshort></p>
<div class="r-fit-text">
<p>formal <code>debugging</code> techniques.</p>
</div>
</section>
<section id="key-concepts" class="slide level2">
<h2>Key concepts</h2>
<p><br></p>
<p><svg aria-hidden="true" role="img" viewbox="0 0 576 512" style="height:1em;width:1.12em;vertical-align:-0.125em;margin-left:auto;margin-right:auto;font-size:inherit;fill:white;overflow:visible;position:relative;"><path d="M256 96C256 113.7 270.3 128 288 128C305.7 128 320 113.7 320 96V32H394.8C421.9 32 446 49.08 455.1 74.63L572.9 407.2C574.9 413 576 419.2 576 425.4C576 455.5 551.5 480 521.4 480H320V416C320 398.3 305.7 384 288 384C270.3 384 256 398.3 256 416V480H54.61C24.45 480 0 455.5 0 425.4C0 419.2 1.06 413 3.133 407.2L120.9 74.63C129.1 49.08 154.1 32 181.2 32H255.1L256 96zM320 224C320 206.3 305.7 192 288 192C270.3 192 256 206.3 256 224V288C256 305.7 270.3 320 288 320C305.7 320 320 305.7 320 288V224z"></path></svg> traceback</p>
<p> <code>location</code> where did the error occur</p>
<p><br></p>
<p><svg aria-hidden="true" role="img" viewbox="0 0 512 512" style="height:1em;width:1em;vertical-align:-0.125em;margin-left:auto;margin-right:auto;font-size:inherit;fill:white;overflow:visible;position:relative;"><path d="M352 96V99.56C352 115.3 339.3 128 323.6 128H188.4C172.7 128 159.1 115.3 159.1 99.56V96C159.1 42.98 202.1 0 255.1 0C309 0 352 42.98 352 96zM41.37 105.4C53.87 92.88 74.13 92.88 86.63 105.4L150.6 169.4C151.3 170 151.9 170.7 152.5 171.4C166.8 164.1 182.9 160 199.1 160H312C329.1 160 345.2 164.1 359.5 171.4C360.1 170.7 360.7 170 361.4 169.4L425.4 105.4C437.9 92.88 458.1 92.88 470.6 105.4C483.1 117.9 483.1 138.1 470.6 150.6L406.6 214.6C405.1 215.3 405.3 215.9 404.6 216.5C410.7 228.5 414.6 241.9 415.7 256H480C497.7 256 512 270.3 512 288C512 305.7 497.7 320 480 320H416C416 344.6 410.5 367.8 400.6 388.6C402.7 389.9 404.8 391.5 406.6 393.4L470.6 457.4C483.1 469.9 483.1 490.1 470.6 502.6C458.1 515.1 437.9 515.1 425.4 502.6L362.3 439.6C337.8 461.4 306.5 475.8 272 479.2V240C272 231.2 264.8 224 255.1 224C247.2 224 239.1 231.2 239.1 240V479.2C205.5 475.8 174.2 461.4 149.7 439.6L86.63 502.6C74.13 515.1 53.87 515.1 41.37 502.6C28.88 490.1 28.88 469.9 41.37 457.4L105.4 393.4C107.2 391.5 109.3 389.9 111.4 388.6C101.5 367.8 96 344.6 96 320H32C14.33 320 0 305.7 0 288C0 270.3 14.33 256 32 256H96.3C97.38 241.9 101.3 228.5 107.4 216.5C106.7 215.9 106 215.3 105.4 214.6L41.37 150.6C28.88 138.1 28.88 117.9 41.37 105.4H41.37z"></path></svg> interactive debugger</p>
<p> <code>context</code> why did the error occur</p>
<p><br></p>
<p><svg aria-hidden="true" role="img" viewbox="0 0 512 512" style="height:1em;width:1em;vertical-align:-0.125em;margin-left:auto;margin-right:auto;font-size:inherit;fill:white;overflow:visible;position:relative;"><path d="M500.3 443.7l-119.7-119.7c27.22-40.41 40.65-90.9 33.46-144.7C401.8 87.79 326.8 13.32 235.2 1.723C99.01-15.51-15.51 99.01 1.724 235.2c11.6 91.64 86.08 166.7 177.6 178.9c53.8 7.189 104.3-6.236 144.7-33.46l119.7 119.7c15.62 15.62 40.95 15.62 56.57 0C515.9 484.7 515.9 459.3 500.3 443.7zM79.1 208c0-70.58 57.42-128 128-128s128 57.42 128 128c0 70.58-57.42 128-128 128S79.1 278.6 79.1 208z"></path></svg> your code vs <svg aria-hidden="true" role="img" viewbox="0 0 512 512" style="height:1em;width:1em;vertical-align:-0.125em;margin-left:auto;margin-right:auto;font-size:inherit;fill:white;overflow:visible;position:relative;"><path d="M200 376l-49.23-16.41c-7.289-2.434-7.289-12.75 0-15.18L200 328l16.41-49.23c2.434-7.289 12.75-7.289 15.18 0L248 328l49.23 16.41c7.289 2.434 7.289 12.75 0 15.18L248 376L240 416H448l-86.38-201.6C355.4 200 354.8 183.8 359.8 168.9L416 0L228.4 107.3C204.8 120.8 185.1 141.4 175 166.4L64 416h144L200 376zM231.2 172.4L256 160l12.42-24.84c1.477-2.949 5.68-2.949 7.156 0L288 160l24.84 12.42c2.949 1.477 2.949 5.68 0 7.156L288 192l-12.42 24.84c-1.477 2.949-5.68 2.949-7.156 0L256 192L231.2 179.6C228.2 178.1 228.2 173.9 231.2 172.4zM496 448h-480C7.164 448 0 455.2 0 464C0 490.5 21.49 512 48 512h416c26.51 0 48-21.49 48-48C512 455.2 504.8 448 496 448z"></path></svg> their code</p>
<aside class="notes">
<p>interactive debugging: pause the execution of a function and launch environment where you can interactively explore what’s happening</p>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside>
</section>
<section id="debugging-tools" class="slide level2">
<h2>Debugging tools</h2>
<p><img data-src="img/debugging_tools.svg"></p>
<aside class="notes">
<p>source for image in google slides at</p>
<p>https://docs.google.com/presentation/d/14mqGirw4TnblqSFY0Tk30YrxkAwIrz1xo4nMIwgqk_o/edit?u sp=sharing</p>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside>
</section>
<section id="section-1" class="slide level2">
<h2></h2>
<div class="r-fit-text">
<p>This is a lot.</p>
</div>
<div class="fragment">
<p><br></p>
<p>These tools achieve similar objectives slightly differently.</p>
<p><br></p>
<p>People don’t generally use <em>all</em> of these tools at once. They pick and choose the ones they like.</p>
</div>
</section>
<section id="sourcing" class="slide level2">
<h2>Sourcing</h2>
<p><br></p>
<p>⚠️ name your script with functions</p>
<p><brshort></brshort></p>
<p>⚠️ source your script with functions</p>
<p><brshort></brshort></p>
<p>for the best debugging experience 😎</p>
<p><br></p>
<img data-src="img/source-marked.jpg" class="r-stretch"></section>
<section id="set-up" class="slide level2">
<h2>Set up</h2>
<p><br></p>
<div class="cell">
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1"></a>f <span class="ot"><-</span> <span class="cf">function</span>(x) {</span>
<span id="cb1-2"><a href="#cb1-2"></a> x <span class="sc">+</span> <span class="dv">1</span></span>
<span id="cb1-3"><a href="#cb1-3"></a>}</span>
<span id="cb1-4"><a href="#cb1-4"></a></span>
<span id="cb1-5"><a href="#cb1-5"></a>g <span class="ot"><-</span> <span class="cf">function</span>(x) <span class="fu">f</span>(x)</span>
<span id="cb1-6"><a href="#cb1-6"></a></span>
<span id="cb1-7"><a href="#cb1-7"></a><span class="fu">g</span>(<span class="st">"a"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-error">
<pre><code>Error in x + 1: non-numeric argument to binary operator</code></pre>
</div>
</div>
</section></section>
<section>
<section id="debugging-your-code" class="title-slide slide level1 center">
<h1>Debugging your code</h1>
</section>
<section id="print" class="slide level2">
<h2>print()</h2>
<div class="cell">
<div class="sourceCode cell-code" id="cb3" data-code-line-numbers="2"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1"></a>f <span class="ot"><-</span> <span class="cf">function</span>(x) {</span>
<span id="cb3-2"><a href="#cb3-2"></a> <span class="fu">print</span>(x)</span>
<span id="cb3-3"><a href="#cb3-3"></a> x <span class="sc">+</span> <span class="dv">1</span></span>
<span id="cb3-4"><a href="#cb3-4"></a>}</span>
<span id="cb3-5"><a href="#cb3-5"></a></span>
<span id="cb3-6"><a href="#cb3-6"></a>g <span class="ot"><-</span> <span class="cf">function</span>(x) <span class="fu">f</span>(x)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<div class="cell">
<div class="sourceCode cell-code" id="cb4" data-code-line-numbers="2"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb4-1"><a href="#cb4-1"></a><span class="fu">g</span>(<span class="st">"a"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] "a"</code></pre>
</div>
<div class="cell-output cell-output-error">
<pre><code>Error in x + 1: non-numeric argument to binary operator</code></pre>
</div>
</div>
<aside class="notes">
<p>Insert numerous print statements to precisely locate the problem, and see the values of important variables.</p>
<p>Print debugging is slow and primitive, but it always works.</p>
<p>Can provide location by inserting print statements in different places, can provide context by seeing values.</p>
<p>can assess <code>location</code> by where <code>print</code> statement is inserted</p>
<p>can assess <code>context</code> by value printed</p>
<p><code>non-interactive</code> debugging</p>
<p>good for <code>your code</code></p>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside>
</section>
<section id="cat" class="slide level2">
<h2>cat()</h2>
<div class="cell">
<div class="sourceCode cell-code" id="cb7" data-code-line-numbers="2-3"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb7-1"><a href="#cb7-1"></a>f <span class="ot"><-</span> <span class="cf">function</span>(x) {</span>
<span id="cb7-2"><a href="#cb7-2"></a> <span class="fu">cat</span>(<span class="st">"f()</span><span class="sc">\n</span><span class="st">"</span>)</span>
<span id="cb7-3"><a href="#cb7-3"></a> <span class="fu">cat</span>(<span class="st">"x ="</span>, x, <span class="st">"</span><span class="sc">\n</span><span class="st">"</span>)</span>
<span id="cb7-4"><a href="#cb7-4"></a> x <span class="sc">+</span> <span class="dv">1</span></span>
<span id="cb7-5"><a href="#cb7-5"></a>}</span>
<span id="cb7-6"><a href="#cb7-6"></a></span>
<span id="cb7-7"><a href="#cb7-7"></a>g <span class="ot"><-</span> <span class="cf">function</span>(x) <span class="fu">f</span>(x)</span>
<span id="cb7-8"><a href="#cb7-8"></a></span>
<span id="cb7-9"><a href="#cb7-9"></a><span class="fu">g</span>(<span class="st">"a"</span>)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>f()
x = a </code></pre>
</div>
<div class="cell-output cell-output-error">
<pre><code>Error in x + 1: non-numeric argument to binary operator</code></pre>
</div>
</div>
<aside class="notes">
<p>can assess <code>location</code> by where <code>print</code> statement is inserted</p>
<p>can assess <code>context</code> by value printed</p>
<p><code>non-interactive</code> debugging</p>
<p>good for <code>your code</code></p>
<p>print is handy to see full object; cat is handy to create smaller messages</p>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside>
</section>
<section id="traceback" class="slide level2">
<h2>traceback()</h2>
<p><br></p>
<div class="cell">
<div class="sourceCode cell-code" id="cb10" data-code-line-numbers="3"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb10-1"><a href="#cb10-1"></a><span class="fu">source</span>(<span class="st">"demo/my_functions.R"</span>)</span>
<span id="cb10-2"><a href="#cb10-2"></a><span class="fu">g</span>(<span class="st">"a"</span>)</span>
<span id="cb10-3"><a href="#cb10-3"></a><span class="fu">traceback</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<p><img data-src="img/traceback.PNG"></p>
<p><br></p>
<p>shows the sequence of calls that lead to the error.</p>
<aside class="notes">
<p>used interactively in console, called for last error observed</p>
<style type="text/css">
span.MJX_Assistive_MathML {
position:absolute!important;
clip: rect(1px, 1px, 1px, 1px);
padding: 1px 0 0 0!important;
border: 0!important;
height: 1px!important;
width: 1px!important;
overflow: hidden!important;
display:block!important;
}</style></aside>
<div class="footer">
<p>the trace back is also known as: <br> call stack, stack trace, & back trace</p>
</div>
</section>
<section id="richer-traceback" class="slide level2">
<h2>Richer traceback</h2>
<p><br></p>
<div class="cell">
<div class="sourceCode cell-code" id="cb11" data-code-line-numbers="2,4"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb11-1"><a href="#cb11-1"></a><span class="fu">source</span>(<span class="st">"demo/my_functions.R"</span>)</span>
<span id="cb11-2"><a href="#cb11-2"></a><span class="fu">options</span>(<span class="at">error =</span> rlang<span class="sc">::</span>entrace) </span>
<span id="cb11-3"><a href="#cb11-3"></a><span class="fu">g</span>(<span class="st">"a"</span>)</span>
<span id="cb11-4"><a href="#cb11-4"></a>rlang<span class="sc">::</span><span class="fu">last_error</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<img data-src="img/rlang_last-error.PNG" class="r-stretch"></section>
<section id="richer-traceback-1" class="slide level2">
<h2>Richer traceback</h2>
<p><br></p>
<div class="cell">
<div class="sourceCode cell-code" id="cb12" data-code-line-numbers="5"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb12-1"><a href="#cb12-1"></a><span class="fu">source</span>(<span class="st">"demo/my_functions.R"</span>)</span>
<span id="cb12-2"><a href="#cb12-2"></a><span class="fu">options</span>(<span class="at">error =</span> rlang<span class="sc">::</span>entrace) </span>
<span id="cb12-3"><a href="#cb12-3"></a><span class="fu">g</span>(<span class="st">"a"</span>)</span>
<span id="cb12-4"><a href="#cb12-4"></a>rlang<span class="sc">::</span><span class="fu">last_error</span>()</span>
<span id="cb12-5"><a href="#cb12-5"></a>rlang<span class="sc">::</span><span class="fu">last_trace</span>()</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<img data-src="img/rlang_last-trace.PNG" class="r-stretch"><p><br></p>
<p><code>options(error = rlang::entrace)</code> <br> could go in your <code>.Rprofile</code></p>
</section>
<section id="traceback-vs-rlang-functions" class="slide level2">
<h2>traceback vs rlang functions</h2>
<p><br></p>
<p>Numbering and ordering differs between <code>traceback()</code> and rlang functions.</p>
<p><brshort></brshort></p>
<img data-src="img/traceback-ordering.PNG" class="r-stretch"><div class="footer">
<p><a href="https://adv-r.hadley.nz/debugging.html#call-stack-ordering" class="uri">https://adv-r.hadley.nz/debugging.html#call-stack-ordering</a></p>
</div>
</section>
<section id="browser" class="slide level2">
<h2>browser()</h2>
<div class="cell">
<div class="sourceCode cell-code" id="cb13" data-code-line-numbers="2"><pre class="sourceCode numberSource r number-lines code-with-copy"><code class="sourceCode r"><span id="cb13-1"><a href="#cb13-1"></a>f <span class="ot"><-</span> <span class="cf">function</span>(x) {</span>
<span id="cb13-2"><a href="#cb13-2"></a> <span class="fu">browser</span>()</span>
<span id="cb13-3"><a href="#cb13-3"></a> x <span class="sc">+</span> <span class="dv">1</span></span>
<span id="cb13-4"><a href="#cb13-4"></a>}</span>
<span id="cb13-5"><a href="#cb13-5"></a></span>
<span id="cb13-6"><a href="#cb13-6"></a>g <span class="ot"><-</span> <span class="cf">function</span>(x) <span class="fu">f</span>(x)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</div>
<p><br></p>
<p><code>browser()</code> opens the interactive debugger.</p>
<ol type="1">
<li><p>Modify the function by inserting a <code>browser()</code> statement.</p></li>
<li><p>Source the function.</p></li>
<li><p>Execute the function.</p></li>
</ol>
</section>
<section id="interactive-debugger" class="slide level2">
<h2>Interactive debugger</h2>
<img data-src="img/interactive-debugger.PNG" class="r-stretch"></section>
<section id="interactive-debugger-tips" class="slide level2">
<h2>Interactive debugger tips</h2>
<p><br></p>
<div class="columns">
<div class="column" style="width:35%;">
<p>Investigate objects</p>
<p><br></p>
<p><br></p>
<p>Control execution</p>
</div><div class="column" style="width:5%;">
</div><div class="column" style="width:55%;">
<p><code>ls()</code>, <code>ls.str()</code>,<br> <code>str()</code>, <code>print()</code></p>
<p><br></p>
<div class="small">
<table>
<thead>
<tr class="header">
<th>command</th>
<th>operation</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><code>n</code></td>
<td>next statement</td>
</tr>
<tr class="even">
<td><code>c</code></td>
<td>continue (leave interactive debugging)</td>
</tr>
<tr class="odd">
<td><code>s</code></td>
<td>step into function call</td>
</tr>
<tr class="even">
<td><code>f</code></td>
<td>finish loop / function</td>
</tr>
<tr class="odd">
<td><code>where</code></td>
<td>show previous calls</td>
</tr>
<tr class="even">
<td><code>Q</code></td>
<td>quit debugger</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</section>
<section id="debugging-your-code-1" class="slide level2">
<h2>Debugging your code</h2>
<img data-src="img/debugging_yours.svg" class="r-stretch"></section>
<section id="your-turn-exercise-01" class="slide level2">
<h2>Your turn, exercise 01</h2>
<p><a href="https://rstudio.cloud/spaces/293870/join?access_code=5lSkhQedDhpg6X-KDU0j433JgYYpIsz1YZaLGXBU" target="_blank">Click here to open the NHS-R RStudio Cloud debugging work space.</a></p>
<p><brshort></brshort></p>
<div class="question">
<p>Complete 01_exercise to practice debugging your own code.</p>
</div>
<div class="small">
<p>Check out the <code>README.md</code> for some getting started tips!</p>
<ul>
<li><p><code>01_debugging_spartan.R</code> (directions to explore without suggested code)</p></li>
<li><p><code>01_debugging_comfy.R</code> (directions to explore with suggested code)</p></li>
<li><p><code>01_debugging_solution.R</code> (directions to explore with code solutions)</p></li>
</ul>
</div>
<div class="cell">
<div class="cell-output-display">
<div class="countdown" id="timer_26f57079" data-update-every="1" data-play-sound="true" tabindex="0" style="right:0;bottom:0;font-size:2em;">
<div class="countdown-controls"><button class="countdown-bump-down">−</button><button class="countdown-bump-up">+</button></div>
<code class="countdown-time"><span class="countdown-digits minutes">15</span><span class="countdown-digits colon">:</span><span class="countdown-digits seconds">00</span></code>
</div>
</div>
</div>
<div class="footer">
<p><a href="https://github.com/rstats-wtf/wtf-debugging" class="uri">https://github.com/rstats-wtf/wtf-debugging</a></p>
</div>
</section></section>
<section>
<section id="debugging-in-rstudio" class="title-slide slide level1 center">
<h1>Debugging in RStudio</h1>
</section>
<section id="editor-breakpoints" class="slide level2">
<h2>Editor breakpoints</h2>
<p>red circle = breakpoint = <code>browser()</code></p>
<p>(but you don’t have to change your code)</p>
<img data-src="img/breakpoint.PNG" class="r-stretch"><div class="fragment">
<p>Set / re-set an editor breakpoint:</p>
<ul>
<li><p>click to the left of the line number in the source file</p></li>
<li><p>press Shift+F9 with your cursor on the line</p></li>
</ul>
</div>
</section>
<section id="editor-breakpoints-1" class="slide level2">
<h2>Editor breakpoints</h2>
<p>red circle = breakpoint = <code>browser()</code></p>
<p>(but you don’t have to change your code)</p>
<img data-src="img/breakpoint.PNG" class="r-stretch"><p>To activate, either</p>
<ul>
<li><p>click IDE Source button, or</p></li>
<li><p><code>debugSource(</code>“demo/my_functions.R”<code>)</code></p></li>
</ul>
</section>
<section id="debugging-console" class="slide level2">
<h2>Debugging console</h2>
<img data-src="img/cheatsheet-debug-console.PNG" class="r-stretch"><div class="footer">
<p>RStudio IDE cheatsheet</p>
<p><a href="https://www.rstudio.com/resources/cheatsheets/" class="uri">https://www.rstudio.com/resources/cheatsheets/</a></p>
</div>
</section>
<section id="ide-on-error" class="slide level2">