6 # Copyright (C) 2010 Red Hat Inc.
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 use Cwd qw(getcwd abs_path);
30 use Glib qw(TRUE FALSE);
38 techtalk-pse - superior technical demonstration software
42 cd /path/to/talk/; techtalk-pse
44 techtalk-pse /path/to/talk/
48 Tech Talk "Platinum Supreme Edition" (PSE) is Linux Presentation
49 Software designed by technical people to give technical software
50 demonstrations to other technical people. It is designed to be simple
51 to use (for people who know how to use an editor and the command line)
52 and powerful, so that you can create informative, technically accurate
53 and entertaining talks and demonstrations.
55 Tech Talk PSE is good at opening editors at the right place, opening
56 shell prompts with preloaded history, compiling and running things
57 during the demonstration, displaying text, photos, figures and video.
59 Tech Talk PSE is I<bad> at slide effects, chart junk and bullet
62 This manual page covers all the documentation you will need to use
63 Tech Talk PSE. The next section covers running the tool from the
64 command line. After that there is a L</TUTORIAL> section to get you
65 started. Then there is a detailed L</REFERENCE> section. Finally
66 there is a discussion on L<WHAT MAKES A GOOD TALK>.
68 =head1 RUNNING THE TOOL FROM THE COMMAND LINE
70 A Tech Talk PSE talk is not a single file, but a directory full of
71 files. (If you want to start a new talk, see the L</TUTORIAL> section
72 below). To display or run the talk, change into the directory
73 containing all those files and run the C<techtalk-pse> command:
75 cd /path/to/talk/; techtalk-pse
77 You can also run C<techtalk-pse> without changing directory, instead
78 specifying the path to the talk:
80 techtalk-pse /path/to/talk/
92 Display brief help and exit.
100 Start at the last slide.
102 You cannot use this with the B<-n> / B<--start> option.
108 =item B<-n SLIDE> | B<--start SLIDE>
110 Start at the named slide. I<SLIDE> is the shortest unique prefix of
111 the slide name, so to start at a slide named
112 I<00010-introduction.html>, you could use I<-n 00010> or I<-n 00010-intro>,
113 or give the full filename I<-n 00010-introduction.html>.
115 The default is to start at the first slide in the talk.
123 Don't display the initial "splash" screen which advertises Tech Talk
124 PSE to your audience. Just go straight into the talk.
132 Display verbose messages, useful for debugging or tracing
133 what the program is doing.
141 Display version number and exit.
149 GetOptions ("help|?" => \$help,
151 "mozembed" => \$mozembed,
152 "mozembed-first" => \$mozembed_first,
153 "mozembed-last" => \$mozembed_last,
155 "splash!" => \$splash,
156 "start=s" => \$start,
157 "verbose" => \$verbose,
158 "version" => \$version,
165 pod2usage (1) if $help;
167 print "@PACKAGE@ @VERSION@\n";
170 die "techtalk-pse: cannot use --start and --last options together\n"
171 if defined $last && defined $start;
173 # Run with --mozembed: see below.
174 run_mozembed () if $mozembed;
176 # Normal run of the program.
177 die "techtalk-pse: too many arguments\n" if @ARGV >= 2;
179 # Get the true name of the program.
186 chdir $d or die "techtalk-pse: chdir: $d: $!";
188 # XXX In future allow people to specify an archive and unpack
190 die "techtalk-pse: argument is not a directory"
202 foreach (glob ("*")) {
203 if (/^(\d+)(?:-.*)\.(html|sh)$/) {
204 print STDERR "reading $_\n" if $verbose;
208 warn "techtalk-pse: $_: command file is not executable (+x)\n"
209 if $ext eq "sh" && ! -x $_;
211 my $h = { name => $_, seq => $1, ext => $2, i => $i };
216 print STDERR "ignoring $_\n" if $verbose;
221 $files[0]->{first} = 1;
222 $files[$#files]->{last} = 1;
226 print STDERR "read ", 0+@files, " files\n" if $verbose;
228 warn "techtalk-pse: no files found, continuing anyway ...\n"
231 # Work out what slide we're starting on.
233 if (defined $current) {
234 die "start slide not implemented yet XXX"
237 $current = $files[0];
239 # else $current is undefined
242 my $w = Gtk2::AboutDialog->new;
243 $w->set_authors ("Richard W.M. Jones");
245 "Superior technical demonstration software\n"
247 $w->set_program_name ("Tech Talk Platinum Supreme Edition (PSE)");
248 $w->set_version ("@VERSION@");
249 $w->set_website ("http://people.redhat.com/~rjones");
250 $w->set_license ("GNU General Public License v2 or above");
252 print STDERR "calling \$w->destroy on about dialog\n" if $verbose;
257 if (defined $current) {
258 my $go = show_slide ($current);
260 print STDERR "go = $go\n" if $verbose;
261 last MAIN if $go eq "QUIT";
263 my $i = $current->{i};
264 print STDERR "i = $i\n" if $verbose;
265 $i-- if $go eq "PREV" && $i > 0;
266 $i++ if $go eq "NEXT" && $i+1 < @files;
267 $current = $files[$i];
270 print "No slides found. Press any key to reload directory ...\n";
274 # Reread directory between slides.
277 if (defined $current && !exists $files{$current->{name}}) {
278 # Current slide was deleted.
280 $current = $files[0] if @files;
288 # Display an HTML page.
289 if ($slide->{ext} eq "html") {
290 # MozEmbed is incredibly crashy, so we run ourself as a
291 # subprocess, so when it segfaults we don't care.
292 my @cmd = ($0, "--mozembed");
293 push @cmd, "--mozembed-first" if exists $slide->{first};
294 push @cmd, "--mozembed-last" if exists $slide->{last};
296 my $url = "file://" . $cwd . "/" . $slide->{name};
299 die "failed to execute subcommand: ", join(" ", @cmd), ": $!\n"
302 # Subcommand probably segfaulted, just continue to next slide.
315 # Run a shell command.
316 elsif ($slide->{ext} eq "sh") {
318 # http://docstore.mik.ua/orelly/perl/cookbook/ch10_17.htm
319 local *run_process = sub {
321 die "fork: $!" unless defined $pid;
325 exec ("./".$slide->{name});
326 die "failed to execute command: ", $slide->{name}, ": $!";
330 local *kill_process = sub {
331 print STDERR "sending TERM signal to process group $pid\n"
339 my $w = Gtk2::Window->new ();
341 my $s = $w->get_screen;
342 $w->set_default_size ($s->get_width, -1);
344 $w->set_decorated (0);
346 my $bbox = Gtk2::HButtonBox->new ();
347 $bbox->set_layout ('start');
349 my $bnext = Gtk2::Button->new ("Next slide");
350 $bnext->signal_connect (clicked => sub { $r = "NEXT"; $w->destroy });
351 $bnext->set_sensitive (!(exists $slide->{last}));
354 my $bback = Gtk2::Button->new ("Back");
355 $bback->signal_connect (clicked => sub { $r = "PREV"; $w->destroy });
356 $bback->set_sensitive (!(exists $slide->{first}));
359 my $brestart = Gtk2::Button->new ("Kill & restart");
360 $brestart->signal_connect (clicked => sub {
364 $bbox->add ($brestart);
366 my $bquit = Gtk2::Button->new ("Quit");
367 $bquit->signal_connect (clicked => sub { $r = "QUIT"; $w->destroy });
369 $bbox->set_child_secondary ($bquit, 1);
373 $w->signal_connect (destroy => sub {
382 print STDERR "returning r=$r\n" if $verbose;
387 # If invoked with the --mozembed parameter then we just display a
388 # single page. This is just to prevent crashes in MozEmbed from
389 # killing the whole program.
394 my $w = Gtk2::Window->new ();
395 my $vbox = Gtk2::VBox->new ();
396 my $moz = Gtk2::MozEmbed->new ();
398 my $bbox = Gtk2::HButtonBox->new ();
399 $bbox->set_layout ('start');
401 $vbox->pack_start ($bbox, 0, 0, 0);
404 #$w->set_default_size (640, 480);
407 my $bnext = Gtk2::Button->new ("Next slide");
408 $bnext->signal_connect (clicked => sub { $r = 0; $w->destroy });
409 $bnext->set_sensitive (!$mozembed_last);
412 my $bback = Gtk2::Button->new ("Back");
413 $bback->signal_connect (clicked => sub { $r = 1; $w->destroy });
414 $bback->set_sensitive (!$mozembed_first);
417 my $bquit = Gtk2::Button->new ("Quit");
418 $bquit->signal_connect (clicked => sub { $r = 2; $w->destroy });
420 $bbox->set_child_secondary ($bquit, 1);
422 $w->signal_connect (destroy => sub {
428 $moz->load_url ($ARGV[0]);
438 =head2 START WRITING A TALK
440 [Before you start writing your real talk, I urge you to read
441 L</WHAT MAKES A GOOD TALK> below].
443 To start your talk, all you have to do is to make a new directory
449 A tech talk consists of HTML files ("slides") and shell scripts. The
450 filenames must start with a number, followed optionally by a
451 description, followed by the extension (C<.html> or C<.sh>). So to
452 start our talk with two slides:
454 echo "This is the introduction" > 0010-introduction.html
455 echo "This is the second slide" > 0020-second.html
457 To run it, run the command from within the talk directory:
461 Any other file in the directory is ignored, so if you want to add
462 Makefiles, version control files etc, just go ahead.
464 =head2 TIPS FOR WRITING HTML
466 You may have your own techniques and tools for writing HTML, so
467 this section is just to share my ideas. I start every
468 HTML file with a standard stylesheet and Javascript header:
470 <link rel="stylesheet" href="style.css" type="text/css"/>
471 <script src="code.js" type="text/javascript"></script>
473 That just ensures that I can put common styling instructions for all
474 my slides in a single file (C<style.css>), and I have one place where
475 I can add all Javascript, if I need to use any (C<code.js>).
477 =head3 BACKGROUNDS, FONTS AND LOGOS
479 To add a common background and font size to all slides, put this in
484 background: url(background-image.jpg) no-repeat;
487 To add a logo in one corner:
490 background: url(logo.jpg) top right no-repeat;
493 =head3 SCALING AND CENTERING
495 Scaling slide text and images so that they appear at the same
496 proportionate size for any screen resolution can be done using
498 L<https://developer.mozilla.org/En/DOM/window.innerHeight>).
500 If you want to center text horizontally, use CSS, eg:
506 To center text vertically, CSS3 is supposed to offer a solution some
507 time, but while you're waiting for that try
508 L<http://www.w3.org/Style/Examples/007/center#vertical>.
510 =head3 PREVIEWING HTML
512 I find it helpful to have Firefox open to display the HTML files and
513 styles as I edit them. Just start firefox in the talk directory:
515 firefox file://$(pwd) &
517 When you edit an HTML file, click the Firefox reload button to
518 immediately see your changes.
520 Tech Talk PSE uses Mozilla embedding to display HTML, which uses the
521 same Mozilla engine as Firefox, so what you should see in Firefox
522 should be identical to what Tech Talk PSE displays.
524 =head2 CREATING FIGURES
526 Use your favorite tool to draw the figure, convert it to an image (in
527 any format that the Mozilla engine can display) and include it using
528 an C<E<lt>imgE<gt>> tag, eg:
532 Suitable tools include: XFig, GnuPlot, GraphViz, and many TeX tools
533 such as PicTex and in particular TikZ.
535 =head2 EMBEDDING VIDEOS, ANIMATIONS, ETC.
537 Using HTML 5, embedding videos in the browser is easy. See:
538 L<https://developer.mozilla.org/En/Using_audio_and_video_in_Firefox>
540 For animations, you could try L<Haxe|http://haxe.org/> which has a
541 Javascript back-end. There are many other possibilities.
543 If you are B<sure> that the venue will have an internet connection,
544 why not embed a YouTube video.
546 =head2 DISPLAYING EXISTING WEB PAGES
548 Obviously you could just have an HTML file that contains a redirect to
551 <meta http-equiv="Refresh" content="0; url=http://www.example.com/">
553 However if you want your talk to work offline, then it's better to
554 download the web page in advance, eg. using Firefox's "Save Page As
555 -E<gt> Web Page, complete" feature, into the talk directory, then
556 either rename or make a symbolic link to the slide name:
558 ln -s "haXe - Welcome to haXe.html" 0010-haxe-homepage.html
560 =head2 TIPS FOR WRITING SHELL SCRIPTS
562 Make sure each C<*.sh> file you write is executable, otherwise Tech
563 Talk PSE won't be able to run it. (The program gives a warning if you
566 A good idea is to start each script by sourcing some common functions.
567 All my scripts start with:
572 where C<functions> is another file (ignored by Tech Talk PSE) which
573 contains common functions for setting shell history and starting a
576 In C<functions>, I have:
578 # -*- shell-script -*-
580 export HISTFILE=/tmp/history
585 echo "$@" >> $HISTFILE
593 --geometry=+100+100 \
596 -e '/bin/bash --norc' \
600 By initializing the shell history, during your talk you can rapidly
601 recall commands to start parts of the demonstration just by hitting
602 the Up arrow. A complete shell script from one of my talks would look
607 add_history guestfish -i debian.img
608 terminal --title="Examining a Debian guest image in guestfish"
610 This is just a starting point for your own scripts. You may want to
611 use a different terminal, such as xterm, and you may want to adjust
616 =head2 ORDER OF FILES
618 Tech Talk PSE displays the slides in the directory in lexicographic
619 order (the same order as C<LANG=C ls -1>). Only files matching the
620 following regexp are considered:
622 ^(\d+)(?:-.*)\.(html|sh)$
624 For future compatibility, you should ensure that every slide has a
625 unique numeric part (ie. I<don't> have C<0010-aaa.html> and
626 C<0010-bbb.html>). This is because in future we want to have the
627 ability to display multiple files side by side.
629 Also for future compatibility, I<don't> use file names that have an
630 uppercase letter immediately after the numeric part. This is because
631 in future we want to allow placement hints using filenames like
632 C<0010L-on-the-left.html> and C<0010R-on-the-right.html>.
634 =head2 BASE URL AND CURRENT DIRECTORY
636 The base URL is set to the be the directory containing the talk files.
637 Thus you should use relative paths, eg:
641 You can also place assets into subdirectories, because subdirectories
642 are ignored by Tech Talk PSE, eg:
644 <img src="images/fig1.gif">
646 When running shell scripts, the current directory is also set to be
647 the directory containing the talk files, so the same rules about using
648 relative paths apply there too.
650 =head1 WHAT MAKES A GOOD TALK
652 I like what Edward Tufte writes, for example his evisceration of
653 PowerPoint use at NASA here:
654 L<http://www.edwardtufte.com/bboard/q-and-a-fetch-msg?msg_id=0001yB>
656 However it is sometimes hard to translate his ideas into clear
657 presentations, and not all of that is the fault of the tools. Here
658 are my thoughts and rules on how to deliver a good talk.
660 B<First, most important rule:> Before you start drawing any slides at
661 all, write your talk as a short essay.
663 This is the number one mistake that presenters make, and it is partly
664 a tool fault, because PowerPoint, OpenOffice, even Tech Talk PSE, all
665 open up on an initial blank slide, inviting you to write a title and
666 some bullet points. If you start that way, you will end up using the
667 program as a kind of clumsy outlining tool, and then reading that
668 outline to your audience. That's boring and a waste of time for you
669 and your audience. (It would be quicker for them just to download the
670 talk and read it at home).
672 B<Secondly:> How long do you want to spend preparing the talk? A good
673 talk, with a sound essay behind it, well thought out diagrams and
674 figures, and interesting demonstrations, takes many hours to prepare.
675 How many hours? I would suggest thinking about how many hours of
676 effort your audience are putting in. Even just 20 people sitting
677 there for half an hour is 10 man-hours of attention, and that is a
678 very small talk, and doesn't include all the extra time and hassle
679 that it took to get them all in one place.
681 I don't think you can get away with spending less than two full days
682 preparing a talk, if you want to master the topic and draw up accurate
683 slides. Steve Jobs is reputed to spend weeks preparing his annual
684 sales talk to the Apple faithful.
686 B<Thirdly:> Now that you're going to write your talk as an essay, what
687 should go in the slides? I would say that you should consider
688 delivering the essay, I<not> the slides, to people who don't make the
689 talk. An essay can be turned into an article or blog posting, whereas
690 even "read-out-the-bullet-point" slides have a low information
691 density, large size, and end-user compatibility problems (*.pptx
694 What, then, goes on the slides? Anything you cannot just say:
695 diagrams, graphs, videos, animations, and of course (only with Tech
696 Talk PSE!) demonstrations.
698 B<Lastly:> Once you've got your talk as an essay and slides, practice,
699 practice and practice again. Deliver the talk to yourself in the
700 mirror, to your colleagues. Practice going backwards and forwards
701 through the slides, using your actual laptop and the software so you
702 know what to click and what keys to press. Partly memorize what you
703 are going to say (but use short notes written on paper if you need
708 The Cognitive Style of PowerPoint, Tufte, Edward R.
712 Richard W.M. Jones L<http://people.redhat.com/~rjones/>
716 Copyright (C) 2010 Red Hat Inc.
718 This program is free software; you can redistribute it and/or modify
719 it under the terms of the GNU General Public License as published by
720 the Free Software Foundation; either version 2 of the License, or
721 (at your option) any later version.
723 This program is distributed in the hope that it will be useful,
724 but WITHOUT ANY WARRANTY; without even the implied warranty of
725 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
726 GNU General Public License for more details.
728 You should have received a copy of the GNU General Public License
729 along with this program; if not, write to the Free Software
730 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.