|
Running executable notes from http://anggtwu.net/ with find-angg and find-wget
The main page about this video is here.
Its index is here.
Its subtitles in Lua are here.
The rest of this page contains a conversion of the subtitles in Lua
to a slightly more readable format.
00:00 Hi! My name is Eduardo Ochs...
00:02 I'm the author of an Emacs package called
00:04 eev, and the main idea behind eev is that
00:08 you can save executable notes
00:11 for everything that you do
00:13 and you can share these notes with
00:14 other people... possibly by
00:17 putting your notes on the web.
00:21 All the material about this video
00:24 is going to be in this page here,
00:27 and the title of this video is:
00:29 "Running executable notes from
00:31 [my home page, which is this one]
00:33 with `find-angg' and `find-wget'.
00:37 Let me explain what this means.
00:39 Oh, by the way, by the way -
00:41 this image is totally unrelated
00:44 to the presentation, it is just
00:46 one of my favorite CDs ever.
00:49 Let me use a smaller font here.
00:51 These are the things
00:53 that I'm going to present.
00:56 I put all my executable notes on the web.
01:00 Practically everything - I mean, there's
01:03 just a couple of files that I don't put there.
01:06 Most of my notes are in these files with
01:09 .e at the end, in this directory here...
01:12 if we visit this directory -
01:16 let's wait one second, because it needs
01:18 to open Google Chrome...
01:20 We see that it contains many, many,
01:22 many files...
01:24 some of them end with just .e, and
01:28 some of them end with .e.html,
01:31 and the ones with .e.html are
01:35 converted versions....
01:37 We can see this header here,
01:39 that explains that this is
01:41 an htmlized version...
01:44 and here you have a link to the original
01:47 version without the .html...
01:50 and here you have a very messy page
01:53 explaining the conversion rules.
01:57 One second, let me go back...
02:04 So, I'm going to show how to execute
02:14 executable notes from my site, and I'm
02:17 going to use one specific example that
02:19 is in my notes about Maxima.
02:22 Maxima is a program for
02:26 doing symbolic computation, and
02:28 numeric computation, and graphics, and
02:30 lots of things from Mathematics,
02:33 and my day job is as a teacher of
02:37 Mathematics, and so I've been using
02:39 Maxima a lot...
02:41 I started using it a few months ago
02:45 and I'm finding it really fascinating.
02:51 So, my notes are in this file here...
02:57 if we open it in the browser we are
03:00 going to see that it has
03:01 some strange characters here...
03:05 my site doesn't even recognize that this
03:08 thing is UTF-8, and so some characters
03:12 look really wrong...
03:15 but if we run... if we download
03:19 a copy of this with wget
03:22 everything looks right...
03:28 Actually I'm going to do something
03:29 different - I'm going to run wget to
03:35 download a copy of this thing
03:38 in a way that sends the output to
03:41 the standard output, and I'm going to put
03:43 this output in a temporary buffer.
03:47 So, this sexp does that...
03:50 it takes a few seconds,
03:52 and then it downloads this file here -
03:54 you can see here the command - more or
03:57 less the command that was run...
03:59 this is an abbreviation, because it
04:02 doesn't say exactly the command line
04:04 arguments that were used...
04:07 but you can see that
04:10 these characters appear right,
04:13 the red stars also appear
04:16 in the right way, and so on...
04:20 and note that when I'm in my machine I
04:28 can access the local copy of this file
04:30 with this sexp here...
04:35 this other sexp here is an abbreviation
04:37 for the previous one...
04:40 so this one essentially runs the same thing,
04:42 it adds a "~/" to the beginning...
04:47 and this third one is an abbreviation
04:50 for this one... it takes this string,
04:52 and it adds a "~/e/"
04:58 to the beginning, and a ".e" to the end.
05:01 So all these three are more or less
05:04 equivalent, but there's a detail here.
05:09 When we call these two sexps here
05:12 with other arguments these arguments are
05:19 interpreted as the tags in anchors.
05:22 So, if I run this...
05:27 if I run just this -
05:30 let me make a copy here -
05:32 if I run just this...
05:34 this argument here says that
05:38 we need to start at the beginning of the
05:40 file and then look for the first
05:41 occurrence of this string,
05:44 and it is here on line 112...
05:50 and if we run this other sexp here,
05:54 with `find-angg'...
05:59 this thing here is converted to an anchor,
06:03 with these characters here
06:06 at the beginning and at the end...
06:10 and this sexp searches for the first
06:12 occurrence of that anchor in the file -
06:15 so it goes to this section here.
06:18 And this is the example that I'm going
06:21 to show in a few seconds.
06:25 This other one is equivalent, it's an
06:27 even shorter form of this one...
06:32 so it points to this example here...
06:35 and let me show what this example does.
06:38 If we type `f8' here several times
06:41 the `f8's on the lines that start with red
06:44 stars will set up a target buffer here,
06:47 running Maxima...
06:51 here we just got a new
06:54 Maxima session, here...
06:57 and the `f8's on lines that do not
06:59 start with red stars
07:01 will send these lines to Maxima,
07:03 and Maxima will run each of them.
07:06 So: here I'm doing some tests, then I'm
07:09 going to define a few functions...
07:11 then I'm going to run plot2d,
07:14 that shows a two-dimensional plot
07:17 of one of the functions that I've
07:19 defined... and then here I run plot3d,
07:23 that runs...
07:25 that displays a 3D plot that I can
07:30 rotate in several ways.
07:35 So: these files are on my machine,
07:40 and in principle if you want to find
07:44 these notes at the internet you need to
07:47 visit this thing here on the browser...
07:51 note that this anchor here...
07:54 ah, sorry...
07:55 this anchor here is in green, which is a
07:59 convention that I use to indicate that
08:02 this thing here was converted to an
08:04 anchor...
08:05 so, this "#2021-2-C3-diag-nums" etc
08:14 points exactly to this anchor...
08:17
08:22 If we run either this or this...
08:28 this `find-wget' here, or the second one...
08:31 we get...
08:34 the wget downloads the html file,
08:39 which is not exactly what we want,
08:41 because it has these headers here...
08:43 it has some things that for humans
08:45 are usually garbage...
08:49 but if I run this `find-wgeta' here
08:52 it will download the
08:56 copy of this thing here, which is the
08:58 version without the .html, the version
09:00 that is not converted to html...
09:03 and the `a' here means to...
09:07 look in this temporary buffer -
09:10 in the temporary buffer with the output
09:11 of wget - for the first occurrence of this
09:14 anchor here...
09:16 so let's test...
09:19 It opens the output of wget, blah blah
09:22 blah, of this file with maxima.e at
09:25 the end, not maxima.e.html, and it
09:28 opens this section here...
09:31 note that this is a temporary buffer,
09:34 we haven't downloaded a copy
09:37 of this maxima.e...
09:41 but even with this being a temporary
09:44 buffer we can execute these things
09:47 by just typing `f8' several times...
09:50 so if I type `f8's here...
09:52 - in this temporary buffer!!!
09:55 this is not a file!!!... -
09:57 the first three `f8's
10:00 create a Maxima session here, and then
10:04 the other `f8's send commands here...
10:07 and this command here shows a nice 2D plot,
10:13 and this one shows a very nice 3D plot.
10:17
10:20 So these are my notes on a specific
10:24 thing on Maxima, a demo of
10:28 how a function looks...
10:31 and you can run this demo without
10:37 having to to download this file,
10:40 and this is what I mean with the title...
10:45 this is a way to run my executable notes
10:47 from my site
10:50 with `find-wget'.
10:54 Let me now show something else.
10:59 I showed that when I run this
11:02 I run something that opens the
11:06 local copy of this file...
11:08 it opens this file here -
11:10 and when I run this thing here I open
11:13 this local file and I look for
11:16 the first anchor with this thing
11:19 between the double angle brackets...
11:29 But here is a trick.
11:31 if you are not on my machine you can use
11:34 this thing, (find-angg-es-links),
11:37 to make `find-angg' behave in another way.
11:41 This thing here will create a temporary
11:43 buffer with lots of instructions and
11:46 executable things...
11:48 and this first block
11:50 explains that this `progn' here
11:56 is how I define `find-angg' and `find-es'
12:00 on my machine to point to local files...
12:06 and here's a comment about how this
12:08 thing searches for anchors, and so on...
12:14 and this second section here
12:19 explains that in this `progn' here...
12:23 I mean, sorry...
12:25 if we run this `progn' here it will
12:28 redefine `find-angg' and `find-es'
12:31 in ways that use `find-wgeta'
12:34 to download these files with wget
12:37 into temporary buffers...
12:40 and if there are extra arguments
12:48 here, like anchors, and other
12:51 strings, and so on...
12:53 this function will search for that
12:55 anchor and the other strings after that.
12:59 Let me first explain what I mean by
13:02 other strings... If I execute this
13:05 the `find-wgeta' searches for this anchor,
13:10 and if I add this to the sexp...
13:15 this is a word in Portuguese, "Sejam"...
13:18 it means "let"... then this sexp here will
13:22 first search for an anchor with this name
13:28 and then for the first occurrence
13:30 of the word "Sejam" after that...
13:32 so it goes to this position.
13:34
13:36 Anyway, let me go back.
13:39 We were here, and the thing is that
13:42 if we run this `progn' here
13:44 it will run these two `defun's,
13:46 that will redefine `find-angg' and `find-es'
13:50 in a certain way, and after running
13:52 these `defun's, `find-angg'
13:55 will run `find-wgeta' with the right arguments,
14:00 and `find-es' will run `find-wgeta' with the
14:03 right arguments...
14:06 so if we run this
14:08 we redefine `find-angg' and `find-es'...
14:12 and now if we run, for example,
14:15 this sexp here, it will run wget,
14:19 it will download this URL here,
14:25 and spit the output to the
14:28 standard output, and `find-wget'
14:31 will show that in the temporary
14:33 buffer, and in this case this thing will
14:35 search for the first occurrence of this
14:38 anchor in this file.
14:40 So: this is a temporary buffer with a copy
14:43 of this file from my site...
14:46 and this `find-angg' searches for
14:51 this anchor here...
14:56 and this `find-es' here does the same
15:00 thing, it's just a bit shorter...
15:04 so it runs `find-wget' in a
15:07 certain way and searches for
15:09 this anchor here...
15:14 and then we can run this thing here...
15:16 let me run it again just because it's
15:19 nice -
15:21 Here we have a 2D plot, and here we
15:24 have our 3D plot, that we can rotate
15:29 in very nice ways, blah blah blah...
15:32
15:37 So... my notes are very hyperlinked,
15:43 with lots of links like this one,
15:46 that points to
15:47 another file in this directory here...
15:52 and to a certain section... oops,
15:56 usually to sections in these files,
15:58 using anchors...
16:00 and if you run this block here
16:08 you'll be able to use these things
16:10 even without being in my machine,
16:14 because you'll replace the definitions of
16:16 `find-angg' and `find-es' by things that
16:21 download local copies and show them in
16:23 temporary buffers...
16:25 and in this way
16:28 you can follow links like this,
16:30 to examples, and...
16:32 for example, if you're chatting
16:35 with me on IRC I can just send you a
16:38 link like this, to show, for example,
16:40 how I do something in Maxima...
16:44 and you can run this to
16:47 download the local copy, show it in a
16:49 temporary buffer, and then you can
16:51 execute this to run the example.
16:59 So this is an easy way to run examples
17:04 without having to download anything,
17:07 and in many cases my
17:11 executable notes do not need any
17:13 installation,
17:15 they just need you to have
17:17 some program installed...
17:18 in this case you just need to
17:20 have Maxima installed -
17:22 usually something like this will do
17:24 the job: "sudo apt-get install maxima"
17:28 this will probably install everything
17:31 that you need to run this specific example.
17:35 Yeah, so that's it! That's what I
17:38 wanted to show... this page does not exist
17:40 yet, but it's going to exist in,
17:42 I guess, one hour or so...
17:45 and there you're going to
17:47 have notes like this and you'll
17:50 be able to try some sexps like this, and
17:53 see if you can run the examples...
17:55 and that's it! That's what I wanted to
17:57 show. Bye! =)
|