WEBVTT
00:01.040 --> 00:03.520
Hello, everybody. My name is Daniel German.
00:03.520 --> 00:00:04.799
I'm a professor of computer science
00:00:04.799 --> 00:00:06.080
at the University of Victoria,
00:00:06.080 --> 00:00:07.680
and I have been teaching programming
00:00:07.680 --> 00:00:12.080
for more than 10 years.
00:12.080 --> 00:00:14.639
I want to tell you today
00:00:14.639 --> 00:00:15.759
about how I have been
00:00:15.759 --> 00:00:17.680
using Emacs effectively
00:00:17.680 --> 00:00:20.000
during the last 10 years,
00:00:20.000 --> 00:00:22.880
and to try to improve how I not only
00:00:22.880 --> 00:00:24.720
create content for my students,
00:24.720 --> 00:00:26.480
but also how I deliver it,
00:00:26.480 --> 00:00:27.680
and particularly how,
00:00:27.680 --> 00:00:29.119
within the last five years,
00:00:29.119 --> 00:00:31.599
I have been using Org mode
00:00:31.599 --> 00:00:33.200
in a very effective way
00:33.200 --> 00:00:35.600
that benefits both
00:00:35.600 --> 00:00:38.239
my students and myself
00:38.239 --> 00:00:40.480
in the creation and the delivery
00:00:40.480 --> 00:00:42.399
of content.
00:42.399 --> 00:00:45.200
Let me switch to my computer.
00:00:45.200 --> 00:00:46.480
I'm going to remove myself
00:00:46.480 --> 00:00:47.840
because I can use
00:00:47.840 --> 00:00:50.800
all the real-estate screen.
00:51.840 --> 00:54.079
The goal of my presentation today
00:54.079 --> 00:00:55.600
is really to give you
00:00:55.600 --> 00:00:59.280
a little bit of an overview
00:00:59.280 --> 00:01:03.440
of how I have been able to
01:03.440 --> 00:01:06.240
combine the use of Org mode
00:01:06.240 --> 00:01:08.560
and with some other tools.
00:01:08.560 --> 00:01:10.880
I'll talk about specifically about them
00:01:10.880 --> 00:01:13.680
and then also offer some suggestions
00:01:13.680 --> 00:01:14.640
and recommendations
00:01:14.640 --> 00:01:16.240
in how to get it started.
01:16.240 --> 00:01:18.799
I have created a configuration,
00:01:18.799 --> 00:01:20.080
a set of configuration files
00:01:20.080 --> 00:01:20.799
that you can use.
00:01:20.799 --> 00:01:22.880
I will describe them towards the end.
01:22.880 --> 00:01:28.240
Hopefully, it will make it easy
00:01:28.240 --> 00:01:31.439
for all of you to get started on using it.
01:31.439 --> 01:33.200
So we start talking a little bit
01:33.200 --> 00:01:34.079
about the challenges
00:01:34.079 --> 00:01:35.119
of teaching programming.
00:01:35.119 --> 00:01:37.200
I think that the fundamental one
00:01:37.200 --> 00:01:41.680
is that keeping the content
00:01:41.680 --> 00:01:45.280
and the slides up to date is hard,
00:01:45.280 --> 00:01:46.960
because the content is programs.
00:01:46.960 --> 00:01:47.840
There are programs
00:01:47.840 --> 00:01:50.399
that sometimes have errors,
00:01:50.399 --> 00:01:53.759
and sometimes the slides are
00:01:53.759 --> 00:01:58.079
incomplete snippets of code, and that
00:01:58.079 --> 00:02:00.240
once they go into the slides software,
00:02:00.240 --> 00:02:01.840
like Google Slides or PowerPoint,
00:02:01.840 --> 00:02:04.159
they're essentially static objects.
02:05.520 --> 00:02:07.439
If we need to update them,
00:02:07.439 --> 00:02:09.920
we basically don't know
00:02:09.920 --> 00:02:12.160
whether the update code actually works,
00:02:12.160 --> 00:02:13.440
or does it work?
00:02:13.440 --> 00:02:16.000
Also, we cannot insert automatically
00:02:16.000 --> 00:02:16.400
the output.
00:02:16.400 --> 00:02:18.480
We'll have to run the snippet outside,
00:02:18.480 --> 00:02:20.560
and run it, and then insert that code.
00:02:20.560 --> 00:02:22.080
So that's very cumbersome.
00:02:22.080 --> 00:02:23.200
It's really, really one of the
00:02:23.200 --> 00:02:26.080
major challenges of using a slide software
00:02:26.080 --> 00:02:29.360
to teach programming.
02:29.360 --> 00:02:30.879
The other thing is that
00:02:30.879 --> 00:02:32.000
during the presentation,
00:02:32.000 --> 00:02:33.440
there's nothing you can do with the code.
00:02:33.440 --> 00:02:34.480
You might be able to edit it,
00:02:34.480 --> 00:02:35.440
but you cannot run it.
00:02:35.440 --> 00:02:37.360
You have to move outside of the
00:02:37.360 --> 00:02:38.640
presentation software
00:02:38.640 --> 00:02:41.200
to be able to execute the code.
02:42.800 --> 00:02:44.640
The last one is kind of related to
00:02:44.640 --> 00:02:46.959
the previous two.
02:46.959 --> 00:02:48.800
You don't have a single file
00:02:48.800 --> 00:02:51.121
and your information is spread across
00:02:51.121 --> 00:02:52.879
many, many different files,
00:02:52.879 --> 00:02:54.080
especially if you have lots of
00:02:54.080 --> 00:02:55.760
different snippets in your slides.
00:02:55.760 --> 00:02:56.959
You probably have a lot of
00:02:56.959 --> 00:02:59.440
different small files, each of them
02:59.440 --> 03:01.599
contributing something to your slides,
03:01.599 --> 03:06.239
and so it becomes a pain to manage.
03:07.280 --> 00:03:10.080
All of this is where Org mode
00:03:10.080 --> 00:03:12.640
really excels. Org mode is capable of
00:03:12.640 --> 00:03:15.840
doing everything, and it needs
00:03:15.840 --> 00:03:18.400
a little bit of help from some friends.
00:03:18.400 --> 00:03:22.159
I will describe what I mean by that.
00:03:22.159 --> 00:03:23.040
But the other thing
00:03:23.040 --> 00:03:24.480
that is also very valuable
03:24.480 --> 00:03:27.440
is that it's within the magic of Emacs.
00:03:27.440 --> 00:03:30.480
I absolutely love to be able to
03:30.480 --> 00:03:32.879
work with text within Emacs.
00:03:32.879 --> 00:03:34.799
I enjoy actually creating my notes
00:03:34.799 --> 00:03:36.640
in Org mode way more than if I was
00:03:36.640 --> 00:03:39.360
making them in Google Slides.
03:39.360 --> 00:03:42.400
Let me start by giving you a short demo.
00:03:42.400 --> 00:03:46.400
I have been teaching programming in C++
00:03:46.400 --> 00:03:47.519
for around five years,
00:03:47.519 --> 00:03:50.159
and this was really the trigger towards
03:50.159 --> 00:03:53.280
trying to do everything within Org mode.
00:03:53.280 --> 00:03:58.159
So I have a repository in GitHub,
00:03:58.159 --> 00:03:59.439
and I think that GitHub
00:03:59.439 --> 00:04:00.560
is an excellent tool
00:04:00.560 --> 00:04:04.480
that works collaboration with Org mode.
04:04.480 --> 00:04:05.439
I'll describe actually
00:04:05.439 --> 00:04:07.680
what I mean by that.
00:04:07.680 --> 00:04:09.680
My lectures are essentially Org files.
00:04:09.680 --> 00:04:12.480
So, for example, let's go into
00:04:12.480 --> 00:04:15.040
one of these files.
04:15.040 --> 00:04:16.799
This is a an Org file.
00:04:16.799 --> 00:04:21.199
You can actually see it in the extension.
04:21.199 --> 04:26.160
I get a table of contents.
04:26.160 --> 00:04:28.000
GitHub creates or give us actually
00:04:28.000 --> 00:04:31.280
the ability to quickly jump, and it creates
00:04:31.280 --> 00:04:32.880
a dynamic table of contents,
00:04:32.880 --> 00:04:33.759
but I also can actually
00:04:33.759 --> 00:04:35.280
create it automatically,
00:04:35.280 --> 00:04:36.800
and then here it goes.
00:04:36.800 --> 00:04:38.479
This is the code that i have.
00:04:38.479 --> 00:04:41.440
This is a snippet
00:04:41.440 --> 00:04:44.240
that I present in the class.
04:44.240 --> 00:04:45.680
Let me actually show you
00:04:45.680 --> 00:04:48.400
how I do it within Emacs.
04:48.400 --> 00:04:52.160
So what I will do is the following.
00:04:52.160 --> 00:04:55.440
Let me try to open that file.
04:57.919 --> 04:59.440
Here's the file,
04:59.440 --> 00:05:00.880
and it's exactly the same
00:05:00.880 --> 00:05:03.759
that we were browsing in GitHub.
00:05:03.759 --> 00:05:08.720
What I do is I simply just scroll through
05:08.720 --> 00:05:10.160
the document. It's almost like
00:05:10.160 --> 00:05:13.440
movie credits at the end of the movie.
00:05:13.440 --> 00:05:15.360
I don't break them into chunks
00:05:15.360 --> 00:05:16.639
that I show in the screen.
00:05:16.639 --> 00:05:18.320
I see no point in doing that.
00:05:18.320 --> 00:05:20.880
What I do is I simply scroll through
00:05:20.880 --> 00:05:24.160
the text. The students are able to see
00:05:24.160 --> 00:05:26.560
the same information in GitHub
00:05:26.560 --> 00:05:27.759
on their computer,
05:27.759 --> 00:05:29.680
or they can print it if they want,
00:05:29.680 --> 00:05:31.039
and they are able to actually
00:05:31.039 --> 00:05:32.560
follow with me, and then having
00:05:32.560 --> 00:05:33.759
a much bigger picture
05:33.759 --> 05:36.320
than if i just show a very small snippet.
05:36.320 --> 00:05:38.800
In the case that the snippet is too big,
00:05:38.800 --> 00:05:40.800
for example, let's say this one
00:05:40.800 --> 00:05:42.240
actually doesn't cover the...
00:05:42.240 --> 00:05:43.759
covers more than full screen,
00:05:43.759 --> 00:05:45.360
I actually reduce the size
00:05:45.360 --> 00:05:48.000
and then give a little bit of
00:05:48.000 --> 00:05:49.759
an explanation of the whole thing,
00:05:49.759 --> 00:05:51.600
and then focus and say this is the line
00:05:51.600 --> 00:05:53.600
where we have to pay attention.
05:53.600 --> 00:05:55.600
Notice actually how I use color for that.
00:05:55.600 --> 00:05:57.759
I think that the ability to use color
00:05:57.759 --> 00:05:59.759
and typesetting is fundamental
00:05:59.759 --> 00:06:01.520
to be able to do this effectively,
00:06:01.520 --> 00:06:02.720
and the nice thing is that
00:06:02.720 --> 00:06:04.160
we can configure Org mode
00:06:04.160 --> 00:06:05.840
to be able to do most of this
06:05.840 --> 06:08.160
automatically.
06:08.160 --> 00:06:09.360
As I said before,
00:06:09.360 --> 00:06:10.960
one of the great advantages is that
00:06:10.960 --> 00:06:13.600
I can actually run the code dynamically.
00:06:13.600 --> 00:06:15.360
So let's say that the student says,
00:06:15.360 --> 00:06:17.360
"But what if I change that value to 10?"
00:06:17.360 --> 00:06:18.560
Well, let's try it.
00:06:18.560 --> 00:06:20.560
Let's change it, run it,
06:20.560 --> 00:06:21.840
and then you can see here
00:06:21.840 --> 00:06:24.720
that it has a 10.
00:06:24.720 --> 00:06:26.960
That's really powerful because
00:06:26.960 --> 00:06:29.280
you're not tied to
00:06:29.280 --> 00:06:30.560
what is the content you have
00:06:30.560 --> 00:06:33.120
on the slides. If you find an error
00:06:33.120 --> 00:06:34.880
or an omission, or you want to talk about
06:34.880 --> 00:06:36.880
something else, you can very quickly
00:06:36.880 --> 00:06:40.720
do it. You can add comments
00:06:40.720 --> 00:06:42.080
and then make some suggestions
00:06:42.080 --> 00:06:43.840
specifically to that,
06:43.840 --> 00:06:45.680
or worst-case scenario,
00:06:45.680 --> 00:06:48.880
if you really, really, need it,
06:48.880 --> 00:06:55.440
you can say, "Let's load it into..."
00:06:55.440 --> 00:06:58.400
Let's actually do some hand annotation.
00:06:58.400 --> 00:07:00.319
Let's actually say, "look at this thing,
00:07:00.319 --> 00:07:01.840
this is the value that I want you to
07:01.840 --> 00:07:02.800
concentrate on."
00:07:02.800 --> 00:07:03.599
It's not perfect.
00:07:03.599 --> 00:07:04.960
I'm not doing it with an Emacs.
00:07:04.960 --> 00:07:06.960
I wish there was a way to do it,
00:07:06.960 --> 00:07:09.120
but it is absolutely effective
00:07:09.120 --> 00:07:10.720
because I'm actually able to
00:07:10.720 --> 00:07:12.800
use the power. Notice that all that is
07:12.800 --> 07:15.520
exported is just the block, and also
07:15.520 --> 07:22.400
the color and typesetting,
07:22.400 --> 00:07:24.560
the typesetting of the content.
00:07:24.560 --> 00:07:25.759
So this is actually great.
00:07:25.759 --> 00:07:30.639
I have the colors red, purple, etc. etc.
00:07:30.639 --> 00:07:34.160
I love being able to do that.
07:34.160 --> 00:07:35.919
This is just a temporary file.
00:07:35.919 --> 00:07:36.880
I can actually discard it,
00:07:36.880 --> 00:07:39.680
and it doesn't really matter.
07:39.680 --> 07:41.919
Let me go back to the presentation.
07:41.919 --> 00:07:43.360
So that's the delivery.
00:07:43.360 --> 00:07:44.639
So the delivery is great,
00:07:44.639 --> 00:07:46.400
and I can tell the students
00:07:46.400 --> 00:07:48.080
now you're actually in GitHub,
00:07:48.080 --> 00:07:50.160
if you want to test the code,
07:50.160 --> 00:07:51.360
just cut and paste.
00:07:51.360 --> 00:07:54.240
Notice that I clicked on the little icon.
00:07:54.240 --> 00:07:56.639
Now it's copied. It's now part of
00:07:56.639 --> 00:07:57.440
the kill buffer ([kill-ring]),
00:07:57.440 --> 00:07:59.520
so if I want to actually create a file
00:07:59.520 --> 00:08:00.560
that has that content,
00:08:00.560 --> 00:08:02.560
I can very quickly do it.
08:02.560 --> 00:08:05.840
Try that with PowerPoint.
00:08:05.840 --> 00:08:08.160
You will have to have the text
00:08:08.160 --> 00:08:10.000
without any nice typesetting,
00:08:10.000 --> 00:08:11.280
or you will have to have a picture
00:08:11.280 --> 00:08:13.120
that is impossible to cut and paste.
00:08:13.120 --> 00:08:14.400
So that's something that the students
00:08:14.400 --> 00:08:17.440
really, really appreciate of this.
00:08:17.440 --> 00:08:18.879
They can try it on the computer.
00:08:18.879 --> 00:08:19.919
They can load it into
00:08:19.919 --> 00:08:22.319
their favorite editor.
00:08:22.319 --> 00:08:24.720
I don't force them to use Emacs,
00:08:24.720 --> 00:08:26.879
but I have to say that some of them
00:08:26.879 --> 00:08:28.479
really get intrigued by this power
00:08:28.479 --> 00:08:30.000
that they want to try Emacs
08:30.000 --> 08:31.440
because they see that they can do things,
08:31.440 --> 08:33.760
that I can do things that they cannot do
08:33.760 --> 08:35.919
with other tools.
08:35.919 --> 08:39.039
Okay, so let's go back to presentation.
08:39.039 --> 00:08:40.080
The other half of it is
00:08:40.080 --> 00:08:41.039
preparing the notes.
00:08:41.039 --> 00:08:44.640
I think the preparatory notes
08:44.640 --> 00:08:46.320
is something that I want to do
00:08:46.320 --> 00:08:48.240
as easy as possible.
00:08:48.240 --> 00:08:52.560
I want to be able to reduce the time
00:08:52.560 --> 00:08:53.760
that I waste on things,
00:08:53.760 --> 00:08:55.120
that they are done.
08:55.120 --> 08:57.519
They're not part of the actual thinking
08:57.519 --> 00:09:01.760
or the delivery of the presentation.
00:09:01.760 --> 00:09:03.440
So let me create a file.
09:03.440 --> 00:09:05.720
Let's call it rip2.org.
00:09:05.720 --> 00:09:07.839
Well, I have this one,
00:09:07.839 --> 00:09:09.519
so let's call it rip.org.
00:09:09.519 --> 00:09:10.480
Oh, I have this one too,
00:09:10.480 --> 00:09:12.800
so let's call it rip4.org.
09:12.800 --> 09:15.040
So it's empty.
09:15.040 --> 00:09:17.200
I use yasnippets. I think yasnippets
00:09:17.200 --> 00:09:17.920
are very important,
00:09:17.920 --> 00:09:19.040
and I'll go through this
00:09:19.040 --> 00:09:19.760
in a little bit later.
00:09:19.760 --> 00:09:21.200
It's important to set up
00:09:21.200 --> 00:09:23.440
the properties for each language
00:09:23.440 --> 00:09:24.399
that I use properly.
09:24.399 --> 09:26.320
I'll describe this a little bit later.
09:26.320 --> 00:09:28.000
Unfortunately, the properties
00:09:28.000 --> 00:09:30.080
have to be evaluated one at a time,
00:09:30.080 --> 00:09:33.839
and so I'm just going to
00:09:33.839 --> 00:09:35.040
kill the buffer and open it again.
00:09:35.040 --> 00:09:36.480
So now all of these properties
00:09:36.480 --> 00:09:38.000
are properly set.
09:40.560 --> 00:09:43.760
As I said before, I have some yasnippets,
00:09:43.760 --> 00:09:46.560
so I can actually do very quickly...
00:09:46.560 --> 00:09:55.200
This is C++, cout << "hello world",
09:55.200 --> 09:58.080
std::endl.
09:58.080 --> 00:10:00.080
And then I run it,
00:10:00.080 --> 00:10:02.720
and then it's inserted down here,
00:10:02.720 --> 00:10:04.000
so nothing special.
10:04.000 --> 10:06.160
Let's assume that I make a mistake
10:06.160 --> 00:10:08.480
and I type a double l here.
00:10:08.480 --> 00:10:10.720
I will get an error.
10:10.720 --> 00:10:12.399
These line numbers unfortunately
00:10:12.399 --> 00:10:13.600
don't perfectly match
00:10:13.600 --> 00:10:15.040
with the line numbers
10:15.040 --> 10:17.839
in the little snippet
10:17.839 --> 00:10:18.959
because there's some code
00:10:18.959 --> 00:10:22.160
that org-babel inserts,
00:10:22.160 --> 00:10:23.040
so that shifts them.
00:10:23.040 --> 00:10:25.440
So that's something to be aware of.
10:25.440 --> 00:10:27.680
I can correct it, run it,
00:10:27.680 --> 00:10:30.160
and then it inserts the result.
10:30.160 --> 00:10:36.079
Let's do one in C.
10:36.079 --> 00:10:37.680
I'll explain the exports both
00:10:37.680 --> 00:10:38.640
a little bit.
00:10:38.640 --> 00:10:40.079
So let's assume that I don't want to
10:40.079 --> 00:10:41.519
have a full main program.
00:10:41.519 --> 00:10:42.560
Let's assume that i just want to
00:10:42.560 --> 00:10:45.200
demonstrate how to use a printf
00:10:45.200 --> 00:10:54.959
"hello world %s\n", "my friend".
10:54.959 --> 10:56.800
Let's run it.
10:56.800 --> 00:10:58.800
I get a bunch of errors. Why?
00:10:58.800 --> 00:11:00.480
Because I don't have a main program,
00:11:00.480 --> 00:11:03.279
so I have to actually tell org-babel
00:11:03.279 --> 00:11:05.200
that I want a main product,
00:11:05.200 --> 00:11:07.360
so yes put a main around it.
00:11:07.360 --> 00:11:09.040
So now I run it and it says, oh,
11:09.040 --> 00:11:09.760
in the function main,
00:11:09.760 --> 00:11:10.959
we have an implicit declaration
00:11:10.959 --> 00:11:12.640
for function printf.
00:11:12.640 --> 00:11:14.000
I'm very, very stringent
00:11:14.000 --> 00:11:16.959
on my compilation options,
00:11:16.959 --> 00:11:18.959
so I want to have every single
11:18.959 --> 00:11:21.279
potential error displayed ,
00:11:21.279 --> 00:11:22.959
so that's actually why.
00:11:22.959 --> 00:11:24.640
In this case, I actually need include,
00:11:24.640 --> 00:11:29.040
so I can say :includes <stdio.h>,
11:29.040 --> 00:11:31.040
and I'll run it and it runs perfectly.
00:11:31.040 --> 00:11:32.480
So why is this important?
00:11:32.480 --> 00:11:35.440
Well, it allows me to just have
00:11:35.440 --> 00:11:37.600
the snippet that I'm concerned about.
00:11:37.600 --> 00:11:39.920
I don't have to have all the overhead
00:11:39.920 --> 00:11:43.279
of having to have the include, main, etc.,
00:11:43.279 --> 00:11:44.000
if I want to show
00:11:44.000 --> 00:11:45.440
just one specific concept
00:11:45.440 --> 00:11:46.560
and I can do it
00:11:46.560 --> 00:11:48.079
in very few lines of code.
00:11:48.079 --> 00:11:50.240
I can do that immediately, of course.
00:11:50.240 --> 00:11:51.279
The students will not be able to
00:11:51.279 --> 00:11:53.600
cut and paste it without the main file,
00:11:53.600 --> 00:11:54.320
but that's something
00:11:54.320 --> 00:11:56.800
that we can explain to them.
11:57.600 --> 00:11:59.440
We can do all the languages.
00:11:59.440 --> 00:12:02.079
So I can say print,
12:02.079 --> 12:07.680
let's print just a list,
12:07.680 --> 12:10.000
or let's actually keep updating it,
12:10.000 --> 00:12:16.000
and let's do a map of a lambda x,
00:12:16.000 --> 00:12:19.279
x multiplied by x,
12:19.279 --> 00:12:22.079
and then we run it. Okay.
00:12:22.079 --> 00:12:23.200
The thing that is important
00:12:23.200 --> 00:12:25.120
is that if we also have
00:12:25.120 --> 00:12:26.720
the full power of the environment,
00:12:26.720 --> 00:12:28.320
right, so we can actually edit it
00:12:28.320 --> 00:12:31.519
in the native mode of the language,
00:12:31.519 --> 00:12:34.560
and wherever we actually want to use
00:12:34.560 --> 00:12:36.720
specific features, that they are available
00:12:36.720 --> 00:12:38.800
in the particular mode.
12:38.800 --> 00:12:40.720
But for most of the cases,
00:12:40.720 --> 00:12:41.519
I don't need that,
00:12:41.519 --> 00:12:44.160
because my examples are relatively simple.
12:44.160 --> 12:46.720
Let's do one more.
12:46.720 --> 00:12:48.399
This is a little bit different: SQLite.
00:12:48.399 --> 00:12:49.760
In the previous examples,
00:12:49.760 --> 00:12:51.200
the output that is inserted
00:12:51.200 --> 00:12:52.720
is a standard output.
00:12:52.720 --> 00:12:54.320
In SQLite, I want to actually see
00:12:54.320 --> 00:12:55.279
the tables. I want to see
00:12:55.279 --> 00:12:56.720
how the tables are,
00:12:56.720 --> 00:12:58.880
what the results are.
00:12:58.880 --> 00:13:04.000
So let's create table s.
13:04.000 --> 00:13:08.399
Let's call it r, a int, b int,
13:08.399 --> 00:13:09.200
and let's run it.
00:13:09.200 --> 00:13:10.639
This is-- oh, the table already exists.
00:13:10.639 --> 00:13:16.240
Okay. So drop table if exists r,
13:16.240 --> 00:13:17.440
and then we run it. Okay.
00:13:17.440 --> 00:13:21.120
So now it's created. sqlite...
00:13:21.120 --> 00:13:25.920
So we can say create a table,
00:13:25.920 --> 00:13:27.760
and let's actually add SQL,
00:13:27.760 --> 00:13:32.079
and here we're actually going to add...
13:32.079 --> 00:13:34.240
This is an example in C,
00:13:34.240 --> 00:13:38.240
and here we're going to have C++.
00:13:38.240 --> 00:13:42.160
Okay. So, SQL,
00:13:42.160 --> 00:13:43.920
and then we create a table,
00:13:43.920 --> 00:13:47.839
and then we populate
00:13:47.839 --> 00:13:51.360
and then insert into R
00:13:51.360 --> 00:13:57.839
values 1,2 2,3 3,4.
13:57.839 --> 00:13:59.519
Okay. So now I have a table,
00:13:59.519 --> 00:14:01.600
I have values,
00:14:01.600 --> 00:14:04.560
and I can do "select * from here,"
14:04.560 --> 14:07.040
and then I get the result. Okay.
14:07.040 --> 00:14:07.920
It's almost magic
00:14:07.920 --> 00:14:10.399
because I can actually get, formatted,
00:14:10.399 --> 00:14:13.040
the output in the way that I expected.
14:13.040 --> 14:15.279
Obviously, if my result is too big,
14:15.279 --> 00:14:18.399
then it will basically just create
00:14:18.399 --> 00:14:20.880
a huge, huge buffer, or Org will say
00:14:20.880 --> 00:14:21.920
the output is too big.
00:14:21.920 --> 00:14:24.079
So often with databases,
00:14:24.079 --> 00:14:26.480
I actually narrow my output, right,
00:14:26.480 --> 00:14:28.639
or I might do it with a clause,
00:14:28.639 --> 00:14:32.800
"where a > 1".
14:34.959 --> 00:14:36.959
If the language is supported by Org Babel,
00:14:36.959 --> 00:14:39.920
then you can do all of this.
14:39.920 --> 00:14:42.079
Let me go back to the presentation.
00:14:42.079 --> 00:14:43.760
I'm running out of time.
00:14:43.760 --> 00:14:45.680
Let me give you a short tour
00:14:45.680 --> 00:14:47.279
of how this is done.
14:47.279 --> 00:14:53.279
I have created a repository that has
00:14:53.279 --> 00:14:54.800
all the configuration that I have.
00:14:54.800 --> 00:14:56.639
Everything is self-contained.
14:56.639 --> 14:59.600
You can just download it and run it.
14:59.600 --> 00:15:01.360
You will have to replace
00:15:01.360 --> 00:15:03.760
your ~/.emacs.d directory,
00:15:03.760 --> 00:15:07.440
and then you can explore it, test it,
00:15:07.440 --> 00:15:11.039
and then pick things out of it,
00:15:11.039 --> 00:15:14.639
choose, etc.
15:14.639 --> 00:15:16.800
Let me go through the README.
00:15:16.800 --> 00:15:17.920
I think that the README
00:15:17.920 --> 00:15:19.600
is actually useful.
00:15:19.600 --> 00:15:21.760
I have a function called actually start.
00:15:21.760 --> 00:15:22.480
That is the one
00:15:22.480 --> 00:15:24.000
that creates indentation
00:15:24.000 --> 00:15:28.399
and sets up the mode, etc.
15:28.399 --> 00:15:29.440
Let me talk about GitHub.
00:15:29.440 --> 00:15:31.839
So GitHub is a great resource. Why?
00:15:31.839 --> 00:15:32.880
Well its publishing,
00:15:32.880 --> 00:15:34.240
as i mentioned before,
00:15:34.240 --> 00:15:35.519
is very simple.
00:15:35.519 --> 00:15:37.120
To publish, you basically just
00:15:37.120 --> 00:15:37.920
push your changes
00:15:37.920 --> 00:15:43.199
and it automatically renders the code.
15:43.199 --> 00:15:46.800
It's something that is quite useful.
15:46.800 --> 00:15:48.720
But it is not perfect,
00:15:48.720 --> 00:15:50.399
and it's not able to understand
00:15:50.399 --> 00:15:52.880
the full Org. But for most of the things
00:15:52.880 --> 00:15:53.680
that I use for teaching,
00:15:53.680 --> 00:15:55.600
it's sufficiently good.
00:15:55.600 --> 00:15:57.360
It would be better if it was full
00:15:57.360 --> 00:16:00.720
at compliance, but it's not bad as it is.
16:00.720 --> 00:16:02.463
Version control. I think
00:16:02.463 --> 00:16:03.839
it's extremely valuable
00:16:03.839 --> 00:16:05.199
to have version control.
00:16:05.199 --> 00:16:08.079
It allows to actually use
00:16:08.079 --> 00:16:08.959
different computers
00:16:08.959 --> 00:16:10.560
or keep track of my changes,
00:16:10.560 --> 00:16:11.920
collaborate with authors,
00:16:11.920 --> 00:16:13.040
even have pull requests
00:16:13.040 --> 00:16:13.759
from the students.
16:13.759 --> 16:16.320
Actually it's very empowering
16:16.320 --> 16:18.800
for the students.
16:18.800 --> 00:16:20.480
Navigation, links, cut and paste
00:16:20.480 --> 00:16:21.920
between code blocks,
00:16:21.920 --> 00:16:23.199
you can even edit in place
16:23.199 --> 16:26.160
if you want to.
16:26.160 --> 16:27.920
In a pinch, you can actually use GitHub
16:27.920 --> 00:16:30.000
to do the editing of your file.
00:16:30.000 --> 00:16:33.199
Of course, it will not update your buffers.
16:33.199 --> 00:16:35.199
:exports both. This is very important.
00:16:35.199 --> 00:16:40.160
If we have a block, by default,
16:40.160 --> 16:43.199
GitHub will not typeset
16:43.199 --> 00:16:44.399
the output of that block.
00:16:44.399 --> 00:16:45.839
It will only put the source code,
00:16:45.839 --> 00:16:47.199
but not its output.
16:47.199 --> 00:16:50.079
In this case, if I actually showed this
00:16:50.079 --> 00:16:52.720
in GitHub, "hello world" will not appear.
00:16:52.720 --> 00:16:55.120
So what we need to do is for every block,
00:16:55.120 --> 00:16:57.040
we have to do :exports both.
16:57.040 --> 00:16:58.720
okay that's unfortunate,
00:16:58.720 --> 00:17:01.120
but we can deal with that.
17:01.120 --> 00:17:03.920
Once it's done, then the output
00:17:03.920 --> 00:17:06.079
is actually typeset.
17:06.079 --> 00:17:07.520
I mentioned that header args
00:17:07.520 --> 00:17:09.039
are very important,
00:17:09.039 --> 00:17:10.079
because those are the ones
00:17:10.079 --> 00:17:12.799
that set the parameters
00:17:12.799 --> 00:17:14.640
for each one of the blocks that you have.
17:14.640 --> 17:16.000
You don't want to have to type every
17:16.000 --> 00:17:19.120
single one of them at once.
00:17:19.120 --> 00:17:20.880
For example, let me go back to
00:17:20.880 --> 00:17:22.880
my presentation.
17:23.839 --> 17:26.160
Here's actually the parameters for C.
17:26.160 --> 00:17:28.880
C, I say, I don't want you to
00:17:28.880 --> 00:17:30.000
automatically add a main.
00:17:30.000 --> 00:17:31.120
I want to provide my main,
00:17:31.120 --> 00:17:34.160
and these are the flags to the compiler.
17:34.160 --> 00:17:37.280
With C++, similar. With SQLite,
00:17:37.280 --> 00:17:38.720
I said this is my database,
17:38.720 --> 00:17:39.600
this is the data,
00:17:39.600 --> 00:17:41.360
the file where the database lives,
00:17:41.360 --> 00:17:44.559
and for the results, I want you to insert
17:44.559 --> 00:17:46.160
the column names. I want to see
00:17:46.160 --> 00:17:48.400
the names of the columns in the result.
17:48.400 --> 17:50.960
So those are actually why
17:50.960 --> 17:53.840
the headers are important.
17:53.840 --> 00:17:55.520
There's one in general.
00:17:55.520 --> 00:17:56.880
That's :results output.
00:17:56.880 --> 00:17:59.039
If you're interested on showing
00:17:59.039 --> 00:18:01.760
the standard output of your snippet,
00:18:01.760 --> 00:18:03.600
then you have to use :results output.
00:18:03.600 --> 00:18:04.799
Otherwise, it will insert
00:18:04.799 --> 00:18:06.720
the result of the last expression.
00:18:06.720 --> 00:18:08.000
It just depends on what you want to show,
18:08.000 --> 00:18:08.720
but it's important
00:18:08.720 --> 00:18:11.200
that you are aware of that.
18:11.200 --> 18:13.440
I'm almost running out of time.
18:13.440 --> 00:18:15.919
There are some things that are C-specific
00:18:15.919 --> 00:18:18.400
and that I sort of covered
00:18:18.400 --> 00:18:23.919
during the demo.
18:23.919 --> 00:18:26.000
You can use advanced Org features,
00:18:26.000 --> 00:18:29.039
and you can actually use noweb.
00:18:29.039 --> 00:18:30.640
Now that's confusing for students,
00:18:30.640 --> 00:18:33.600
so i will suggest that you actually do it
18:33.600 --> 00:18:34.880
but then inform the students
00:18:34.880 --> 00:18:37.760
very clearly of that.
18:37.760 --> 00:18:39.280
Some potential issues:
00:18:39.280 --> 00:18:42.400
_ (underscore). _ is used everywhere.
00:18:42.400 --> 00:18:44.640
By default, it will try to export it--
00:18:44.640 --> 00:18:46.960
Org will try to export it as circumflex,
00:18:46.960 --> 00:18:48.400
the same as with GitHub.
00:18:48.400 --> 00:18:52.480
So we want to inform Org and GitHub
00:18:52.480 --> 00:18:53.840
not to do anything with them,
00:18:53.840 --> 00:18:55.520
and this is via the circumflex.
00:18:55.520 --> 00:18:57.440
So we said in #+OPTIONS: ^:nil ,
00:18:57.440 --> 00:18:58.720
and that actually takes care
00:18:58.720 --> 00:19:01.679
of the circumflex and also the underscore.
00:19:01.679 --> 00:19:02.720
It's kind of confusing
00:19:02.720 --> 00:19:04.080
because it's both,
00:19:04.080 --> 00:19:05.120
but it's actually named
00:19:05.120 --> 00:19:06.720
after the circumflex.
19:06.720 --> 00:19:07.840
The pipe character
00:19:07.840 --> 00:19:08.880
is one of those characters
00:19:08.880 --> 00:19:10.640
that is actually very, very common
00:19:10.640 --> 00:19:12.799
in programming, but if you put in a table,
00:19:12.799 --> 00:19:14.480
there's no way to do it. Like, okay,
00:19:14.480 --> 00:19:16.559
I wish I had this table nicely
19:16.559 --> 00:19:19.520
where I can say || here,
00:19:19.520 --> 00:19:21.280
but if I put this ||,
00:19:21.280 --> 00:19:22.799
it will actually interpret it
00:19:22.799 --> 00:19:23.919
as the separator.
00:19:23.919 --> 00:19:25.760
So that's one of the few things
00:19:25.760 --> 00:19:27.679
that's kind of annoying.
19:27.679 --> 00:19:31.679
Final words. See my configuration file,
19:31.679 --> 00:19:35.520
and try to typeset the code,
00:19:35.520 --> 00:19:37.520
the buffer as close as possible
00:19:37.520 --> 00:19:38.720
to what you want to present.
00:19:38.720 --> 00:19:40.000
As you can see here,
00:19:40.000 --> 00:19:42.240
I'm actually using colors to highlight
00:19:42.240 --> 00:19:44.320
by using the current line.
19:44.320 --> 19:46.960
Use yasnippets.
19:46.960 --> 19:48.480
They're amazing, and they will actually
19:48.480 --> 19:51.440
make your life much more useful.
19:51.440 --> 19:53.280
Experiment.
19:53.280 --> 19:56.720
Just a conclusion.
19:56.720 --> 00:19:58.400
Org mode and Emacs really make
00:19:58.400 --> 00:20:01.039
a wonderful, amazing environment
00:20:01.039 --> 00:20:03.360
for teaching programming.
20:03.360 --> 20:06.640
I just want to end by saying that
20:06.640 --> 00:20:10.320
I'm very grateful to all the Emacs community
20:10.320 --> 00:20:14.159
because I have benefited tremendously
00:20:14.159 --> 00:20:16.080
over the years. I have been using Emacs
00:20:16.080 --> 00:20:18.960
since 1991, so this is essentially
00:20:18.960 --> 00:20:22.240
my 30th year that have been using Emacs.
00:20:22.240 --> 00:20:24.640
I think that is the most important,
00:20:24.640 --> 00:20:26.980
most fundamental tool that I use
00:20:26.980 --> 00:20:29.760
day-to-day, from reading email,
00:20:29.760 --> 00:20:32.480
to doing my teaching, doing my papers,
00:20:32.480 --> 00:20:34.960
my research... it's everything.
00:20:34.960 --> 00:20:37.039
So thank you all
20:37.039 --> 20:40.799
and I hope that you find this useful.
20:40.799 --> 00:20:42.799
Bye.
00:20:42.799 --> 00:20:43.799
[captions by sachac]